diff --git a/README.md b/README.md index ef465d1eb..2bedea4a3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Digi Embedded Yocto (DEY) 2.2 -## Release 2.2-r2 +## Release 2.2-r3 This document provides information about Digi Embedded Yocto, Digi International's professional embedded Yocto development environment. @@ -9,6 +9,14 @@ Digi Embedded Yocto 2.2 is based on the Yocto Project(TM) 2.2 (Morty) release. For a full list of supported features and interfaces please refer to the online documentation. +# Tested OS versions + +The current release has been verified and tested with the following +OS versions: + +* Ubuntu 16.04 +* Ubuntu 14.04 + # Supported Platforms The current release supports the following hardware platforms: @@ -71,6 +79,16 @@ Documentation is available online on the Digi documentation site: # Release Changelog +## 2.2-r3 + +* Added Digi APIX C library to access and manage ConnectCore platforms interfaces: + * ADC + * GPIO + * I2C + * PWM + * SPI +* Updated AWS Greengrass Core software to v1.1.0 + ## 2.2-r2 * Fix for KRACK Attack vulnerability: @@ -146,6 +164,9 @@ boot a signed U-Boot only. * Cloud Connector * Remote file system management fails with long file names and paths (over 255 characters). +* For P2P connections Digi recommends "Negotiated GO" modes. The QCA6564 + devices (ConnectCore 6UL and ConnectCore 6 Plus) running a 4.9 kernel + version fail to join to autonomous groups. ## Digi ConnectCore 6UL diff --git a/meta-digi-arm/README b/meta-digi-arm/README index a59b51cb4..f1c951904 100644 --- a/meta-digi-arm/README +++ b/meta-digi-arm/README @@ -29,4 +29,4 @@ Support ------- This layer is provided 'as is' with no guarantee. However, some support -may be available from support@digi.com +may be available from tech.support@digi.com diff --git a/meta-digi-arm/classes/image_types_digi.bbclass b/meta-digi-arm/classes/image_types_digi.bbclass index 334ac0e79..999c10962 100644 --- a/meta-digi-arm/classes/image_types_digi.bbclass +++ b/meta-digi-arm/classes/image_types_digi.bbclass @@ -298,65 +298,5 @@ IMAGE_CMD_sdcard() { dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc,fsync seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024 + ${BOOT_SPACE_ALIGNED} \* 1024) } -# -# Create an image that can by written onto a SD card using dd (for ccardimx28 family) -# -# The disk layout used is: -# -# 1. Not partitioned : reserved for bootloader (u-boot at 1MiB offset) -# 2. BOOT PARTITION : kernel and device tree blobs -# 3. ROOTFS PARTITION : rootfs -# -# 4MiB BOOT_SPACE ROOTFS_SIZE -# <----------------> <--------------------> <------------------------------> -# +---+--------------+----------------------+--------------------------------+ -# | | U-BOOT (RAW) | BOOT PARTITION (FAT) | ROOTFS PARTITION (EXT4) | -# +---+--------------+----------------------+--------------------------------+ -# ^ ^ ^ ^ ^ -# | | | | | -# 0 1MiB 4MiB 4MiB + BOOT_SPACE SDIMG_SIZE -# -IMAGE_CMD_sdcard_ccardimx28() { - # Align boot partition and calculate total sdcard image size - BOOT_SPACE_ALIGNED="$(expr \( \( ${BOARD_BOOTIMAGE_PARTITION_SIZE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1 \) / ${IMAGE_ROOTFS_ALIGNMENT} \) \* ${IMAGE_ROOTFS_ALIGNMENT})" - SDIMG_SIZE="$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $ROOTFS_SIZE)" - - # Initialize sdcard image file - dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE} - - # - # Bootstream header for u-boot at 1M offset - # - # The offset is coded in bytes 29-32 in little-endian. The - # value to set is the offset in 512 bytes blocks + 1. - # - # For 1M offset we can calculate the bytes: - # - # printf '%08x' 2049 | grep -o .. | tac | tr -d '\n' - # - BS_HDR="\x33\x22\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x08\x00\x00\x00\x00\x00\x00" - - # Use 'printf' command and not shell builtins because hexadecimal - # format does not work well with 'dash' shell - PRINTF="$(which printf)" - - # Create partition table, boot partition (with bootable flag) and rootfs partition (to the end of the disk) - parted -s ${SDIMG} mklabel msdos - parted -s ${SDIMG} unit KiB mkpart primary 1024 ${IMAGE_ROOTFS_ALIGNMENT} - parted -s ${SDIMG} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED}) - parted -s ${SDIMG} set 2 boot on - parted -s ${SDIMG} -- unit KiB mkpart primary ext2 $(expr ${IMAGE_ROOTFS_ALIGNMENT} \+ ${BOOT_SPACE_ALIGNED}) -1s - parted -s ${SDIMG} unit KiB print - - # Change partition type to 0x53 for mxs processor family and write bootstream header - echo -n S | dd of=${SDIMG} bs=1 count=1 seek=450 conv=notrunc - ${PRINTF} "${BS_HDR}" | dd of=${SDIMG} bs=512 seek=$(expr 1024 \* 2) conv=notrunc,sync - - # Burn bootloader, boot and rootfs partitions - dd if=${DEPLOY_DIR_IMAGE}/${UBOOT_SYMLINK} of=${SDIMG} conv=notrunc,fsync seek=$(expr 1024 \* 2 \+ 1) bs=512 - dd if=${SDIMG_BOOTFS} of=${SDIMG} conv=notrunc,fsync seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) - dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc,fsync seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024 + ${BOOT_SPACE_ALIGNED} \* 1024) -} - # The sdcard image requires the boot and rootfs images to be built before IMAGE_TYPEDEP_sdcard = "${SDIMG_BOOTFS_TYPE} ${SDIMG_ROOTFS_TYPE}" diff --git a/meta-digi-arm/conf/machine/ccardimx28js.conf b/meta-digi-arm/conf/machine/ccardimx28js.conf deleted file mode 100644 index 0a111e0f0..000000000 --- a/meta-digi-arm/conf/machine/ccardimx28js.conf +++ /dev/null @@ -1,28 +0,0 @@ -#@TYPE: Machine -#@NAME: ConnectCore for MX28 JumpStart Kit. -#@DESCRIPTION: Machine configuration for Digi's ConnectCore for MX28 JSK. - -include conf/machine/include/ccardimx28.inc - -# U-Boot configurations -UBOOT_CONFIG ??= "ccardimx28js" -UBOOT_CONFIG[ccardimx28js] = "ccardimx28js_config" - -KERNEL_DEVICETREE = "imx28-${MACHINE}.dtb" - -# Serial console -SERIAL_CONSOLES ?= "115200;ttyAMA0" - -# Bluetooth tty -BT_TTY ?= "ttyAPP0" - -# U-Boot script to be copied to the SD image -BOOT_SCRIPTS = "boot.scr:boot.scr" - -# Flash image types -IMAGE_FSTYPES ?= "jffs2.sum sdcard tar.bz2 ubifs" - -# FLASH parameters -MKUBIFS_ARGS ?= "-m 2048 -e 126976 -c 2047" -EXTRA_IMAGECMD_jffs2 ?= "-l -e 128 -n" -JFFS2_SUM_EXTRA_ARGS ?= "${EXTRA_IMAGECMD_jffs2}" diff --git a/meta-digi-arm/conf/machine/ccimx6qpsbc.conf b/meta-digi-arm/conf/machine/ccimx6qpsbc.conf new file mode 100644 index 000000000..810d92b89 --- /dev/null +++ b/meta-digi-arm/conf/machine/ccimx6qpsbc.conf @@ -0,0 +1,42 @@ +#@TYPE: Machine +#@NAME: ConnectCore 6 QuadPlus Single Board Computer. +#@DESCRIPTION: Machine configuration for Digi's ConnectCore 6 QuadPlus SBC. + +# Include the machine configuration for Digi's ConnectCore 6 module. +include conf/machine/include/ccimx6.inc + +# Wireless external module +WIRELESS_MODULE_append = " ${@base_conditional('HAVE_WIFI', '1', 'kernel-module-qualcomm', '', d)}" + +# Wireless p2p interface +WLAN_P2P_INTERFACE ?= "p2p0" + +MACHINE_EXTRA_RRECOMMENDS += "cryptoauthlib" + +# Firmware +MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_BT', '1', 'firmware-qualcomm-qca6564-bt', '', d)}" +MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_WIFI', '1', 'firmware-qualcomm-qca6564-wifi', '', d)}" + +PREFERRED_PROVIDER_virtual/libg2d_mx6 = "imx-gpu-g2d" + +# U-Boot configurations +# Last one is the default (the one the symlinks point at) +UBOOT_CONFIG ??= "ccimx6qpsbc2GB" +UBOOT_CONFIG[ccimx6qpsbc2GB] = "ccimx6qpsbc2GB_defconfig" + +KERNEL_DEVICETREE ?= " \ + imx6qp-ccimx6qpsbc.dtb \ + imx6qp-ccimx6qpsbc-id160.dtb \ + imx6qp-ccimx6qpsbc-wb.dtb \ +" + +SERIAL_CONSOLES ?= "115200;ttymxc3" + +# Bluetooth tty +BT_TTY ?= "ttymxc1" + +# U-Boot script to be copied to the boot image +BOOT_SCRIPTS = "boot.scr:boot.scr" + +# Flash image types +IMAGE_FSTYPES ?= "boot.vfat ext4 sdcard tar.bz2 recovery.vfat" diff --git a/meta-digi-arm/conf/machine/ccimx6sbc.conf b/meta-digi-arm/conf/machine/ccimx6sbc.conf index 38d494206..5dc0967ff 100644 --- a/meta-digi-arm/conf/machine/ccimx6sbc.conf +++ b/meta-digi-arm/conf/machine/ccimx6sbc.conf @@ -5,6 +5,17 @@ # Contains the ConnectCore 6 module. include conf/machine/include/ccimx6.inc +# To be removed (rng-tools) once kernel 3.14 is deprecated +MACHINE_EXTRA_RRECOMMENDS += "rng-tools" + +# Firmware +MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_BT', '1' , 'firmware-atheros-ar3k', '', d)}" +MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_WIFI', '1' , 'firmware-atheros-ath6kl', '', d)}" + +PREFERRED_VERSION_imx-gpu-viv ?= "5.0.11.p8.6-hfp" +PREFERRED_VERSION_kernel-module-imx-gpu-viv ?= "5.0.11.p8.6+fslc%" +PREFERRED_VERSION_xf86-video-imxfb-vivante ?= "5.0.11.p8.6" + # U-Boot configurations # Last one is the default (the one the symlinks point at) UBOOT_CONFIG ??= "ccimx6dlsbc512MB ccimx6dlsbc ccimx6qsbc2GB ccimx6qsbc512MB ccimx6qsbc" @@ -14,6 +25,9 @@ UBOOT_CONFIG[ccimx6qsbc2GB] = "ccimx6qsbc2GB_defconfig" UBOOT_CONFIG[ccimx6qsbc512MB] = "ccimx6qsbc512MB_defconfig" UBOOT_CONFIG[ccimx6qsbc] = "ccimx6qsbc_defconfig" +# Use uImage for backwards compatibility +KERNEL_IMAGETYPE = "uImage" + KERNEL_DEVICETREE ?= " \ imx6dl-ccimx6sbc.dtb \ imx6dl-ccimx6sbc-w.dtb \ diff --git a/meta-digi-arm/conf/machine/ccimx6ulsbc.conf b/meta-digi-arm/conf/machine/ccimx6ulsbc.conf index 33664cb87..db3ce2345 100644 --- a/meta-digi-arm/conf/machine/ccimx6ulsbc.conf +++ b/meta-digi-arm/conf/machine/ccimx6ulsbc.conf @@ -24,12 +24,11 @@ KERNEL_DEVICETREE ?= " \ imx6ul-ccimx6ulsbc.dtb \ imx6ul-ccimx6ulsbc-wb.dtb \ imx6ul-ccimx6ulsbc-id135.dtb \ + imx6ul-ccimx6ulsbc-id136.dtb \ " SERIAL_CONSOLES ?= "115200;ttymxc4" -MACHINE_FEATURES += "second-eth" - # Bluetooth tty BT_TTY ?= "ttymxc0" diff --git a/meta-digi-arm/conf/machine/include/ccardimx28.inc b/meta-digi-arm/conf/machine/include/ccardimx28.inc deleted file mode 100644 index ab0ce8835..000000000 --- a/meta-digi-arm/conf/machine/include/ccardimx28.inc +++ /dev/null @@ -1,47 +0,0 @@ -#@TYPE: Machine -#@NAME: ConnectCore for MX28 module. -#@DESCRIPTION: Machine configuration for Digi's ConnectCore for MX28 module. - -DIGI_FAMILY = "ccardimx28" -MACHINEOVERRIDES =. "mxs:mx28:${DIGI_FAMILY}:" - -include conf/machine/include/imx-digi-base.inc -include conf/machine/include/tune-arm926ejs.inc - -# Platform u-boot settings -UBOOT_ENTRYPOINT = "0x40008000" -UBOOT_SUFFIX = "sb" -UBOOT_SYMLINK = "u-boot-${MACHINE}.${UBOOT_SUFFIX}" - -# Wireless external module -WIRELESS_MODULE ?= "" -WIRELESS_MODULE_append = " ${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'kernel-module-atheros', '', d)}" - -# Firmware -MACHINE_FIRMWARE ?= "" -MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_BT', '1' , 'firmware-atheros-ar3k', '', d)}" -MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_WIFI', '1' , 'firmware-atheros-ath6kl', '', d)}" - -MACHINE_EXTRA_RDEPENDS += "mtd-utils-ubifs nvram ubootenv update-flash" -MACHINE_EXTRA_RRECOMMENDS += "${MACHINE_FIRMWARE} ${WIRELESS_MODULE}" - -# -# Supported variants -# -# Maintain in sync with the same table in platform local.conf template. -# -# Name WiFi Eth2 BT 1wire -# ------------------------------------------- -# - N N N N (empty MACHINE_VARIANT="") -# e N Y N N -# w Y N N N -# wb Y N Y N -# web Y Y Y N -# web1 Y Y Y Y - -# Per-variant machine features -MACHINE_FEATURES_append_e = " second-eth" -MACHINE_FEATURES_append_w = " wifi" -MACHINE_FEATURES_append_wb = " wifi bluetooth" -MACHINE_FEATURES_append_web = " wifi second-eth bluetooth" -MACHINE_FEATURES_append_web1 = " wifi second-eth bluetooth 1-wire" diff --git a/meta-digi-arm/conf/machine/include/ccimx6.inc b/meta-digi-arm/conf/machine/include/ccimx6.inc index b3477ba03..e638551ce 100644 --- a/meta-digi-arm/conf/machine/include/ccimx6.inc +++ b/meta-digi-arm/conf/machine/include/ccimx6.inc @@ -20,8 +20,6 @@ WIRELESS_MODULE ?= "" MACHINE_FIRMWARE ?= "" MACHINE_FIRMWARE_append_mx6q = " firmware-imx-vpu-imx6q" MACHINE_FIRMWARE_append_mx6dl = " firmware-imx-vpu-imx6d" -MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_BT', '1' , 'firmware-atheros-ar3k', '', d)}" -MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_WIFI', '1' , 'firmware-atheros-ath6kl', '', d)}" MACHINE_EXTRA_RDEPENDS += " \ e2fsprogs-mke2fs \ @@ -30,6 +28,6 @@ MACHINE_EXTRA_RDEPENDS += " \ u-boot-fw-utils \ " MACHINE_EXTRA_RRECOMMENDS += "${MACHINE_FIRMWARE} ${WIRELESS_MODULE}" -MACHINE_EXTRA_RRECOMMENDS += "imx-alsa-plugins cryptodev-module rng-tools" +MACHINE_EXTRA_RRECOMMENDS += "imx-alsa-plugins cryptodev-module" MACHINE_FEATURES += "accel-graphics accel-video wifi bluetooth" diff --git a/meta-digi-arm/conf/machine/include/ccimx6ul.inc b/meta-digi-arm/conf/machine/include/ccimx6ul.inc index 302bf54d9..30691e816 100644 --- a/meta-digi-arm/conf/machine/include/ccimx6ul.inc +++ b/meta-digi-arm/conf/machine/include/ccimx6ul.inc @@ -36,8 +36,6 @@ MACHINE_FEATURES += "wifi bluetooth" MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_BT', '1', 'firmware-qualcomm-qca6564-bt', '', d)}" MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_WIFI', '1', 'firmware-qualcomm-qca6564-wifi', '', d)}" -KERNEL_IMAGETYPE = "zImage" - # mkfs.ubifs parameters for boot partition (the one holding kernel and device tree files) # Max LEB count (-c 255) calculated for a partition of up to 32 MiB considering 128 KiB erase-block size. MKUBIFS_BOOT_ARGS ?= "-m 2048 -e 126976 -c 255" diff --git a/meta-digi-arm/conf/machine/include/digi-defaults.inc b/meta-digi-arm/conf/machine/include/digi-defaults.inc index 1780c8ec7..78d76a3ad 100644 --- a/meta-digi-arm/conf/machine/include/digi-defaults.inc +++ b/meta-digi-arm/conf/machine/include/digi-defaults.inc @@ -10,18 +10,15 @@ PREFERRED_PROVIDER_virtual/xserver = "xserver-xorg" # # Platform Linux U-Boot # ------------------------------------------------- -# ccardimx28 3.10 2013.01 # ccimx6 4.1, 3.14 2015.04 -# ccimx6ul 4.1 2015.04 +# ccimx6qp 4.9 2015.04 +# ccimx6ul 4.9, 4.1 2015.04 # # Help variables used in recipes HAVE_WIFI = "${@bb.utils.contains('MACHINE_FEATURES', 'wifi', '1', '', d)}" -HAVE_SECOND_ETH = "${@bb.utils.contains('MACHINE_FEATURES', 'second-eth', '1', '', d)}" HAVE_BT = "${@bb.utils.contains('MACHINE_FEATURES', 'bluetooth', '1', '', d)}" -HAVE_1WIRE = "${@bb.utils.contains('MACHINE_FEATURES', '1-wire', '1', '', d)}" HAVE_GUI = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '1', '', d)}" -HAVE_EXAMPLE = "${@bb.utils.contains('IMAGE_FEATURES', 'dey-examples', '1', '', d)}" # # Ethernet configuration used in recipes diff --git a/meta-digi-arm/conf/machine/include/imx-digi-base.inc b/meta-digi-arm/conf/machine/include/imx-digi-base.inc index b5447c7de..bb8a6a5ec 100644 --- a/meta-digi-arm/conf/machine/include/imx-digi-base.inc +++ b/meta-digi-arm/conf/machine/include/imx-digi-base.inc @@ -88,7 +88,7 @@ PREFERRED_PROVIDER_virtual/libg2d_mx6ul = "" EXTRA_IMAGEDEPENDS = "u-boot" -KERNEL_IMAGETYPE = "uImage" +KERNEL_IMAGETYPE = "zImage" MACHINE_FEATURES = "usbgadget usbhost vfat alsa touchscreen" diff --git a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state.bbappend b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state.bbappend index e21da25b4..5cc823267 100644 --- a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state.bbappend +++ b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state.bbappend @@ -10,20 +10,8 @@ SRC_URI_append_ccimx6 = " \ file://asound.play.state \ " -SRC_URI_append_ccardimx28 = " \ - file://asound.inline_play.state \ - file://asound.inline.state \ - file://asound.micro_play.state \ - file://asound.micro.state \ - file://asound.play.state \ -" - SRC_URI_append_ccimx6ul = " file://asound.state" do_install_append_ccimx6() { ln -sf asound.micro_play.state ${D}${localstatedir}/lib/alsa/asound.state } - -do_install_append_ccardimx28() { - ln -sf asound.micro_play.state ${D}${localstatedir}/lib/alsa/asound.state -} diff --git a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccardimx28/asound.inline.state b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccardimx28/asound.inline.state deleted file mode 100644 index 5a3fa2a42..000000000 --- a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccardimx28/asound.inline.state +++ /dev/null @@ -1,114 +0,0 @@ -state.mxssgtl5000 { - control.1 { - iface MIXER - name 'PCM Playback Volume' - value.0 154 - value.1 154 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 192' - } - } - control.2 { - iface MIXER - name 'Capture Volume' - value.0 11 - value.1 11 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 15' - } - } - control.3 { - iface MIXER - name 'Capture Attenuate Switch (-6dB)' - value 0 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 2' - dbmin -600 - dbmax 600 - dbvalue.0 -600 - } - } - control.4 { - iface MIXER - name 'Capture ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.5 { - iface MIXER - name 'Headphone Playback Volume' - value.0 115 - value.1 115 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 127' - dbmin -5150 - dbmax 1200 - dbvalue.0 600 - dbvalue.1 600 - } - } - control.6 { - iface MIXER - name 'Headphone Playback ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.7 { - iface MIXER - name 'Mic Volume' - value 2 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 3' - dbmin 0 - dbmax 4000 - dbvalue.0 3000 - } - } - control.8 { - iface MIXER - name 'Headphone Mux' - value LINE_IN - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 DAC - item.1 LINE_IN - } - } - control.9 { - iface MIXER - name 'Capture Mux' - value LINE_IN - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 MIC_IN - item.1 LINE_IN - } - } -} diff --git a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccardimx28/asound.inline_play.state b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccardimx28/asound.inline_play.state deleted file mode 100644 index 434eda5b0..000000000 --- a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccardimx28/asound.inline_play.state +++ /dev/null @@ -1,114 +0,0 @@ -state.mxssgtl5000 { - control.1 { - iface MIXER - name 'PCM Playback Volume' - value.0 154 - value.1 154 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 192' - } - } - control.2 { - iface MIXER - name 'Capture Volume' - value.0 11 - value.1 11 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 15' - } - } - control.3 { - iface MIXER - name 'Capture Attenuate Switch (-6dB)' - value 0 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 2' - dbmin -600 - dbmax 600 - dbvalue.0 -600 - } - } - control.4 { - iface MIXER - name 'Capture ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.5 { - iface MIXER - name 'Headphone Playback Volume' - value.0 115 - value.1 115 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 127' - dbmin -5150 - dbmax 1200 - dbvalue.0 600 - dbvalue.1 600 - } - } - control.6 { - iface MIXER - name 'Headphone Playback ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.7 { - iface MIXER - name 'Mic Volume' - value 2 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 3' - dbmin 0 - dbmax 4000 - dbvalue.0 3000 - } - } - control.8 { - iface MIXER - name 'Headphone Mux' - value DAC - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 DAC - item.1 LINE_IN - } - } - control.9 { - iface MIXER - name 'Capture Mux' - value LINE_IN - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 MIC_IN - item.1 LINE_IN - } - } -} diff --git a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccardimx28/asound.micro.state b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccardimx28/asound.micro.state deleted file mode 100644 index 113b99bea..000000000 --- a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccardimx28/asound.micro.state +++ /dev/null @@ -1,188 +0,0 @@ -state.ccardxmx28 { - control.1 { - comment.access 'read write' - comment.type ENUMERATED - comment.count 1 - comment.item.0 '0dB' - comment.item.1 '20dB' - comment.item.2 '30dB' - comment.item.3 '40dB' - iface MIXER - name 'MIC GAIN' - value '0dB' - } - control.2 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 15' - iface MIXER - name 'Capture Volume' - value.0 15 - value.1 15 - } - control.3 { - comment.access 'read write' - comment.type ENUMERATED - comment.count 1 - comment.item.0 'No Change' - comment.item.1 'Reduced by 6dB' - iface MIXER - name 'Capture Vol Reduction' - value 'No Change' - } - control.4 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 192' - iface MIXER - name 'Playback Volume' - value.0 132 - value.1 132 - } - control.5 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 127' - iface MIXER - name 'Headphone Volume' - value.0 103 - value.1 103 - } - control.6 { - comment.access 'read write' - comment.type ENUMERATED - comment.count 1 - comment.item.0 DAC - comment.item.1 LINE_IN - iface MIXER - name 'DAC Mux' - value DAC - } - control.7 { - comment.access 'read write' - comment.type ENUMERATED - comment.count 1 - comment.item.0 MIC_IN - comment.item.1 LINE_IN - iface MIXER - name 'ADC Mux' - value MIC_IN - } -} -state.mxssgtl5000 { - control.1 { - iface MIXER - name 'PCM Playback Volume' - value.0 138 - value.1 138 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 192' - } - } - control.2 { - iface MIXER - name 'Capture Volume' - value.0 0 - value.1 0 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 15' - } - } - control.3 { - iface MIXER - name 'Capture Attenuate Switch (-6dB)' - value 2 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 2' - dbmin -600 - dbmax 600 - dbvalue.0 600 - } - } - control.4 { - iface MIXER - name 'Capture ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.5 { - iface MIXER - name 'Headphone Playback Volume' - value.0 103 - value.1 103 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 127' - dbmin -5150 - dbmax 1200 - dbvalue.0 0 - dbvalue.1 0 - } - } - control.6 { - iface MIXER - name 'Headphone Playback ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.7 { - iface MIXER - name 'Mic Volume' - value 1 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 3' - dbmin 0 - dbmax 4000 - dbvalue.0 2000 - } - } - control.8 { - iface MIXER - name 'Headphone Mux' - value LINE_IN - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 DAC - item.1 LINE_IN - } - } - control.9 { - iface MIXER - name 'Capture Mux' - value MIC_IN - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 MIC_IN - item.1 LINE_IN - } - } -} diff --git a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccardimx28/asound.micro_play.state b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccardimx28/asound.micro_play.state deleted file mode 100644 index 992cc8945..000000000 --- a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccardimx28/asound.micro_play.state +++ /dev/null @@ -1,114 +0,0 @@ -state.mxssgtl5000 { - control.1 { - iface MIXER - name 'PCM Playback Volume' - value.0 138 - value.1 138 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 192' - } - } - control.2 { - iface MIXER - name 'Capture Volume' - value.0 0 - value.1 0 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 15' - } - } - control.3 { - iface MIXER - name 'Capture Attenuate Switch (-6dB)' - value 2 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 2' - dbmin -600 - dbmax 600 - dbvalue.0 600 - } - } - control.4 { - iface MIXER - name 'Capture ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.5 { - iface MIXER - name 'Headphone Playback Volume' - value.0 103 - value.1 103 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 127' - dbmin -5150 - dbmax 1200 - dbvalue.0 0 - dbvalue.1 0 - } - } - control.6 { - iface MIXER - name 'Headphone Playback ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.7 { - iface MIXER - name 'Mic Volume' - value 1 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 3' - dbmin 0 - dbmax 4000 - dbvalue.0 2000 - } - } - control.8 { - iface MIXER - name 'Headphone Mux' - value DAC - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 DAC - item.1 LINE_IN - } - } - control.9 { - iface MIXER - name 'Capture Mux' - value MIC_IN - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 MIC_IN - item.1 LINE_IN - } - } -} diff --git a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccardimx28/asound.play.state b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccardimx28/asound.play.state deleted file mode 100644 index 8a1bdb44e..000000000 --- a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccardimx28/asound.play.state +++ /dev/null @@ -1,114 +0,0 @@ -state.mxssgtl5000 { - control.1 { - iface MIXER - name 'PCM Playback Volume' - value.0 142 - value.1 142 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 192' - } - } - control.2 { - iface MIXER - name 'Capture Volume' - value.0 11 - value.1 11 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 15' - } - } - control.3 { - iface MIXER - name 'Capture Attenuate Switch (-6dB)' - value 0 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 2' - dbmin -600 - dbmax 600 - dbvalue.0 -600 - } - } - control.4 { - iface MIXER - name 'Capture ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.5 { - iface MIXER - name 'Headphone Playback Volume' - value.0 115 - value.1 115 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 127' - dbmin -5150 - dbmax 1200 - dbvalue.0 600 - dbvalue.1 600 - } - } - control.6 { - iface MIXER - name 'Headphone Playback ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.7 { - iface MIXER - name 'Mic Volume' - value 2 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 3' - dbmin 0 - dbmax 4000 - dbvalue.0 3000 - } - } - control.8 { - iface MIXER - name 'Headphone Mux' - value DAC - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 DAC - item.1 LINE_IN - } - } - control.9 { - iface MIXER - name 'Capture Mux' - value LINE_IN - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 MIC_IN - item.1 LINE_IN - } - } -} diff --git a/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros.bb b/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros.bb index 9cc5843fd..aba5c07cd 100644 --- a/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros.bb +++ b/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros.bb @@ -1,4 +1,4 @@ -# Copyright (C) 2013 Digi International. +# Copyright (C) 2013-2017 Digi International. SUMMARY = "Firmware files for Digi's platforms, such as Atheros bluetooth." SECTION = "base" @@ -8,6 +8,8 @@ LIC_FILES_CHKSUM = "file://${DIGI_EULA_FILE};md5=8c0ad592dd48ace3d25eed5bbb26ba7 FW_ATH6KL = " \ file://athtcmd_ram.bin \ file://athwlan.bin \ + file://Digi_6203_2_ANT-US.bin \ + file://Digi_6203_2_ANT-World.bin \ file://Digi_6203-6233-US.bin \ file://Digi_6203-6233-World.bin \ file://fw-4.bin \ @@ -15,11 +17,6 @@ FW_ATH6KL = " \ file://utf.bin \ " -FW_ATH6KL_append_ccimx6 = " \ - file://Digi_6203_2_ANT-US.bin \ - file://Digi_6203_2_ANT-World.bin \ -" - FW_AR3K = " \ file://PS_ASIC_class_1.pst \ file://PS_ASIC_class_2.pst \ @@ -49,6 +46,8 @@ do_install() { install -m 0644 \ athtcmd_ram.bin \ athwlan.bin \ + Digi_6203_2_ANT-US.bin \ + Digi_6203_2_ANT-World.bin \ Digi_6203-6233-US.bin \ Digi_6203-6233-World.bin \ fw-4.bin \ @@ -63,13 +62,6 @@ do_install() { ln -sf Digi_6203-6233-US.bin ${D}${base_libdir}/firmware/ath6k/AR6003/hw2.1.1/bdata.0x0.bin ln -sf Digi_6203-6233-World.bin ${D}${base_libdir}/firmware/ath6k/AR6003/hw2.1.1/bdata.0x1.bin ln -sf Digi_6203-6233-World.bin ${D}${base_libdir}/firmware/ath6k/AR6003/hw2.1.1/bdata.0x2.bin -} - -do_install_append_ccimx6() { - install -m 0644 \ - Digi_6203_2_ANT-US.bin \ - Digi_6203_2_ANT-World.bin \ - ${D}${base_libdir}/firmware/ath6k/AR6003/hw2.1.1/ ln -sf Digi_6203_2_ANT-US.bin ${D}${base_libdir}/firmware/ath6k/AR6003/hw2.1.1/bdata.ANT-0x0.bin ln -sf Digi_6203_2_ANT-World.bin ${D}${base_libdir}/firmware/ath6k/AR6003/hw2.1.1/bdata.ANT-0x1.bin ln -sf Digi_6203_2_ANT-World.bin ${D}${base_libdir}/firmware/ath6k/AR6003/hw2.1.1/bdata.ANT-0x2.bin @@ -82,4 +74,4 @@ FILES_${PN}-ar3k = "/lib/firmware/ar3k" FILES_${PN}-ath6kl = "/lib/firmware/ath6k" PACKAGE_ARCH = "${MACHINE_ARCH}" -COMPATIBLE_MACHINE = "(ccardimx28|ccimx6$)" +COMPATIBLE_MACHINE = "(ccimx6sbc)" diff --git a/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/ccimx6/Digi_6203-6233-US.bin b/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/Digi_6203-6233-US.bin similarity index 100% rename from meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/ccimx6/Digi_6203-6233-US.bin rename to meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/Digi_6203-6233-US.bin diff --git a/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/ccimx6/Digi_6203_2_ANT-US.bin b/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/Digi_6203_2_ANT-US.bin similarity index 100% rename from meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/ccimx6/Digi_6203_2_ANT-US.bin rename to meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/Digi_6203_2_ANT-US.bin diff --git a/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/ccimx6/Digi_6203_2_ANT-World.bin b/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/Digi_6203_2_ANT-World.bin similarity index 100% rename from meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/ccimx6/Digi_6203_2_ANT-World.bin rename to meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/Digi_6203_2_ANT-World.bin diff --git a/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/ccimx6/PS_ASIC_class_1.pst b/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/PS_ASIC_class_1.pst similarity index 100% rename from meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/ccimx6/PS_ASIC_class_1.pst rename to meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/PS_ASIC_class_1.pst diff --git a/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/ccardimx28/Digi_6203-6233-US.bin b/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/ccardimx28/Digi_6203-6233-US.bin deleted file mode 100644 index 74e7f50fe..000000000 Binary files a/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/ccardimx28/Digi_6203-6233-US.bin and /dev/null differ diff --git a/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/ccardimx28/PS_ASIC_class_1.pst b/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/ccardimx28/PS_ASIC_class_1.pst deleted file mode 100644 index 4ad2e1f52..000000000 --- a/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros/ccardimx28/PS_ASIC_class_1.pst +++ /dev/null @@ -1,126 +0,0 @@ - -// Radio table TAG -# -[H:S]012C -[H:S]00EE -[H:A]B1 B1 12 00 B8 08 FE FE 7D 00 17 00 00 20 02 00 - 0C 09 00 14 00 00 8C 08 00 00 00 40 80 08 78 00 - 00 01 84 08 AD AC 80 5F 88 08 20 3F 00 41 8C 08 - 00 00 00 40 94 08 54 25 64 92 98 08 C8 4E 2C 2E - 9C 08 C0 20 DA 2C C0 08 B6 0D 01 00 C4 08 6C DB - B6 6D C8 08 DB 36 D3 6D CC 08 60 DB B6 6D 00 09 - 50 00 92 04 04 09 20 49 00 80 08 09 E0 6F 5B E5 - 0C 09 00 14 00 00 10 09 81 03 30 F0 14 09 80 80 - 43 00 18 09 00 00 00 80 1C 09 00 00 00 00 20 09 - 02 00 00 00 88 0A 00 60 77 58 61 00 00 60 02 00 - 04 07 C4 C1 8B 00 1C 00 00 05 90 01 0C 07 00 0D - 00 00 30 00 D8 70 EF 4A 7C 00 B0 D2 5A B1 78 00 - DE 7A 58 00 5C 00 01 00 14 01 44 00 00 00 10 E4 - 84 00 3F F0 E7 04 C0 00 90 01 2C 00 C4 00 80 D6 - 82 03 DC 00 D8 40 06 00 88 00 52 6C 3D 0E -// Radio table TAG -# -[H:S]012D -[H:S]00F0 -[H:A]94 00 41 06 00 00 80 00 20 9C C8 00 90 00 DD DD - 97 06 54 00 E0 A6 09 00 10 07 3D A0 00 3D 14 07 - A0 80 01 00 18 07 17 55 D1 0C 1C 07 6D 23 00 00 - C0 07 65 A8 0C 0B E4 07 27 CA 54 00 C4 07 FF FF - FF 3F C8 07 FF FF E3 3F CC 07 FF FF FF 3F D0 07 - FF FF FF 3F D4 07 3F FE FF 3F D8 07 FF FF FF 3F - DC 07 FF FF FF 38 E0 07 FF FF FF 3F BC 07 D8 05 - 00 00 B8 07 42 00 0B 00 00 05 4A 1C 00 00 04 05 - 8A 1C 00 00 08 05 CA 1C 00 00 0C 05 0A 1D 00 00 - 10 05 4A 1D 00 00 14 05 1A 1C 00 00 18 05 5A 1C - 00 00 1C 05 9A 1C 00 00 20 05 DA 1C 00 00 24 05 - 1A 1D 00 00 28 05 5A 1D 00 00 2C 05 2A 1C 00 00 - 30 05 6A 1C 00 00 34 05 AA 1C 00 00 38 05 EA 1C - 00 00 3C 05 2A 1D 00 00 40 05 6A 1D 00 00 44 05 - 3A 1C 00 00 48 05 2B 1C 00 00 4C 05 6B 1C 00 00 - -// Radio table TAG -# -[H:S]012E -[H:S]00F0 -[H:A]50 05 AB 1C 00 00 54 05 EB 1C 00 00 58 05 2B 1D - 00 00 5C 05 5C 1D 00 00 60 05 2C 1C 00 00 64 05 - 6C 1C 00 00 68 05 AC 1C 00 00 6C 05 1D 1D 00 00 - 70 05 2D 1C 00 00 74 05 6D 1C 00 00 78 05 AD 1C - 00 00 7C 05 ED 1C 00 00 80 05 2D 1D 00 00 84 05 - 6D 1D 00 00 88 05 3D 1C 00 00 8C 05 7D 1C 00 00 - 90 05 AE 1C 00 00 94 05 EE 1C 00 00 98 05 2E 1D - 00 00 9C 05 6E 1D 00 00 A0 05 3E 1C 00 00 A4 05 - 7E 1C 00 00 A8 05 BE 1C 00 00 AC 05 2F 1C 00 00 - B0 05 6F 1C 00 00 B4 05 AF 1C 00 00 B8 05 EF 1C - 00 00 BC 05 2F 1D 00 00 C0 05 6F 1D 00 00 C4 05 - AF 1D 00 00 C8 05 BF 00 00 00 CC 05 FF 1C 00 00 - D0 05 3F 01 00 00 D4 05 7F 01 00 00 D8 05 BF 01 - 00 00 DC 05 FF 01 00 00 E0 05 3F 02 00 00 E4 05 - 7F 12 00 00 E8 05 BF 02 00 00 EC 05 FF 02 00 00 - -// Radio table TAG -# -[H:S]012F -[H:S]0044 -[H:A]F0 05 3F 03 00 00 F4 05 7F 03 00 00 F8 05 BF 03 - 00 00 FC 05 FF 03 00 00 04 00 00 00 02 00 10 00 - 01 CE C0 10 14 00 07 04 00 00 A0 04 00 E9 FF 03 - BC 04 FF 41 00 00 01 00 00 C0 02 00 B8 01 01 00 - 00 00 B2 B2 - -// System config TAG -# -[H:S]0013 -[H:S]00F0 -[H:A]C1 C1 20 02 BD 08 FE FE C9 00 00 CC B1 01 20 00 - FF CC 02 CC 04 00 B6 FB A9 90 00 21 00 E0 FF CC - 08 CC 1E 00 80 84 00 07 DB 05 93 11 FF CC 0E CC - 0B 00 E4 FF 61 47 00 00 4D FD 61 47 00 00 58 FD - E8 FF 41 27 04 00 6F FD 41 27 04 00 6C FD EC FF - A0 A7 00 00 2F FD A0 A7 00 00 6D FD F0 FF 60 27 - 01 00 50 FD 60 27 01 00 6F FD F4 FF A0 C7 04 00 - 3A FD A0 C7 04 00 89 FD F8 FF 80 C7 08 00 12 FD - 80 C7 08 00 58 FD FC FF 40 47 09 00 66 FD 40 47 - 09 00 0B FD 00 00 80 C7 0D 00 09 FD 80 C7 0D 00 - 09 FD 04 00 20 47 0E 40 58 FD 20 47 0E 40 58 FD - 08 00 60 47 13 40 58 FD 60 47 13 40 58 FD 0C 00 - 00 E7 13 40 58 FD 00 E7 13 40 58 FD FF CC 0F CC - 01 01 01 01 07 04 03 33 00 0A 00 04 00 00 60 6D - F0 00 66 01 00 00 00 00 00 00 FF CC 10 CC 22 81 - -// System config TAG -# -[H:S]0014 -[H:S]00AE -[H:A]A0 0F A0 00 32 00 02 08 0A 64 20 20 0A FF 20 20 - FF CC 11 CC 01 01 FF CC 12 CC 09 01 FF 03 00 FF - FF 03 FF CC 13 CC 02 19 B8 0B 17 0F E0 FD E0 FD - E0 FD E0 FD 58 FD 14 FD 58 FD 14 FD 54 25 11 A0 - 92 24 00 00 00 00 00 00 00 00 00 00 00 00 02 64 - 04 02 03 FF 04 03 FF CC 1A CC 0C 02 08 00 60 47 - 13 40 58 FD 0C 00 00 E7 13 40 58 FD FF CC 18 CC - 01 00 05 05 14 0A FF CC 17 CC 20 01 FF CC 16 CC - 07 00 C9 B0 B4 00 FF CC 14 CC 01 01 FF CC 15 CC - 01 00 08 00 FF CC 1D CC 01 00 00 00 00 00 FB 00 - 16 F5 08 00 24 24 07 00 1C 1C FF CC C2 C2 -// Coex Configuration -# -[H:S]0017 -[H:S]0026 -[H:A]D1 D1 20 00 02 01 02 09 0C 00 24 1F 12 00 00 01 - 00 01 00 00 01 01 01 01 01 00 00 00 01 00 01 01 - 01 01 01 00 D2 D2 - -//Audio - Audio main config -# -[H:S]0041 -[H:S]0004 -[H:A]01 00 00 00 - -//TLPM -//HOST TLPM 6W (GPIO14) Enable Active low No ack, Target TLPM 4W Enable Active low, No ack -# -[H:S]0023 -[H:S]0018 -[H:A]06 0E 06 0F 08 08 00 0E 05 00 05 00 2C 01 00 00 - E8 03 00 00 C8 00 00 00 \ No newline at end of file diff --git a/meta-digi-arm/recipes-bsp/firmware-imx/firmware-imx_6.0.bb b/meta-digi-arm/recipes-bsp/firmware-imx/firmware-imx_6.0.bb new file mode 100644 index 000000000..5c2cfb949 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/firmware-imx/firmware-imx_6.0.bb @@ -0,0 +1,13 @@ +# Copyright (C) 2012-2016 Freescale Semiconductor +# Copyright 2017 NXP + +require recipes-bsp/firmware-imx/firmware-imx.inc +LIC_FILES_CHKSUM = "file://COPYING;md5=6b552f505eedab4a11ab538cf3db743a" + +SRC_URI[md5sum] = "088fb08b565748b537f6481b1ad6c9d7" +SRC_URI[sha256sum] = "9fa7c204a6ff8a30f2b5e8f9002d8c5736791e455dc137b952fa725dc0c3aeb8" + +#BRCM firmware git +SRCREV = "951c1363abe95dd75ab3e9447f640d7807240236" + +COMPATIBLE_MACHINE = "(ccimx6qpsbc)" diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb index b12bc2b14..049f3f41b 100644 --- a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb +++ b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb @@ -1,4 +1,4 @@ -# Copyright (C) 2016 Digi International. +# Copyright (C) 2016,2017 Digi International. SUMMARY = "Qualcomm firmware files for Digi's platforms." SECTION = "base" @@ -55,4 +55,4 @@ FILES_${PN}-qca6564-bt = "/lib/firmware/qca" FILES_${PN}-qca6564-wifi = "/lib/firmware" PACKAGE_ARCH = "${MACHINE_ARCH}" -COMPATIBLE_MACHINE = "(ccimx6ul)" +COMPATIBLE_MACHINE = "(ccimx6qpsbc|ccimx6ul)" diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/rampatch_tlv_3.0.tlv b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/rampatch_tlv_3.0.tlv index ee1149488..7b9c5bb64 100644 Binary files a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/rampatch_tlv_3.0.tlv and b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/rampatch_tlv_3.0.tlv differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/rampatch_tlv_3.2.tlv b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/rampatch_tlv_3.2.tlv index ec01e6740..def7cc30a 100644 Binary files a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/rampatch_tlv_3.2.tlv and b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/rampatch_tlv_3.2.tlv differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qwlan30.bin b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qwlan30.bin index caefbe0e2..47a5db5c6 100644 Binary files a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qwlan30.bin and b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qwlan30.bin differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/utf30.bin b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/utf30.bin index 301dbe9ec..94fcd018b 100644 Binary files a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/utf30.bin and b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/utf30.bin differ diff --git a/meta-digi-arm/recipes-bsp/imx-vpu/imx-vpu_5.4.37.bb b/meta-digi-arm/recipes-bsp/imx-vpu/imx-vpu_5.4.37.bb new file mode 100644 index 000000000..05f77def3 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/imx-vpu/imx-vpu_5.4.37.bb @@ -0,0 +1,21 @@ +# Copyright (C) 2013-2016 Freescale Semiconductor +# Copyright 2017 NXP + +require recipes-bsp/imx-vpu/imx-vpu.inc +LIC_FILES_CHKSUM = "file://COPYING;md5=6b552f505eedab4a11ab538cf3db743a" + +PE = "1" + +SRC_URI[md5sum] = "2b8311cb6e5b5813253db706e807d962" +SRC_URI[sha256sum] = "ee265e88d17c7369bd9cb917e7cce035b8c7ee2ba4491645fdab9f382f54beb0" + +# imx-vpu can only support imx6q platform, in order to build out the vpu case in unit test, +# using a workaround to transfer "IMX6Q" on imx6ul & imx7d platform. +PLATFORM_mx6ul = "IMX6Q" +PLATFORM_mx7 = "IMX6Q" +PLATFORM_mx6sll = "IMX6Q" + +PROVIDES = "virtual/libvpu" +RPROVIDES_${PN} = "virtual/libvpu" + +COMPATIBLE_MACHINE = "(ccimx6qpsbc)" diff --git a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0001-makefile.am.patch b/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0001-makefile.am.patch deleted file mode 100644 index d5981d7bc..000000000 --- a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0001-makefile.am.patch +++ /dev/null @@ -1,29 +0,0 @@ -From: Javier Viguera -Date: Fri, 11 Oct 2013 18:56:04 +0200 -Subject: [PATCH] makefile.am - -Yocto build system does not use the makefile.in directly. Instead it -uses autotools to regenerate it using the source makefile.am. - -But the makefile.in distributed in the package has some rules changed -that are not generated from the makefile.am, so adapt the makefile.am to -generate an equivalent makefile.in. - -Signed-off-by: Javier Viguera ---- - include/Makefile.am | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/include/Makefile.am b/include/Makefile.am -index 17d4d2c..dc3a466 100644 ---- a/include/Makefile.am -+++ b/include/Makefile.am -@@ -1,5 +1,8 @@ - noinst_HEADERS=version.h - -+all-local: -+ echo "const char *git_sha = \""`git rev-parse HEAD`"\";" > ../include/autoversion.h -+ - version.h: stamp-vh - @: - diff --git a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0002-fix-mtd-defines.patch b/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0002-fix-mtd-defines.patch deleted file mode 100644 index eeef870e3..000000000 --- a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0002-fix-mtd-defines.patch +++ /dev/null @@ -1,84 +0,0 @@ -From: "Paul B. Henson" -Date: Fri, 11 Oct 2013 17:23:44 +0200 -Subject: [PATCH] fix-mtd-defines - -Newer kernel headers renamed mtd mode defines and no longer support -MEMSETOOBSEL. Allow code to work with both older and newer kernel -versions. - -Signed-off-by: Paul B. Henson -Signed-off-by: Javier Viguera ---- - src/mtd.c | 9 +++++++++ - src/mtd.h | 8 ++++++++ - 2 files changed, 17 insertions(+) - -diff --git a/src/mtd.c b/src/mtd.c -index 2974814..f9e60a3 100644 ---- a/src/mtd.c -+++ b/src/mtd.c -@@ -852,8 +852,11 @@ void mtd_close(struct mtd_data *md) - mp = &md->part[i]; - - if (mp->fd != -1) { -+/* Newer kernels dropped MEMSETOOBSEL */ -+#ifdef MEMSETOOBSEL - (void)ioctl(mp->fd, MEMSETOOBSEL, - &mp->old_oobinfo); -+#endif - close(mp->fd); - } - -@@ -896,6 +899,8 @@ int mtd_set_ecc_mode(struct mtd_data *md, int ecc) - continue; - } - -+/* Newer kernels dropped MEMSETOOBSEL */ -+#ifdef MEMSETOOBSEL - if (r == -ENOTTY) { - r = ioctl(mp->fd, MEMSETOOBSEL, &mp->old_oobinfo); - if (r != 0) { -@@ -904,6 +909,7 @@ int mtd_set_ecc_mode(struct mtd_data *md, int ecc) - } - mp->oobinfochanged = 0; - } -+#endif - } else { - r = ioctl(mp->fd, MTDFILEMODE, (void *)MTD_MODE_RAW); - if (r != 0 && r != -ENOTTY) { -@@ -911,6 +917,8 @@ int mtd_set_ecc_mode(struct mtd_data *md, int ecc) - continue; - } - -+/* Newer kernels dropped MEMSETOOBSEL */ -+#ifdef MEMSETOOBSEL - if (r == -ENOTTY) { - r = ioctl(mp->fd, MEMSETOOBSEL, &none_oobinfo); - if (r != 0) { -@@ -920,6 +928,7 @@ int mtd_set_ecc_mode(struct mtd_data *md, int ecc) - mp->oobinfochanged = 1; - } else - mp->oobinfochanged = 2; -+#endif - } - - mp->ecc = ecc; -diff --git a/src/mtd.h b/src/mtd.h -index 99d7887..bf6e53d 100644 ---- a/src/mtd.h -+++ b/src/mtd.h -@@ -31,6 +31,14 @@ - #include "BootControlBlocks.h" - #include "rom_nand_hamming_code_ecc.h" - -+// Newer kernel headers renamed define -+#ifndef MTD_MODE_NORMAL -+#define MTD_MODE_NORMAL MTD_FILE_MODE_NORMAL -+#endif -+#ifndef MTD_MODE_RAW -+#define MTD_MODE_RAW MTD_FILE_MODE_RAW -+#endif -+ - //------------------------------------------------------------------------------ - // Re-definitions of true and false, because the standard ones aren't good - // enough? diff --git a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0003-cleanup-ROM-version-detection-code-and-add-cpx2-supp.patch b/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0003-cleanup-ROM-version-detection-code-and-add-cpx2-supp.patch deleted file mode 100644 index d70fe428f..000000000 --- a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0003-cleanup-ROM-version-detection-code-and-add-cpx2-supp.patch +++ /dev/null @@ -1,170 +0,0 @@ -From: Hector Palacios -Date: Fri, 18 Oct 2013 10:10:37 +0200 -Subject: cleanup ROM version detection code and add cpx2 support - -The original code flow was difficult to understand. -Now there is a main if-elseif to check for 'Hardware' or 'Revision' -strings from cpuinfo. -On the 'Hardware' section we first check if it is a CPX2, or else we -will parse the MX-- number to get the CPU model. -On the 'Revision' section we base on the revision number to get the -CPU model or, if unset (like when Linux is booted directly), we'll -rely on the previous hw_system_rev calculated before. - -Signed-off-by: Hector Palacios -Reviewed-by: Robert Hodaszi ---- - src/plat_boot_config.c | 119 ++++++++++++++++++++++++++----------------------- - 1 file changed, 63 insertions(+), 56 deletions(-) - -diff --git a/src/plat_boot_config.c b/src/plat_boot_config.c -index 76e65c8..e3bf242 100644 ---- a/src/plat_boot_config.c -+++ b/src/plat_boot_config.c -@@ -109,10 +109,11 @@ int discover_boot_rom_version(void) - { - FILE *cpuinfo; - char line_buffer[100]; -- static char *banner = "Revision"; -+ static char *banner_rev = "Revision"; - static char *banner_hw = "Hardware"; -+ static char *banner_digi_x2 = "Hardware\t: Digi ConnectPort X2"; - char *rev; -- int system_rev, hw_system_rev = 0; -+ int system_rev = 0, hw_system_rev = 0; - - cpuinfo = fopen("/proc/cpuinfo", "r"); - if (!cpuinfo) { -@@ -125,15 +126,20 @@ int discover_boot_rom_version(void) - if (!fgets(line_buffer, sizeof(line_buffer), cpuinfo)) - break; - -- /* Check if it's revision line */ -- if (strncmp(line_buffer, banner, strlen(banner))) { -- /* -- * Why use the `Hardware` to parse the system type ? -- * [1] If boot linux kernel directly from SD card not by uboot, -- * the `Revision` will be zero. -- * [2] The code does not change the old logic. -- */ -- if (!strncmp(line_buffer, banner_hw, strlen(banner))) { -+ /* Check if it's hardware line... */ -+ /* -+ * Why use the `Hardware` to parse the system type ? -+ * [1] If boot linux kernel directly from SD card not by uboot, -+ * the `Revision` will be zero. -+ * [2] The code does not change the old logic. -+ */ -+ if (!strncmp(line_buffer, banner_hw, strlen(banner_hw))) { -+ if (!strncmp(line_buffer, banner_digi_x2, -+ strlen(banner_digi_x2))) { -+ /* The cpx2 is an i.MX28 */ -+ hw_system_rev = MX28; -+ } -+ else { - rev = strstr(line_buffer, "MX"); - if (rev) { - char tmp[3] = {}; -@@ -143,56 +149,57 @@ int discover_boot_rom_version(void) - hw_system_rev = strtoul(tmp, NULL, 16); - } - } -- continue; - } -+ /* ... or Revision line */ -+ else if (!strncmp(line_buffer, banner_rev, strlen(banner_rev))) { -+ rev = index(line_buffer, ':'); -+ if (rev != NULL) { -+ rev++; -+ system_rev = strtoul(rev, NULL, 16); -+ system_rev = mxc_cpu(system_rev); -+ if (!system_rev) -+ system_rev = hw_system_rev; -+ -+ switch (system_rev) { -+ case MX23: -+ plat_config_data = &mx23_boot_config; -+ break; -+ -+ case MX28: -+ plat_config_data = &mx28_boot_config; -+ break; -+ -+ case MX53: -+ if (mxc_cpu_is_rev(system_rev, CHIP_REV_2_0) < 0) -+ plat_config_data = &mx53to1_boot_config; -+ else -+ plat_config_data = &mx53to2_boot_config; -+ break; -+ -+ case MX50: -+ plat_config_data = &mx50_boot_config; -+ break; -+ -+ case MX6: -+ case MX6Q: -+ case MX6DL: -+ plat_config_data = &mx6q_boot_config; -+ break; -+ -+ default: -+ fprintf(stderr, "Couldn't find Boot ROM version\n"); -+ break; -+ } - -- rev = index(line_buffer, ':'); -- if (rev != NULL) { -- rev++; -- system_rev = strtoul(rev, NULL, 16); -- system_rev = mxc_cpu(system_rev); -- if (!system_rev) -- system_rev = hw_system_rev; -- -- switch (system_rev) { -- case MX23: -- plat_config_data = &mx23_boot_config; -- break; -- -- case MX28: -- plat_config_data = &mx28_boot_config; -- break; -- -- case MX53: -- if (mxc_cpu_is_rev(system_rev, CHIP_REV_2_0) < 0) -- plat_config_data = &mx53to1_boot_config; -- else -- plat_config_data = &mx53to2_boot_config; -- break; -- -- case MX50: -- plat_config_data = &mx50_boot_config; -- break; -- -- case MX6: -- case MX6Q: -- case MX6DL: -- plat_config_data = &mx6q_boot_config; -- break; -- -- default: -- fprintf(stderr, "Couldn't find Boot ROM version\n"); -- break; -- } -- -- fclose(cpuinfo); -- if (plat_config_data) { -- plat_config_data->m_u32Arm_type = system_rev; -- return 0; -+ break; /* quit for loop */ - } -- return -1; - } - } -+ - fclose(cpuinfo); -+ if (plat_config_data) { -+ plat_config_data->m_u32Arm_type = system_rev; -+ return 0; -+ } - return -1; - } diff --git a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0004-discover-boot-ROM-version-from-FDT-if-available.patch b/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0004-discover-boot-ROM-version-from-FDT-if-available.patch deleted file mode 100644 index ce5954700..000000000 --- a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0004-discover-boot-ROM-version-from-FDT-if-available.patch +++ /dev/null @@ -1,128 +0,0 @@ -From: Hector Palacios -Date: Fri, 18 Oct 2013 10:11:29 +0200 -Subject: discover boot ROM version from FDT if available - -New kernels don't get CPU information from U-Boot ATAGS and -so the /proc/cpuinfo file does not have the Hardware/Revision -lines filled in. -This patch gets the CPU model from the device tree information -at /proc/device-tree/compatible. -For backwards compatibility, if the CPU model cannot be retrieved -from this file, we try to get it from /proc/cpuinfo. - -Signed-off-by: Hector Palacios -Reviewed-by: Robert Hodaszi ---- - src/plat_boot_config.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 94 insertions(+), 1 deletion(-) - -diff --git a/src/plat_boot_config.c b/src/plat_boot_config.c -index e3bf242..af7e03a 100644 ---- a/src/plat_boot_config.c -+++ b/src/plat_boot_config.c -@@ -105,7 +105,91 @@ static platform_config mx6q_boot_config = { - .rom_mtd_commit_structures = v4_rom_mtd_commit_structures, - }; - --int discover_boot_rom_version(void) -+#define MAX_STRLEN 256 -+int get_rom_version_from_fdt(void) -+{ -+ FILE *fd; -+ char line_buffer[MAX_STRLEN]; -+ char *p; -+ static char *compatible = "fsl,imx"; -+ char *rev; -+ int system_rev; -+ -+ fd = fopen("/proc/device-tree/compatible", "r"); -+ if (!fd) -+ return -1; -+ -+ p = &line_buffer[0]; -+ if (fgets(p, MAX_STRLEN, fd)) { -+ /* -+ * The compatible string can contain more than one string. -+ * Each string value is separated from the next one by a -+ * NULL char. We must check all values one by one until -+ * we find two consecutive NULL chars. -+ */ -+ while (p[0] != 0) { -+ if (!strncmp(p, compatible, strlen(compatible))) { -+ rev = p + strlen(compatible); -+ /* -+ * check if it's an imx6 CPU series, or -+ * a parsable number. -+ */ -+ if (!strncmp(rev, "6q", 2)) -+ system_rev = MX6Q; -+ else if (!strncmp(rev, "6d", 2)) -+ system_rev = MX6DL; -+ else if (!strncmp(rev, "6s", 2)) -+ system_rev = MX6; -+ else -+ system_rev = strtoul(rev, NULL, 16); -+ -+ switch (system_rev) { -+ case MX23: -+ plat_config_data = &mx23_boot_config; -+ break; -+ -+ case MX28: -+ plat_config_data = &mx28_boot_config; -+ break; -+ -+ case MX53: -+ /* -+ * TODO: check CPU revision -+ * Consider it is a TO2 for the -+ * moment -+ */ -+ plat_config_data = &mx53to2_boot_config; -+ break; -+ -+ case MX50: -+ plat_config_data = &mx50_boot_config; -+ break; -+ -+ case MX6: -+ case MX6Q: -+ case MX6DL: -+ plat_config_data = &mx6q_boot_config; -+ break; -+ -+ default: -+ break; -+ } -+ -+ if (plat_config_data) { -+ plat_config_data->m_u32Arm_type = system_rev; -+ return 0; -+ } -+ } -+ /* Move string pointer to next possible value */ -+ p += strlen(p) + 1; -+ } -+ } -+ -+ fclose(fd); -+ return -1; -+} -+ -+int get_rom_version_from_cpuinfo(void) - { - FILE *cpuinfo; - char line_buffer[100]; -@@ -203,3 +287,12 @@ int discover_boot_rom_version(void) - } - return -1; - } -+ -+int discover_boot_rom_version(void) -+{ -+ /* First, try to get ROM version from FDT */ -+ if (get_rom_version_from_fdt()) -+ return (get_rom_version_from_cpuinfo()); -+ -+ return 0; -+} diff --git a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0005-dump-v1-boot-structures.patch b/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0005-dump-v1-boot-structures.patch deleted file mode 100644 index 62c786998..000000000 --- a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0005-dump-v1-boot-structures.patch +++ /dev/null @@ -1,195 +0,0 @@ -From: Hector Palacios -Date: Tue, 15 Oct 2013 18:58:11 +0200 -Subject: dump v1 boot structures - -The kobs-ng that we received from Freescale did not support reading the -boot structures on the mx28. It could write them, but the function that -reads them was never updated to handle the updated structures used by -the mx28. This change adds basic support for reading these structures, -enough so that the dump command works. - -(forward ported from kobs-ng-10.12.01 to kobs-ng-3.0.35_4.1.0) - -Signed-off-by: Hector Palacios -Reviewed-by: Robert Hodaszi ---- - src/main.c | 5 ++- - src/mtd.c | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- - src/mtd.h | 1 + - 3 files changed, 131 insertions(+), 4 deletions(-) - -diff --git a/src/main.c b/src/main.c -index 82b6f9e..70517b0 100644 ---- a/src/main.c -+++ b/src/main.c -@@ -152,7 +152,10 @@ int dump_main(int argc, char **argv) - if (flags & F_VERBOSE) - mtd_dump(md); - -- r = mtd_load_all_boot_structures(md); -+ if (ROM_Version_1 == plat_config_data->m_u32RomVer) -+ r = mtd_load_v1_boot_structures(md); -+ else -+ r = mtd_load_all_boot_structures(md); - if (r != 0) { - fprintf(stderr, "Unable to load boot structures\n"); - exit(5); -diff --git a/src/mtd.c b/src/mtd.c -index f9e60a3..9ea92ad 100644 ---- a/src/mtd.c -+++ b/src/mtd.c -@@ -975,6 +975,130 @@ void dump(const void *data, int size) - printf("\n"); - } - -+/* -+ * This function is a hack written by Digi because the original code from -+ * Freescale did not supporting reading the bootlet structures at all. -+ * This function reads the search areas for a given BCB. It will read the first -+ * search area and use it if the read succeeds. If the read fails, then it will -+ * try again with the second search area. -+ * -+ * md A pointer to the current struct mtd_data. -+ * bcb_name A pointer to a human-readable string that indicates what kind of -+ * BCB we're reading. This string will only be used in log messages. -+ * ofs1 If there is one chips, the index of the search area to read -+ * ofs2 -+ * ofs_mchip If there are multiple chips, the index of the search area to read -+ * on both chips. -+ * end The number of consecutive search areas to be read. -+ * size The size of the BCB data to be read. -+ * ecc Indicates whether or not to use hardware ECC. -+ */ -+int mtd_read_bcb(struct mtd_data *md, char *bcb_name, -+ loff_t ofs1, loff_t ofs2, loff_t ofs_mchip, -+ loff_t end, size_t size, int ecc) -+{ -+ int chip; -+ loff_t end_index, search_area_indices[2], o; -+ int r; -+ int i; -+ int j; -+ unsigned stride_size_in_bytes; -+ unsigned search_area_size_in_strides; -+ unsigned search_area_size_in_bytes; -+ -+ /* Compute some important facts about geometry */ -+ if (plat_config_data->m_u32RomVer == ROM_Version_2) { -+ stride_size_in_bytes = mtd_erasesize(md); -+ search_area_size_in_strides = 4; -+ search_area_size_in_bytes = search_area_size_in_strides * stride_size_in_bytes; -+ } else { -+ stride_size_in_bytes = PAGES_PER_STRIDE * mtd_writesize(md); -+ search_area_size_in_strides = 1 << md->cfg.search_exponent; -+ search_area_size_in_bytes = search_area_size_in_strides * stride_size_in_bytes; -+ } -+ -+ /* -+ * Check whether there are multiple chips and set up the two search area -+ * indices accordingly. -+ */ -+ if (multichip(md)) -+ search_area_indices[0] = search_area_indices[1] = ofs_mchip; -+ else { -+ search_area_indices[0] = ofs1; -+ search_area_indices[1] = ofs2; -+ } -+ -+ /* Loop over search areas for this BCB. */ -+ for (i = 0; i < 2; i++) { -+ /* -+ * Compute the search area index that marks the end of the -+ * writing on this chip. -+ */ -+ end_index = search_area_indices[i] + end; -+ -+ /* Figure out which chip we're writing */ -+ chip = multichip(md) ? i : 0; -+ -+ /* Loop over consecutive search areas to write. */ -+ for (; search_area_indices[i] < end_index; search_area_indices[i]++) { -+ /* -+ * Compute the byte offset of the beginning of this -+ * search area -+ */ -+ o = search_area_indices[i] * search_area_size_in_bytes; -+ -+ /* Loop over strides in this search area. */ -+ for (j = 0; j < search_area_size_in_strides; j++, o += stride_size_in_bytes) { -+ /* -+ * If we're crossing into a new block, erase it -+ * first. -+ */ -+ -+ /* Write the page */ -+ vp(md, "mtd: Reading %s%d @%d:0x%llx(%x)\n", -+ bcb_name, j, chip, o, size); -+ -+ r = mtd_read_page(md, chip, o, ecc); -+ if (r != size) { -+ fprintf(stderr, "\n%s r = 0x%8.8X, size = 0x%8.8X\n", __func__, r, size); -+ fprintf(stderr, "mtd: Failed to read %s @%d: 0x%llx (%d)\n", -+ bcb_name, chip, o, r); -+ } else -+ break; -+ } -+ } -+ } -+ -+ return !(r == size); -+} -+ -+/* -+ * This function is a hack by Digi, written because the original code from -+ * Freescale did not support reading the v1 boot structures at all. Do not -+ * use the results from this function for anything other than browsing the -+ * boot structures. -+ */ -+int mtd_load_v1_boot_structures(struct mtd_data *md) -+{ -+ int err = 0; -+ -+ /* read the FCB search area */ -+ err = mtd_read_bcb(md, "FCB", 0, 0, 0, 1, -+ mtd_writesize(md) + mtd_oobsize(md), false); -+ memcpy(&md->fcb, md->buf, sizeof(md->fcb)); -+ -+ /* read the DBBT search area */ -+ err |= mtd_read_bcb(md, "DBBT", 1, 1, 1, 1, mtd_writesize(md), true); -+ memcpy(&md->dbbt28, md->buf, sizeof(md->dbbt28)); -+ -+ if ((err != 0) || -+ (md->dbbt28.m_u32FingerPrint != DBBT_FINGERPRINT2)) { -+ err = -1; -+ } -+ -+ return err; -+} -+ - void *mtd_load_boot_structure(struct mtd_data *md, int chip, loff_t *ofsp, loff_t end, - uint32_t magic1, uint32_t magic2, uint32_t magic3, int use_ecc, - int magic_offset) -@@ -1083,9 +1207,8 @@ int mtd_load_all_boot_structures(struct mtd_data *md) - md->curr_ncb = NULL; - md->ncb_version = ncb_get_version(buf, &md->curr_ncb); - -- if (md->flags & F_VERBOSE) -- printf("mtd: found NCB%d candidate version %d @%d:0x%llx\n", -- i, md->ncb_version, chip, ofs); -+ vp(md, "mtd: found NCB%d candidate version %d @%d:0x%llx\n", -+ i, md->ncb_version, chip, ofs); - - if (md->ncb_version >= 0) - break; -diff --git a/src/mtd.h b/src/mtd.h -index bf6e53d..18e4d70 100644 ---- a/src/mtd.h -+++ b/src/mtd.h -@@ -276,6 +276,7 @@ void *mtd_load_boot_structure(struct mtd_data *md, int chip, loff_t *ofsp, loff_ - uint32_t magic1, uint32_t magic2, uint32_t magic3, int use_ecc, - int magic_offset); - int mtd_load_all_boot_structures(struct mtd_data *md); -+int mtd_load_v1_boot_structures(struct mtd_data *md); - int mtd_dump_structure(struct mtd_data *md); - - int v0_rom_mtd_init(struct mtd_data *md, FILE *fp); diff --git a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0006-added-option-to-verify-data-written-to-flash.patch b/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0006-added-option-to-verify-data-written-to-flash.patch deleted file mode 100644 index 945f30ecf..000000000 --- a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0006-added-option-to-verify-data-written-to-flash.patch +++ /dev/null @@ -1,454 +0,0 @@ -From: Hector Palacios -Date: Wed, 16 Oct 2013 10:30:14 +0200 -Subject: added option to verify data written to flash - -This patch adds a -c (check) option to the update command. -This option will read back the data written to the flash and -compare to the original contents in RAM, to verify the write -operation was successful. - -Signed-off-by: Hector Palacios -Reviewed-by: Robert Hodaszi ---- - src/main.c | 22 ++++++-- - src/mtd.c | 138 +++++++++++++++++++++++++++++++++++++++---------- - src/mtd.h | 10 ++-- - src/plat_boot_config.h | 2 +- - 4 files changed, 136 insertions(+), 36 deletions(-) - -diff --git a/src/main.c b/src/main.c -index 70517b0..8774045 100644 ---- a/src/main.c -+++ b/src/main.c -@@ -82,10 +82,12 @@ void usage(void) - " -x .................................... Add 1k-padding in the head\n" - " -n .................................... Dry run (don't commit to flash)\n" - " -w .................................... Commit to flash\n" -+ " -c .................................... Check committed data in flash\n" - "\n" - " update [-v] [KEY] [KOBS] [-0|1] .. Update a single bootstream\n" - " -v .................................... Verbose mode\n" - " -0|1 .................................. Update specified bootstream #\n" -+ " -c .................................... Check committed data in flash\n" - "\n" - " extract [-v] [KEY] [KOBS] [-0|1] . Extract a bootstream from flash\n" - " -v .................................... Verbose mode\n" -@@ -390,7 +392,8 @@ int extract_main(int argc, char **argv) - return 0; - } - --static int perform_bootstream_update(struct mtd_data *md, FILE *infp, int image_mask) -+static int perform_bootstream_update(struct mtd_data *md, FILE *infp, -+ int image_mask, int check) - { - int i, r; - unsigned int size, start, avail, end, update; -@@ -435,7 +438,8 @@ static int perform_bootstream_update(struct mtd_data *md, FILE *infp, int image_ - update |= UPDATE_BS(i); - } - -- r = plat_config_data->rom_mtd_commit_structures(md, infp, UPDATE_LDLB | update); -+ r = plat_config_data->rom_mtd_commit_structures(md, infp, -+ UPDATE_LDLB | update, check); - if (r < 0) { - fprintf(stderr, "FAILED to commit structures\n"); - return -1; -@@ -457,6 +461,7 @@ int update_main(int argc, char **argv) - char ascii[20 * 2 + 1]; - int device_key; - uint8_t *keyp; -+ int check; - - memset(key, 0, sizeof(key)); - device_key = 0; -@@ -473,6 +478,7 @@ int update_main(int argc, char **argv) - image_mask = 0; /* no image */ - flags = 0; - j = 0; -+ check = 0; - for (i = 1; i < argc; i++) { - - if (argv[i][0] != '-') { -@@ -500,6 +506,9 @@ int update_main(int argc, char **argv) - exit(5); - } - break; -+ case 'c': -+ check = 1; -+ break; - case 'v': - flags |= F_VERBOSE; - break; -@@ -545,7 +554,7 @@ int update_main(int argc, char **argv) - if (flags & F_VERBOSE) - mtd_dump(md); - -- r = perform_bootstream_update(md, infp, image_mask); -+ r = perform_bootstream_update(md, infp, image_mask, check); - if (r != 0) { - fprintf(stderr, "Unable to perform bootstream update\n"); - usage(); -@@ -597,6 +606,7 @@ int init_main(int argc, char **argv) - FILE *infp; - loff_t ofs; - int dryrun; -+ int check; - int padding = 0; - struct mtd_config cfg; - uint8_t key[16]; -@@ -619,6 +629,7 @@ int init_main(int argc, char **argv) - image = 0; /* first image */ - flags = 0; - dryrun = 0; -+ check = 0; - j = 0; - for (i = 1; i < argc; i++) { - -@@ -640,6 +651,9 @@ int init_main(int argc, char **argv) - case 'w': - dryrun = 0; - break; -+ case 'c': -+ check = 1; -+ break; - case 'n': - dryrun = 1; - break; -@@ -738,7 +752,7 @@ int init_main(int argc, char **argv) - mtd_dump_structure(md); - - if (!dryrun) { -- r = plat_config_data->rom_mtd_commit_structures(md, infp, UPDATE_ALL); -+ r = plat_config_data->rom_mtd_commit_structures(md, infp, UPDATE_ALL, check); - if (r < 0) { - fprintf(stderr, "FAILED to commit structures\n"); - exit(5); -diff --git a/src/mtd.c b/src/mtd.c -index 9ea92ad..77ba307 100644 ---- a/src/mtd.c -+++ b/src/mtd.c -@@ -2344,7 +2344,7 @@ int v4_rom_mtd_init(struct mtd_data *md, FILE *fp) - - int mtd_commit_bcb(struct mtd_data *md, char *bcb_name, - loff_t ofs1, loff_t ofs2, loff_t ofs_mchip, -- loff_t end, size_t size, int ecc) -+ loff_t end, size_t size, int ecc, int verify) - { - int chip; - loff_t end_index, search_area_indices[2], o; -@@ -2355,6 +2355,13 @@ int mtd_commit_bcb(struct mtd_data *md, char *bcb_name, - unsigned search_area_size_in_strides; - unsigned search_area_size_in_bytes; - unsigned count; -+ char *readbuf = NULL; -+ -+ if (verify) { -+ readbuf = malloc(mtd_writesize(md)); -+ if (NULL == readbuf) -+ return -1; -+ } - - vp(md, "-------------- Start to write the [ %s ] -----\n", bcb_name); - //---------------------------------------------------------------------- -@@ -2457,6 +2464,20 @@ int mtd_commit_bcb(struct mtd_data *md, char *bcb_name, - err ++; - } - -+ if (verify) { -+ //------------------------------------------------------ -+ // Verify the written data -+ //------------------------------------------------------ -+ r = pread(md->part[chip].fd, readbuf, mtd_writesize(md), o); -+ if (r != mtd_writesize(md)) { -+ fprintf(stderr, "mtd: Failed to read @0x%llx (%d)\n", o, r); -+ goto err_free; -+ } -+ if (memcmp(md->buf, readbuf, mtd_writesize(md))) { -+ fprintf(stderr, "mtd: Verification error @0x%llx\n", o); -+ goto err_free; -+ } -+ } - } - - } -@@ -2466,16 +2487,31 @@ int mtd_commit_bcb(struct mtd_data *md, char *bcb_name, - if (md->flags & F_VERBOSE) - printf("%s(%s): status %d\n\n", __func__, bcb_name, err); - -- return err; -+err_free: -+ if (verify) -+ free(readbuf); -+ if (err) { -+ fprintf(stderr, "mtd: %d errors\n", err); -+ return -1; -+ } -+ else -+ return 0; - } - --int write_boot_stream(struct mtd_data *md, FILE *fp) -+int write_boot_stream(struct mtd_data *md, FILE *fp, int verify) - { - int startpage, start, size; - loff_t ofs, end; -- int i, r, chunk; -+ int i, r = 0, chunk; - int chip = 0; - struct fcb_block *fcb = &md->fcb.FCB_Block; -+ char *readbuf = NULL; -+ -+ if (verify) { -+ readbuf = malloc(mtd_writesize(md)); -+ if (NULL == readbuf) -+ return -1; -+ } - - vp(md, "---------- Start to write the [ %s ]----\n", (char*)md->private); - for (i = 0; i < 2; i++) { -@@ -2530,7 +2566,7 @@ int write_boot_stream(struct mtd_data *md, FILE *fp) - r = fread(md->buf, 1, chunk, fp); - if (r < 0) { - fprintf(stderr, "mtd: Failed %d (fread %d)\n", r, chunk); -- return -1; -+ goto err_free; - } - if (r < chunk) { - memset(md->buf + r, 0, chunk - r); -@@ -2539,10 +2575,30 @@ int write_boot_stream(struct mtd_data *md, FILE *fp) - - /* write page */ - r = mtd_write_page(md, chip, ofs, 1); -- if (r != mtd_writesize(md)) -+ if (r != mtd_writesize(md)) { - fprintf(stderr, "mtd: Failed to write BS @0x%llx (%d)\n", - ofs, r); -+ r = -1; -+ goto err_free; -+ } - -+ if (verify) { -+ //------------------------------------------------------ -+ // Verify the written data -+ //------------------------------------------------------ -+ r = pread(md->part[chip].fd, readbuf, -+ mtd_writesize(md), ofs); -+ if (r != mtd_writesize(md)) { -+ fprintf(stderr, "mtd: Failed to read BS @0x%llx (%d)\n", ofs, r); -+ r = -1; -+ goto err_free; -+ } -+ if (memcmp(md->buf, readbuf, mtd_writesize(md))) { -+ fprintf(stderr, "mtd: Verification error @0x%llx\n", ofs); -+ r = -1; -+ goto err_free; -+ } -+ } - ofs += mtd_writesize(md); - size -= chunk; - } -@@ -2555,19 +2611,26 @@ int write_boot_stream(struct mtd_data *md, FILE *fp) - */ - memset(md->buf, 0, mtd_writesize(md)); - r = mtd_write_page(md, chip, ofs, 1); -- if (r != mtd_writesize(md)) -+ if (r != mtd_writesize(md)) { - fprintf(stderr, "Failed to write safe page\n"); -+ r = -1; -+ goto err_free; -+ } - vp(md, "mtd: We write one page for save guard. *\n"); -- - if (ofs >= end) { - fprintf(stderr, "mtd: Failed to write BS#%d\n", i); -- return -1; -+ r = -1; -+ goto err_free; - } - } -- return 0; -+ -+err_free: -+ if (verify) -+ free(readbuf); -+ return r; - } - --int v0_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags) -+int v0_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify) - { - int startpage, start, size; - unsigned int search_area_sz, stride; -@@ -2666,7 +2729,9 @@ int v0_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags) - if (r < 0) - return r; - -- mtd_commit_bcb(md, "NCB", 0, 1, 0, 1, size, false); -+ r = mtd_commit_bcb(md, "NCB", 0, 1, 0, 1, size, false, verify); -+ if (r < 0) -+ return r; - } - - if (flags & UPDATE_LDLB) { -@@ -2675,7 +2740,10 @@ int v0_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags) - memset(md->buf, 0, mtd_writesize(md)); - memcpy(md->buf, md->curr_ldlb, sizeof(*md->curr_ldlb)); - -- mtd_commit_bcb(md, "LDLB", 2, 3, 1, 1, mtd_writesize(md), true); -+ r = mtd_commit_bcb(md, "LDLB", 2, 3, 1, 1, mtd_writesize(md), true, -+ verify); -+ if (r < 0) -+ return r; - } - - if (flags & UPDATE_DBBT) { -@@ -2684,7 +2752,11 @@ int v0_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags) - memset(md->buf, 0, mtd_writesize(md)); - memcpy(md->buf, md->curr_dbbt, sizeof(*md->curr_dbbt)); - -- mtd_commit_bcb(md, "DBBT", 4, 5, 2, 1, mtd_writesize(md), true); -+ r = mtd_commit_bcb(md, "DBBT", 4, 5, 2, 1, mtd_writesize(md), true, -+ verify); -+ if (r < 0) -+ return r; -+ - for (i = 0; i < 2; i++) { - for (j = 0; j < 2; j++) { - if (md->flags & F_MULTICHIP) { -@@ -2766,7 +2838,7 @@ static void write_dbbt(struct mtd_data *md, int dbbt_num) - } - } - --int v1_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags) -+int v1_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify) - { - int size ,r; - -@@ -2779,8 +2851,11 @@ int v1_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags) - size = mtd_writesize(md) + mtd_oobsize(md); - r = fcb_encrypt(&md->fcb, md->buf, size, 1); - if (r < 0) -- return r; -- mtd_commit_bcb(md, "FCB", 0, 0, 0, 1, size, false); -+ return -1; -+ -+ r = mtd_commit_bcb(md, "FCB", 0, 0, 0, 1, size, false, verify); -+ if (r < 0) -+ return -1; - - //---------------------------------------------------------------------- - // Write the DBBT search area. -@@ -2788,14 +2863,17 @@ int v1_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags) - memset(md->buf, 0, mtd_writesize(md)); - memcpy(md->buf, &(md->dbbt28), sizeof(md->dbbt28)); - dbbt_checksum(md, &md->dbbt28); -- mtd_commit_bcb(md, "DBBT", 1, 1, 1, 1, mtd_writesize(md), true); -+ r = mtd_commit_bcb(md, "DBBT", 1, 1, 1, 1, mtd_writesize(md), true, -+ verify); -+ if (r < 0) -+ return -1; - write_dbbt(md, 1); /* only write the DBBT for nand0 */ - - /* write the boot image. */ -- return write_boot_stream(md, fp); -+ return write_boot_stream(md, fp, verify); - } - --int v2_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags) -+int v2_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify) - { - int startpage, start, size; - unsigned int search_area_size_in_bytes, stride_size_in_bytes; -@@ -2832,7 +2910,9 @@ int v2_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags) - memset(md->buf, 0, mtd_writesize(md)); - memcpy(md->buf, &(md->fcb), sizeof(md->fcb)); - -- mtd_commit_bcb(md, "FCB", 0, 0, 0, 1, mtd_writesize(md), true); -+ r = mtd_commit_bcb(md, "FCB", 0, 0, 0, 1, mtd_writesize(md), true, verify); -+ if (r < 0) -+ return -1; - - //---------------------------------------------------------------------- - // Write the DBBT search area. -@@ -2841,7 +2921,9 @@ int v2_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags) - memset(md->buf, 0, mtd_writesize(md)); - memcpy(md->buf, &(md->dbbt28), sizeof(md->dbbt28)); - -- mtd_commit_bcb(md, "DBBT", 1, 1, 1, 1, mtd_writesize(md), true); -+ r = mtd_commit_bcb(md, "DBBT", 1, 1, 1, 1, mtd_writesize(md), true, verify); -+ if (r < 0) -+ return -1; - - //---------------------------------------------------------------------- - // Write the DBBT table area. -@@ -2985,7 +3067,7 @@ int v2_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags) - return 0; - } - --int v4_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags) -+int v4_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify) - { - int size, i, r, chip = 0; - loff_t ofs; -@@ -2997,12 +3079,16 @@ int v4_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags) - r = fcb_encrypt(&md->fcb, md->buf, size, 1); - if (r < 0) - return r; -- mtd_commit_bcb(md, "FCB", 0, 0, 0, 1, size, false); -+ r = mtd_commit_bcb(md, "FCB", 0, 0, 0, 1, size, false, verify); -+ if (r < 0) -+ return r; - - /* [2] Write the DBBT search area. */ - memset(md->buf, 0, mtd_writesize(md)); - memcpy(md->buf, &(md->dbbt50), sizeof(md->dbbt50)); -- mtd_commit_bcb(md, "DBBT", 1, 1, 1, 1, mtd_writesize(md), true); -+ r = mtd_commit_bcb(md, "DBBT", 1, 1, 1, 1, mtd_writesize(md), true, verify); -+ if (r < 0) -+ return -1; - - /* Write the DBBT table area. */ - memset(md->buf, 0, mtd_writesize(md)); -@@ -3023,7 +3109,7 @@ int v4_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags) - } - - /* [3] Write the two boot streams. */ -- return write_boot_stream(md, fp); -+ return write_boot_stream(md, fp, verify); - } - - #undef ARG -diff --git a/src/mtd.h b/src/mtd.h -index 18e4d70..699e505 100644 ---- a/src/mtd.h -+++ b/src/mtd.h -@@ -295,11 +295,11 @@ int mtd_markbad(struct mtd_data *md, int chip, loff_t ofs); - #define UPDATE_BS(x) (0x08 << ((x) & 1)) - #define UPDATE_ALL (UPDATE_NCB | UPDATE_LDLB | UPDATE_DBBT | UPDATE_BS0 | UPDATE_BS1) - --int v0_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags); --int v1_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags); --int v2_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags); --int v3_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags); --int v4_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags); -+int v0_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify); -+int v1_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify); -+int v2_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify); -+int v3_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify); -+int v4_rom_mtd_commit_structures(struct mtd_data *md, FILE *fp, int flags, int verify); - - int mtd_set_ecc_mode(struct mtd_data *md, int ecc); - -diff --git a/src/plat_boot_config.h b/src/plat_boot_config.h -index 8242ede..a3c03a7 100644 ---- a/src/plat_boot_config.h -+++ b/src/plat_boot_config.h -@@ -55,7 +55,7 @@ typedef struct _platform_config_t { - uint32_t m_u32Arm_type; - uint32_t m_u32DBBT_FingerPrint; - int (* rom_mtd_init)(struct mtd_data *md, FILE *fp); -- int (* rom_mtd_commit_structures)(struct mtd_data *md, FILE *fp, int flags); -+ int (* rom_mtd_commit_structures)(struct mtd_data *md, FILE *fp, int flags, int verify); - } platform_config; - - extern platform_config *plat_config_data; diff --git a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0007-disable-use-of-nfc_geometry.patch b/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0007-disable-use-of-nfc_geometry.patch deleted file mode 100644 index 5d2e8bb9d..000000000 --- a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0007-disable-use-of-nfc_geometry.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Javier Viguera -Date: Thu, 14 Nov 2013 16:46:01 +0100 -Subject: [PATCH] disable use of nfc_geometry - -Not supported in kernel v3.10 - -Signed-off-by: Javier Viguera ---- - src/plat_boot_config.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/plat_boot_config.c b/src/plat_boot_config.c -index af7e03a47f1b..463045f0bc75 100644 ---- a/src/plat_boot_config.c -+++ b/src/plat_boot_config.c -@@ -46,7 +46,7 @@ static platform_config mx28_boot_config = { - .m_u32EnDISBBM = 0, - .m_u32EnSoftEcc = 1, - .m_u32EnBootStreamVerify = 1, -- .m_u32UseNfcGeo = 1, -+ .m_u32UseNfcGeo = 0, - .m_u32UseMultiBootArea = 0, - .m_u32UseSinglePageStride = 1, - .m_u32DBBT_FingerPrint = DBBT_FINGERPRINT2, diff --git a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0008-mtd-configure-16-bit-ECC-for-4K-page-NAND-with-224-b.patch b/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0008-mtd-configure-16-bit-ECC-for-4K-page-NAND-with-224-b.patch deleted file mode 100644 index 23dcad30b..000000000 --- a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng-3.0.35-4.1.0/0008-mtd-configure-16-bit-ECC-for-4K-page-NAND-with-224-b.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 62d43285dd08709c86b91ba0ae23c974e96c2905 Mon Sep 17 00:00:00 2001 -From: Hector Palacios -Date: Thu, 15 Oct 2015 12:31:24 +0200 -Subject: [PATCH] mtd: configure 16-bit ECC for 4K page NAND with 224-byte OOB - -Signed-off-by: Hector Palacios ---- - src/mtd.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/mtd.c b/src/mtd.c -index 77ba3070de7a..4d04f4c2921d 100644 ---- a/src/mtd.c -+++ b/src/mtd.c -@@ -2124,7 +2124,7 @@ int v1_rom_mtd_init(struct mtd_data *md, FILE *fp) - if (mtd_writesize(md) == 2048) { - geo->ecc_strength = ROM_BCH_Ecc_8bit << 1; - } else if (mtd_writesize(md) == 4096) { -- if (mtd_oobsize(md) == 218) -+ if (mtd_oobsize(md) == 218 || mtd_oobsize(md) == 224) - geo->ecc_strength = ROM_BCH_Ecc_16bit << 1; - else if ((mtd_oobsize(md) == 128)) - geo->ecc_strength = ROM_BCH_Ecc_8bit << 1; diff --git a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng_3.0.35-4.1.0.bb b/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng_3.0.35-4.1.0.bb deleted file mode 100644 index 889e36673..000000000 --- a/meta-digi-arm/recipes-bsp/kobs-ng/kobs-ng_3.0.35-4.1.0.bb +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2013 Digi International. All rights reserved. - -SUMMARY = "Freescale's mxs nand update utility" -SECTION = "base" -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833" - -inherit autotools - -SRC_URI = " \ - ${DIGI_PKG_SRC}/${PN}-${PV}.tar.gz \ - file://0001-makefile.am.patch \ - file://0002-fix-mtd-defines.patch \ - file://0003-cleanup-ROM-version-detection-code-and-add-cpx2-supp.patch \ - file://0004-discover-boot-ROM-version-from-FDT-if-available.patch \ - file://0005-dump-v1-boot-structures.patch \ - file://0006-added-option-to-verify-data-written-to-flash.patch \ - file://0007-disable-use-of-nfc_geometry.patch \ - file://0008-mtd-configure-16-bit-ECC-for-4K-page-NAND-with-224-b.patch \ -" - -SRC_URI[md5sum] = "2a0e55b5063605b2664fd67c95a6c686" -SRC_URI[sha256sum] = "92d2f23add8c5d3102c77f241cae26ca55871ccc613a7af833bebbbac7afb8ea" - -COMPATIBLE_MACHINE = "mxs" diff --git a/meta-digi-arm/recipes-bsp/libdigi/libdigi.bb b/meta-digi-arm/recipes-bsp/libdigi/libdigi.bb deleted file mode 100644 index 6f9c00945..000000000 --- a/meta-digi-arm/recipes-bsp/libdigi/libdigi.bb +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2013,2017 Digi International. - -SUMMARY = "Digi's utilities library" -SECTION = "libs" -LICENSE = "GPL-2.0" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" - -SRC_URI = " \ - file://cmdopt.c \ - file://cmdopt.h \ - file://crc32.c \ - file://crc32.h \ - file://digi-platforms.h \ - file://log.c \ - file://log.h \ - file://mem.c \ - file://mem.h \ - file://misc_helper.h \ - file://platform.c \ -" - -S = "${WORKDIR}" - -do_compile() { - ${CC} -O2 -Wall ${LDFLAGS} -c -o log.o log.c - ${CC} -O2 -Wall ${LDFLAGS} -c -o cmdopt.o cmdopt.c - ${CC} -O2 -Wall ${LDFLAGS} -c -o mem.o mem.c - ${CC} -O2 -Wall ${LDFLAGS} -c -o crc32.o crc32.c - ${CC} -O2 -Wall ${LDFLAGS} -c -o platform.o platform.c - ${AR} -rcs libdigi.a log.o cmdopt.o mem.o crc32.o platform.o -} - -do_install() { - mkdir -p ${D}${includedir}/libdigi ${D}${libdir} - install -m 0644 libdigi.a ${D}${libdir} - install -m 0644 cmdopt.h crc32.h digi-platforms.h log.h mem.h misc_helper.h ${D}${includedir}/libdigi -} - -RDEPENDS_${PN}-dev = "" diff --git a/meta-digi-arm/recipes-bsp/libdigi/libdigi/cmdopt.c b/meta-digi-arm/recipes-bsp/libdigi/libdigi/cmdopt.c deleted file mode 100644 index 5deadbe5b..000000000 --- a/meta-digi-arm/recipes-bsp/libdigi/libdigi/cmdopt.c +++ /dev/null @@ -1,366 +0,0 @@ -/*********************************************************************** - * - * Copyright 2001,2002 by FS-Forth Systeme GmbH. - * All rights reserved. - * - * $Id: cmdopt.c,v 1.4 2007-01-23 15:13:27 mpietrek Exp $ - * @Author: Markus Pietrek - * @Descr: Provides some helper functions to access the command line - * options. The results are stored in global variables. - * This file is not thread safe. - * - ********************************************************************** */ -/*********************************************************************** * - * @History: - * 2002/10/21 : Purified for splint. Changed to new variable - * naming convention. - * - *********************************************************************** */ - -#include -#include // toupper -#include // getopt -#include -#include // atoi -#include // strlen - -#include "cmdopt.h" -#include "log.h" -#include "misc_helper.h" - -#define BUFFER_SIZE 1024 -#define MAX_ENTRIES 32 - -/*@observer@*/ -void (*fnCmdOptExtendedUsage) (char bCmdLine) = NULL; -const char* szCmdOptVersion = "$Revision: 1.4 $"; // if not - // overwritten take - // at least the - // revision of cmdopt - -static CmdOptEntry cmdOptEntries[ MAX_ENTRIES ]; // to avoid malloc we - // use a static buffer -/*@noreturn@*/ -static void usageAndExit( int argc, - char* argv[], - const CmdOptEntry entries[], - const char* szDescr, - char cWrongNumber ); -static void updateVar( const CmdOptEntry entries[], - int nOptIndex, - const char* szStr ); - - -/*********************************************************************** - * @Function: cmdOptParse - * @Return: only if command line could be parsed otherwise ends - * the application. Result is only set if COT_MORE is specified - * and points to the first unprocessed entry - * @Descr: reads the command line and sets the variables. Displays a usage - * if values are wrong. - ***********************************************************************/ - -int cmdOptParse( int argc, - char* argv[], - const CmdOptEntry entries[], - const char* szDescr ) -{ - char szOptLine[ BUFFER_SIZE ]; - struct option axLongOptions[ MAX_ENTRIES ]; - int nOptIndex = 0; - int nSize = 0; - int nSizeLong = 0; - signed char cOptChar; - int nOptIndexStatic = 0; - int nOptLongIndex = 0; - char cPrintVersion = 0; - char cPrintHelp = 0; - - CmdOptEntry coePrintVersion = - {COT_BOOL, -1, &cPrintVersion, "version", "print version and exit" }; - CmdOptEntry coePrintHelp = - {COT_BOOL, 'h', &cPrintHelp, "help", "print help" }; - CmdOptEntry coeLogLevel = - {COT_INT, 'l', &logLevel, "log-level", "log level for messages" }; - - CLEAR( axLongOptions ); - - // add global default command line arguments - cmdOptEntries[ nOptIndexStatic++ ] = coePrintVersion; - cmdOptEntries[ nOptIndexStatic++ ] = coePrintHelp; - cmdOptEntries[ nOptIndexStatic++ ] = coeLogLevel; - - // copy default command line entries - // will break when all entries are copied to global area - // or too much arguments - while( 1 ) - { - if( nOptIndexStatic == MAX_ENTRIES ) - { - logMsg( LOG_ERR, "cmdOptParse: too many command line options" ); - exit( EXIT_FAILURE ); - } - - cmdOptEntries[ nOptIndexStatic ] = entries[ nOptIndex ]; - if( entries[ nOptIndex ].type == COT_NONE ) - // no more entries - break; - - nOptIndexStatic++; - nOptIndex++; - } - - // create parameter list for getopt - - nOptIndex = 0; - szOptLine[ nOptIndex ] = 0; - - while( cmdOptEntries[ nSize ].type != COT_NONE ) - { - if( ( cmdOptEntries[ nSize ].type != COT_MORE ) && - ( cmdOptEntries[ nSize ].type != COT_MORE_OPT ) ) { - axLongOptions[ nSizeLong ].name = cmdOptEntries[ nSize ].szLabelStr; - axLongOptions[ nSizeLong ].has_arg = - ((cmdOptEntries[ nSize ].type != COT_BOOL ) ? required_argument : no_argument); - axLongOptions[ nSizeLong ].flag = NULL; - axLongOptions[ nSizeLong ].val = -2 - nSize; - nSizeLong++; - } - - if( NULL != cmdOptEntries[ nSize ].pbPresent ) - *cmdOptEntries[ nSize ].pbPresent = 0; - if( !cmdOptEntries[ nSize ].cOptChar ) - { - // parameter is not mandatory - nSize++; - continue; - } - - if( nOptIndex >= BUFFER_SIZE - 2 ) - { - logMsg( LOG_ERR, - "cmdOptParse: too long command line" ); - exit( EXIT_FAILURE ); - } - - if( -1 != cmdOptEntries[ nSize ].cOptChar ) { - szOptLine[ nOptIndex++ ] = cmdOptEntries[ nSize ].cOptChar; - if( cmdOptEntries[ nSize ].type != COT_BOOL ) - szOptLine[ nOptIndex++ ] = ':'; - } - - szOptLine[ nOptIndex ] = 0; - - nSize++; - } - - // parse optional command line options - - while( ( cOptChar = getopt_long( argc, argv, szOptLine, axLongOptions, &nOptLongIndex ) ) != -1 ) - { - char cFound = 0; - - if( cOptChar < 0 ) { - cFound = 1; - updateVar( cmdOptEntries, -2 - cOptChar, optarg ); - } else { - for( nOptIndex = 0; nOptIndex < nSize; nOptIndex++ ) - { - if( cmdOptEntries[ nOptIndex ].cOptChar == cOptChar ) - { - // optional arguments only - cFound = 1; - updateVar( cmdOptEntries, nOptIndex, optarg ); - } - } - } - - if( !cFound ) - usageAndExit( argc, argv, cmdOptEntries, szDescr, 0 ); - } - - if( cPrintVersion ) - { - fprintf( stdout, "%s %s\n", - argv[ 0 ], - szCmdOptVersion ); - exit( EXIT_SUCCESS ); - } - - if( cPrintHelp ) - usageAndExit( argc, argv, cmdOptEntries, szDescr, 0 ); - - // parse mandatory command line options - - nOptIndex = 0; - for( nOptIndex = 0; nOptIndex < nSize; nOptIndex++ ) - if( !cmdOptEntries[ nOptIndex ].cOptChar ) - { - if( cmdOptEntries[ nOptIndex ].type == COT_MORE_OPT ) - // don't parse the following arguments as they - // can't be covered by this lib yet - return optind; - - if( !( argc - optind ) ) - usageAndExit( argc, argv, cmdOptEntries, szDescr, 1 ); - - if( cmdOptEntries[ nOptIndex ].type == COT_MORE ) - // don't parse the following arguments as they - // can't be covered by this lib yet - return optind; - - updateVar( cmdOptEntries, nOptIndex, argv[ optind++ ] ); - } - - if( argc - optind ) - // COT_MORE is aborted before - usageAndExit( argc, argv, cmdOptEntries, szDescr, 1 ); - - return 0; -} - -void cmdOptUsageAndExit( - int argc, - char* argv[], - const CmdOptEntry entries[], - const char* szDescr ) -{ - usageAndExit( argc, argv, entries, szDescr, 0 ); -} - - -/*********************************************************************** - * @Function: usageAndExit - * @Return: never - * @Descr: displays usage and exits with EXIT_FAILURE. If wrongNumber is 1, - * a message "too many arguments is displayed". - ***********************************************************************/ - -static void usageAndExit( /*@unused@*/ int argc, - char* argv[], - const CmdOptEntry entries[], - const char* szDescr, - char cWrongNumber ) -{ - int nOptIndex = 0; - size_t maxStrLen = 0; - - fprintf( stdout, "Usage: %s ", argv[ 0 ] ); - - // print command line arguments - while( entries[ nOptIndex ].type != COT_NONE ) - { - if( entries[ nOptIndex ].szLabelStr != NULL ) - { - // determine max len of labelStr for formatted output - size_t strLen = strlen( entries[ nOptIndex ].szLabelStr ); - - if( strLen > maxStrLen ) - maxStrLen = strLen; - } - - switch( entries[ nOptIndex ].type ) - { - case COT_BOOL: - case COT_INT: - case COT_STRING: - fprintf( stdout, "[--%s] ", entries[ nOptIndex ].szLabelStr ); - break; - case COT_MORE: - case COT_MORE_OPT: - fprintf( stdout, - "%s ", - entries[ nOptIndex ].szLabelStr ); - break; - case COT_NONE: - // will never happen but satisfies compiler - break; - } - nOptIndex++; - } - if( NULL != fnCmdOptExtendedUsage ) - fnCmdOptExtendedUsage( 1 ); - - fprintf( stdout, "\n" ); - - // explain command line options - nOptIndex = 0; - while( entries[ nOptIndex ].type != COT_NONE ) - { - fprintf( stdout, " " ); - fprintf( stdout, " %-*s", - (int) maxStrLen, - entries[ nOptIndex ].szLabelStr ); - - if( entries[ nOptIndex ].cOptChar > 0) - fprintf( stdout, " [-%c]", entries[ nOptIndex ].cOptChar ); - else - fprintf( stdout, " " ); - /*@+matchanyintegral*/ // maxStrLen is size_t. We shall - // unrestrict for this case the - // behaviour of splint because the - // compiler should do some - // checking, too - /*@-matchanyintegral*/ - - if( entries[ nOptIndex ].szHelpStr != NULL ) - fprintf( stdout, " : %s", entries[ nOptIndex ].szHelpStr ); - - fprintf( stdout, "\n" ); - nOptIndex++; - } - - if( NULL != fnCmdOptExtendedUsage ) - fnCmdOptExtendedUsage( 0 ); - - fprintf( stdout, "\n%s\n", szDescr ); - - // explain failure - if( cWrongNumber ) - fprintf( stderr, "\n*** Wrong # arguments ***\n" ); - - exit( EXIT_FAILURE ); -} - - -/*********************************************************************** - * @Function: updateVar - * @Return: nothing - * @Descr: sets the variable in entries[ index ] to the value in str - * and does conversion if necessary - ***********************************************************************/ - -static void updateVar( const CmdOptEntry entries[], - int nOptIndex, - const char* szStr ) -{ - switch( entries[ nOptIndex ].type ) - { - case COT_BOOL: - *((char*) entries[ nOptIndex ].vValuePtr) = 1; - break; - case COT_INT: - if( (int) strlen( szStr ) > 2 && - ((szStr[ 0 ] == '0' && (toupper( szStr[ 1 ] ) == 'X' )))) - { - sscanf( &szStr[ 2 ], - "%x", - ((int*) entries[ nOptIndex ].vValuePtr ) ); - break; - } - *((int*) entries[ nOptIndex ].vValuePtr) = atoi( szStr ); - break; - case COT_STRING: - *((const char**) entries[ nOptIndex ].vValuePtr) = szStr; - break; - case COT_MORE: - case COT_MORE_OPT: - case COT_NONE: - // will never happen but satisfies compiler - break; - } - - if( NULL != entries[ nOptIndex ].pbPresent ) - *entries[ nOptIndex ].pbPresent = 1; -} - diff --git a/meta-digi-arm/recipes-bsp/libdigi/libdigi/cmdopt.h b/meta-digi-arm/recipes-bsp/libdigi/libdigi/cmdopt.h deleted file mode 100644 index 7f9ca2ab5..000000000 --- a/meta-digi-arm/recipes-bsp/libdigi/libdigi/cmdopt.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * libdigi/cmdopt.h - * - * Copyright (C) 2001,2002 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * Description: Helper functions to access command line options. - * The results are stored in global variables. - * - */ - -#ifndef DG_CMDOPT_H -#define DG_CMDOPT_H - -typedef enum { - COT_BOOL, // if present,bool is set 1, otherwise unchanged - COT_INT, // sets *valuePtr to the int value - // with conversions (if 0x - // prefix is present) - COT_STRING, // sets *valuePtr to the string - COT_MORE, // to end the array. Any additional arguments - // are allowed - COT_MORE_OPT, // to end the array. Any optional arguments - // are allowed - COT_NONE // to end the array. Any additional arguments - // are considered as failures -} CmdOptTypes; - -typedef struct { - CmdOptTypes type; // type of option to be read - signed char cOptChar; // character to identify that option, if 0, then - // no option is used but parameter is required - void *vValuePtr; // ptr to the variable where value is stored - const char *szLabelStr; // label displayed in command line - const char *szHelpStr; // displays this help string for the variable - char *pbPresent; // will be set to if this option is present -} CmdOptEntry; - -/* can be set to display additional usage */ -extern void (*fnCmdOptExtendedUsage) (char bCmdLine); - -extern const char *szCmdOptVersion; // overwrite it before calling cmdOptParse to - // define version of application - -int cmdOptParse(int argc, char *argv[], const CmdOptEntry entries[], const char *szDescr); - -void cmdOptUsageAndExit(int argc, - char *argv[], const CmdOptEntry entries[], const char *szDescr); - -#endif /* DG_CMDOPT_H */ diff --git a/meta-digi-arm/recipes-bsp/libdigi/libdigi/crc32.c b/meta-digi-arm/recipes-bsp/libdigi/libdigi/crc32.c deleted file mode 100644 index 52d7aa710..000000000 --- a/meta-digi-arm/recipes-bsp/libdigi/libdigi/crc32.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * crc32.c - * - * Copyright (C) 2006 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * Description: Flash Test Util - * - */ - -#include "crc32.h" - -static const crc32_t crc32_table[256] = { - 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, - 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, - 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, - 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, - 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, - 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, - 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, - 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, - 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, - 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, - 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, - 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, - 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, - 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, - 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, - 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, - 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, - 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, - 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, - 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, - 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, - 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, - 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, - 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, - 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, - 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, - 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, - 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, - 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, - 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, - 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, - 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, - 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, - 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, - 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, - 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, - 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, - 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, - 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, - 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, - 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, - 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, - 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, - 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, - 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, - 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, - 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, - 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, - 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, - 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, - 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, - 0x2d02ef8dL -}; - -crc32_t crc32(crc32_t uiCRC, const void *pvBuf, size_t iLen) -{ - const unsigned char *pcBuf = (const unsigned char *)pvBuf; - - /* uiCRC starts with 0 on first block. If run on a block, undoes the - previous uiCRC ^ 0xffffffff. */ - uiCRC ^= 0xffffffff; - - while (iLen-- > 0) - uiCRC = crc32_table[(uiCRC ^ *pcBuf++) & 0xff] ^ (uiCRC >> 8); - - /* if last block, this is the result. Otherwise this will be undone - on next crc32 call */ - return uiCRC ^ 0xffffffff; -} diff --git a/meta-digi-arm/recipes-bsp/libdigi/libdigi/crc32.h b/meta-digi-arm/recipes-bsp/libdigi/libdigi/crc32.h deleted file mode 100644 index 6cf7e1197..000000000 --- a/meta-digi-arm/recipes-bsp/libdigi/libdigi/crc32.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * libdigi/crc32.h - * - * Copyright (C) 2006 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * Description: CRC32 functions - * - */ - -#ifndef DG_CRC32_H -#define DG_CRC32_H - -#include /* uint32_t */ -#include /* size_t */ - -typedef uint32_t crc32_t; -extern crc32_t crc32(crc32_t uiCRC, const void *pvBuf, size_t iLen); - -#endif /* DG_CRC32_H */ diff --git a/meta-digi-arm/recipes-bsp/libdigi/libdigi/digi-platforms.h b/meta-digi-arm/recipes-bsp/libdigi/libdigi/digi-platforms.h deleted file mode 100644 index 6b4639e72..000000000 --- a/meta-digi-arm/recipes-bsp/libdigi/libdigi/digi-platforms.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * libdigi/digi-platforms.h - * - * Copyright (C) 2011 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * Description: Digi platforms - * - */ - -#ifndef DIGI_PLATFORMS_H -#define DIGI_PLATFORMS_H - -#define PLATFORM_NAME(x) x ## _NAME - -#define MACH_TYPE_CC7U 1017 -#define MACH_TYPE_CC7U_NAME "cc7u" -#define MACH_TYPE_CWIEM 1033 -#define MACH_TYPE_CWIEM_NAME "cwiem" -#define MACH_TYPE_CCW9C 1110 -#define MACH_TYPE_CCW9C_NAME "ccw9c" -#define MACH_TYPE_CC9P9360DEV 1114 -#define MACH_TYPE_CC9P9360DEV_NAME "cc9p9360dev" -#define MACH_TYPE_CC9P9750DEV 1115 -#define MACH_TYPE_CC9P9750DEV_NAME "cc9p9750dev" -#define MACH_TYPE_CC9P9360VAL 1116 -#define MACH_TYPE_CC9P9360VAL_NAME "cc9p9360val" -#define MACH_TYPE_CC9P9750VAL 1117 -#define MACH_TYPE_CC9P9750VAL_NAME "cc9p9750val" -#define MACH_TYPE_CC9P9360JS 1264 -#define MACH_TYPE_CC9P9360JS_NAME "cc9p9360js" -#define MACH_TYPE_CC9P9215 1445 -#define MACH_TYPE_CC9P9215_NAME "cc9p9215" -#define MACH_TYPE_CC9P9210 1446 -#define MACH_TYPE_CC9P9210_NAME "cc9p9210" -#define MACH_TYPE_CC9P9215JS 1447 -#define MACH_TYPE_CC9P9215JS_NAME "cc9p9215js" -#define MACH_TYPE_CC9P9210JS 1448 -#define MACH_TYPE_CC9P9210JS_NAME "cc9p9210js" -#define MACH_TYPE_CC7UCAMRY 1493 -#define MACH_TYPE_CC7UCAMRY_NAME "cc7ucamry" -#define MACH_TYPE_CC9M2443JS 1663 -#define MACH_TYPE_CC9M2443JS_NAME "cc9m2443js" -#define MACH_TYPE_CME9210 1712 -#define MACH_TYPE_CME9210_NAME "cme9210" -#define MACH_TYPE_CCW9P9215JS 1811 -#define MACH_TYPE_CCW9P9215JS_NAME "ccw9p9215js" -#define MACH_TYPE_CC9M2443 1815 -#define MACH_TYPE_CC9M2443_NAME "cc9m2443" -#define MACH_TYPE_CME9210JS 1854 -#define MACH_TYPE_CME9210JS_NAME "cme9210js" -#define MACH_TYPE_CC9P9360 1855 -#define MACH_TYPE_CC9P9360_NAME "cc9p9360" -#define MACH_TYPE_CCW9P9215 2137 -#define MACH_TYPE_CCW9P9215_NAME "ccw9p9215" -#define MACH_TYPE_CCW9M2443 2145 -#define MACH_TYPE_CCW9M2443_NAME "ccw9m2443" -#define MACH_TYPE_CCW9M2443JS 2146 -#define MACH_TYPE_CCW9M2443JS_NAME "ccw9m2443js" -#define MACH_TYPE_CC9P9215_3G 2397 -#define MACH_TYPE_CC9P9215_3G_NAME "cc9p9215_3g" -#define MACH_TYPE_CC9P9215_3GJS 2398 -#define MACH_TYPE_CC9P9215_3GJS_NAME "cc9p9215_3gjs" -#define MACH_TYPE_CCMX51 2516 -#define MACH_TYPE_CCMX51_NAME "ccmx51" -#define MACH_TYPE_CCMX51JS 2517 -#define MACH_TYPE_CCMX51JS_NAME "ccmx51js" -#define MACH_TYPE_CCWMX51 2518 -#define MACH_TYPE_CCWMX51_NAME "ccwmx51" -#define MACH_TYPE_CCWMX51JS 2519 -#define MACH_TYPE_CCWMX51JS_NAME "ccwmx51js" -#define MACH_TYPE_CWME9210 3320 -#define MACH_TYPE_CWME9210_NAME "cwme9210" -#define MACH_TYPE_CWME9210JS 3321 -#define MACH_TYPE_CWME9210JS_NAME "cwme9210js" -#define MACH_TYPE_CCMX53 3346 -#define MACH_TYPE_CCMX53_NAME "ccmx53" -#define MACH_TYPE_CCMX53JS 3347 -#define MACH_TYPE_CCMX53JS_NAME "ccmx53js" -#define MACH_TYPE_CCWMX53 3348 -#define MACH_TYPE_CCWMX53_NAME "ccwmx53" -#define MACH_TYPE_CCWMX53JS 3349 -#define MACH_TYPE_CCWMX53JS_NAME "ccwmx53js" -#define MACH_TYPE_CPX2 3419 -#define MACH_TYPE_CPX2_NAME "cpx2" -#define MACH_TYPE_WR21 3737 -#define MACH_TYPE_WR21_NAME "wr21" -#define MACH_TYPE_CCARDWMX28 3893 -#define MACH_TYPE_CCARDWMX28_NAME "ccardwmx28" -#define MACH_TYPE_CCARDMX28 3894 -#define MACH_TYPE_CCARDMX28_NAME "ccardmx28" -#define MACH_TYPE_CCARDWMX28JS 3917 -#define MACH_TYPE_CCARDWMX28JS_NAME "ccardwmx28js" -#define MACH_TYPE_CCARDMX28JS 3918 -#define MACH_TYPE_CCARDMX28JS_NAME "ccardmx28js" -#define MACH_TYPE_CCIMX53 9980 -#define MACH_TYPE_CCIMX53_NAME "ccimx53" -#define MACH_TYPE_CCIMX53JS 9981 -#define MACH_TYPE_CCIMX53JS_NAME "ccimx53js" -#define MACH_TYPE_CCIMX51 9982 -#define MACH_TYPE_CCIMX51_NAME "ccimx51" -#define MACH_TYPE_CCIMX51JS 9983 -#define MACH_TYPE_CCIMX51JS_NAME "ccimx51js" -#define MACH_TYPE_CCARDIMX28 9984 -#define MACH_TYPE_CCARDIMX28_NAME "ccardimx28" -#define MACH_TYPE_CCARDIMX28JS 9985 -#define MACH_TYPE_CCARDIMX28JS_NAME "ccardimx28js" - -int get_platform_id(void); -char is_nand_oob_atomic(void); - -#endif /* DIGI_PLATFORMS_H */ diff --git a/meta-digi-arm/recipes-bsp/libdigi/libdigi/log.c b/meta-digi-arm/recipes-bsp/libdigi/libdigi/log.c deleted file mode 100644 index 5aeebafc2..000000000 --- a/meta-digi-arm/recipes-bsp/libdigi/libdigi/log.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * log.c - * - * Copyright (C) 2001,2002 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * Description: implements logging interface - * - */ - -#include // fprintf -#include // EXIT_FAILURE -#include // errno -#include // h_errno -#include // strerror -#include // vprintf - -#include "log.h" - -/* Globaly visible */ -LogLevel logLevel = LOG_STATUS; - - -/*********************************************************************** - * @Function: log - * @Return: nothing - * @Descr: format and arg1..arg3 are printed on stderr only if level - * is <= logLevel - * format may not contain any newline character. - ***********************************************************************/ -void logMsg(LogLevel level, const char *szFormat, ...) -{ - if (level <= logLevel) { - va_list ap; - - /*@-formatconst@ */ - va_start(ap, szFormat); - vfprintf(stderr, szFormat, ap); - va_end(ap); - /*@-formatconst@ */ - fputs("\n", stderr); - } -} - -/*********************************************************************** - * @Function: systemLog - * @Return: nothing - * @Descr: dumps the system error that happened just before - ***********************************************************************/ -void systemLog(const char *szFormat, ...) -{ - char *szError = NULL; - va_list ap; - - if (errno) - szError = strdup(strerror(errno)); - else if (h_errno) - szError = strdup(hstrerror(h_errno)); - - /*@-formatconst@ */ - va_start(ap, szFormat); - vfprintf(stderr, szFormat, ap); - va_end(ap); - /*@-formatconst@ */ - if (NULL != szError) - fprintf(stderr, " (%s)", szError); - - fputs("\n", stderr); - - if (NULL != szError) - free(szError); -} - -/*********************************************************************** - * @Function: error - * @Return: never - * @Descr: format and arg1..arg3 are printed on stderr only if level - * is <= logLevel - * format may not contain any newline character. - ***********************************************************************/ -void error(const char *szFormat, ...) -{ - va_list ap; - - fprintf(stderr, "*** Error: "); - /*@-formatconst@ */ - va_start(ap, szFormat); - vfprintf(stderr, szFormat, ap); - va_end(ap); - /*@-formatconst@ */ - fputs("\n", stderr); - - exit(EXIT_FAILURE); -} - -/*********************************************************************** - * @Function: systemError - * @Return: never - * @Descr: dumps the system error that happened just before and exits the - * application - ***********************************************************************/ -void systemError(const char *szFormat, ...) -{ - char *szError = NULL; - va_list ap; - - if (errno) - szError = strdup(strerror(errno)); - else if (h_errno) - szError = strdup(hstrerror(h_errno)); - - fprintf(stderr, "*** Error: "); - /*@-formatconst@ */ - va_start(ap, szFormat); - vfprintf(stderr, szFormat, ap); - va_end(ap); - /*@-formatconst@ */ - if (NULL != szError) - fprintf(stderr, " (%s)", szError); - - fputs("\n", stderr); - free(szError); - - exit(EXIT_FAILURE); -} diff --git a/meta-digi-arm/recipes-bsp/libdigi/libdigi/log.h b/meta-digi-arm/recipes-bsp/libdigi/libdigi/log.h deleted file mode 100644 index 26f573f64..000000000 --- a/meta-digi-arm/recipes-bsp/libdigi/libdigi/log.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * libdigi/log.h - * - * Copyright (C) 2001,2002 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * Description: Logging facility for applications - * - */ - -#ifndef DG_LOG_H -#define DG_LOG_H - -typedef enum { - LOG_ERR = 0, - LOG_STATUS, - LOG_HARDWARE1, - LOG_HARDWARE2, - LOG_PACKET, - LOG_LAST -} LogLevel; - -extern LogLevel logLevel; - -extern void logMsg(LogLevel level, const char *szFormat, ...); -extern void systemLog(const char *szFormat, ...); -extern void error(const char *szFormat, ...); -extern void systemError(const char *szFormat, ...); - -#endif /* DG_LOG_H */ diff --git a/meta-digi-arm/recipes-bsp/libdigi/libdigi/mem.c b/meta-digi-arm/recipes-bsp/libdigi/libdigi/mem.c deleted file mode 100644 index df4a853f9..000000000 --- a/meta-digi-arm/recipes-bsp/libdigi/libdigi/mem.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * mem.c - * - * Copyright (C) 2006 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * Description: provides MemCmp() and MemDump() - * - */ - -#include /* printf */ - -#include "mem.h" - -/*********************************************************************** - * !Function: MemCmp - * !Descr: compares memory - * !Return: offset of failure or -1 if none - ***********************************************************************/ -loff_t MemCmp(const void *pvS1, const void *pvS2, size_t iSize) -{ - const char *pcS2 = (const char *)pvS2; - const char *pcS1 = (const char *)pvS1; - loff_t iOffset = 0; - - while (iOffset < iSize) { - if (*pcS2 != *pcS1) - return iOffset; - - pcS2++; - pcS1++; - iOffset++; - } - - return -1; -} - -/*********************************************************************** - * !Function: MemDump - * !Descr: Prints memory from pvbase + iOffset to pvBase + iOffset + iLen - ***********************************************************************/ -void MemDump(const void *pvBase, loff_t iOffset, size_t iLen) -{ - const unsigned char *pucBuf = (const unsigned char *)pvBase + iOffset; - const int COLUMN_COUNT = 16; - int i; - - for (i = 0; i < iLen; i += COLUMN_COUNT) { - /* print one row */ - int j, iRowLen; - - if ((i + COLUMN_COUNT) <= iLen) - iRowLen = COLUMN_COUNT; - else - iRowLen = iLen - i; - - printf("%08llx ", (long long)iOffset); - - /* print hexadecimal representation */ - for (j = 0; j < iRowLen; j++) { - printf("%02x ", *(pucBuf + j)); - if (((COLUMN_COUNT / 2) - 1) == j) - /* additional separator */ - printf(" "); - } - - printf(" "); - - /* print character representation row */ - for (j = 0; j < iRowLen; j++) { - unsigned char c = *(pucBuf + j); - if ((c < 32) || (c > 127)) - c = '.'; - - if (((COLUMN_COUNT / 2) - 1) == j) - /* additional separator */ - printf(" "); - - printf("%c", c); - } - - printf("\r\n"); - pucBuf += iRowLen; - iOffset += iRowLen; - } -} diff --git a/meta-digi-arm/recipes-bsp/libdigi/libdigi/mem.h b/meta-digi-arm/recipes-bsp/libdigi/libdigi/mem.h deleted file mode 100644 index 0316e6d56..000000000 --- a/meta-digi-arm/recipes-bsp/libdigi/libdigi/mem.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * libdigi/mem.h - * - * Copyright (C) 2006 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * Description: provides MemCmp() and MemDump() - * - */ - -#ifndef DG_MEM_H -#define DG_MEM_H - -#include /* size_t */ - -extern loff_t MemCmp(const void *pvS1, const void *pvS2, size_t iSize); -extern void MemDump(const void *pvBase, loff_t iOffset, size_t iLen); - -#endif /* DG_MEM_H */ diff --git a/meta-digi-arm/recipes-bsp/libdigi/libdigi/misc_helper.h b/meta-digi-arm/recipes-bsp/libdigi/libdigi/misc_helper.h deleted file mode 100644 index d809980f6..000000000 --- a/meta-digi-arm/recipes-bsp/libdigi/libdigi/misc_helper.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * libdigi/misc_helper.h - * - * Copyright (C) 2006 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * Description: miscellaneous definitions that simplifies developing - * May require 'string.h' or 'log.h' - * - */ - -#ifndef DG_MISC_HELPER_H -#define DG_MISC_HELPER_H - -#include /* snprintf */ -#include /* memset */ - -#define ARRAY_SIZE(x) (sizeof(x)/sizeof(*(x))) -#define CLEAR(x) memset( &x, 0, sizeof( x ) ) - -/* round up to kB */ -#define TO_KiB(x) (((x) + 1023) / 1024) - -/* to bytes */ -#define KiB(x) ((x) * 1024) -#define MiB(x) (KiB(x) * 1024) - -#define MAX(a, b) ((a) < (b) ? (b) : (a)) -#define MIN(a, b) ((a) > (b) ? (b) : (a)) - -#define FREE(x) \ - do { \ - free((void *)x); \ - x = NULL; \ - } while (0) - -#define CLOSE(x) \ - do { \ - if (close(x)) \ - systemError("close"); \ - x = -1; \ - } while (0) - -#define SPRINTF(acStr, args...) \ - snprintf(acStr, sizeof(acStr), args) - -#endif /* DG_MISC_HELPER_H */ diff --git a/meta-digi-arm/recipes-bsp/libdigi/libdigi/platform.c b/meta-digi-arm/recipes-bsp/libdigi/libdigi/platform.c deleted file mode 100644 index 25d37c514..000000000 --- a/meta-digi-arm/recipes-bsp/libdigi/libdigi/platform.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2011 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version2 as published by - * the Free Software Foundation. -*/ - -#include -#include -#include -#include - -#include "digi-platforms.h" -#include "log.h" - -/* - * Gets the platform ID from the file /proc/cpuinfo - * (the kernel needs to write the machine ID in this file). - * Returns the machine ID or -1 on error - */ -int get_platform_id(void) -{ - char buffer[80]; - FILE *fp; - long id = -1; - - fp = popen("cat /proc/cpuinfo | grep \"Machine ID\" | cut -f 2 -d :", "r"); - if (fp == NULL) - systemError("cannot access /proc/cpuinfo"); - - if (fgets(buffer, sizeof(buffer) - 1, fp)) { - errno = 0; /* to distinguish success/failure after call */ - id = strtol(buffer, NULL, 10); - if (errno != 0) - id = -1; /* don't care about the error code */ - } - fclose(fp); - - return id; -} - -/* - * get_platform_name_from_fdt - * - * Read the device tree and return platform name or NULL - */ -static char *get_platform_name_from_fdt(void) -{ - static const char *fdt = "/proc/device-tree/digi,machine,name"; - static char buffer[64]; /* static buffer so it can be used in the caller function */ - char *plat_name = NULL; - FILE *fp; - - fp = fopen(fdt, "r"); - if (fp == NULL) - goto out; - - plat_name = fgets(buffer, sizeof(buffer), fp); - fclose(fp); - -out: - return plat_name; -} - -/* - * Checks whether platform requires an atomic access to NAND OOB - */ -char is_nand_oob_atomic(void) -{ - int platform_id; - - platform_id = get_platform_id(); - if (platform_id != -1) { - /* The following platforms require atomic access to NAND OOB */ - if (MACH_TYPE_CPX2 == platform_id || - MACH_TYPE_WR21 == platform_id || - MACH_TYPE_CCMX51 == platform_id || - MACH_TYPE_CCMX51JS == platform_id || - MACH_TYPE_CCWMX51 == platform_id || - MACH_TYPE_CCWMX51JS == platform_id || - MACH_TYPE_CCIMX51 == platform_id || - MACH_TYPE_CCIMX51JS == platform_id || - MACH_TYPE_CCMX53 == platform_id || - MACH_TYPE_CCMX53JS == platform_id || - MACH_TYPE_CCWMX53 == platform_id || - MACH_TYPE_CCWMX53JS == platform_id || - MACH_TYPE_CCIMX53 == platform_id || - MACH_TYPE_CCIMX53JS == platform_id || - MACH_TYPE_CCARDMX28 == platform_id || - MACH_TYPE_CCARDMX28JS == platform_id || - MACH_TYPE_CCARDWMX28 == platform_id || - MACH_TYPE_CCARDWMX28JS == platform_id || - MACH_TYPE_CCARDIMX28 == platform_id || - MACH_TYPE_CCARDIMX28JS == platform_id) - return 1; - } else { - /* - * Workaround to detect is_nand_oob_atomic in ccardimx28 using - * linux 3.x - * TODO: generalize this. - */ - char *platform_name = get_platform_name_from_fdt(); - if (platform_name && !strcmp(platform_name, "ccardimx28")) - return 1; - } - - return 0; -} diff --git a/meta-digi-arm/recipes-bsp/nvram/nvram.inc b/meta-digi-arm/recipes-bsp/nvram/nvram.inc deleted file mode 100644 index 8b0506d23..000000000 --- a/meta-digi-arm/recipes-bsp/nvram/nvram.inc +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (C) 2013 Digi International. - -SUMMARY = "Digi's NVRAM tool" -SECTION = "base" -LICENSE = "GPL-2.0" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" - -require recipes-bsp/u-boot/u-boot-dey-rev_${PV}.inc - -DEPENDS = "libdigi" - -SRC_URI += " \ - file://main.c \ - file://nvram_priv_linux.c \ -" - -S = "${WORKDIR}" - -CMD_GIT_SHA1 = "$(cd ${THISDIR} && git rev-parse --short=7 HEAD)" -LIB_GIT_SHA1 = "$(cd ${WORKDIR}/git && git rev-parse --short=7 HEAD)" - -EXTRA_CFLAGS = "-Wall -DLINUX -DCMD_GIT_SHA1=\"${CMD_GIT_SHA1}\" -DLIB_GIT_SHA1=\"${LIB_GIT_SHA1}\" -Ilib/include -I${STAGING_INCDIR}/libdigi" - -do_configure() { - rm -f lib && ln -s ${UBOOT_NVRAM_LIBPATH} -} - -do_compile() { - # 'libnvram.a' static library - ${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c -o nvram.o lib/src/nvram.c - ${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c -o nvram_cmdline.o lib/src/nvram_cmdline.c - ${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c -o nvram_priv_linux.o nvram_priv_linux.c - ${AR} -rcs libnvram.a nvram.o nvram_cmdline.o nvram_priv_linux.o - # 'nvram' command-line tool - ${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c -o main.o main.c - ${CC} ${LDFLAGS} -o nvram main.o libnvram.a -ldigi -} - -do_install() { - mkdir -p ${D}${base_sbindir} ${D}${includedir} ${D}${libdir} - install -m 0644 libnvram.a ${D}${libdir}/ - install -m 0644 lib/include/nvram.h lib/include/nvram_types.h ${D}${includedir}/ - install -m 0755 nvram ${D}${base_sbindir}/ -} - -PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/meta-digi-arm/recipes-bsp/nvram/nvram/main.c b/meta-digi-arm/recipes-bsp/nvram/nvram/main.c deleted file mode 100644 index f3627cf0f..000000000 --- a/meta-digi-arm/recipes-bsp/nvram/nvram/main.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * nvram/src/main.c - * - * Copyright (C) 2006-2013 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version2 as published by - * the Free Software Foundation. - */ -/* - * !Author: Markus Pietrek - * !Descr: main() and user code for nvram. - */ - -#include /* errno */ -#include /* open */ -#include /* vprintf */ -#include /* snprintf */ -#include /* EXIT_SUCCESS */ -#include /* strdup */ -#include - -/* from libdigi */ -#include -#include -#include - -#include "nvram.h" /* Nv* */ - -#define CA(cmd) \ - do { \ - if( !cmd ) \ - ExitError( #cmd ); \ - } while( 0 ) - -#define VERSION "1.15" "-g"CMD_GIT_SHA1 - -/* Hack to change priv_linux mode */ -void NvPrivLinuxSetMode(char bManufMode); - -/* local functions */ -static void ExitError(const char *szFormat, ...); -static void OnExit(void); -static void ExtendedUsage(char bCmdLine); -static void OSLoadFromFile(nv_os_type_e eOS, const char *szFile); -static void OSSaveToFile(nv_os_type_e eOS, const char *szFile); - -static char l_bOptDetailed = 0; -static char quiet = 0; -static char l_bManufMode = 0; - -int main(int argc, char *argv[]) -{ - char acVersion[128]; - uint32_t uiLibVerMajor; - uint32_t uiLibVerMinor; - int iExtendedArgs; - const char *xPrintAll[] = { "printall" }; - const char *szOSOutFile = NULL; - const char *szOSInFile = NULL; - const char *szOS = NULL; - char bSave = 0; - nv_os_type_e eOS = NVOS_NONE; - int ret; - - CmdOptEntry aCmdEntries[] = { - /*@@-nullassign@@ */// only COT_NONE may have a NULL for vValuePtr - {COT_BOOL, 'e', &l_bOptDetailed, "error_detailed", - "detailed error messages"}, - {COT_BOOL, 'b', &g_markBadBlocks, "bad-block-marking", - "On repeated error, mark block as bad."}, - {COT_STRING, 'g', &szOSOutFile, "get_os_cfg", - "copies the os configuration block to file"}, - {COT_STRING, 's', &szOSInFile, "set_os_cfg", - "copies the os configuration block from file"}, - {COT_STRING, 'o', &szOS, "os", - "select's the OS to get configuration from"}, - {COT_BOOL, 'q', &quiet, "quiet", - "display no error messages"}, - {COT_BOOL, 'm', &l_bManufMode, "manuf-mode", - "manufacturing mode (no auto-repair, permit reset)"}, - {COT_MORE_OPT, 0, NULL, "", ""}, - {COT_NONE, 0, NULL, NULL, NULL}, - /*@@+nullassign@@ */ - }; - - NvGetLibVersion(&uiLibVerMajor, &uiLibVerMinor); - snprintf(acVersion, - sizeof(acVersion) - 1, - "Version: " VERSION ", NVRAM Library %u.%u-g" LIB_GIT_SHA1 ", compiled on " - __DATE__ "," __TIME__, uiLibVerMajor, uiLibVerMinor); - acVersion[sizeof(acVersion) - 1] = 0U; - szCmdOptVersion = acVersion; - fnCmdOptExtendedUsage = ExtendedUsage; - - iExtendedArgs = cmdOptParse(argc, argv, aCmdEntries, - "NVRAM Tool for updating nvram settings"); - logMsg(LOG_HARDWARE1, - "Sizes: Critical: %i\n" - " Module ID: %i\n" - " IP: %i\n" - " IP Device: %i\n" - " Partition Table: %i\n" - " Partition Entry: %i\n" - " OS Cfg Table: %i\n" - " OS Cfg: %i\n", - sizeof(nv_critical_t), - sizeof(nv_param_module_id_t), - sizeof(nv_param_ip_t), - sizeof(nv_param_ip_device_t), - sizeof(nv_param_part_table_t), - sizeof(nv_param_part_t), - sizeof(nv_param_os_cfg_table_t), - sizeof(nv_param_os_cfg_t)); - - /* so we can close everything even on error() or on return of main */ - atexit(OnExit); - - NvPrivLinuxSetMode(l_bManufMode); - - /* In manufacturing mode, do not let library auto-repair the NVRAM */ - ret = NvInit(l_bManufMode ? NVR_MANUAL : NVR_AUTO); - if (!ret) { - /* If NVRAM was not initialized, only continue if - * we are requesting a reset. - */ - if (argc == iExtendedArgs) { - ExitError("NvInit"); - } else { - if (strcmp("reset", argv[iExtendedArgs])) - ExitError("NvInit"); - } - } - - if (NULL != szOS) { - if (!NvToOS(&eOS, szOS)) - error("OS not known: %s\n", szOS); - } - - if (NULL != szOSInFile) { - bSave = 1; - OSLoadFromFile(eOS, szOSInFile); - } - - if (NULL != szOSOutFile) - /* it's load from NVRAM view */ - OSSaveToFile(eOS, szOSOutFile); - - if (argc == iExtendedArgs) { - if ((NULL == szOSInFile) && (NULL == szOSOutFile)) - /* on -o, the user likes to read/write something */ - CA(NvCmdLine(ARRAY_SIZE(xPrintAll), xPrintAll)); - } else { - CA(NvCmdLine(argc - iExtendedArgs, (const char **)&argv[iExtendedArgs])); - - if (!strcmp("set", argv[iExtendedArgs]) || - !strcmp("reset", argv[iExtendedArgs]) || - !strcmp("init", argv[iExtendedArgs])) - bSave = 1; - } - - if (bSave) - CA(NvSave()); - - return EXIT_SUCCESS; -} - -/* ********** local functions ********** */ - -static void ExtendedUsage(char bCmdLine) -{ - if (bCmdLine == 1) - CA(NvPrintHelp()); -} - -static void ExitError(const char *szFormat, ...) -{ - const char *szError = NULL; - const char *szWhat = NULL; - const char *szFunc = NULL; - const char *szFile = NULL; - int iLine; - - va_list ap; - - if (!quiet || l_bOptDetailed) { - fprintf(stderr, "*** Error: "); - if (l_bOptDetailed) { - /*@-formatconst@ */ - va_start(ap, szFormat); - vfprintf(stderr, szFormat, ap); - va_end(ap); - fprintf(stderr, ": "); - /*@+formatconst@ */ - } - - if (NVE_GOOD != NvErrorMsg(&szError, &szWhat, &szFunc, &szFile, &iLine)) { - if (l_bOptDetailed) - fprintf(stderr, " %s: (%s) @ %s:%i (%s)", - szError, szWhat, szFile, iLine, szFunc); - else - fprintf(stderr, " %s: (%s)", szError, szWhat); - } - - fprintf(stderr, "\n"); - } - - exit(EXIT_FAILURE); -} - -static void OSLoadFromFile(nv_os_type_e eOS, const char *szFile) -{ - int iFd; - nv_param_os_cfg_t xCfg; - void *pvTmp; - - CA(NvOSCfgFind(&xCfg, eOS)); - pvTmp = malloc(xCfg.uiSize); - if (NULL == pvTmp) - systemError("malloc: %i", xCfg.uiSize); - - iFd = open(szFile, O_RDONLY); - if (-1 == iFd) - systemError("%s", szFile); - if (-1 == read(iFd, pvTmp, xCfg.uiSize)) - systemError("read"); - CLOSE(iFd); - - CA(NvOSCfgSet(eOS, pvTmp, xCfg.uiSize)); - - FREE(pvTmp); - - printf("Loaded from %s\n", szFile); -} - -static void OSSaveToFile(nv_os_type_e eOS, const char *szFile) -{ - int iFd; - nv_param_os_cfg_t xCfg; - void *pvTmp; - size_t iSize; - - CA(NvOSCfgFind(&xCfg, eOS)); - pvTmp = malloc(xCfg.uiSize); - if (NULL == pvTmp) - systemError("malloc: %i", xCfg.uiSize); - - CA(NvOSCfgGet(eOS, pvTmp, xCfg.uiSize, &iSize)); - - iFd = open(szFile, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - if (-1 == iFd) - systemError("%s", szFile); - if (xCfg.uiSize != write(iFd, pvTmp, xCfg.uiSize)) - systemError("write"); - CLOSE(iFd); - FREE(pvTmp); - - printf("Stored to %s\n", szFile); -} - -/*! \brief closes all descriptors on any exit */ -static void OnExit(void) -{ - NvFinish(); -} diff --git a/meta-digi-arm/recipes-bsp/nvram/nvram/nvram_priv_linux.c b/meta-digi-arm/recipes-bsp/nvram/nvram/nvram_priv_linux.c deleted file mode 100644 index 47cbffe65..000000000 --- a/meta-digi-arm/recipes-bsp/nvram/nvram/nvram_priv_linux.c +++ /dev/null @@ -1,302 +0,0 @@ -/* - * nvram/src/nvram_priv_linux.c - * - * Copyright (C) 2006-2013 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version2 as published by - * the Free Software Foundation. - */ -/* - * !Author: Markus Pietrek - * !Descr: Defines the private functions needed by the nvram core to - * access I2C, Flash and a console for linux userspace. - */ - -#define _XOPEN_SOURCE 500 /* for pread/pwrite */ - -#include /* ENOTSUP */ -#include /* open */ -#include /* MEMERASE */ -#include /* vprintf */ -#include /* ioctl */ -#include /* stat */ - -/* from libdigi */ -#include /* systemError */ -#include /* CLEAR */ - -#include "nvram_priv.h" - -#define NVRAM_PARTITION 1 - -char g_markBadBlocks = 0; - -/* ********** local variables ********** */ -static char l_acMtd[32]; -static int l_iFdMtd = -1; -static mtd_info_t l_xMtdInfo; -static unsigned char bbMaxRetries = 3; -extern void MemDump(const void *pvBase, loff_t iOffset, size_t iLen); - -static char l_bManufMode = 0; - -/* ********** global functions ********** */ -void NvPrivLinuxSetMode(char bManufMode) -{ - /* Hack so linux nvram can change behavior of priv_linux */ - /* without ubootenv also changing. */ - l_bManufMode = bManufMode; -} - -int NvPrivOSInit(void) -{ - struct stat xStat; - - CLEAR(xStat); - - /* detect NVRAM partition */ - SPRINTF(l_acMtd, "/dev/mtd/%i", NVRAM_PARTITION); - - /* determine whether we are /dev/mtd/ or /dev/mtd */ - if (-1 == stat(l_acMtd, &xStat)) { - SPRINTF(l_acMtd, "/dev/mtd%i", NVRAM_PARTITION); - /* not dev fs */ - if (-1 == stat(l_acMtd, &xStat)) - return NV_SET_ERROR(NVE_NO_DEV, strerror(errno)); - } - - return 1; -} - -int NvPrivOSFinish(void) -{ - return 1; -} - -int NvPrivOSPostInit(void) -{ - return 1; -} - -int NvPrivOSCriticalPostReset(struct nv_critical *pParams) -{ - /* nothing to do */ - return 1; -} - -int NvPrivOSCriticalPartReset(struct nv_critical *pCrit, nv_os_type_e eForOS) -{ - if (l_bManufMode) { - /* - * In manufacturing mode, don't return an error, assuming - * that caller knows what they're doing. - */ - return 1; - } else { - /* - * Retain previous behavior of returning an error, which - * will cause us to exit before calling NvSave(); this is - * done to prevent 'nvram reset' from linux from erasing the - * OSCfgTable, since we won't properly restore the ubootenv - * section. - */ - RETURN_NOT_IMPLEMENTED(); - } -} - -int NvPrivOSFlashOpen(char bForWrite) -{ - l_iFdMtd = open(l_acMtd, bForWrite ? (O_RDWR | O_SYNC) : O_RDONLY); - if (-1 == l_iFdMtd) - return NV_SET_ERROR(NVE_NO_DEV, strerror(errno)); - - CLEAR(l_xMtdInfo); - /* read partition info */ - if (ioctl(l_iFdMtd, MEMGETINFO, &l_xMtdInfo)) { - CLOSE(l_iFdMtd); - return NV_SET_ERROR(NVE_NO_DEV, strerror(errno)); - } - - return 1; -} - -int NvPrivOSFlashClose(void) -{ - CLOSE(l_iFdMtd); - - return 1; -} - -/* A block is marked as bad as a consequence of consecutive read/write errors, - * for example unrecoverable CRC errors, or if the data verification after a - * write finds data mismatch after a number of retries. */ -static int NvPrivMarkBadBlock(int fd, loff_t iOffset) -{ - logMsg(LOG_STATUS, "Marking offset %d as bad\n", (int)iOffset); - return (ioctl(fd, MEMSETBADBLOCK, &iOffset)); -} - -int NvPrivOSFlashRead(void *pvBuf, loff_t iOffs, size_t iLength) -{ - int iRead; - int i, iRet; - - for (i = 0; i < bbMaxRetries; i++) { - iRead = pread(l_iFdMtd, pvBuf, iLength, iOffs); - - if (iRead != iLength) { - if (g_markBadBlocks) { - systemLog("Retrying failed read:Got %i " - "Bytes instead of %i.\n", iRead, iLength); - continue; - } else { - systemLog("read failed. Got %i Bytes " - "instead of %i\n", iRead, iLength); - return NV_SET_ERROR(NVE_IO, strerror(errno)); - } - } - break; - } - - if (g_markBadBlocks && (i >= bbMaxRetries)) { - /* Read error, for example unrecoverable ECC */ - iRet = NvPrivMarkBadBlock(l_iFdMtd, iOffs); - return NV_SET_ERROR(NVE_IO, strerror(iRet)); - } - - return 1; -} - -int NvPrivOSFlashErase(loff_t iOffs) -{ - erase_info_t xErase; - CLEAR(xErase); - - xErase.length = l_xMtdInfo.erasesize; - xErase.start = iOffs; - if (ioctl(l_iFdMtd, MEMERASE, &xErase)) - return NV_SET_ERROR(NVE_IO, strerror(errno)); - - return 1; -} - -int NvPrivOSFlashWrite( /*@in@ */ const void *pvBuf, loff_t iOffs, size_t iLength) -{ - int iWritten, iRead; - int i, iRet; - unsigned char *pvRdBuf; - - /* we are not called for bad sectors */ - - for (i = 0; i < bbMaxRetries; i++) { - iWritten = pwrite(l_iFdMtd, pvBuf, iLength, iOffs); - if (iWritten != iLength) { - if (g_markBadBlocks) { - systemLog("Retrying failed write:" - "Wrote %i Bytes" - " instead of %i.\n", iWritten, iLength); - continue; - } else { - logMsg(LOG_ERR, "write failed." - " Wrote %i Bytes" " instead of %i\n", iWritten, iLength); - return NV_SET_ERROR(NVE_IO, strerror(errno)); - } - } - - if (g_markBadBlocks) { - pvRdBuf = (unsigned char *)malloc(iLength); - if (NULL == pvRdBuf) { - systemLog("Malloc failed.\n"); - return NV_SET_ERROR(NVE_IO, strerror(errno)); - } - for (i = 0; i < bbMaxRetries; i++) { - iRead = pread(l_iFdMtd, pvRdBuf, iLength, iOffs); - if (iRead != iLength) { - systemLog("Retrying failed read:" - "%i < > %i.\n", iRead, iLength); - continue; - } - if (memcmp(pvRdBuf, pvBuf, iLength) != 0) { - logMsg(LOG_ERR, - "\nData mismatch at offset 0x%08x\n", iOffs); - logMsg(LOG_ERR, "Source is"); - MemDump(pvBuf, iOffs & ~0xf, MIN(iLength, 0x20)); - logMsg(LOG_ERR, "Flash is"); - MemDump(pvRdBuf, iOffs & ~0xf, MIN(iRead, 0x20)); - continue; - } - break; - } - FREE(pvRdBuf); - } - break; - } - - if (g_markBadBlocks && (i >= bbMaxRetries)) { - iRet = NvPrivMarkBadBlock(l_iFdMtd, iOffs); - return NV_SET_ERROR(NVE_IO, strerror(iRet)); - } - - return 1; -} - -int NvPrivOSFlashProtect(loff_t iOffs, size_t iLength, char bProtect) -{ - erase_info_t xErase; - CLEAR(xErase); - - xErase.length = l_xMtdInfo.erasesize; - xErase.start = iOffs; - if (ioctl(l_iFdMtd, (bProtect ? MEMLOCK : MEMUNLOCK), &xErase)) { - if (ENOTSUP != errno) - /* e.g. NAND */ - return NV_SET_ERROR(NVE_IO, strerror(errno)); - } - - return 1; -} - -int NvPrivOSFlashInfo(loff_t iOffs, -/*@out@*/ struct nv_priv_flash_status *pStatus) -{ - int iRes; - - CLEAR(*pStatus); - - /* linux hasn't an interface yet to determine erase size at iOffs. - Anyway, we place NVRAM immediately after U-Boot, so we have unique - erase sizes */ - pStatus->iEraseSize = l_xMtdInfo.erasesize; - pStatus->type = l_xMtdInfo.type; - - /* determine whether block at iOffs is bad */ - iRes = ioctl(l_iFdMtd, MEMGETBADBLOCK, &iOffs); - - if (iRes > 0) - pStatus->bBad = 1; - else if ((iRes < 0) && (ENOTSUP != errno)) - return NV_SET_ERROR(NVE_IO, strerror(errno)); - /* else if not supported (NOR), is is assumed good */ - - return 1; -} - -void NvPrivOSPrintf(const char *szFormat, ...) -{ - va_list ap; - - va_start(ap, szFormat); - vprintf(szFormat, ap); - va_end(ap); -} - -void NvPrivOSPrintfError(const char *szFormat, ...) -{ - va_list ap; - - va_start(ap, szFormat); - vfprintf(stderr, szFormat, ap); - va_end(ap); -} diff --git a/meta-digi-arm/recipes-bsp/nvram/nvram_2013.01.bb b/meta-digi-arm/recipes-bsp/nvram/nvram_2013.01.bb deleted file mode 100644 index e0667c69d..000000000 --- a/meta-digi-arm/recipes-bsp/nvram/nvram_2013.01.bb +++ /dev/null @@ -1,5 +0,0 @@ -PV = "2013.01" - -require recipes-bsp/nvram/nvram.inc - -COMPATIBLE_MACHINE = "(ccardimx28)" diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-native.inc b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-native.inc new file mode 100644 index 000000000..dd11a8fd4 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-native.inc @@ -0,0 +1,50 @@ +# Copyright (C) 2017 Digi International +SUMMARY = "NXP Code signing Tool for the High Assurance Boot library" +DESCRIPTION = "Provides software code signing support designed for use with \ +i.MX processors that integrate the HAB library in the internal boot ROM." +HOMEPAGE = "https://www.nxp.com/webapp/Download?colCode=IMX_CST_TOOL" +LICENSE = "CLOSED" + +DEPENDS = "openssl-native" + +SRC_URI = " \ + ${@base_conditional('TRUSTFENCE_SIGN', '1', 'file://cst-${PV}.tar.gz', '', d)} \ + file://0001-gen_auth_encrypted_data-reuse-existing-DEK-file.patch \ + file://0002-hab4_pki_tree.sh-automate-script.patch \ + file://0003-openssl_helper-use-dev-urandom-as-seed-source.patch \ + file://0004-hab4_pki_tree.sh-usa-a-random-password-for-the-defau.patch \ + file://Makefile \ +" + +# Usually local files (with file:// protocol) are not checked for +# premirrors. But in this case we want to be able to download the 'cst' +# package from a premirror in case it's not already in the DL_DIR, so prepend +# a premirror for the 'file://' protocol. +python() { + source_mirror_url = d.getVar('SOURCE_MIRROR_URL', True) + if source_mirror_url: + premirrors = d.getVar('PREMIRRORS', True) + d.setVar('PREMIRRORS', "file://cst.* %s \\n %s" % (source_mirror_url, premirrors)) +} + +S = "${WORKDIR}/cst-${PV}" + +inherit native + +do_configure() { + cp -f ${WORKDIR}/Makefile . +} + +do_compile() { + oe_runmake clean && oe_runmake +} + +do_install() { + install -d ${D}${bindir} + install -m 0755 linux64/cst ${D}${bindir}/cst + install -m 0755 $(find linux64 -type f -name srktool) ${D}${bindir}/srktool + install -m 0755 keys/hab4_pki_tree.sh ${D}${bindir}/trustfence-gen-pki.sh + install -m 0755 ca/openssl.cnf ${D}${bindir}/openssl.cnf + install -m 0755 ca/v3_ca.cnf ${D}${bindir}/v3_ca.cnf + install -m 0755 ca/v3_usr.cnf ${D}${bindir}/v3_usr.cnf +} diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-native_2.3.2.bb b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-native_2.3.2.bb index 77194dbcf..b3ec2f2de 100644 --- a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-native_2.3.2.bb +++ b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-native_2.3.2.bb @@ -1,49 +1,3 @@ -SUMMARY = "NXP Code signing Tool for the High Assurance Boot library" -DESCRIPTION = "Provides software code signing support designed for use with \ -i.MX processors that integrate the HAB library in the internal boot ROM." -HOMEPAGE = "https://www.nxp.com/webapp/Download?colCode=IMX_CST_TOOL" -LICENSE = "CLOSED" +# Copyright (C) 2017 Digi International -DEPENDS = "openssl-native" - -SRC_URI = " \ - ${@base_conditional('TRUSTFENCE_SIGN', '1', 'file://cst-${PV}.tar.gz', '', d)} \ - file://0001-gen_auth_encrypted_data-reuse-existing-DEK-file.patch \ - file://0002-hab4_pki_tree.sh-automate-script.patch \ - file://0003-openssl_helper-use-dev-urandom-as-seed-source.patch \ - file://0004-hab4_pki_tree.sh-usa-a-random-password-for-the-defau.patch \ - file://Makefile \ -" - -# Usually local files (with file:// protocol) are not checked for -# premirrors. But in this case we want to be able to download the 'cst' -# package from a premirror in case it's not already in the DL_DIR, so prepend -# a premirror for the 'file://' protocol. -python() { - source_mirror_url = d.getVar('SOURCE_MIRROR_URL', True) - if source_mirror_url: - premirrors = d.getVar('PREMIRRORS', True) - d.setVar('PREMIRRORS', "file://cst.* %s \\n %s" % (source_mirror_url, premirrors)) -} - -S = "${WORKDIR}/cst-${PV}" - -inherit native - -do_configure() { - cp -f ${WORKDIR}/Makefile . -} - -do_compile() { - oe_runmake clean && oe_runmake -} - -do_install() { - install -d ${D}${bindir} - install -m 0755 linux64/cst ${D}${bindir}/cst - install -m 0755 linux64/srktool ${D}${bindir}/srktool - install -m 0755 keys/hab4_pki_tree.sh ${D}${bindir}/trustfence-gen-pki.sh - install -m 0755 ca/openssl.cnf ${D}${bindir}/openssl.cnf - install -m 0755 ca/v3_ca.cnf ${D}${bindir}/v3_ca.cnf - install -m 0755 ca/v3_usr.cnf ${D}${bindir}/v3_usr.cnf -} +require trustfence-cst-native.inc diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-native_2.3.3.bb b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-native_2.3.3.bb new file mode 100644 index 000000000..dc6e8bbd5 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-native_2.3.3.bb @@ -0,0 +1,5 @@ +# Copyright (C) 2017 Digi International + +require trustfence-cst-native.inc + +INSANE_SKIP_${PN} += "already-stripped" diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0001-gen_auth_encrypted_data-reuse-existing-DEK-file.patch b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/0001-gen_auth_encrypted_data-reuse-existing-DEK-file.patch similarity index 100% rename from meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0001-gen_auth_encrypted_data-reuse-existing-DEK-file.patch rename to meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/0001-gen_auth_encrypted_data-reuse-existing-DEK-file.patch diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0002-hab4_pki_tree.sh-automate-script.patch b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/0002-hab4_pki_tree.sh-automate-script.patch similarity index 100% rename from meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0002-hab4_pki_tree.sh-automate-script.patch rename to meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/0002-hab4_pki_tree.sh-automate-script.patch diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0003-openssl_helper-use-dev-urandom-as-seed-source.patch b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/0003-openssl_helper-use-dev-urandom-as-seed-source.patch similarity index 100% rename from meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0003-openssl_helper-use-dev-urandom-as-seed-source.patch rename to meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/0003-openssl_helper-use-dev-urandom-as-seed-source.patch diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0004-hab4_pki_tree.sh-usa-a-random-password-for-the-defau.patch b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/0004-hab4_pki_tree.sh-usa-a-random-password-for-the-defau.patch similarity index 100% rename from meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0004-hab4_pki_tree.sh-usa-a-random-password-for-the-defau.patch rename to meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/0004-hab4_pki_tree.sh-usa-a-random-password-for-the-defau.patch diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/Makefile b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/Makefile similarity index 100% rename from meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/Makefile rename to meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/Makefile diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2013.01/ccardimx28/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2013.01/ccardimx28/boot.txt deleted file mode 100644 index fa6d69123..000000000 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2013.01/ccardimx28/boot.txt +++ /dev/null @@ -1,16 +0,0 @@ -# -# U-Boot bootscript for SD images created by Yocto. -# -# Layout: -# * U-Boot (raw copied) -# * Boot partion (FAT) with kernel images and DTB -# * Rootfs partion (EXT4) -# -# +--------------+----------------------+-------------------------+ -# | U-BOOT (RAW) | BOOT_PARTITION (FAT) | ROOTFS_PARTITION (EXT4) | -# +--------------+----------------------+-------------------------+ -# -setenv fdtimg uimage-imx28-ccardimx28js.dtb -setenv kimg uimage-ccardimx28js.bin -setenv mmc_rpart /dev/mmcblk0p3 -dboot linux mmc 0:2 diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6qpsbc/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6qpsbc/boot.txt new file mode 100644 index 000000000..52b84adef --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6qpsbc/boot.txt @@ -0,0 +1,35 @@ +# +# U-Boot bootscript for EMMC/SD images created by Yocto. +# + +# +# Set device tree filename depending on the board ID (if defined) +# +if test -n "${board_id}"; then + setenv fdt_file zImage-${soc_family}-ccimx6qpsbc-id${board_id}.dtb +else + # + # Set device tree filename depending on the hardware variant + # + if test "${module_variant}" = "0x01"; then + setenv fdt_file zImage-${soc_family}-ccimx6qpsbc-wb.dtb + else + echo "------ Using default fdt_file" + fi +fi + +# Get the UUID of the configured boot partition. +part uuid mmc ${mmcbootdev}:${mmcpart} bootpart +# Check the boot source. +if test "${bootpart}" = "${part1_uuid}"; then + # We are booting from the eMMC using 'linux'. + true +elif test "${bootpart}" = "${part2_uuid}"; then + # We are booting from the eMMC using 'recovery'. + setenv boot_initrd true + setenv initrd_file uramdisk-recovery.img +else + # We are booting from the SD card. + setenv mmcroot /dev/mmcblk${mmcbootdev}p2 +fi +dboot linux mmc ${mmcbootdev}:${mmcpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6qpsbc/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6qpsbc/install_linux_fw_sd.txt new file mode 100644 index 000000000..76bebec7b --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6qpsbc/install_linux_fw_sd.txt @@ -0,0 +1,162 @@ +# +# U-Boot script for installing Linux images created by Yocto from the SD +# card into the eMMC +# + +echo "############################################################" +echo "# Linux firmware install from micro SD #" +echo "############################################################" +echo "" +echo " This process will erase your eMMC and will install a new" +echo " U-Boot and Linux firmware images on the eMMC." +echo "" +echo " Press CTRL+C now if you wish to abort or wait 10 seconds" +echo " to continue." + +sleep 10 +if test $? -eq 1; then + echo "Aborted by user."; + exit; +fi + +# Determine U-Boot file to program basing on module variant +if test -n "${module_variant}"; then + if test "${module_variant}" = "0x01"; then + setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qpsbc2GB.imx; + fi +fi +# Use 'test -n ...' because 'test -z ...' does not work well on old versions of +# u-boot when the checked value is empty. +if test -n "${INSTALL_UBOOT_FILENAME}"; then + true; +else + echo ""; + echo "[ERROR] Cannot determine U-Boot file for this module!"; + echo ""; + echo "1. Set variable 'INSTALL_UBOOT_FILENAME' depending on your ConnectCore 6 QuadPlus variant:"; + echo " - For a QuadPlus CPU with 2GB DDR3, run:"; + echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qpsbc2GB.imx"; + echo ""; + echo "2. Run the install script again."; + echo ""; + echo "Aborted"; + echo ""; + exit; +fi; + +setenv INSTALL_MMCDEV 1 +setenv INSTALL_LINUX_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6qpsbc.boot.vfat +setenv INSTALL_RECOVERY_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6qpsbc.recovery.vfat +setenv INSTALL_ROOTFS_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6qpsbc.ext4 + +# Check for presence of firmware files on the SD card +for install_f in ${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do + if test ! -e mmc ${INSTALL_MMCDEV}:1 ${install_f}; then + echo "ERROR: Could not find file ${install_f}"; + install_abort=1; + fi; +done +if test -n "${install_abort}"; then + echo "Aborted."; + exit; +fi + +# Skip user confirmation for U-Boot update +setenv forced_update 1 + +# Set bootdelay to zero so that firmware update is run immediately after +# the first reset. +setenv bootdelay 0 + +# Set target MMC device index to eMMC +setenv mmcdev 0 + +# Update U-Boot +echo "" +echo "" +echo ">> Installing U-Boot boot loader (target will reset)" +echo "" +echo "" +update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME} +if test $? -eq 1; then + echo "[ERROR] Failed to update U-Boot boot loader!"; + echo ""; + echo "Aborted."; + exit; +fi + +# Set 'bootcmd' to the second part of the script that will +# - Reset environment to defaults +# - Save the environment +# - Partition the eMMC user data area for Linux +# - Update the 'linux' partition +# - Update the 'recovery' partition +# - Update the 'rootfs' partition +# - Configure recovery to wipe 'update' partition +# - Run 'recovery' and let the system boot after +setenv bootcmd " + env default -a; + saveenv; + echo \"\"; + echo \"\"; + echo \">> Creating Linux partition table on the eMMC\"; + echo \"\"; + echo \"\"; + run partition_mmc_linux; + if test \$? -eq 1; then + echo \"[ERROR] Failed to create Linux partition table!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; + echo \"\"; + echo \"\"; + echo \">> Installing Linux kernel and device tree files\"; + echo \"\"; + echo \"\"; + update linux mmc ${INSTALL_MMCDEV} fat ${INSTALL_LINUX_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; + echo \"\"; + echo \"\"; + echo \">> Installing recovery\"; + echo \"\"; + echo \"\"; + update recovery mmc ${INSTALL_MMCDEV} fat ${INSTALL_RECOVERY_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update recovery partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; + echo \"\"; + echo \"\"; + echo \">> Installing Linux root file system\"; + echo \"\"; + echo \"\"; + update rootfs mmc ${INSTALL_MMCDEV} fat ${INSTALL_ROOTFS_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update rootfs partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; + echo \"\"; + setenv boot_recovery yes; + setenv recovery_command wipe_update; + saveenv; + echo \"\"; + echo \"\"; + echo \">> Firmware installation complete. Rebooting into recovery mode for final deployment.\"; + echo \"\"; + echo \"\"; + sleep 1; + reset; +" + +saveenv +reset diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6sbc/boot.txt similarity index 100% rename from meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/boot.txt rename to meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6sbc/boot.txt diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6sbc/install_linux_fw_sd.txt similarity index 100% rename from meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/install_linux_fw_sd.txt rename to meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6sbc/install_linux_fw_sd.txt diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-rev_2013.01.inc b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-rev_2013.01.inc deleted file mode 100644 index 03d459756..000000000 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-rev_2013.01.inc +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (C) 2013 Digi International - -SRCBRANCH = "v2013.01/dub-2.0/maint" -SRCREV = "${AUTOREV}" - -# Select internal or Github U-Boot repo -UBOOT_GIT_URI ?= "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${DIGI_GIT}u-boot-denx.git', '${DIGI_GITHUB_GIT}/u-boot.git', d)}" - -SRC_URI = "${UBOOT_GIT_URI};branch=${SRCBRANCH}" - -UBOOT_NVRAM_LIBPATH = "git/board/digi/common/cmd_nvram/lib" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2013.01.bb b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2013.01.bb deleted file mode 100644 index d78543dbc..000000000 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2013.01.bb +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2012 Digi International - -DESCRIPTION = "Bootloader for Digi platforms" -require recipes-bsp/u-boot/u-boot.inc -include u-boot-dey-rev_${PV}.inc - -PROVIDES += "u-boot" - -LICENSE = "GPLv2+" -LIC_FILES_CHKSUM = "file://COPYING;md5=1707d6db1d42237583f50183a5651ecb" - -SRC_URI += "file://boot.txt" - -S = "${WORKDIR}/git" - -DEPENDS += "elftosb-native u-boot-mkimage-native" - -do_compile_prepend() { - ${S}/tools/setlocalversion --save-scmversion ${S} -} - -do_deploy_append() { - mkimage -T script -n bootscript -C none -d ${WORKDIR}/boot.txt ${DEPLOYDIR}/boot.scr -} - -COMPATIBLE_MACHINE = "(ccardimx28)" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend index 547138192..5dc685e89 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend @@ -88,4 +88,4 @@ pkg_postinst_${PN}() { fi } -COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul)" +COMPATIBLE_MACHINE = "(ccimx6sbc|ccimx6qpsbc|ccimx6ul)" diff --git a/meta-digi-arm/recipes-bsp/ubootenv/ubootenv.bb b/meta-digi-arm/recipes-bsp/ubootenv/ubootenv.bb deleted file mode 100644 index 680a4bb24..000000000 --- a/meta-digi-arm/recipes-bsp/ubootenv/ubootenv.bb +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2013 Digi International. - -SUMMARY = "Digi's ubootenv tool" -SECTION = "base" -LICENSE = "GPL-2.0" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" - -DEPENDS = "libdigi nvram" - -SRC_URI = " \ - file://env_funcs.c \ - file://env_funcs.h \ - file://environment.h \ - file://main_env.c \ -" - -S = "${WORKDIR}" - -GIT_SHA1 = "$(cd ${THISDIR} && git rev-parse --short=7 HEAD)" - -EXTRA_CFLAGS = "-Wall -DLINUX -DGIT_SHA1=\"${GIT_SHA1}\" -I${STAGING_INCDIR}/libdigi" - -do_compile() { - ${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c -o main_env.o main_env.c - ${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c -o env_funcs.o env_funcs.c - ${CC} ${LDFLAGS} -o ubootenv main_env.o env_funcs.o -lnvram -ldigi -} - -do_install() { - mkdir -p ${D}${base_sbindir} - install -m 0755 ubootenv ${D}${base_sbindir}/ -} - -PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/meta-digi-arm/recipes-bsp/ubootenv/ubootenv/env_funcs.c b/meta-digi-arm/recipes-bsp/ubootenv/ubootenv/env_funcs.c deleted file mode 100644 index 588c9b6c6..000000000 --- a/meta-digi-arm/recipes-bsp/ubootenv/ubootenv/env_funcs.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * env_funcs.c - * - * Copyright (C) 2006-2013 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * Description: Function prototypes for all the flavors of the NVRAM tool - * - */ - -#include -#include - -#include "env_funcs.h" - -/* - * Function: get_var_value - * Return: NULL on failure/ pointer where var value starts on succes - * Description: Checks if the variable name is contained on the string and - * returns a pointer where the variable value starts. - */ -char *get_var_value(const char *from, const char *var_name, char sep) -{ - char *separator; - char *start; - - if (((separator = strchr(from, sep)) != NULL) && - ((start = strstr(from, var_name)) != NULL)) { - if (start < separator) - return (++separator); - } - - return NULL; -} - -/* - * Function: get_var_name - * Return: 1 on success, 0 otherwise - * Description: Retrieves the var name from a var string - */ -int get_var_name(const char *from, char *var_name, char sep) -{ - char *separator; - - if ((separator = strchr(from, sep)) != NULL) { - while (from < separator) - *var_name++ = *from++; - *var_name = 0; - return 1; - } - return 0; -} - -/* - * Function: get_next_env_string - * Return: the string to the next environment variable in UBOOT or - * NULL on failure - * Description: returns the addr of the next string in a data structure - * \0\0\0 - * It does an offset calculation to check for overflow. - */ -char *get_next_env_string(char *from, char *till) -{ - if (*from == 0) - return NULL; - - while (from < till && *from) - from++; - - if (from == till && *from) - return NULL; // Indicate string to long - - return (++from); -} - -/* - * Function: get_var_addr - * Return: the pointer to the address string or NULL if not found. - * Description: Returns the addr of the variable in a data structure - * \0\0\0 - * It does an offset calculation to check for overflow. - */ -char *get_var_addr(char *from, char *till, char *var_name) -{ - char *data = from; - char *var_addr; - char var_name_temp[ENV_MAX_VAR_NAME_LEN + 1]; - - sprintf(var_name_temp, "%s%s", var_name, "="); - - do { - if (*data && data < till) { - if ((var_addr = strstr(data, var_name_temp)) != NULL - && (var_addr == data)) - return var_addr < till ? var_addr : NULL; - } - } while ((data = get_next_env_string(data, till)) != NULL); - - return NULL; -} - -/* - * Function: get_end_mark - * Description: - */ -char *get_end_mark(char *from, char *till) -{ - while (from < till) { - while (*from) - from++; - if (from >= till) - return NULL; - if (*(++from) == 0) - return from; - } - return NULL; -} - -/* - * Function: remove_var - * Return: 1 on success, 0 otherwise - * Description: Remove environment variables - */ -int remove_var(char *from, char *till, char *var_name) -{ - char *var_addr; - char *env_end; - char *var_end; - - /* Check if variable already exists */ - if ((var_addr = get_var_addr(from, till, var_name)) != NULL) { - if ((env_end = get_end_mark(var_addr, till)) != NULL) { - if ((var_end = get_next_env_string(var_addr, till)) != NULL) { - while (var_end <= env_end) - *var_addr++ = *var_end++; - while (var_addr <= env_end) - *var_addr++ = 0; /* Just to have a clean environment :-) */ - return 1; - } - } - } - - return 0; -} - -/* - * Function: add_var - * Return: 1 on success, 0 otherwise - * Description: Add a new environment variable - */ -int add_var(char *from, char *till, char *var_str) -{ - char *var_addr; - char var_name[ENV_MAX_VAR_NAME_LEN]; - - if (get_var_name(var_str, var_name, '=')) { - /* Check if variable already exists */ - if ((var_addr = get_var_addr(from, till, var_name)) != NULL) { - /* @TODO: remove more?? could be that it were there more than once?? */ - if (!remove_var(var_addr, till, var_name)) - return 0; - } - /* Append the variable to the end */ - if ((var_addr = get_end_mark(from, till)) != NULL) { - /* Check if environment is empty. If yes, start from the beginning */ - if (var_addr == (from + 1)) - var_addr--; - while (var_addr < till && *var_str) - *var_addr++ = *var_str++; - *var_addr++ = 0; - *var_addr = 0; - return 1; - } else { - fprintf(stderr, "Unable to find environment end\n"); - } - } - - return 0; -} diff --git a/meta-digi-arm/recipes-bsp/ubootenv/ubootenv/env_funcs.h b/meta-digi-arm/recipes-bsp/ubootenv/ubootenv/env_funcs.h deleted file mode 100644 index 051ca0662..000000000 --- a/meta-digi-arm/recipes-bsp/ubootenv/ubootenv/env_funcs.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * env_funcs.h - * - * Copyright (C) 2006-2013 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * Description: Data types and prototypes for parsing the NVRAM environment - * - */ - -#ifndef ENV_FUNCS_H -#define ENV_FUNCS_H - -#define ENV_MAX_VAR_NAME_LEN 50 -#define ENV_MAX_VAR_VAL_LEN 256 - -char *get_var_value(const char *from, const char *var_name, char sep); -char *get_next_env_string(char *from, char *till); -char *get_var_addr(char *from, char *till, char *var_name); -char *get_end_mark(char *from, char *till); -int get_var_name(const char *from, char *var_name, char sep); -int add_var(char *from, char *till, char *var_str); -int remove_var(char *from, char *till, char *var_name); - -#endif diff --git a/meta-digi-arm/recipes-bsp/ubootenv/ubootenv/environment.h b/meta-digi-arm/recipes-bsp/ubootenv/ubootenv/environment.h deleted file mode 100644 index ea60bd84a..000000000 --- a/meta-digi-arm/recipes-bsp/ubootenv/ubootenv/environment.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * environment.h - * - * Copyright (C) 2006-2013 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * Description: Data types and definitions for environment in NVRAM - * - */ - -#ifndef __ENV_TOOL_H_ -#define __ENV_TOOL_H_ - -#define VAR_SEP '\0' -#define VAR_ASIGN '=' - -typedef struct { - unsigned long crc; - char data[]; -} env_t; - -#endif diff --git a/meta-digi-arm/recipes-bsp/ubootenv/ubootenv/main_env.c b/meta-digi-arm/recipes-bsp/ubootenv/ubootenv/main_env.c deleted file mode 100644 index 1e5a7257f..000000000 --- a/meta-digi-arm/recipes-bsp/ubootenv/ubootenv/main_env.c +++ /dev/null @@ -1,561 +0,0 @@ -/* - * main_env.c - * - * Copyright (C) 2006-2013 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * Description: main() and user code to manage u-boot and linux environment - * - */ - -#define VERSION "1.8" "-g"GIT_SHA1 - -#include -#include -#include -#include /* MEMERASE */ -#include -#include -#include -#include /* ioctl */ -#include - -#include - -#include /* Nv* */ - -#include "env_funcs.h" -#include "environment.h" - -#define APP_UBOOTENV "ubootenv" -#define APP_PRODINFOENV "prodinfoenv" - -static char *fileadd = NULL; -static char *printlist = NULL; -static char *setstring = NULL; -static char *eraselist = NULL; -static char *cmdname = NULL; -static int dump = 0, clean = 0; -static nv_os_type_e envType; - -static const char *envTypes[] = { - [NVOS_NONE] = "None", - [NVOS_UBOOT] = "U-Boot", - [NVOS_PROD_INFO] = "Product Info", -}; - -static const size_t envDefaultSizes[] = { - [NVOS_NONE] = 0, - [NVOS_UBOOT] = 8192, /* Default value is CONFIG_ENV_SIZE, normally set by U-Boot */ - [NVOS_PROD_INFO] = PROD_INFO_DATA_SIZE, /* Defined in nvram.h but shouldn't be except uboot needs it */ -}; - -static const char* excludeVars[][2] = { - {"ethaddr", "ethaddr1" }, - {"wlanaddr", "ethaddr2" }, - {"eth1addr", "ethaddr3" }, - {"ipaddr", "ip1" }, - {"ipaddr_wlan", "ip2" }, - {"ipaddr1", "ip3" }, - {"netmask", "netmask1" }, - {"netmask_wlan","netmask2" }, - {"netmask1", "netmask3" }, - {"serverip", "server" }, - {"gatewayip", "gateway" }, - {"dnsip", "dns1" }, - {"dnsip2", "dns2" }, - {"dhcp", "dhcp1" }, - {"dhcp_wlan", "dhcp2" }, - {"dhcp1", "dhcp3" }, -}; - -static const char *env_os_type_to_string(void) -{ - return envTypes[envType]; -} - -static int env_onetime_writable(void) -{ - if (NVOS_PROD_INFO == envType) - return 1; - - return 0; -} - -static int env_is_empty(env_t * env, unsigned int envlen) -{ - char *from = (char *)&env->data; - char *till = (char *)&env->data + envlen; - char *end; - - end = get_end_mark(from, till); - /* Check if environment is empty. If yes, start from the beginning */ - if (end == (from + 1)) - return 1; - - return 0; -} - -static int env_have_to_use_nvram(const char *varname) -{ - int j; - - if (envType == NVOS_UBOOT) { - for (j = 0; j < ARRAY_SIZE(excludeVars); j++) { - if (strcmp(varname, excludeVars[j][0]) == 0) - return j; - } - } - return -1; -} - -static void show_usage(void) -{ - fprintf(stdout, "Usage: %s [options]\n" - "%s %s Copyright Digi International Inc.\n\n" - "Prints or updates the %s environment\n" - "\n" - " -d, --dump Prints the values of all the environment\n" - " -p, --print 'var_name_list' Prints the value of the list of variables\n" - " The list has to be simple quoted ('')\n" - " -s, --set 'var_name=var_value' Sets var_value in the variable var_name\n" - " The string has to be simple quoted ('') to allow\n" - " spaces\n" - " -e --erase 'var_name_list' Removes the list of variables (simple quoted)\n" - " -c --clean Removes all variables\n" - " -a --fileadd file_name Adds variables from file_name. To init the full\n" - " environment from file use -c -a simultaneously\n" - " -h --help Displays usage information\n\n", - cmdname, cmdname, VERSION, env_os_type_to_string()); - - if (env_onetime_writable()) { - fprintf(stdout, " WARNING: Variables can only be set the first time\n" - " and become read-only afterwards.\n"); - } -} - -static void show_usage_and_exit(int exit_code) -{ - show_usage(); - exit(exit_code); -} - -static void process_options(int argc, char *argv[]) -{ - int opt_index, opt, optcount = 0; - static const char *short_options = "?hdcp:s:e:a:"; - static const struct option long_options[] = { - {"dump", no_argument, NULL, 'd'}, - {"help", no_argument, NULL, 'h'}, - {"erase", required_argument, NULL, 'e'}, - {"clean", no_argument, NULL, 'c'}, - {"fileadd", required_argument, NULL, 'a'}, - {"print", required_argument, NULL, 'p'}, - {"set", required_argument, NULL, 's'}, - {0, 0, 0, 0}, - }; - - for (opt_index = 0;;) { - - opt = getopt_long(argc, argv, short_options, long_options, &opt_index); - if (opt == EOF) - break; - - switch (opt) { - case 'd': - dump = 1; - break; - case 'p': - printlist = optarg; - break; - case 's': - setstring = optarg; - break; - case 'a': - fileadd = optarg; - break; - case 'e': - eraselist = optarg; - break; - case 'c': - clean = 1; - break; - case 'h': - case '?': - show_usage_and_exit(EXIT_SUCCESS); - break; - } - optcount++; - } - - if (optcount == 0) - show_usage_and_exit(EXIT_FAILURE); - - /* Check options */ - if (dump && (printlist != NULL)) { - fprintf(stderr, "--dump and --print can't be used simultaneously\n"); - show_usage_and_exit(EXIT_FAILURE); - } - if (clean && (eraselist != NULL)) { - fprintf(stderr, "--clean and --erase can't be used simultaneously\n"); - show_usage_and_exit(EXIT_FAILURE); - } -} - -static int env_add_var(const char *varstring, env_t * env, unsigned int envlen) -{ - char *nvramCmd[3] = { "set", "network", NULL }; - char tmpstr[50]; - - char *varval; - int j; - - if (varstring == NULL) - return -EINVAL; - - if (!get_var_name(varstring, tmpstr, VAR_ASIGN)) - return -EINVAL; - - /* Check if is a special variable */ - if ((j = env_have_to_use_nvram(tmpstr)) != -1) { - if ((varval = get_var_value(varstring, excludeVars[j][0], VAR_ASIGN)) != NULL) { - /* Define command to be used by nvram */ - sprintf(tmpstr, "%s=%s", excludeVars[j][1], varval); - nvramCmd[2] = tmpstr; - if (!NvCmdLine(3, (const char **)nvramCmd)) { - return -EINVAL; - } - } - } else { - if (!add_var(env->data, env->data + envlen, (char *)varstring)) { - return -EINVAL; - } - } - - return 0; -} - -static int env_add_vars_from_file(char *filename, env_t * env, unsigned int envlen) -{ - FILE *fp; - char line[ENV_MAX_VAR_NAME_LEN + ENV_MAX_VAR_VAL_LEN + 3]; - int ret = EXIT_SUCCESS; - - if ((fp = fopen(filename, "r")) == NULL) - return -errno; - - while (!feof(fp)) { - if (fgets(line, sizeof(line), fp)) { - /* TODO should we remove comments starting with # ?? */ - /* Remove '\n' */ - if (line[strlen(line) - 1] == '\n') - line[strlen(line) - 1] = 0; - if (env_add_var((const char *)line, env, envlen)) { - fprintf(stderr, "Unable to add environment variable %s\n", - line); - ret = -EINVAL; - goto out; - } - } - } - - out: - if (fp) - fclose(fp); - return ret; -} - -static void env_remove_varlist(const char *varlist, env_t * env, unsigned int envlen) -{ - char *var; - - var = strtok((char *)varlist, " "); - - while (var != NULL) { - if (!remove_var(env->data, env->data + envlen, var)) - fprintf(stderr, "Unable to remove environment variable %s\n", var); - var = strtok(NULL, " "); - } -} - -static int env_validate(env_t * env, int datalen, int verbose) -{ - unsigned long new_crc; - - /* Check stored crc with data */ - new_crc = crc32(0, (const unsigned char *)env->data, datalen); - - if ((unsigned int)env->crc != new_crc) { - if ( verbose ) { - fprintf(stderr, "CRC failure: got 0x%08x expected 0x%08x\n", - (unsigned int)env->crc, (unsigned int)new_crc); - } - return 1; - } - return 0; -} - -static void env_printenv_nvram_vars(char *varname) -{ - struct nv_critical *crit; - nv_param_ip_t *ip_params; - int index; - int oneloop = 0; - - if (NvCriticalGet(&crit)) { - - ip_params = &crit->s.p.xIP; - for (index = 3; index < ARRAY_SIZE(excludeVars); index++) { - if (varname != NULL) { - if ((index = env_have_to_use_nvram(varname)) == -1) - break; - oneloop = 1; - } - - switch (index) { - case 3: - fprintf(stdout, "ipaddr=%s\n", - NvToStringIP(ip_params->axDevice[0].uiIP)); - break; - case 4: - fprintf(stdout, "ipaddr_wlan=%s\n", - NvToStringIP(ip_params->axDevice[1].uiIP)); - break; - case 5: - fprintf(stdout, "ipaddr1=%s\n", - NvToStringIP(crit->s.p.eth1dev.uiIP)); - break; - case 6: - fprintf(stdout, "netmask=%s\n", - NvToStringIP(ip_params->axDevice[0].uiNetMask)); - break; - case 7: - fprintf(stdout, "netmask_wlan=%s\n", - NvToStringIP(ip_params->axDevice[1].uiNetMask)); - break; - case 8: - fprintf(stdout, "netmask1=%s\n", - NvToStringIP(crit->s.p.eth1dev.uiNetMask)); - break; - case 9: - fprintf(stdout, "serverip=%s\n", - NvToStringIP(ip_params->uiIPServer)); - break; - case 10: - fprintf(stdout, "gatewayip=%s\n", - NvToStringIP(ip_params->uiIPGateway)); - break; - case 11: - fprintf(stdout, "dnsip=%s\n", - NvToStringIP(ip_params->auiIPDNS[0])); - break; - case 12: - fprintf(stdout, "dnsip2=%s\n", - NvToStringIP(ip_params->auiIPDNS[1])); - break; - case 13: - fprintf(stdout, "dhcp=%s\n", - (ip_params->axDevice[0].flags.bDHCP ? "on" : "off")); - break; - case 14: - fprintf(stdout, "dhcp_wlan=%s\n", - (ip_params->axDevice[1].flags.bDHCP ? "on" : "off")); - break; - case 15: - fprintf(stdout, "dhcp1=%s\n", - (crit->s.p.eth1dev.flags.bDHCP ? "on" : "off")); - break; - } - if (oneloop) - break; - } - } -} - -static void env_printenv(int dump, char *varlist, env_t * env, unsigned int envlen) -{ - char *var; - char *data = env->data; - char *varinenv; - - if (dump) { - /* print the full environment */ - while (data != NULL && *data) { - fprintf(stdout, "%s\n", data); - data = get_next_env_string(data, env->data + envlen); - } - if (envType == NVOS_UBOOT) - env_printenv_nvram_vars(NULL); - return; - } else { - var = strtok((char *)varlist, " "); - - while (var != NULL) { - - if (envType == NVOS_UBOOT) - env_printenv_nvram_vars(var); - if ((varinenv = - get_var_addr(env->data, env->data + envlen, var)) != NULL) { - fprintf(stdout, "%s\n", varinenv); - } - var = strtok(NULL, " "); - } - } -} - -int main(int argc, char *argv[]) -{ - unsigned int envlen = 0; - env_t *env = NULL; - nv_param_os_cfg_t xCfg; - size_t iSize; - int save_env = 0; - int ret = EXIT_SUCCESS; - int found; - char *cmdstart; - - cmdname = argv[0]; - - cmdname = *argv; - - if ((cmdstart = strrchr(cmdname, '/')) != NULL) { - cmdname = cmdstart + 1; - } - - if (strcmp(cmdname, APP_UBOOTENV) == 0) - envType = NVOS_UBOOT; - else if (strcmp(cmdname, APP_PRODINFOENV) == 0) - envType = NVOS_PROD_INFO; - else { - fprintf(stderr, "This application can be invoked as:\n" - "%s\n%s\n\n", APP_UBOOTENV, APP_PRODINFOENV); - return EXIT_FAILURE; - } - - /* read and process command line */ - process_options(argc, argv); - - if (!NvInit(NVR_AUTO)) { - fprintf(stderr, "Unable to initialize nvram\n"); - return EXIT_FAILURE; - } - - found = NvOSCfgFind(&xCfg, envType); - - if (!found && clean) { - /* Add missing section to nvram if --clean specified */ - - if (envDefaultSizes[envType] != 0 ) { - if (!NvOSCfgAdd(envType, envDefaultSizes[envType])) { - fprintf(stderr, "Unable to add missing %s environment to flash\n", - env_os_type_to_string()); - return EXIT_FAILURE; - } - - /* Try again to find our section */ - found = NvOSCfgFind(&xCfg, envType); - } - } - - if (!found) { - fprintf(stderr, "Unable to detect %s environment in flash\n", - env_os_type_to_string()); - return EXIT_FAILURE; - } - - env = malloc(xCfg.uiSize); - if (NULL == env) { - perror("malloc"); - return EXIT_FAILURE; - } - - memset(env, 0, xCfg.uiSize); - /* Adjust envlen for just for data, crc32 value not included */ - envlen = xCfg.uiSize - sizeof(unsigned long); - - if (!NvOSCfgGet(envType, (void *)env, xCfg.uiSize, &iSize)) { - /* This can't fail; we either found it, created it, or exited. */ - /* But just to be safe... */ - fprintf(stderr, "Unable to get %s environment from flash\n", - env_os_type_to_string()); - ret = EXIT_FAILURE; - goto free_and_ret; - } - - /* Check if env is one-time writable, is valid, and was already written */ - if (env_onetime_writable() && !env_validate(env, envlen, 0) && - !env_is_empty(env, envlen)) { - if ( clean || fileadd || eraselist || setstring ) { - fprintf(stderr, "Environment is one-time writable only\n"); - ret = EXIT_FAILURE; - goto free_and_ret; - } - } - - if (clean) { - memset(env, 0, xCfg.uiSize); - save_env = 1; - } else { - if (env_validate(env, envlen, 1)) { - fprintf(stderr, "Invalid %s environment found\n", - env_os_type_to_string()); - ret = EXIT_FAILURE; - goto free_and_ret; - } - } - - if (fileadd != NULL) { - if (env_add_vars_from_file(fileadd, env, envlen) < 0) { - fprintf(stderr, "Unable to add %s environment from file %s\n", - env_os_type_to_string(), fileadd); - ret = EXIT_FAILURE; - goto free_and_ret; - } - save_env = 1; - } - - if (eraselist != NULL) { - env_remove_varlist(eraselist, env, envlen); - save_env = 1; - } - - if (setstring != NULL) { - if (env_add_var(setstring, env, envlen)) { - fprintf(stderr, "Unable to add environment variable %s\n", setstring); - ret = EXIT_FAILURE; - goto free_and_ret; - } - save_env = 1; - } - - if (dump) { - env_printenv(1, NULL, env, envlen); - } else if (printlist != NULL) { - env_printenv(0, printlist, env, envlen); - } - - if (save_env) { - /* Compute new crc32 value just in case we are going to update the value in flash */ - env->crc = crc32(0, (const unsigned char *)env->data, envlen); - - if (!NvOSCfgSet(envType, env, xCfg.uiSize)) { - fprintf(stderr, "Unable to set %s environment to store in flash\n", - env_os_type_to_string()); - ret = EXIT_FAILURE; - } - if (!NvSave()) { - fprintf(stderr, "Unable to save %s environment in flash\n", - env_os_type_to_string()); - ret = EXIT_FAILURE; - } - } - - free_and_ret: - free(env); - return ret; -} - diff --git a/meta-digi-arm/recipes-bsp/update-flash/update-flash.bb b/meta-digi-arm/recipes-bsp/update-flash/update-flash.bb deleted file mode 100644 index 49194d0b7..000000000 --- a/meta-digi-arm/recipes-bsp/update-flash/update-flash.bb +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2013,2017 Digi International. - -SUMMARY = "Digi's update test utility" -SECTION = "base" -LICENSE = "GPL-2.0" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" - -DEPENDS += "libdigi" -RDEPENDS_${PN}_append_mxs = " kobs-ng" - -SRC_URI = "file://update_flash.c \ - file://jffs2-user.h \ - " - -GIT_SHA1 = "$(cd ${THISDIR} && git rev-parse --short HEAD)" - -S = "${WORKDIR}" - -do_compile() { - ${CC} -O2 -Wall ${LDFLAGS} -DGIT_SHA1=\"${GIT_SHA1}\" update_flash.c -o update_flash -ldigi -} - -do_install() { - install -d ${D}${bindir} - install -m 0755 update_flash ${D}${bindir} -} diff --git a/meta-digi-arm/recipes-bsp/update-flash/update-flash/jffs2-user.h b/meta-digi-arm/recipes-bsp/update-flash/update-flash/jffs2-user.h deleted file mode 100644 index 001685d7f..000000000 --- a/meta-digi-arm/recipes-bsp/update-flash/update-flash/jffs2-user.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * JFFS2 definitions for use in user space only - */ - -#ifndef __JFFS2_USER_H__ -#define __JFFS2_USER_H__ - -/* This file is blessed for inclusion by userspace */ -#include -#include -#include - -#undef cpu_to_je16 -#undef cpu_to_je32 -#undef cpu_to_jemode -#undef je16_to_cpu -#undef je32_to_cpu -#undef jemode_to_cpu - -extern int target_endian; - -#define t16(x) ({ uint16_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); }) -#define t32(x) ({ uint32_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); }) - -#define cpu_to_je16(x) ((jint16_t){t16(x)}) -#define cpu_to_je32(x) ((jint32_t){t32(x)}) -#define cpu_to_jemode(x) ((jmode_t){t32(x)}) - -#define je16_to_cpu(x) (t16((x).v16)) -#define je32_to_cpu(x) (t32((x).v32)) -#define jemode_to_cpu(x) (t32((x).m)) - -#endif /* __JFFS2_USER_H__ */ diff --git a/meta-digi-arm/recipes-bsp/update-flash/update-flash/update_flash.c b/meta-digi-arm/recipes-bsp/update-flash/update-flash/update_flash.c deleted file mode 100644 index 4c91ab90f..000000000 --- a/meta-digi-arm/recipes-bsp/update-flash/update-flash/update_flash.c +++ /dev/null @@ -1,1770 +0,0 @@ -/* - * update_flash.c - * - * Copyright (C) 2006 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - */ -/* - * - * !Revision: $Revision: 1.25 $ - * !Descr: Flash Test Util - * !References: [1] mtd-utils/flash_eraseall.c - * [2] http://www.linux-mtd.infradead.org/doc/nand.html - * [3] http://www.linux-mtd.infradead.org/tech/mtdnand/x255.html - */ - -#define _XOPEN_SOURCE 500 /* for pread/pwrite */ - -#include /* ENOENT */ -#include /* open */ -#include /* basename */ -#include /* regexp */ -#include /* kill */ -#include /* varg */ -#include /* printf */ -#include /* EXIT_SUCCESS */ -#include /* memset */ -#include /* close */ -#include /* reboot */ - -#include /* ntohl */ -#include /* setmntent */ -#include /* ioctl */ -#include /* mount */ -#include /* stat */ -#include /* statfs */ - -#include /* MEMERASE */ - -static int target_endian = __BYTE_ORDER; /* for jffs2-user.h, cpu_to_je16 */ -#include "jffs2-user.h" /* jffs2_unknown_node */ - -/* libdigi */ -#include -#include -#include -#include -#include -#include - -#define VERSION "1.25" "-g"GIT_SHA1 - -/* man statfs does mention them, but they are only defined inside kernel */ -#define NFS_SUPER_MAGIC 0x6969 /* linux/nfs_fs.h */ -#define JFFS2_SUPER_MAGIC 0x72b6 /* linux/jffs2.h */ - -#define IO_BLOCK_SIZE 65536 - -#define FLASH_ERASED_BYTE 0xff - -#define WARNING "!!! " -#define INFO "--- " - -#define PRINTF(...) \ - do { \ - if (!cSilent) \ - printf(__VA_ARGS__); \ - } while (0) - -#define PERCENTAGE(iCurrent, iTotal) ((iCurrent * 100) / (iTotal ? iTotal : 1)) - -#define SET_CRC32(pMtd, uiCRC32) \ - do { \ - pMtd->uiCRC32 = uiCRC32; \ - pMtd->cChecksumSet = 1; \ - } while (0) - -/* open it at least read-only so we can see whether open fails or not */ -#define OPEN_READWRITE_IF_NOT_DRY ((cDryRun ? O_RDONLY : O_RDWR) | O_SYNC) - -/* ********** data types ********** */ - -typedef enum { - PTUBoot = 0, - PTKernel, - PTEnvironment, - PTFPGA, - PTBootstream, - PTUnknown /* always last */ -} PartType_e; - -typedef enum { - FTUBoot = 0, - FTKernel, - FTFPGA, - FTNVRAM, - FTJFFS2, - FTSQUASHFS, - FTUBI, - FTBootstream, - FTUnknown /* always last */ -} FileType_e; - -typedef struct { - /* configuration data */ - const char *szOrigImageFileName; - const char *szImageFileName; /* may later be /tmp/ */ - unsigned int uiPartition; - char cChecksumSet; - char cEraseAll; - uint32_t uiCRC32; - - /* auto-detected */ - char cChecksumCalculated; - char acName[64]; - char cIsNAND; - char cWriteCleanMarker; - char cFileType; - char cIsJFFS2; - loff_t iSize; - loff_t iFileSize; - size_t iPageSize; - mtd_info_t xInfo; - unsigned int uiBadBlocks; - PartType_e ePartType; - FileType_e eFileType; - FileType_e eFileTypeNeeded; - - /* open handles */ - int iFd; /* of Partition */ - - /* status */ - char cAlreadyPrintedVerifyWarning; - char cAlreadyRemounted; - - unsigned int uiClMPos; - unsigned int uiClMLen; - struct jffs2_unknown_node xCleanMarker; -} mtdPartition_t; - - -/* ********** function definitions ********** */ - -/* top level functions */ -static void DoPrintChecksums(void); -static void DoMtdUpdate(void); -static void DoMtdVerify(void); - -static void OnExit(void); - -/* helper functions */ -static void MtdInit(void); -static void MtdPartInit( /*@out@ */ mtdPartition_t * pMtd, unsigned int uiPartition, - const char *szImageFileName); -static void MtdPartOpen( /*@inout@ */ mtdPartition_t * pMtd, char cReadOnly); -static void MtdPartClose( /*@inout@ */ mtdPartition_t * pMtd); -static int MtdPartIsBadBlock(const mtdPartition_t * pMtd, loff_t iOffset); -static void MtdPartUseFile( /*@inout@ */ mtdPartition_t * pMtd, const char *szImageFileName); -static void MtdPartErase(const mtdPartition_t * pMtd); -static void MtdPartWrite(mtdPartition_t * pMtd); -static int MtdPartVerify(mtdPartition_t * pMtd); -static void MtdPartCheckCRC32(mtdPartition_t * pMtd); -static void MtdPartCopyFile(mtdPartition_t * pMtd, const char *szDstFileName); -static void MtdPartInitCleanMarker(const mtdPartition_t * pMtd, - struct jffs2_unknown_node *pCleanMarker, - unsigned int *puiClMPos, unsigned int *puiClMLen); -static void MtdPartInitJFFS2Node(struct jffs2_unknown_node *pNode, unsigned short uhNodeType, - size_t iLen); -static void MtdPartCompareCRC32(mtdPartition_t * pMtd, uint32_t uiCRC32); -static void MtdPartRemountAllReadOnly(mtdPartition_t * pMtd); -static void MtdPartDeterminePartType(mtdPartition_t * pMtd); -static void MtdPartDetermineAndCheckFileType(mtdPartition_t * pMtd); -static void MtdPartVerifyFile(mtdPartition_t * pMtd); -static void MtdPartVerifyJFFS2Block(mtdPartition_t * pMtd, unsigned char *pucData, - size_t iSize); -static int MtdPartGetThrottle(const mtdPartition_t * pMtd, uint64_t ullSize); -static void PrintProgress(int iPercentage, int iThrottle, const char *szFmt, ...); -static void VerifyTmpDir(void); -static uint32_t CalcCRC32OfFile(const char *szFileName); -static const char *GetRootDevice(void); -static void mtd_part_write_ubi(mtdPartition_t * pMtd); - -/* ********** local variables ********** */ - -/* set by command line */ -static const char *szTmpDir = NULL; -static const char *szKey = NULL; -static char cNoImageTypeCheck = 0; -static char cProgressInNewLine = 0; -static char cSilent = 0; -static char cChecksumOnly = 0; -static char cDoReboot = 0; -static char cHasChecksum = 0; -static char cWriteCleanMarker = 0; -static char cDryRun = 0; -static char cVerify = 0; -static char cVerifyOnly = 0; -static char cEraseAll = 0; -static char cMaxRetries = 3; -static char cMarkBadBlocks = 0; - -/* calculated */ -static mtdPartition_t axMtdParts[64]; -static mtdPartition_t *pMtdPartLastToUpdate = axMtdParts; -static const char *szMtdPrefix = "/dev/mtd/"; -static const char *szMtdBlockPrefix = "/dev/mtdblock/"; -static unsigned int uiMtdPartsCount = 0; - -#define MK(x, szName)[x] = szName -static const char *aszPartType[PTUnknown + 1] = { - MK(PTUBoot, "U-Boot"), - MK(PTKernel, "Kernel"), - MK(PTEnvironment, "NVRAM"), - MK(PTFPGA, "FPGA"), - MK(PTBootstream, "Bstrm-U-Boot"), - MK(PTUnknown, "Unknown"), -}; -#undef MK - -#define MK(x, szRegExp, szName)[x] = {szRegExp, szName} -static const struct { - const char *szExp; - const char *szName; -} axFileType[FTUnknown + 1] = { - MK(FTUBoot, "u-boot-.*\\.bin", "UBoot"), - MK(FTNVRAM, "nvram-.*", "NVRAM"), - MK(FTKernel, "uImage-.*", "Kernel"), - MK(FTFPGA, ".*\\.biu", "FPGA"), - MK(FTJFFS2, ".*\\.jffs2", "JFFS2"), - MK(FTSQUASHFS, ".*\\.squashfs", "SQUASHFS"), - MK(FTUBI, ".*\\.ubi", "UBI"), - MK(FTBootstream, ".*\\.sb", "Bootstream"), - MK(FTUnknown, ".*", "Unknown"), -}; -#undef MK - -/* ********** function implementations ********** */ - -int main(int argc, char *argv[]) -{ - int iPartListIndex; - - CmdOptEntry aCmdEntries[] = { - {COT_BOOL, 'C', &cChecksumOnly, "checksum-only", - "calculates only CRC32 checksum of image"}, - {COT_BOOL, 'R', &cDoReboot, "reboot", - "reboots the system"}, - {COT_BOOL, 'V', &cVerifyOnly, "verify-only", - "verifies current contents, no updates are done"}, - {COT_BOOL, 'v', &cVerify, "verify", - "After flashing, compare flash contents with image on byte-to-byte"}, - {COT_BOOL, 'c', &cHasChecksum, "checksum", - "flashes only when checksum matches"}, - {COT_BOOL, -1, &cDryRun, "dry-run", - "don't erase or write to the flash"}, - {COT_BOOL, -1, &cProgressInNewLine, "progress-in-new-line", - "each percentage is printed in an own line"}, - {COT_BOOL, 'i', &cNoImageTypeCheck, "no-image-type-check", - "doesn't check image type for partition"}, - {COT_BOOL, 'f', &cEraseAll, "erase-all", - "erases the partition, not only the parts being written"}, - {COT_BOOL, -1, &cWriteCleanMarker, "clean-marker", - "writes clean markers to every partition (implies -f)"}, - {COT_BOOL, 'b' , &cMarkBadBlocks, "bad-block-marking", - "On repeated error, marks block as bad."}, - {COT_BOOL, 's', &cSilent, "silent", - "Silent Mode"}, - {COT_STRING, 't', &szTmpDir, "tmpdir", - "copy files to temporary directory before flashing"}, - {COT_STRING, 'k', &szKey, "encrypt_key", - "Verify bootstream image against encryption key"}, - {COT_MORE, 0, NULL, "", - "file to flash to partition and check for checksum"}, - {COT_NONE, 0, NULL, NULL, NULL}, - }; - - CLEAR(axMtdParts); - - szCmdOptVersion = "Version: " VERSION ", compiled on " __DATE__ "," __TIME__; - iPartListIndex = cmdOptParse(argc, argv, aCmdEntries, - "Flash Update Tool\n\n" - "Examples of use cases:\n" - " update_flash rootfs-ccw9cjsnand-128.jffs2 4\n" - " => updates partition /dev/mtd4 with rootfs image\n" - "\n" - " update_flash -C uImage-ccw9cjsnand\n" - " => calculates file CRC32 only\n" - "\n" - " update_flash -c uImage-ccw9cjsnand 3 0x1051e3c9\n" - " => updates partition /dev/mtd3 only if CRC32 of file is 0x1051e3c9\n" - "\n" - " update_flash uImage-ccw9cjsnand 3 rootfs-ccw9cjsnand-128.jffs2 4:\n" - " => updates kernel at partition 3 and rootfs at partition 4\n" - "\n" - " update_flash u-boot-cpx2-ivt.sb 0 -k 48855699413545113545511513300447\n" - " => updates bootstream file on partition 0 if the encryption key matches\n"); - - /* so we can close everything even on error() or on return of main */ - atexit(OnExit); - - /* Force disable writing clean markers for platforms that require atomic - * access to the OOB */ - if (cWriteCleanMarker && is_nand_oob_atomic()) { - PRINTF(WARNING "JFFS2 clean markers disabled for this platform\n"); - cWriteCleanMarker = 0; - } - - if (cWriteCleanMarker) - cEraseAll = 1; - - if (!cChecksumOnly) - MtdInit(); - - /* check what files to write to what partition */ - while (iPartListIndex < argc) { - unsigned int uiPartition = 0; - - if ((pMtdPartLastToUpdate - axMtdParts) >= ARRAY_SIZE(axMtdParts)) - error("Too many partitions to update on command line"); - - if (iPartListIndex > (argc - (1 + (cChecksumOnly ? 0 : 1) + (cHasChecksum ? 1 : 0)))) - error("Require filename%s%s", (cChecksumOnly ? "" : " and partition"), - (cHasChecksum ? " and checksum" : "")); - - if (!cChecksumOnly) { - /* check partition argument */ - if (sscanf(argv[iPartListIndex + 1], "%u", &uiPartition) != 1) - error("Wrong partition number\n"); - - if (uiPartition >= uiMtdPartsCount) - error("Have only %u mtd partitions", uiMtdPartsCount); - - MtdPartInit(pMtdPartLastToUpdate, uiPartition, argv[iPartListIndex]); - iPartListIndex++; - } else { - /* initialize it partly */ - CLEAR(*pMtdPartLastToUpdate); - pMtdPartLastToUpdate->iFd = -1; - MtdPartUseFile(pMtdPartLastToUpdate, argv[iPartListIndex]); - } - - if (cHasChecksum) { - /* parse checksum argument */ - const char *szCRC32 = argv[iPartListIndex + 1]; - uint32_t uiCRC32; - - if (sscanf(szCRC32, "%x", &uiCRC32) != 1) - error("Invalid Checksum: %s", szCRC32); - SET_CRC32(pMtdPartLastToUpdate, uiCRC32); - iPartListIndex++; - } - - iPartListIndex++; - pMtdPartLastToUpdate++; - } /* while( iPartListIndex ) */ - - /* all command line parsing verifications complete */ - - /* report what will be done */ - if (cNoImageTypeCheck || cDryRun || cWriteCleanMarker || cEraseAll) { - PRINTF("\nEnabled command line options:\n"); - if (cNoImageTypeCheck) - PRINTF(INFO "do not check image type\n"); - if (cDryRun) - PRINTF(INFO "dry-run: flash content is not changed\n"); - if (cWriteCleanMarker) - PRINTF(INFO "write JFFS2 clean markers\n"); - if (cEraseAll) - PRINTF(INFO "erase complete partition\n"); - PRINTF("\n"); - } - - if (cChecksumOnly) - DoPrintChecksums(); - else if (cVerifyOnly) - DoMtdVerify(); - else - DoMtdUpdate(); - - PRINTF("Done\n"); - - if (cDoReboot) { - sync(); - reboot(RB_AUTOBOOT); - } - - /* may not be reached in case of kill */ - return EXIT_SUCCESS; -} - -/*********************************************************************** - * !Function: DoPrintChecksums - * !Descr: Calculates CRC32 of files (and compares them to -c option) - ***********************************************************************/ -static void DoPrintChecksums(void) -{ - mtdPartition_t *pMtd = NULL; - - PRINTF("CRC32 Results:\n"); - - for (pMtd = axMtdParts; pMtd < pMtdPartLastToUpdate; pMtd++) { - uint32_t uiCRC32 = 0; - - uiCRC32 = CalcCRC32OfFile(pMtd->szImageFileName); - PRINTF(" %-20s : 0x%08x\n", pMtd->szImageFileName, uiCRC32); - - if (pMtd->cChecksumSet) - MtdPartCompareCRC32(pMtd, uiCRC32); - } -} - -/*********************************************************************** - * !Function: DoMtdUpdate - * !Descr: Updates all flash partitions - ***********************************************************************/ -static void DoMtdUpdate(void) -{ - mtdPartition_t *pMtd = NULL; - - if (NULL != szTmpDir) { - /* checksum is checked or calculated while copying to tmp */ - VerifyTmpDir(); - - /* copy all files to tmp before starting to update */ - for (pMtd = axMtdParts; pMtd < pMtdPartLastToUpdate; pMtd++) { - /* copy it to temp */ - char acTmpFileName[256]; - char *szFileName = strdup(pMtd->szImageFileName); - snprintf(acTmpFileName, sizeof(acTmpFileName) - 1, - "%s/%s", szTmpDir, basename(szFileName)); - acTmpFileName[sizeof(acTmpFileName) - 1] = 0; - FREE(szFileName); - - PRINTF("Copying %s to %s\n", pMtd->szImageFileName, szTmpDir); - MtdPartCopyFile(pMtd, acTmpFileName); - - /* use temporary file name from name */ - FREE(pMtd->szImageFileName); /* get rid of const* */ - pMtd->szImageFileName = strdup(acTmpFileName); - } - } else if (cHasChecksum || !cNoImageTypeCheck) { - /* verify checksum before starting to update */ - PRINTF("Verifying File(s): "); - for (pMtd = axMtdParts; pMtd < pMtdPartLastToUpdate; pMtd++) { - PRINTF(" %s\n", pMtd->szImageFileName); - MtdPartVerifyFile(pMtd); - } - } - - /* make it read-only so no one can destroy the data */ - for (pMtd = axMtdParts; pMtd < pMtdPartLastToUpdate; pMtd++) - MtdPartRemountAllReadOnly(pMtd); - - PRINTF("Updating:\n"); - - for (pMtd = axMtdParts; pMtd < pMtdPartLastToUpdate; pMtd++) { - PRINTF(" %s (%lli KiB)\n", pMtd->szImageFileName, TO_KiB(pMtd->iFileSize)); - - MtdPartOpen(pMtd, 0); - /* For UBI images 'ubiformat' takes care of erasing the partition */ - if (pMtd->eFileType != FTUBI) { - MtdPartErase(pMtd); - } - if (PTBootstream == pMtd->ePartType) { - char cmd[1024]; - - /* Bootstream partitions must be updated by Freescale kobs-ng application */ - /* Close open mtd device */ - MtdPartClose(pMtd); - /* Build command to call kobs-ng - * Use 'strcat' because -O2 compiler optimization - * creates problems with 'sprintf' */ - strcpy(cmd, "kobs-ng init -w"); - if (cVerify) - strcat(cmd, " -c"); - if (NULL != szKey) { - strcat(cmd, " -k"); - strcat(cmd, szKey); - } - strcat(cmd, " --chip_0_device_path="); - strcat(cmd, pMtd->acName); - strcat(cmd, " "); - strcat(cmd, pMtd->szImageFileName); - strcat(cmd, " > /dev/null"); - if (!system(cmd)) { - PRINTF("\r Flashing: complete \n"); - if (cVerify) { - PRINTF("\r Verifying: complete \n"); - } - } - else { - PRINTF("\r Flashing: FAILED! \n"); - exit(EXIT_FAILURE); - } - } else if (pMtd->eFileType == FTUBI) { - /* UBI images are flashed using 'ubiformat' command */ - MtdPartClose(pMtd); - mtd_part_write_ubi(pMtd); - } else { - MtdPartWrite(pMtd); - if (cVerify) { - if (!MtdPartVerify(pMtd)) - exit(EXIT_FAILURE); - /* if CRC32 is given, it has been already checked on - the input files. And Mtd is now same to them. So no - need to check CRC32 again. */ - } else if (cHasChecksum) - MtdPartCheckCRC32(pMtd); - MtdPartClose(pMtd); - } - - PRINTF(" CRC32: 0x%08x\n", pMtd->uiCRC32); - } - - if (NULL != szTmpDir) { - /* delete all temporary files */ - for (pMtd = axMtdParts; pMtd < pMtdPartLastToUpdate; pMtd++) - if (unlink(pMtd->szImageFileName)) { - /* - * Do not exit with error in case the file to remove does not - * exist. - * Try to address corner cases like CCORE_MX53_EXTENSIONS-170 - * (using same file to flash several different partitions) - */ - if (ENOENT == errno) { - systemLog("%s", pMtd->szImageFileName); - } else { - systemError("%s", pMtd->szImageFileName); - } - } - } -} - -/*********************************************************************** - * !Function: DoMtdVerify - * !Descr: Verifies the flash images - ***********************************************************************/ -static void DoMtdVerify(void) -{ - mtdPartition_t *pMtd = NULL; - - PRINTF("Verifying Images:\n"); - - for (pMtd = axMtdParts; pMtd < pMtdPartLastToUpdate; pMtd++) { - MtdPartOpen(pMtd, 1); - MtdPartVerify(pMtd); - MtdPartClose(pMtd); - } -} - -/*********************************************************************** - * !Function: OnExit - * !Descr: Closes all open mtd partitions - ***********************************************************************/ -static void OnExit(void) -{ - mtdPartition_t *pMtd; - - for (pMtd = axMtdParts; pMtd < pMtdPartLastToUpdate; pMtd++) { - if (-1 != pMtd->iFd) - MtdPartClose(pMtd); - - FREE(pMtd->szImageFileName); - } -} - -/*********************************************************************** - * !Function: MtdInit - * !Descr: Checks where the partitions (devfs or not) and how many we have - ***********************************************************************/ -static void MtdInit(void) -{ - struct stat xStat; - - CLEAR(xStat); - - /* determine whether we are /dev/mtd/ or /dev/mtd */ - if (-1 == stat(szMtdPrefix, &xStat)) { - /* not dev fs */ - if (-1 == stat("/dev/mtd0", &xStat)) - error("No MTD devices available"); - - szMtdPrefix = "/dev/mtd"; - szMtdBlockPrefix = "/dev/mtdblock"; - } - - /* determine number of partitions */ - while (uiMtdPartsCount < ARRAY_SIZE(axMtdParts)) { - char acName[64]; - - axMtdParts[uiMtdPartsCount].iFd = -1; /* not open yet */ - - sprintf(acName, "%s%u", szMtdPrefix, uiMtdPartsCount); - if (-1 == stat(acName, &xStat)) - break; - - uiMtdPartsCount++; - } - - if (!uiMtdPartsCount) - error("No MTD partitions found"); -} - -/*********************************************************************** - * !Function: MtdPartInit - * !Descr: opens partition and initializes all sizes and bad blocks - ***********************************************************************/ -static void MtdPartInit( /*@out@ */ mtdPartition_t * pMtd, unsigned int uiPartition, - const char *szImageFileName) -{ - CLEAR(*pMtd); - pMtd->iFd = -1; - pMtd->uiPartition = uiPartition; - - /* open mtd (may be /dev/mtd0 or /dev/mtd/0) */ - MtdPartOpen(pMtd, 0); - - /* read partition info */ - if (ioctl(pMtd->iFd, MEMGETINFO, &pMtd->xInfo)) - systemError("ioctl( MEMGETINFO )"); - - pMtd->iSize = pMtd->xInfo.size; - pMtd->cIsNAND = (MTD_NANDFLASH == pMtd->xInfo.type); - pMtd->uiBadBlocks = 0; - pMtd->cEraseAll = cEraseAll; - pMtd->cWriteCleanMarker = cWriteCleanMarker; - - if (pMtd->cIsNAND) { - /* determine bad block count */ - /* !TODO. in 2.6.18 there already exists - mtd_ecc_stats/ECCGETLAYOUT */ - loff_t iOffset = 0; - - while (iOffset < pMtd->xInfo.size) { - if (MtdPartIsBadBlock(pMtd, iOffset)) { - logMsg(LOG_HARDWARE1, - "Bad Block 0x%08llx on partition %u", - iOffset, pMtd->uiPartition); - pMtd->uiBadBlocks++; - } - iOffset += pMtd->xInfo.erasesize; - } - } - - pMtd->iPageSize = (pMtd->cIsNAND ? pMtd->xInfo.writesize : pMtd->xInfo.erasesize); - - MtdPartDeterminePartType(pMtd); - - PRINTF("Partition %u is %s (%s)\n", pMtd->uiPartition, - (pMtd->cIsNAND ? "NAND" : ((MTD_NORFLASH == pMtd->xInfo.type) ? "NOR" : "???")), - (pMtd->ePartType != PTUnknown) ? aszPartType[pMtd->ePartType] : ""); - PRINTF(" Full Size: %llu KiB\n", TO_KiB(pMtd->iSize)); - - if (pMtd->uiBadBlocks) { - /* determine effective (good) size */ - PRINTF(" %u bad blocks\n", pMtd->uiBadBlocks); - pMtd->iSize -= pMtd->xInfo.erasesize * pMtd->uiBadBlocks; - } - - PRINTF(" Good Size: %llu KiB\n", TO_KiB(pMtd->iSize)); - - if (!is_nand_oob_atomic()) - MtdPartInitCleanMarker(pMtd, &pMtd->xCleanMarker, &pMtd->uiClMPos, &pMtd->uiClMLen); - - MtdPartUseFile(pMtd, szImageFileName); - - /* close it to not leave an unused file descriptor open too long. - The partition info is not gonna change anyway. */ - MtdPartClose(pMtd); - - if (!cVerifyOnly && pMtd->cIsJFFS2) { - PRINTF(INFO "JFFS2 partition %u will be fully erased", - pMtd->uiPartition); - /* clean rootfs completely */ - pMtd->cEraseAll = 1; - if (!is_nand_oob_atomic()) { - pMtd->cWriteCleanMarker = 1; - PRINTF(" and clean markers written\n"); - } else { - PRINTF("\n"); - } - } -} - -/*********************************************************************** - * !Function: MtdPartOpen - * !Descr: Opens the partition, either read only or read-writable - ***********************************************************************/ -static void MtdPartOpen( /*@inout@ */ mtdPartition_t * pMtd, char cReadOnly) -{ - char cReallyReadOnly = cReadOnly || cVerifyOnly; - if (-1 != pMtd->iFd) - error("Partition %u already open", pMtd->uiPartition); - - sprintf(pMtd->acName, "%s%u", szMtdPrefix, pMtd->uiPartition); - pMtd->iFd = open(pMtd->acName, (cReallyReadOnly ? O_RDONLY : OPEN_READWRITE_IF_NOT_DRY)); - if (-1 == pMtd->iFd) - systemError(": %s", pMtd->acName); -} - -/*********************************************************************** - * !Function: MtdPartClose - * !Descr: closes the Mtd Partition - ***********************************************************************/ -static void MtdPartClose( /*@inout@ */ mtdPartition_t * pMtd) -{ - CLOSE(pMtd->iFd); -} - -/*********************************************************************** - * !Function: MtdPartIsBadBlock - * !Return: 1 if the block at iOffset is bad and mustn't be used - * !TODO: on first run, all bad blocks can be stored in a "bad" list and - * reused later to reduce kernel calls - ***********************************************************************/ -static int MtdPartIsBadBlock(const mtdPartition_t * pMtd, loff_t iOffset) -{ - char cIsBad = 0; - int iRes = ioctl(pMtd->iFd, MEMGETBADBLOCK, &iOffset); - - if (iRes > 0) - cIsBad = 1; - else if ((iRes < 0) && (ENOTSUP != errno)) - /* if not supported (NOR), assume it is good */ - systemError("ioctl( MEMGETBADBLOCK )"); - - return cIsBad; -} - -/*********************************************************************** - * !Function: MtdMarkBadBlock - * !Return: 0 on success, <1 on error - ***********************************************************************/ -static int MtdMarkBadBlock(const mtdPartition_t * pMtd, loff_t iOffset) -{ - PRINTF("Marking offset %d as bad\n",(int)iOffset); - return ( ioctl(pMtd->iFd, MEMSETBADBLOCK, &iOffset) ); -} - -/*********************************************************************** - * !Function: MtdPartUseFile - * !Descr: Checks whether szImageFileName can be used for updating. - * E.g. if !cNoImageTypeCheck is set, the prefixes of the image - * file names are checked. - ***********************************************************************/ -static void MtdPartUseFile( /*@inout@ */ mtdPartition_t * pMtd, const char *szImageFileName) -{ - struct stat xStat; - - CLEAR(xStat); - if (stat(szImageFileName, &xStat)) - systemError("%s", szImageFileName); - - pMtdPartLastToUpdate->szOrigImageFileName = szImageFileName; - pMtd->szImageFileName = strdup(szImageFileName); - pMtd->iFileSize = xStat.st_size; - pMtd->eFileType = FTUnknown; - - if (-1 != pMtd->iFd) { - if (xStat.st_size > pMtd->iSize) - error("File %s is %lu KiB, but partition %u has only %lu KiB good free", - pMtd->szImageFileName, - TO_KiB(xStat.st_size), pMtd->uiPartition, TO_KiB(pMtd->iSize)); - - if (!cNoImageTypeCheck) - MtdPartDetermineAndCheckFileType(pMtd); - } -} - -/*********************************************************************** - * !Function: MtdPartErase - * !Descr: erases the flash partition. - * !see [1] - ***********************************************************************/ -static void MtdPartErase(const mtdPartition_t * pMtd) -{ - erase_info_t xErase; - loff_t iEraseSize = 0; - loff_t iBytesErasedTotal = 0; - char cLastWasBad = 0; - struct mtd_oob_buf xoob; - int iThrottle = MtdPartGetThrottle(pMtd, pMtd->xInfo.erasesize); - - CLEAR(xErase); - - xErase.length = pMtd->xInfo.erasesize; - /* bad sectors have already been removed in pMtd->iSize */ - iEraseSize = (pMtd->cEraseAll ? pMtd->iSize : pMtd->iFileSize); - - CLEAR(xoob); - xoob.length = pMtd->uiClMLen; - xoob.ptr = (unsigned char *)&pMtd->xCleanMarker; - - while (iBytesErasedTotal < iEraseSize) { - if (!MtdPartIsBadBlock(pMtd, xErase.start)) { - PrintProgress((((iBytesErasedTotal) * 100) / iEraseSize), - iThrottle, - " Erasing%s %i KiB @ 0x%08x:", - (pMtd->cWriteCleanMarker ? " (CM)" : ""), - TO_KiB(xErase.length), xErase.start); - - if (!cDryRun && ioctl(pMtd->iFd, MEMERASE, &xErase)) - systemError("ioctl(MEMERASE)"); - - iBytesErasedTotal += xErase.length; - cLastWasBad = 0; - - if (!cDryRun && pMtd->cWriteCleanMarker) { - /* write cleanmarker */ - if (pMtd->cIsNAND) { - xoob.start = xErase.start + pMtd->uiClMPos; - if (ioctl(pMtd->iFd, MEMWRITEOOB, &xoob)) - systemError("ioctl( MEMWRITEOOB )"); - } else { - /* the NOR image already contains them. */ - if (pwrite(pMtd->iFd, &pMtd->xCleanMarker, - sizeof(pMtd->xCleanMarker), - xErase.start) != sizeof(pMtd->xCleanMarker)) - systemError("pwrite"); - } - } - } else { - logMsg(LOG_HARDWARE1, - "%s" WARNING "Skipping bad sector @ 0x%08x ", - (!cLastWasBad ? "\r" : ""), xErase.start); - cLastWasBad = 1; - } - - xErase.start += xErase.length; - } - - PRINTF("\r Erasing: complete \n"); -} - -/*********************************************************************** - * !Function: mtd_part_write_ubi - * !Descr: writes an UBI image file to partition - ***********************************************************************/ -static void mtd_part_write_ubi(mtdPartition_t * pMtd) -{ - char line[256]; - FILE *fpin; - int ret; - - snprintf(line, sizeof(line), "ubiformat %s -f %s -y -q 2>&1 >/dev/null", pMtd->acName, - pMtd->szImageFileName); - fpin = popen(line, "r"); - if (fgets(line, sizeof(line) - 1, fpin) != NULL) { - line[strlen(line) - 1] = 0; - } - ret = pclose(fpin); - if (!WEXITSTATUS(ret)) { - PRINTF("\r Flashing: complete \n"); - } else { - PRINTF("\r Flashing: FAILED! (%s)\n", line); - exit(EXIT_FAILURE); - } -} - -/*********************************************************************** - * !Function: MtdPartWrite - * !Descr: writes the image file to partition - ***********************************************************************/ -static void MtdPartWrite(mtdPartition_t * pMtd) -{ - loff_t iBytesReadTotal = 0; - loff_t iCurrentOffs = 0; - int iFdSrc = -1; - char cLastWasBad = 0; - int iBytesRead = 0; - uint32_t uiCRC32 = 0; - unsigned char *pucBuffer = NULL; - const size_t iBlockSize = pMtd->iPageSize; - int iThrottle = MtdPartGetThrottle(pMtd, pMtd->iFileSize); - unsigned int i,iRet; - unsigned int ref_uicrc32 = 0,new_uicrc32 = 0; - unsigned char *pucBufferMtd = NULL; - - pucBuffer = (unsigned char *)malloc(iBlockSize); - if (NULL == pucBuffer) - systemError("malloc"); - - iFdSrc = open(pMtd->szImageFileName, O_RDONLY); - if (-1 == iFdSrc) - systemError("%s", pMtd->szImageFileName); - - /* rewind because descriptor was open and we don't know the state */ - if (lseek(pMtd->iFd, 0, SEEK_SET)) - systemError("%s", pMtd->acName); - - do { - /* write one sector */ - if (!MtdPartIsBadBlock(pMtd, iCurrentOffs)) { - int iBytesWritten; - - PrintProgress(PERCENTAGE(iBytesReadTotal, pMtd->iFileSize), - iThrottle, " Flashing:"); - - iBytesRead = read(iFdSrc, pucBuffer, iBlockSize); - if (!iBytesRead) - break; - else if (-1 == iBytesRead) - systemError("%s", pMtd->szImageFileName); - - if (!pMtd->cChecksumCalculated) - uiCRC32 = crc32(uiCRC32, pucBuffer, iBytesRead); - - if (iBytesRead < iBlockSize) { - char cEmptyChar = FLASH_ERASED_BYTE; - char bJFFS2Padding = 0; - - if (pMtd->cIsJFFS2 && - (iBytesRead + sizeof(struct jffs2_unknown_node) < - iBlockSize)) { - bJFFS2Padding = 1; - cEmptyChar = 0; /* see wbuf.c */ - } - - /* fill block with empty characters */ - memset(pucBuffer + iBytesRead, - cEmptyChar, iBlockSize - iBytesRead); - - if (bJFFS2Padding) { - /* write padding to avoid Empty block messages. - see linux/fs/jffs2/wbuf.c:flush_wbuf */ - struct jffs2_unknown_node *pNode = - (struct jffs2_unknown_node *)(pucBuffer + - iBytesRead); - logMsg(LOG_HARDWARE1, "\nPadding last sector"); - MtdPartInitJFFS2Node(pNode, - JFFS2_NODETYPE_PADDING, - iBlockSize - iBytesRead); - } - } - - /* at least nand writes should be aligned */ - - if( !cDryRun && cMarkBadBlocks ) { - ref_uicrc32 = crc32(0, pucBuffer, iBlockSize); - pucBufferMtd = (unsigned char *)malloc(iBlockSize); - if (NULL == pucBufferMtd) - systemError("malloc"); - } - - for( i = 0 ; i < cMaxRetries ; i++ ) { - int iBytesReadMtd; - - iBytesWritten = (!cDryRun ? - pwrite(pMtd->iFd, - pucBuffer, iBlockSize, - iCurrentOffs) : iBlockSize); - - if (iBytesWritten != iBlockSize) { - if( !cDryRun && cMarkBadBlocks ) { - PRINTF("[%s:%d] %s: Retrying failed write %d.\n", - __FUNCTION__,__LINE__,pMtd->acName,i); - continue; - } - else { - systemError("%s", pMtd->acName); - } - } - - if (!cDryRun && cMarkBadBlocks) { - iBytesReadMtd = pread(pMtd->iFd, pucBufferMtd, iBlockSize, - iCurrentOffs); - if ( iBytesReadMtd < 0 ) { - PRINTF("[%s:%d] %s: Read error.\n", - __FUNCTION__,__LINE__,pMtd->acName); - continue; - } - - new_uicrc32 = crc32(0, pucBufferMtd, iBlockSize); - if( new_uicrc32 != ref_uicrc32 ) { - PRINTF("[%s:%d] %s: CRC mismatch %08x <> %08x.\n", - __FUNCTION__,__LINE__,pMtd->acName,ref_uicrc32, - new_uicrc32); - continue; - } - FREE(pucBufferMtd); - } - break; - } - - if( !cDryRun && cMarkBadBlocks && (i >= cMaxRetries) ) { - PRINTF("[%s:%d] %s: Marking as bad block.\n", - __FUNCTION__,__LINE__,pMtd->acName); - iRet = MtdMarkBadBlock( pMtd , iCurrentOffs ); - systemError("%s: Bad block marking %s.", pMtd->acName, - strerror(iRet)); - } - - iBytesReadTotal += iBytesRead; - - cLastWasBad = 0; - } else { - logMsg(LOG_HARDWARE1, - "%s" WARNING "Skipping bad sector @ 0x%08x ", - (!cLastWasBad ? "\r" : ""), iCurrentOffs); - - cLastWasBad = 1; - } - - iCurrentOffs += iBlockSize; - } while (iCurrentOffs < pMtd->xInfo.size); - - CLOSE(iFdSrc); - FREE(pucBuffer); - - if (pMtd->iFileSize != iBytesReadTotal) - error("Filesize changed while updating: %s", pMtd->szImageFileName); - - if (!pMtd->cChecksumCalculated) { - SET_CRC32(pMtd, uiCRC32); - pMtd->cChecksumCalculated = 1; - } - - PRINTF("\r Flashing: complete \n"); -} - -/*********************************************************************** - * !Function: MtdPartVerify - * !Return: 1 if identical in the used sectors of szOrigImageFileName - * otherwise 0 - * !Descr: compares contents of MtdPartition with szOrigImageFileName - * Only checks the last used sector whether the parts the source - * file not uses are empty. Other blocks are not checked. - ***********************************************************************/ -static int MtdPartVerify(mtdPartition_t * pMtd) -{ - unsigned char *pucBufferSrc; - unsigned char *pucBufferMtd; - int iFdSrc = -1; - loff_t iBytesReadTotal = 0; - loff_t iOffsMtd = 0; - char cRes = 0; - char cLastWasBad = 0; - const size_t iBlockSize = pMtd->iPageSize; - int iThrottle = MtdPartGetThrottle(pMtd, pMtd->iFileSize); - unsigned int i,iRet; - - pucBufferSrc = (unsigned char *)malloc(iBlockSize); - if (NULL == pucBufferSrc) - systemError("malloc"); - - pucBufferMtd = (unsigned char *)malloc(iBlockSize); - if (NULL == pucBufferMtd) - systemError("malloc"); - - /* sync everything */ - MtdPartClose(pMtd); - MtdPartOpen(pMtd, 1); /* also rewinds read pointer */ - - iFdSrc = open(pMtd->szOrigImageFileName, O_RDONLY); - if (-1 == iFdSrc) - systemError("%s", pMtd->szOrigImageFileName); - - do { - if (!MtdPartIsBadBlock(pMtd, iOffsMtd)) { - int iBytesReadSrc; - int iBytesReadMtd; - loff_t iOffs; - - PrintProgress(PERCENTAGE(iBytesReadTotal, pMtd->iFileSize), - iThrottle, " Verifying:"); - - iBytesReadSrc = read(iFdSrc, pucBufferSrc, iBlockSize); - if (!iBytesReadSrc) - /* nothing left */ - break; - else if (iBytesReadSrc < 0) - systemError("%s", pMtd->szOrigImageFileName); - - for( i = 0 ; i < cMaxRetries ; i++ ) { - iBytesReadMtd = pread(pMtd->iFd, pucBufferMtd, iBlockSize, iOffsMtd); - if (iBytesReadMtd < 0) { - if( !cDryRun && cMarkBadBlocks ) { - printf("[%s:%d] %s: Retrying failed read %d, %s.\n", - __FUNCTION__,__LINE__,pMtd->acName,i,strerror(errno)); - continue; - } - else - systemError("%s", pMtd->acName); - } - break; - } - - if( !cDryRun && cMarkBadBlocks && (i >= cMaxRetries) ) { - PRINTF("[%s:%d] %s: Marking as bad block.\n", - __FUNCTION__,__LINE__,pMtd->acName); - iRet = MtdMarkBadBlock( pMtd , iOffsMtd ); - systemError("%s: Bad block marking %s.", pMtd->acName, strerror(iRet)); - } - - if (iBytesReadSrc > iBytesReadMtd) { - logMsg(LOG_ERR, - "\nSize mismatch. Source has %i Bytes but flash only %i bytes", - iBytesReadSrc, iBytesReadMtd); - goto ret; - } - - iOffs = MemCmp(pucBufferSrc, pucBufferMtd, iBytesReadSrc); - if (-1 != iOffs) { - logMsg(LOG_ERR, - "\nData mismatch @ 0x%08x\n", iBytesReadTotal + iOffs); - logMsg(LOG_ERR, "Source is"); - MemDump(pucBufferSrc, iOffs & ~0xf, MIN(iBytesReadSrc, 0x20)); - logMsg(LOG_ERR, "Flash is"); - MemDump(pucBufferMtd, iOffs & ~0xf, MIN(iBytesReadMtd, 0x20)); - goto ret; - } - - if (!pMtd->cIsJFFS2 && (iBytesReadSrc < iBytesReadMtd)) { - /* !TODO. JFFS2 is padded. - This is not yet checked. */ - int i; - - /* check for emptiness of block. */ - /* !TODO. This works only for NOR and NAND */ - for (i = iBytesReadSrc; i < iBytesReadMtd; i++) - if (FLASH_ERASED_BYTE != pucBufferMtd[i]) { - logMsg(LOG_ERR, - "Mtd is not empty @ 0x%llx\n", - iBytesReadTotal + i); - goto ret; - } - } /* if( iBytesReadSrc < iBytesReadMtd */ - iBytesReadTotal += iBytesReadSrc; - - cLastWasBad = 0; - } else { - logMsg(LOG_HARDWARE1, - "%s" WARNING "Skipping bad sector @ 0x%08x ", - (!cLastWasBad ? "\r" : ""), iOffsMtd); - cLastWasBad = 1; - } - - iOffsMtd += iBlockSize; - } while (iOffsMtd < pMtd->xInfo.size); - - if (pMtd->iFileSize != iBytesReadTotal) { - logMsg(LOG_ERR, "Filesize changed while updating: %s", pMtd->szImageFileName); - goto ret; - } - - PRINTF("\r Verifying: complete \n"); - - cRes = 1; - -ret: - CLOSE(iFdSrc); - - FREE(pucBufferMtd); - FREE(pucBufferSrc); - - return cRes; -} - -/*********************************************************************** - * !Function: MtdPartCheckCRC32 - * !Descr: calculates checksum of mtd partition up to filesize - ***********************************************************************/ -static void MtdPartCheckCRC32(mtdPartition_t * pMtd) -{ - unsigned char *pucBufferMtd; - loff_t iBytesReadTotal = 0; - loff_t iOffsMtd = 0; - uint32_t uiCRC32 = 0; - const size_t iBlockSize = pMtd->xInfo.erasesize; - int iThrottle = MtdPartGetThrottle(pMtd, pMtd->iFileSize); - - pucBufferMtd = (unsigned char *)malloc(iBlockSize); - if (NULL == pucBufferMtd) - systemError("malloc"); - - /* sync everything */ - MtdPartClose(pMtd); - MtdPartOpen(pMtd, 1); /* also rewinds read pointer */ - - do { - if (!MtdPartIsBadBlock(pMtd, iOffsMtd)) { - int iBytesReadMtd; - - PrintProgress(PERCENTAGE(iBytesReadTotal, pMtd->iFileSize), - iThrottle, " CRC32: "); - - iBytesReadMtd = pread(pMtd->iFd, pucBufferMtd, iBlockSize, iOffsMtd); - if (iBytesReadMtd < 0) - systemError("%s", pMtd->acName); - - if ((iBytesReadTotal + iBytesReadMtd) > pMtd->iFileSize) - iBytesReadMtd = (pMtd->iFileSize - iBytesReadTotal); - - uiCRC32 = crc32(uiCRC32, pucBufferMtd, iBytesReadMtd); - iBytesReadTotal += iBytesReadMtd; - } - iOffsMtd += iBlockSize; - } while (pMtd->iFileSize > iBytesReadTotal); - - PRINTF("\r CRC32: complete \n"); - - FREE(pucBufferMtd); - - MtdPartCompareCRC32(pMtd, uiCRC32); -} - -/*********************************************************************** - * !Function: MtdPartCopyFile - * !Descr: copies the image file to szDstFileName and calculates its - * check sum - ***********************************************************************/ -static void MtdPartCopyFile(mtdPartition_t * pMtd, const char *szDstFileName) -{ - unsigned char *pucBuffer = NULL; - int iFdDst = -1; - int iFdSrc = -1; - loff_t iBytesReadTotal = 0; - int iBytesRead; - uint32_t uiCRC32 = 0; - const size_t iBlockSize = pMtd->xInfo.erasesize; - - pucBuffer = (unsigned char *)malloc(iBlockSize); - if (NULL == pucBuffer) - systemError("malloc"); - - iFdSrc = open(pMtd->szImageFileName, O_RDONLY); - if (-1 == iFdSrc) - systemError("%s", pMtd->szImageFileName); - - iFdDst = open(szDstFileName, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - if (-1 == iFdDst) - systemError("%s", szDstFileName); - - do { - int iBytesWritten; - - iBytesRead = read(iFdSrc, pucBuffer, iBlockSize); - if (!iBytesRead) - break; - else if (-1 == iBytesRead) - systemError("%s", pMtd->szImageFileName); - - if (pMtd->cIsJFFS2) - MtdPartVerifyJFFS2Block(pMtd, pucBuffer, iBytesRead); - - uiCRC32 = crc32(uiCRC32, pucBuffer, iBytesRead); - - iBytesWritten = write(iFdDst, pucBuffer, iBytesRead); - if (iBytesWritten != iBytesRead) - systemError("%s", szDstFileName); - - iBytesReadTotal += iBytesRead; - } while (1); - - CLOSE(iFdDst); - CLOSE(iFdSrc); - - FREE(pucBuffer); - - if (pMtd->iFileSize != iBytesReadTotal) - error("Filesize changed while updating: %s", pMtd->szImageFileName); - - if (!pMtd->cChecksumSet) { - SET_CRC32(pMtd, uiCRC32); - pMtd->cChecksumCalculated = 1; - } else - MtdPartCompareCRC32(pMtd, uiCRC32); -} - -/*********************************************************************** - * !Function: MtdPartInitCleanMarker - * !Descr: initializes the clean marker - * !see [1] - ***********************************************************************/ -static void MtdPartInitCleanMarker(const mtdPartition_t * pMtd, - struct jffs2_unknown_node *pCleanMarker, - unsigned int *puiClMPos, unsigned int *puiClMLen) -{ - *puiClMPos = 0; - *puiClMLen = 8; - - if (pMtd->cIsNAND) { - struct nand_oobinfo xoobInfo; - - CLEAR(xoobInfo); - if (ioctl(pMtd->iFd, MEMGETOOBSEL, &xoobInfo)) - systemError("ioctl( MEMGETOOBSEL )"); - - /* check for autoplacement */ - if (MTD_NANDECC_AUTOPLACE == xoobInfo.useecc) { - /* get the position of the free bytes */ - if (!xoobInfo.oobfree[0][1]) - error("Autoplacement selected and no empty space in oob\n"); - - *puiClMPos = xoobInfo.oobfree[0][0]; - *puiClMLen = xoobInfo.oobfree[0][1]; - - if (*puiClMLen > 8) - *puiClMLen = 8; - else { - /* legacy mode, detect autoplacement ourselves [3] */ - switch (pMtd->xInfo.oobsize) { - case 8: - *puiClMPos = 6; - *puiClMLen = 2; - break; - case 16: - *puiClMPos = 8; - *puiClMLen = 8; - break; - case 64: - *puiClMPos = 16; - *puiClMLen = 8; - break; - default: - error("unsupported oobsize %i\n", pMtd->xInfo.oobsize); - break; - } /* switch */ - } /* if( *piClMPos ) */ - } /* if( NAND_AUTOPLACE */ - } else - MtdPartInitJFFS2Node(pCleanMarker, - JFFS2_NODETYPE_CLEANMARKER, - sizeof(struct jffs2_unknown_node)); - - logMsg(LOG_HARDWARE2, - " OOB has %i bytes, CleanMarker is from 0x%02x to 0x%02x", - pMtd->xInfo.oobsize, *puiClMPos, *puiClMPos + *puiClMLen); -} - -/*********************************************************************** - * !Function: MtdPartInitJFFS2Node - * !Descr: initializes a node and generates hdr checksum - ***********************************************************************/ -static void MtdPartInitJFFS2Node(struct jffs2_unknown_node *pNode, unsigned short uhNodeType, - size_t iLen) -{ - uint32_t uiStart = 0xffffffff; /* JFFS CRC32 starts from 0xfffffff, our crc32 from 0x0 */ - - CLEAR(*pNode); - - pNode->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); - pNode->nodetype = cpu_to_je16(uhNodeType); - - pNode->totlen = cpu_to_je32(iLen); - /* don't CRC32 the hdr_crc itself */ - pNode->hdr_crc = - cpu_to_je32(crc32(uiStart, pNode, sizeof(struct jffs2_unknown_node) - 4) ^ uiStart); -} - -/*********************************************************************** - * !Function: MtdPartCompareCRC32 - * !Descr: checks whether the CRC32 is same as previously calculated. - ***********************************************************************/ -static void MtdPartCompareCRC32(mtdPartition_t * pMtd, uint32_t uiCRC32) -{ - if (uiCRC32 != pMtd->uiCRC32) - error("CRC32 mismatch on %s.\n Expected 0x%08x, have 0x%08x\n", - pMtd->szImageFileName, pMtd->uiCRC32, uiCRC32); -} - -/*********************************************************************** - * !Function: MtdPartRemountAllReadOnly - * !Descr: remounts all uses of the partition as read-only - ***********************************************************************/ -static void MtdPartRemountAllReadOnly(mtdPartition_t * pMtd) -{ - static const char *szMount = "/proc/mounts"; - char acMtdBlock[20]; - FILE *fhMount = NULL; - const char *szRootDev = GetRootDevice(); - - if (pMtd->cAlreadyRemounted) - /* nothing to do */ - return; - - fhMount = setmntent(szMount, "r"); - if (NULL == fhMount) - systemError(szMount); - - sprintf(acMtdBlock, "%s%u", szMtdBlockPrefix, pMtd->uiPartition); - - /* scan all mount entries */ - do { - char bIsRootDev = 0; - char bRemount = 0; - - struct mntent *pxEnt = getmntent(fhMount); - if (NULL == pxEnt) - break; - - bIsRootDev = (!strcmp(pxEnt->mnt_fsname, "/dev/root") && - !strcmp(szRootDev, acMtdBlock)); - if (!bIsRootDev && !strcmp(pxEnt->mnt_fsname, acMtdBlock)) { - PRINTF(WARNING "Umounting %s\n", pxEnt->mnt_dir); - if (umount(pxEnt->mnt_dir) || bIsRootDev) { - /* rootdev can't be unmounted */ - /* it's for our mtd partition, remount it */ - PRINTF(WARNING "Failed, trying to remount read-only\n"); - bRemount = 1; - } - } - if (bIsRootDev || bRemount) { - PRINTF(WARNING "Remounting %s\n", pxEnt->mnt_dir); - if (mount(pxEnt->mnt_fsname, pxEnt->mnt_dir, - NULL, MS_REMOUNT | MS_RDONLY, NULL)) { - if (EBUSY == errno) - error("Partition in use, can't update it\n"); - else - systemError("%s", pxEnt->mnt_fsname); - } - } - } while (1); - - endmntent(fhMount); - - pMtd->cAlreadyRemounted = 1; -} - -/*********************************************************************** - * !Function: MtdPartDeterminePartType - * !Descr: Determine partition type (rootfs, uboot, etc.) based on - * partition name in /proc/mtd - ***********************************************************************/ -static void MtdPartDeterminePartType(mtdPartition_t * pMtd) -{ - static const char *szMtd = "/proc/mtd"; - FILE *fhMtd = NULL; - unsigned int uiPart; - char acBuffer[200]; - int iPart; - loff_t uiSize; - loff_t uiEraseSize; - char acName[200]; - static const struct { - PartType_e eType; - FileType_e eFileType; - const char *szName; - } axTypes[] = { - {PTUBoot, FTUBoot, "\"U-Boot"}, - {PTKernel, FTKernel, "\"Kernel"}, - {PTEnvironment, FTNVRAM, "\"NVRAM"}, - {PTFPGA, FTFPGA, "\"FPGA"}, - {PTBootstream, FTBootstream, "\"Bstrm-U-Boot"}, - }; - int i; - - /* open /proc/mtd */ - fhMtd = fopen(szMtd, "r"); - if (NULL == fhMtd) - systemError(szMtd); - - /* skip table header (check return value to avoid compiler warning) */ - if (fgets(acBuffer, sizeof(acBuffer), fhMtd)); - - /* seek partition description */ - for (iPart = 0; iPart <= pMtd->uiPartition; iPart++) - if (NULL == fgets(acBuffer, sizeof(acBuffer) - 1, fhMtd)) - systemError(szMtd); - - /* break it into parts */ - acBuffer[sizeof(acBuffer) - 1] = 0; - if (sscanf(acBuffer, "mtd%u: %llx %llx %199s", - &uiPart, &uiSize, &uiEraseSize, acName) != 4) - error("Wrong /proc/mtd line: %s", acBuffer); - if (uiPart != pMtd->uiPartition) - error("Wrong partition: %s", acBuffer); - - /* determine partition type */ - pMtd->ePartType = PTUnknown; - pMtd->eFileTypeNeeded = FTUnknown; - for (i = 0; i < ARRAY_SIZE(axTypes); i++) { - if (!strncmp(axTypes[i].szName, acName, strlen(axTypes[i].szName))) { - pMtd->ePartType = axTypes[i].eType; - pMtd->eFileTypeNeeded = axTypes[i].eFileType; - break; - } - } - - if (fclose(fhMtd) < 0) - systemError(szMtd); -} - -/*********************************************************************** - * !Function: MtdPartDetermineAndCheckFileType - * !Descr: Determine file type (rootfs, uboot, etc.) and checks whether it - * is ok for the partition. Done by looking at filename - ***********************************************************************/ -static void MtdPartDetermineAndCheckFileType(mtdPartition_t * pMtd) -{ - FileType_e eType = 0; - int iMatch = 0; - regex_t regexp; - - CLEAR(regexp); - - /* !TODO: Verify File Type, JFFS2, uimage, u-boot by looking into it */ - - while (eType < ARRAY_SIZE(axFileType)) { - /* does axFileType[ eType ] matches pMtd->szImageFileName? */ - int iError = regcomp(®exp, - axFileType[eType].szExp, - REG_NOSUB); - if (iError) { - char acError[200]; - regerror(iError, ®exp, acError, sizeof(acError) - 1); - error("%s", acError); - } - - iMatch = !regexec(®exp, pMtd->szImageFileName, 0, NULL, 0); - regfree(®exp); - - if (iMatch) { - pMtd->eFileType = eType; - - logMsg(LOG_HARDWARE1, - " Detected Image Type for %s: %s", - pMtd->szImageFileName, axFileType[eType].szName); - - /* check whether it matches the partition */ - if ((pMtd->eFileTypeNeeded != pMtd->eFileType) && - (pMtd->eFileTypeNeeded != FTUnknown)) - error("File %s (Type %s) doesn't match partition type %s", - pMtd->szImageFileName, - axFileType[pMtd->eFileType].szName, - aszPartType[pMtd->ePartType]); - - if (FTJFFS2 == pMtd->eFileType) - pMtd->cIsJFFS2 = 1; - - break; - } - eType++; - } -} - -/*********************************************************************** - * !Function: MtdPartVerifyFile - * !Descr: verifies the file (checksum, JFFS2) - ***********************************************************************/ -static void MtdPartVerifyFile(mtdPartition_t * pMtd) -{ - unsigned char *pucBuffer = NULL; - uint32_t uiCRC32 = 0; - int iFd = -1; - int iBytesRead; - const size_t iBlockSize = pMtd->xInfo.erasesize; - - pucBuffer = (unsigned char *)malloc(iBlockSize); - if (NULL == pucBuffer) - systemError("malloc"); - - iFd = open(pMtd->szImageFileName, O_RDONLY); - if (-1 == iFd) - systemError("%s", pMtd->szImageFileName); - - do { - iBytesRead = read(iFd, pucBuffer, iBlockSize); - if (!iBytesRead) - break; - else if (-1 == iBytesRead) - systemError("%s", pMtd->szImageFileName); - - if (pMtd->cIsJFFS2) - MtdPartVerifyJFFS2Block(pMtd, pucBuffer, iBytesRead); - - uiCRC32 = crc32(uiCRC32, pucBuffer, iBytesRead); - } while (1); - - CLOSE(iFd); - - FREE(pucBuffer); - - if (!pMtd->cChecksumSet) { - SET_CRC32(pMtd, uiCRC32); - pMtd->cChecksumCalculated = 1; - } else - MtdPartCompareCRC32(pMtd, uiCRC32); -} - -/*********************************************************************** - * !Function: MtdPartVerifyJFFS2Block - * !Descr: verifies whether the JFFS2 block is correct. On NOR clean markers - * need to be on the correct position, on NAND there mustn't be. - ***********************************************************************/ -static void MtdPartVerifyJFFS2Block(mtdPartition_t * pMtd, unsigned char *pucData, size_t iSize) -{ - char cCleanMarkerPresent = 0; - int iOffs; - /* only magic and node, length field of xCleanMarker may vary */ - static const size_t NODE_SIZE = 4; - - if (pMtd->cAlreadyPrintedVerifyWarning) - /* do it only once */ - return; - - if (iSize >= 4) - cCleanMarkerPresent = (MemCmp(pucData, &pMtd->xCleanMarker, NODE_SIZE) == -1); - - if (pMtd->cIsNAND) { - const jint16_t MAGIC = cpu_to_je16(JFFS2_MAGIC_BITMASK); - - if (cCleanMarkerPresent) { - logMsg(LOG_ERR, - WARNING - "CleanMarkers present in image for NAND. JFFS2 will complain but function."); - pMtd->cAlreadyPrintedVerifyWarning = 1; - } - - /* MAGIC is < sizeof( xCleanMarker ) */ - if (MemCmp(pucData, &MAGIC, sizeof(MAGIC)) != -1) - error("No JFFS2 Header at erase block begin"); - } else { - /* NOR etc. */ - if (!cCleanMarkerPresent) - error - ("No CleanMarkers present in image for NOR. JFFS2 won't like that. Possibly wrong erase block size of jffs2 or NAND image"); - - /* there shouldn't be any other clean marker in the block. - Check 2^n offsets. */ - for (iOffs = 16; iOffs < iSize - NODE_SIZE; iOffs *= 2) { - if (MemCmp(pucData + iOffs, &pMtd->xCleanMarker, NODE_SIZE) == -1) - error - ("Clean Markers present in the block at offset 0x%08x. Possibly wrong erase block size of jffs2", - iOffs); - } - } -} - -/*********************************************************************** - * !Function: MtdPartGetThrottle - ***********************************************************************/ -static int MtdPartGetThrottle(const mtdPartition_t * pMtd, uint64_t ullSize) -{ - /* Eclipse has a nicer output with an update every second. Therefore it - * is not throttled. */ - return 1; -} - -/*********************************************************************** - * !Function: PrintProgress - * !Descr: Prints message only when progress has changed - ***********************************************************************/ -static void PrintProgress(int iPercentage, int iThrottle, const char *szFmt, ...) -{ - static int iLastPercentage = -1; - int iThrottled = iPercentage / iThrottle; - - if (cSilent) - /* nothing to print */ - return; - - if (iThrottled != iLastPercentage) { - va_list args; - - iLastPercentage = iThrottled; - - va_start(args, szFmt); - vprintf(szFmt, args); - printf("% 3i%% \r", iPercentage); - va_end(args); - - if (cProgressInNewLine) - PRINTF("\n"); - fflush(stdout); - } -} - -/*********************************************************************** - * !Function: VerifyTmpDir - * !Descr: checks whether the temporary directory can be used - ***********************************************************************/ -static void VerifyTmpDir(void) -{ - struct statfs xStat; - - CLEAR(xStat); - - if (statfs(szTmpDir, &xStat)) - systemError("statfs"); - - switch (xStat.f_type) { - case JFFS2_SUPER_MAGIC: - /* flash image temporary on flash fs??? */ - error("Makes no sense to store flash image temporarily on JFFS2"); - break; /* not reached */ - case NFS_SUPER_MAGIC: - error("Makes no sense to store flash image temporarily on NFS"); - break; /* not reached */ - default: - /* Accept all other ones. If they are read-only, it is detected before - * erasing flash */ - break; - } -} - -/*********************************************************************** - * !Function: CalcCRC32OfFile - * !Descr: calculates the CRC32 of the file. - ***********************************************************************/ -static uint32_t CalcCRC32OfFile(const char *szFileName) -{ - char acBuffer[IO_BLOCK_SIZE]; - int iFd = -1; - uint32_t uiCRC32 = 0; - - iFd = open(szFileName, O_RDONLY); - if (-1 == iFd) - systemError("%s", szFileName); - - do { - int iBytesRead = read(iFd, acBuffer, IO_BLOCK_SIZE); - - if (!iBytesRead) - break; - else if (iBytesRead < 0) - systemError("%s", szFileName); - - uiCRC32 = crc32(uiCRC32, acBuffer, iBytesRead); - } while (1); - - CLOSE(iFd); - - return uiCRC32; -} - -/*********************************************************************** - * !Function: GetRootDevice - * !Descr: determines the rootdevice from kernel command line root= - ***********************************************************************/ -static const char *GetRootDevice(void) -{ - int iFd = -1; - int iRead; - /* arm command line is at max 1024 Bytes */ - char szCmdLine[1024]; - static char szRootDev[32] = ""; - const char *szRootStart = NULL; - - if (*szRootDev) - return szRootDev; - - iFd = open("/proc/cmdline", O_RDONLY); - if (-1 == iFd) - systemError("/proc/cmdline"); - - iRead = read(iFd, szCmdLine, sizeof(szCmdLine) - 2); - if (-1 == iRead) - systemError("read"); - szCmdLine[iRead + 1] = 0; - - CLOSE(iFd); - - szRootStart = strstr(szCmdLine, "root="); - if (NULL != szRootStart) { - const char *szDev = szRootStart + 5; /* strlen( root=) */ - const char *szDevEnd = szDev; - int iLen; - - szDevEnd = strchr(szDev, ' '); - iLen = ((NULL == szDevEnd) ? strlen(szDev) : (szDevEnd - szDev)); - - strncpy(szRootDev, szDev, MIN(sizeof(szRootDev), iLen)); - } - - return szRootDev; -} diff --git a/meta-digi-arm/recipes-core/udev/udev-extraconf/81-spi-spidev.rules b/meta-digi-arm/recipes-core/udev/udev-extraconf/81-spi-spidev.rules new file mode 100644 index 000000000..4c1a31799 --- /dev/null +++ b/meta-digi-arm/recipes-core/udev/udev-extraconf/81-spi-spidev.rules @@ -0,0 +1,2 @@ +# Skip loading Spidev module +SUBSYSTEM=="spi", ACTION=="add", ENV{MODALIAS}=="spi:spidev", RUN="/bin/true" diff --git a/meta-digi-arm/recipes-core/udev/udev-extraconf_1.1.bbappend b/meta-digi-arm/recipes-core/udev/udev-extraconf_1.1.bbappend index 662156665..682247ec3 100644 --- a/meta-digi-arm/recipes-core/udev/udev-extraconf_1.1.bbappend +++ b/meta-digi-arm/recipes-core/udev/udev-extraconf_1.1.bbappend @@ -1,15 +1,17 @@ -# Copyright (C) 2013 Digi International. +# Copyright (C) 2013-2017 Digi International. FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" SRC_URI += " \ file://mount_bootparts.sh \ file://mount_partition.sh \ + file://81-spi-spidev.rules \ " do_install_append() { install -m 0755 ${WORKDIR}/mount_bootparts.sh ${D}${sysconfdir}/udev/scripts/ install -m 0755 ${WORKDIR}/mount_partition.sh ${D}${sysconfdir}/udev/scripts/ + install -m 0644 ${WORKDIR}/81-spi-spidev.rules ${D}${sysconfdir}/udev/rules.d/ # Bluetooth tty symlink if [ -n "${BT_TTY}" ]; then diff --git a/meta-digi-arm/recipes-kernel/cryptodev/cryptodev-module/0002-Adjust-to-another-change-in-the-user-page-API.patch b/meta-digi-arm/recipes-kernel/cryptodev/cryptodev-module/0002-Adjust-to-another-change-in-the-user-page-API.patch new file mode 100644 index 000000000..73313f380 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/cryptodev/cryptodev-module/0002-Adjust-to-another-change-in-the-user-page-API.patch @@ -0,0 +1,32 @@ +From: Michael Weiser +Date: Fri, 11 Nov 2016 18:09:32 +0100 +Subject: [PATCH] Adjust to another change in the user page API + +4.9.0 will replace the write and force flags of get_user_pages_remote() +with a gup_flags parameter[1]. Distinguish the two APIs based on kernel +version we're compiling for. + +[1] https://github.com/torvalds/linux/commit/9beae1ea89305a9667ceaab6d0bf46a045ad71e7 +--- + zc.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/zc.c b/zc.c +index a97b49f75327..e766ee3eabc7 100644 +--- a/zc.c ++++ b/zc.c +@@ -65,7 +65,13 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write, + ret = get_user_pages( + #endif + task, mm, +- (unsigned long)addr, pgcount, write, 0, pg, NULL); ++ (unsigned long)addr, pgcount, ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)) ++ write ? FOLL_WRITE : 0, ++#else ++ write, 0, ++#endif ++ pg, NULL); + up_read(&mm->mmap_sem); + if (ret != pgcount) + return -EINVAL; diff --git a/meta-digi-arm/recipes-kernel/cryptodev/cryptodev-module_%.bbappend b/meta-digi-arm/recipes-kernel/cryptodev/cryptodev-module_%.bbappend index 087f298e1..ce1d97772 100644 --- a/meta-digi-arm/recipes-kernel/cryptodev/cryptodev-module_%.bbappend +++ b/meta-digi-arm/recipes-kernel/cryptodev/cryptodev-module_%.bbappend @@ -1,3 +1,7 @@ -# Copyright (C) 2016 Digi International. +# Copyright (C) 2016-2017 Digi International Inc. + +FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" + +SRC_URI_append = " file://0002-Adjust-to-another-change-in-the-user-page-API.patch" KERNEL_MODULE_AUTOLOAD = "cryptodev" diff --git a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros.bb b/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros.bb deleted file mode 100644 index b81036507..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros.bb +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (C) 2013 Digi International. - -SUMMARY = "Atheros's wireless driver" -LICENSE = "ISC" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/ISC;md5=f3b90e78ea0cffb20bf5cca7947a896d" - -inherit module - -SRCREV_external = "" -SRCREV_internal = "50dafb5890180cf33fdb42919c3e6f591d0cd2ea" -SRCREV = "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${SRCREV_internal}', '${SRCREV_external}', d)}" - -SRC_URI_external = "${DIGI_GITHUB_GIT}/atheros.git;protocol=git;nobranch=1" -SRC_URI_internal = "${DIGI_GIT}linux-modules/atheros.git;protocol=git;nobranch=1" -SRC_URI = "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${SRC_URI_internal}', '${SRC_URI_external}', d)}" -SRC_URI += " \ - file://atheros-pre-up \ - file://Makefile \ - file://0001-atheros-convert-NLA_PUT-macros.patch \ - file://0002-atheros-update-renamed-struct-members.patch \ -" - -S = "${WORKDIR}/git" - -EXTRA_OEMAKE += "DEL_PLATFORM=${MACHINE} KLIB_BUILD=${STAGING_KERNEL_DIR}" - -do_configure_prepend() { - cp ${WORKDIR}/Makefile ${S}/ -} - -do_install_append() { - install -d ${D}${sysconfdir}/network/if-pre-up.d - install -m 0755 ${WORKDIR}/atheros-pre-up ${D}${sysconfdir}/network/if-pre-up.d/atheros - install -d ${D}${sysconfdir}/modprobe.d - cat >> ${D}${sysconfdir}/modprobe.d/atheros.conf <<-_EOF_ - install ath6kl_sdio true - options ath6kl_sdio ath6kl_p2p=1 softmac_enable=1 - _EOF_ -} - -FILES_${PN} += " \ - ${sysconfdir}/modprobe.d/ \ - ${sysconfdir}/network/ \ -" - -# 'modprobe' from kmod package is needed to load atheros driver. The one -# from busybox does not support '--ignore-install' option. -RDEPENDS_${PN} = "kmod" - -COMPATIBLE_MACHINE = "(ccardimx28)" diff --git a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/0001-atheros-convert-NLA_PUT-macros.patch b/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/0001-atheros-convert-NLA_PUT-macros.patch deleted file mode 100644 index 331f62c78..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/0001-atheros-convert-NLA_PUT-macros.patch +++ /dev/null @@ -1,1761 +0,0 @@ -From: Javier Viguera -Date: Fri, 13 Sep 2013 10:54:16 +0200 -Subject: [PATCH] atheros: convert NLA_PUT macros - -sed -i -e '/NLA_PUT_[A-Z0-9]\+.*;$/{s,\(\t*\)\(NLA_PUT_[A-Z0-9]\+\)\([^;]\+\);,\1if (\L\2\E\3)\n\1\tgoto nla_put_failure;,g}' compat-wireless/drivers/net/wireless/ath/ath6kl/testmode.c compat-wireless/drivers/net/wireless/ath/ath6kl/wmiconfig.c compat-wireless/net/wireless/nl80211.c - -sed -i -e '/NLA_PUT_[A-Z0-9]\+.*[^;]$/{N;s,\(\t*\)\(NLA_PUT_[A-Z0-9]\+\)\([^;]\+\);,\1if (\L\2\E\3)\n\1\tgoto nla_put_failure;,g}' compat-wireless/drivers/net/wireless/ath/ath6kl/testmode.c compat-wireless/drivers/net/wireless/ath/ath6kl/wmiconfig.c compat-wireless/net/wireless/nl80211.c - -sed -i -e '/NLA_PUT.*;$/{s,\(\t*\)\(NLA_PUT\)\([^;]\+\);,\1if (\L\2\E\3)\n\1\tgoto nla_put_failure;,g}' compat-wireless/drivers/net/wireless/ath/ath6kl/testmode.c compat-wireless/drivers/net/wireless/ath/ath6kl/wmiconfig.c compat-wireless/net/wireless/nl80211.c - -sed -i -e '/NLA_PUT.*[^;]$/{N;s,\(\t*\)\(NLA_PUT\)\([^;]\+\);,\1if (\L\2\E\3)\n\1\tgoto nla_put_failure;,g}' compat-wireless/drivers/net/wireless/ath/ath6kl/testmode.c compat-wireless/drivers/net/wireless/ath/ath6kl/wmiconfig.c compat-wireless/net/wireless/nl80211.c - -sed -i -e '/NLA_PUT.*[^;]$/{N;N;s,\(\t*\)\(NLA_PUT\)\([^;]\+\);,\1if (\L\2\E\3)\n\1\tgoto nla_put_failure;,g}' compat-wireless/drivers/net/wireless/ath/ath6kl/testmode.c compat-wireless/drivers/net/wireless/ath/ath6kl/wmiconfig.c compat-wireless/net/wireless/nl80211.c - -And some minor manual fixes after running above commands. - -Signed-off-by: Javier Viguera ---- - .../drivers/net/wireless/ath/ath6kl/testmode.c | 6 +- - .../drivers/net/wireless/ath/ath6kl/wmiconfig.c | 6 +- - compat-wireless/net/wireless/nl80211.c | 1058 ++++++++++++-------- - 3 files changed, 676 insertions(+), 394 deletions(-) - -diff --git a/compat-wireless/drivers/net/wireless/ath/ath6kl/testmode.c b/compat-wireless/drivers/net/wireless/ath/ath6kl/testmode.c -index 942537cf81b5..c0ce573efb01 100644 ---- a/compat-wireless/drivers/net/wireless/ath/ath6kl/testmode.c -+++ b/compat-wireless/drivers/net/wireless/ath/ath6kl/testmode.c -@@ -59,8 +59,10 @@ void ath6kl_tm_rx_event(struct ath6kl *ar, void *buf, size_t buf_len) - ath6kl_warn("failed to allocate testmode rx skb!\n"); - return; - } -- NLA_PUT_U32(skb, ATH6KL_TM_ATTR_CMD, ATH6KL_TM_CMD_TCMD); -- NLA_PUT(skb, ATH6KL_TM_ATTR_DATA, buf_len, buf); -+ if (nla_put_u32(skb, ATH6KL_TM_ATTR_CMD, ATH6KL_TM_CMD_TCMD)) -+ goto nla_put_failure; -+ if (nla_put(skb, ATH6KL_TM_ATTR_DATA, buf_len, buf)) -+ goto nla_put_failure; - cfg80211_testmode_event(skb, GFP_KERNEL); - return; - -diff --git a/compat-wireless/drivers/net/wireless/ath/ath6kl/wmiconfig.c b/compat-wireless/drivers/net/wireless/ath/ath6kl/wmiconfig.c -index bb60ed23a967..450f915b9f96 100644 ---- a/compat-wireless/drivers/net/wireless/ath/ath6kl/wmiconfig.c -+++ b/compat-wireless/drivers/net/wireless/ath/ath6kl/wmiconfig.c -@@ -64,8 +64,10 @@ void ath6kl_tm_rx_wmi_event(struct ath6kl *ar, void *buf, size_t buf_len) - ath6kl_warn("failed to allocate testmode rx skb!\n"); - return; - } -- NLA_PUT_U32(skb, ATH6KL_TM_ATTR_CMD, ATH6KL_TM_CMD_WMI_CMD); -- NLA_PUT(skb, ATH6KL_TM_ATTR_DATA, buf_len, buf); -+ if (nla_put_u32(skb, ATH6KL_TM_ATTR_CMD, ATH6KL_TM_CMD_WMI_CMD)) -+ goto nla_put_failure; -+ if (nla_put(skb, ATH6KL_TM_ATTR_DATA, buf_len, buf)) -+ goto nla_put_failure; - cfg80211_testmode_event(skb, GFP_KERNEL); - return; - -diff --git a/compat-wireless/net/wireless/nl80211.c b/compat-wireless/net/wireless/nl80211.c -index 66d35f2ca879..c219a2ca027f 100644 ---- a/compat-wireless/net/wireless/nl80211.c -+++ b/compat-wireless/net/wireless/nl80211.c -@@ -363,20 +363,26 @@ static inline void *nl80211hdr_put(struct sk_buff *skb, u32 pid, u32 seq, - static int nl80211_msg_put_channel(struct sk_buff *msg, - struct ieee80211_channel *chan) - { -- NLA_PUT_U32(msg, NL80211_FREQUENCY_ATTR_FREQ, -- chan->center_freq); -+ if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_FREQ, -+ chan->center_freq)) -+ goto nla_put_failure; - - if (chan->flags & IEEE80211_CHAN_DISABLED) -- NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_DISABLED); -+ if (nla_put_flag(msg, NL80211_FREQUENCY_ATTR_DISABLED)) -+ goto nla_put_failure; - if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) -- NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_PASSIVE_SCAN); -+ if (nla_put_flag(msg, NL80211_FREQUENCY_ATTR_PASSIVE_SCAN)) -+ goto nla_put_failure; - if (chan->flags & IEEE80211_CHAN_NO_IBSS) -- NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_NO_IBSS); -+ if (nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_IBSS)) -+ goto nla_put_failure; - if (chan->flags & IEEE80211_CHAN_RADAR) -- NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_RADAR); -+ if (nla_put_flag(msg, NL80211_FREQUENCY_ATTR_RADAR)) -+ goto nla_put_failure; - -- NLA_PUT_U32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, -- DBM_TO_MBM(chan->max_power)); -+ if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, -+ DBM_TO_MBM(chan->max_power))) -+ goto nla_put_failure; - - return 0; - -@@ -630,7 +636,8 @@ static int nl80211_put_iftypes(struct sk_buff *msg, u32 attr, u16 ifmodes) - i = 0; - while (ifmodes) { - if (ifmodes & 1) -- NLA_PUT_FLAG(msg, i); -+ if (nla_put_flag(msg, i)) -+ goto nla_put_failure; - ifmodes >>= 1; - i++; - } -@@ -673,8 +680,9 @@ static int nl80211_put_iface_combinations(struct wiphy *wiphy, - nl_limit = nla_nest_start(msg, j + 1); - if (!nl_limit) - goto nla_put_failure; -- NLA_PUT_U32(msg, NL80211_IFACE_LIMIT_MAX, -- c->limits[j].max); -+ if (nla_put_u32(msg, NL80211_IFACE_LIMIT_MAX, -+ c->limits[j].max)) -+ goto nla_put_failure; - if (nl80211_put_iftypes(msg, NL80211_IFACE_LIMIT_TYPES, - c->limits[j].types)) - goto nla_put_failure; -@@ -684,12 +692,15 @@ static int nl80211_put_iface_combinations(struct wiphy *wiphy, - nla_nest_end(msg, nl_limits); - - if (c->beacon_int_infra_match) -- NLA_PUT_FLAG(msg, -- NL80211_IFACE_COMB_STA_AP_BI_MATCH); -- NLA_PUT_U32(msg, NL80211_IFACE_COMB_NUM_CHANNELS, -- c->num_different_channels); -- NLA_PUT_U32(msg, NL80211_IFACE_COMB_MAXNUM, -- c->max_interfaces); -+ if (nla_put_flag(msg, -+ NL80211_IFACE_COMB_STA_AP_BI_MATCH)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_IFACE_COMB_NUM_CHANNELS, -+ c->num_different_channels)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_IFACE_COMB_MAXNUM, -+ c->max_interfaces)) -+ goto nla_put_failure; - - nla_nest_end(msg, nl_combi); - } -@@ -720,64 +731,89 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, - if (!hdr) - return -1; - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, dev->wiphy_idx); -- NLA_PUT_STRING(msg, NL80211_ATTR_WIPHY_NAME, wiphy_name(&dev->wiphy)); -- -- NLA_PUT_U32(msg, NL80211_ATTR_GENERATION, -- cfg80211_rdev_list_generation); -- -- NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_RETRY_SHORT, -- dev->wiphy.retry_short); -- NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_RETRY_LONG, -- dev->wiphy.retry_long); -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FRAG_THRESHOLD, -- dev->wiphy.frag_threshold); -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_RTS_THRESHOLD, -- dev->wiphy.rts_threshold); -- NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS, -- dev->wiphy.coverage_class); -- NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS, -- dev->wiphy.max_scan_ssids); -- NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, -- dev->wiphy.max_sched_scan_ssids); -- NLA_PUT_U16(msg, NL80211_ATTR_MAX_SCAN_IE_LEN, -- dev->wiphy.max_scan_ie_len); -- NLA_PUT_U16(msg, NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN, -- dev->wiphy.max_sched_scan_ie_len); -- NLA_PUT_U8(msg, NL80211_ATTR_MAX_MATCH_SETS, -- dev->wiphy.max_match_sets); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, dev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_string(msg, NL80211_ATTR_WIPHY_NAME, wiphy_name(&dev->wiphy))) -+ goto nla_put_failure; -+ -+ if (nla_put_u32(msg, NL80211_ATTR_GENERATION, -+ cfg80211_rdev_list_generation)) -+ goto nla_put_failure; -+ -+ if (nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_SHORT, -+ dev->wiphy.retry_short)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_LONG, -+ dev->wiphy.retry_long)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FRAG_THRESHOLD, -+ dev->wiphy.frag_threshold)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY_RTS_THRESHOLD, -+ dev->wiphy.rts_threshold)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS, -+ dev->wiphy.coverage_class)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS, -+ dev->wiphy.max_scan_ssids)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, -+ dev->wiphy.max_sched_scan_ssids)) -+ goto nla_put_failure; -+ if (nla_put_u16(msg, NL80211_ATTR_MAX_SCAN_IE_LEN, -+ dev->wiphy.max_scan_ie_len)) -+ goto nla_put_failure; -+ if (nla_put_u16(msg, NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN, -+ dev->wiphy.max_sched_scan_ie_len)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_ATTR_MAX_MATCH_SETS, -+ dev->wiphy.max_match_sets)) -+ goto nla_put_failure; - - if (dev->wiphy.flags & WIPHY_FLAG_IBSS_RSN) -- NLA_PUT_FLAG(msg, NL80211_ATTR_SUPPORT_IBSS_RSN); -+ if (nla_put_flag(msg, NL80211_ATTR_SUPPORT_IBSS_RSN)) -+ goto nla_put_failure; - if (dev->wiphy.flags & WIPHY_FLAG_MESH_AUTH) -- NLA_PUT_FLAG(msg, NL80211_ATTR_SUPPORT_MESH_AUTH); -+ if (nla_put_flag(msg, NL80211_ATTR_SUPPORT_MESH_AUTH)) -+ goto nla_put_failure; - if (dev->wiphy.flags & WIPHY_FLAG_AP_UAPSD) -- NLA_PUT_FLAG(msg, NL80211_ATTR_SUPPORT_AP_UAPSD); -+ if (nla_put_flag(msg, NL80211_ATTR_SUPPORT_AP_UAPSD)) -+ goto nla_put_failure; - if (dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_FW_ROAM) -- NLA_PUT_FLAG(msg, NL80211_ATTR_ROAM_SUPPORT); -+ if (nla_put_flag(msg, NL80211_ATTR_ROAM_SUPPORT)) -+ goto nla_put_failure; - if (dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) -- NLA_PUT_FLAG(msg, NL80211_ATTR_TDLS_SUPPORT); -+ if (nla_put_flag(msg, NL80211_ATTR_TDLS_SUPPORT)) -+ goto nla_put_failure; - if (dev->wiphy.flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP) -- NLA_PUT_FLAG(msg, NL80211_ATTR_TDLS_EXTERNAL_SETUP); -+ if (nla_put_flag(msg, NL80211_ATTR_TDLS_EXTERNAL_SETUP)) -+ goto nla_put_failure; - -- NLA_PUT(msg, NL80211_ATTR_CIPHER_SUITES, -+ if (nla_put(msg, NL80211_ATTR_CIPHER_SUITES, - sizeof(u32) * dev->wiphy.n_cipher_suites, -- dev->wiphy.cipher_suites); -+ dev->wiphy.cipher_suites)) -+ goto nla_put_failure; - -- NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_PMKIDS, -- dev->wiphy.max_num_pmkids); -+ if (nla_put_u8(msg, NL80211_ATTR_MAX_NUM_PMKIDS, -+ dev->wiphy.max_num_pmkids)) -+ goto nla_put_failure; - - if (dev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL) -- NLA_PUT_FLAG(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE); -+ if (nla_put_flag(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE)) -+ goto nla_put_failure; - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX, -- dev->wiphy.available_antennas_tx); -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, -- dev->wiphy.available_antennas_rx); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX, -+ dev->wiphy.available_antennas_tx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, -+ dev->wiphy.available_antennas_rx)) -+ goto nla_put_failure; - - if (dev->wiphy.flags & WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD) -- NLA_PUT_U32(msg, NL80211_ATTR_PROBE_RESP_OFFLOAD, -- dev->wiphy.probe_resp_offload); -+ if (nla_put_u32(msg, NL80211_ATTR_PROBE_RESP_OFFLOAD, -+ dev->wiphy.probe_resp_offload)) -+ goto nla_put_failure; - - if ((dev->wiphy.available_antennas_tx || - dev->wiphy.available_antennas_rx) && dev->ops->get_antenna) { -@@ -785,8 +821,10 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, - int res; - res = dev->ops->get_antenna(&dev->wiphy, &tx_ant, &rx_ant); - if (!res) { -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_TX, tx_ant); -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_RX, rx_ant); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_TX, tx_ant)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_RX, rx_ant)) -+ goto nla_put_failure; - } - } - -@@ -808,15 +846,19 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, - - /* add HT info */ - if (dev->wiphy.bands[band]->ht_cap.ht_supported) { -- NLA_PUT(msg, NL80211_BAND_ATTR_HT_MCS_SET, -+ if (nla_put(msg, NL80211_BAND_ATTR_HT_MCS_SET, - sizeof(dev->wiphy.bands[band]->ht_cap.mcs), -- &dev->wiphy.bands[band]->ht_cap.mcs); -- NLA_PUT_U16(msg, NL80211_BAND_ATTR_HT_CAPA, -- dev->wiphy.bands[band]->ht_cap.cap); -- NLA_PUT_U8(msg, NL80211_BAND_ATTR_HT_AMPDU_FACTOR, -- dev->wiphy.bands[band]->ht_cap.ampdu_factor); -- NLA_PUT_U8(msg, NL80211_BAND_ATTR_HT_AMPDU_DENSITY, -- dev->wiphy.bands[band]->ht_cap.ampdu_density); -+ &dev->wiphy.bands[band]->ht_cap.mcs)) -+ goto nla_put_failure; -+ if (nla_put_u16(msg, NL80211_BAND_ATTR_HT_CAPA, -+ dev->wiphy.bands[band]->ht_cap.cap)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_BAND_ATTR_HT_AMPDU_FACTOR, -+ dev->wiphy.bands[band]->ht_cap.ampdu_factor)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_BAND_ATTR_HT_AMPDU_DENSITY, -+ dev->wiphy.bands[band]->ht_cap.ampdu_density)) -+ goto nla_put_failure; - } - - /* add frequencies */ -@@ -850,11 +892,13 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, - goto nla_put_failure; - - rate = &dev->wiphy.bands[band]->bitrates[i]; -- NLA_PUT_U32(msg, NL80211_BITRATE_ATTR_RATE, -- rate->bitrate); -+ if (nla_put_u32(msg, NL80211_BITRATE_ATTR_RATE, -+ rate->bitrate)) -+ goto nla_put_failure; - if (rate->flags & IEEE80211_RATE_SHORT_PREAMBLE) -- NLA_PUT_FLAG(msg, -- NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE); -+ if (nla_put_flag(msg, -+ NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE)) -+ goto nla_put_failure; - - nla_nest_end(msg, nl_rate); - } -@@ -874,7 +918,8 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, - do { \ - if (dev->ops->op) { \ - i++; \ -- NLA_PUT_U32(msg, i, NL80211_CMD_ ## n); \ -+ if (nla_put_u32(msg, i, NL80211_CMD_ ## n)) \ -+ goto nla_put_failure; \ - } \ - } while (0) - -@@ -901,7 +946,8 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, - CMD(mgmt_tx_cancel_wait, FRAME_WAIT_CANCEL); - if (dev->wiphy.flags & WIPHY_FLAG_NETNS_OK) { - i++; -- NLA_PUT_U32(msg, i, NL80211_CMD_SET_WIPHY_NETNS); -+ if (nla_put_u32(msg, i, NL80211_CMD_SET_WIPHY_NETNS)) -+ goto nla_put_failure; - } - CMD(set_channel, SET_CHANNEL); - CMD(set_wds_peer, SET_WDS_PEER); -@@ -914,29 +960,34 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, - CMD(probe_client, PROBE_CLIENT); - if (dev->wiphy.flags & WIPHY_FLAG_REPORTS_OBSS) { - i++; -- NLA_PUT_U32(msg, i, NL80211_CMD_REGISTER_BEACONS); -+ if (nla_put_u32(msg, i, NL80211_CMD_REGISTER_BEACONS)) -+ goto nla_put_failure; - } - - #undef CMD - - if (dev->ops->connect || dev->ops->auth) { - i++; -- NLA_PUT_U32(msg, i, NL80211_CMD_CONNECT); -+ if (nla_put_u32(msg, i, NL80211_CMD_CONNECT)) -+ goto nla_put_failure; - } - - if (dev->ops->disconnect || dev->ops->deauth) { - i++; -- NLA_PUT_U32(msg, i, NL80211_CMD_DISCONNECT); -+ if (nla_put_u32(msg, i, NL80211_CMD_DISCONNECT)) -+ goto nla_put_failure; - } - - nla_nest_end(msg, nl_cmds); - - if (dev->ops->remain_on_channel) -- NLA_PUT_U32(msg, NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION, -- dev->wiphy.max_remain_on_channel_duration); -+ if (nla_put_u32(msg, NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION, -+ dev->wiphy.max_remain_on_channel_duration)) -+ goto nla_put_failure; - - if (dev->ops->mgmt_tx_cancel_wait) -- NLA_PUT_FLAG(msg, NL80211_ATTR_OFFCHANNEL_TX_OK); -+ if (nla_put_flag(msg, NL80211_ATTR_OFFCHANNEL_TX_OK)) -+ goto nla_put_failure; - - if (mgmt_stypes) { - u16 stypes; -@@ -955,8 +1006,9 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, - stypes = mgmt_stypes[ift].tx; - while (stypes) { - if (stypes & 1) -- NLA_PUT_U16(msg, NL80211_ATTR_FRAME_TYPE, -- (i << 4) | IEEE80211_FTYPE_MGMT); -+ if (nla_put_u16(msg, NL80211_ATTR_FRAME_TYPE, -+ (i << 4) | IEEE80211_FTYPE_MGMT)) -+ goto nla_put_failure; - stypes >>= 1; - i++; - } -@@ -977,8 +1029,9 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, - stypes = mgmt_stypes[ift].rx; - while (stypes) { - if (stypes & 1) -- NLA_PUT_U16(msg, NL80211_ATTR_FRAME_TYPE, -- (i << 4) | IEEE80211_FTYPE_MGMT); -+ if (nla_put_u16(msg, NL80211_ATTR_FRAME_TYPE, -+ (i << 4) | IEEE80211_FTYPE_MGMT)) -+ goto nla_put_failure; - stypes >>= 1; - i++; - } -@@ -996,21 +1049,29 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, - goto nla_put_failure; - - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_ANY) -- NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_ANY); -+ if (nla_put_flag(msg, NL80211_WOWLAN_TRIG_ANY)) -+ goto nla_put_failure; - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_DISCONNECT) -- NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_DISCONNECT); -+ if (nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT)) -+ goto nla_put_failure; - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_MAGIC_PKT) -- NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT); -+ if (nla_put_flag(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT)) -+ goto nla_put_failure; - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY) -- NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED); -+ if (nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED)) -+ goto nla_put_failure; - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) -- NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE); -+ if (nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE)) -+ goto nla_put_failure; - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_EAP_IDENTITY_REQ) -- NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST); -+ if (nla_put_flag(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST)) -+ goto nla_put_failure; - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_4WAY_HANDSHAKE) -- NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE); -+ if (nla_put_flag(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE)) -+ goto nla_put_failure; - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_RFKILL_RELEASE) -- NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE); -+ if (nla_put_flag(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE)) -+ goto nla_put_failure; - if (dev->wiphy.wowlan.n_patterns) { - struct nl80211_wowlan_pattern_support pat = { - .max_patterns = dev->wiphy.wowlan.n_patterns, -@@ -1019,8 +1080,9 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, - .max_pattern_len = - dev->wiphy.wowlan.pattern_max_len, - }; -- NLA_PUT(msg, NL80211_WOWLAN_TRIG_PKT_PATTERN, -- sizeof(pat), &pat); -+ if (nla_put(msg, NL80211_WOWLAN_TRIG_PKT_PATTERN, -+ sizeof(pat), &pat)) -+ goto nla_put_failure; - } - - nla_nest_end(msg, nl_wowlan); -@@ -1034,10 +1096,12 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, - goto nla_put_failure; - - if (dev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME) -- NLA_PUT_U32(msg, NL80211_ATTR_DEVICE_AP_SME, -- dev->wiphy.ap_sme_capa); -+ if (nla_put_u32(msg, NL80211_ATTR_DEVICE_AP_SME, -+ dev->wiphy.ap_sme_capa)) -+ goto nla_put_failure; - -- NLA_PUT_U32(msg, NL80211_ATTR_FEATURE_FLAGS, dev->wiphy.features); -+ if (nla_put_u32(msg, NL80211_ATTR_FEATURE_FLAGS, dev->wiphy.features)) -+ goto nla_put_failure; - - return genlmsg_end(msg, hdr); - -@@ -1480,14 +1544,19 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 pid, u32 seq, int flags, - if (!hdr) - return -1; - -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_STRING(msg, NL80211_ATTR_IFNAME, dev->name); -- NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, dev->ieee80211_ptr->iftype); -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_string(msg, NL80211_ATTR_IFNAME, dev->name)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFTYPE, dev->ieee80211_ptr->iftype)) -+ goto nla_put_failure; - -- NLA_PUT_U32(msg, NL80211_ATTR_GENERATION, -+ if (nla_put_u32(msg, NL80211_ATTR_GENERATION, - rdev->devlist_generation ^ -- (cfg80211_rdev_list_generation << 2)); -+ (cfg80211_rdev_list_generation << 2))) -+ goto nla_put_failure; - - return genlmsg_end(msg, hdr); - -@@ -1769,34 +1838,41 @@ static void get_key_callback(void *c, struct key_params *params) - struct get_key_cookie *cookie = c; - - if (params->key) -- NLA_PUT(cookie->msg, NL80211_ATTR_KEY_DATA, -- params->key_len, params->key); -+ if (nla_put(cookie->msg, NL80211_ATTR_KEY_DATA, -+ params->key_len, params->key)) -+ goto nla_put_failure; - - if (params->seq) -- NLA_PUT(cookie->msg, NL80211_ATTR_KEY_SEQ, -- params->seq_len, params->seq); -+ if (nla_put(cookie->msg, NL80211_ATTR_KEY_SEQ, -+ params->seq_len, params->seq)) -+ goto nla_put_failure; - - if (params->cipher) -- NLA_PUT_U32(cookie->msg, NL80211_ATTR_KEY_CIPHER, -- params->cipher); -+ if (nla_put_u32(cookie->msg, NL80211_ATTR_KEY_CIPHER, -+ params->cipher)) -+ goto nla_put_failure; - - key = nla_nest_start(cookie->msg, NL80211_ATTR_KEY); - if (!key) - goto nla_put_failure; - - if (params->key) -- NLA_PUT(cookie->msg, NL80211_KEY_DATA, -- params->key_len, params->key); -+ if (nla_put(cookie->msg, NL80211_KEY_DATA, -+ params->key_len, params->key)) -+ goto nla_put_failure; - - if (params->seq) -- NLA_PUT(cookie->msg, NL80211_KEY_SEQ, -- params->seq_len, params->seq); -+ if (nla_put(cookie->msg, NL80211_KEY_SEQ, -+ params->seq_len, params->seq)) -+ goto nla_put_failure; - - if (params->cipher) -- NLA_PUT_U32(cookie->msg, NL80211_KEY_CIPHER, -- params->cipher); -+ if (nla_put_u32(cookie->msg, NL80211_KEY_CIPHER, -+ params->cipher)) -+ goto nla_put_failure; - -- NLA_PUT_U8(cookie->msg, NL80211_ATTR_KEY_IDX, cookie->idx); -+ if (nla_put_u8(cookie->msg, NL80211_ATTR_KEY_IDX, cookie->idx)) -+ goto nla_put_failure; - - nla_nest_end(cookie->msg, key); - -@@ -1854,10 +1930,13 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info) - cookie.msg = msg; - cookie.idx = key_idx; - -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); -- NLA_PUT_U8(msg, NL80211_ATTR_KEY_IDX, key_idx); -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_ATTR_KEY_IDX, key_idx)) -+ goto nla_put_failure; - if (mac_addr) -- NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); -+ if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr)) -+ goto nla_put_failure; - - if (pairwise && mac_addr && - !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) -@@ -2373,14 +2452,18 @@ static bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info, - /* cfg80211_calculate_bitrate will return 0 for mcs >= 32 */ - bitrate = cfg80211_calculate_bitrate(info); - if (bitrate > 0) -- NLA_PUT_U16(msg, NL80211_RATE_INFO_BITRATE, bitrate); -+ if (nla_put_u16(msg, NL80211_RATE_INFO_BITRATE, bitrate)) -+ goto nla_put_failure; - - if (info->flags & RATE_INFO_FLAGS_MCS) -- NLA_PUT_U8(msg, NL80211_RATE_INFO_MCS, info->mcs); -+ if (nla_put_u8(msg, NL80211_RATE_INFO_MCS, info->mcs)) -+ goto nla_put_failure; - if (info->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH) -- NLA_PUT_FLAG(msg, NL80211_RATE_INFO_40_MHZ_WIDTH); -+ if (nla_put_flag(msg, NL80211_RATE_INFO_40_MHZ_WIDTH)) -+ goto nla_put_failure; - if (info->flags & RATE_INFO_FLAGS_SHORT_GI) -- NLA_PUT_FLAG(msg, NL80211_RATE_INFO_SHORT_GI); -+ if (nla_put_flag(msg, NL80211_RATE_INFO_SHORT_GI)) -+ goto nla_put_failure; - - nla_nest_end(msg, rate); - return true; -@@ -2400,41 +2483,53 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, - if (!hdr) - return -1; - -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); -- NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr)) -+ goto nla_put_failure; - -- NLA_PUT_U32(msg, NL80211_ATTR_GENERATION, sinfo->generation); -+ if (nla_put_u32(msg, NL80211_ATTR_GENERATION, sinfo->generation)) -+ goto nla_put_failure; - - sinfoattr = nla_nest_start(msg, NL80211_ATTR_STA_INFO); - if (!sinfoattr) - goto nla_put_failure; - if (sinfo->filled & STATION_INFO_CONNECTED_TIME) -- NLA_PUT_U32(msg, NL80211_STA_INFO_CONNECTED_TIME, -- sinfo->connected_time); -+ if (nla_put_u32(msg, NL80211_STA_INFO_CONNECTED_TIME, -+ sinfo->connected_time)) -+ goto nla_put_failure; - if (sinfo->filled & STATION_INFO_INACTIVE_TIME) -- NLA_PUT_U32(msg, NL80211_STA_INFO_INACTIVE_TIME, -- sinfo->inactive_time); -+ if (nla_put_u32(msg, NL80211_STA_INFO_INACTIVE_TIME, -+ sinfo->inactive_time)) -+ goto nla_put_failure; - if (sinfo->filled & STATION_INFO_RX_BYTES) -- NLA_PUT_U32(msg, NL80211_STA_INFO_RX_BYTES, -- sinfo->rx_bytes); -+ if (nla_put_u32(msg, NL80211_STA_INFO_RX_BYTES, -+ sinfo->rx_bytes)) -+ goto nla_put_failure; - if (sinfo->filled & STATION_INFO_TX_BYTES) -- NLA_PUT_U32(msg, NL80211_STA_INFO_TX_BYTES, -- sinfo->tx_bytes); -+ if (nla_put_u32(msg, NL80211_STA_INFO_TX_BYTES, -+ sinfo->tx_bytes)) -+ goto nla_put_failure; - if (sinfo->filled & STATION_INFO_LLID) -- NLA_PUT_U16(msg, NL80211_STA_INFO_LLID, -- sinfo->llid); -+ if (nla_put_u16(msg, NL80211_STA_INFO_LLID, -+ sinfo->llid)) -+ goto nla_put_failure; - if (sinfo->filled & STATION_INFO_PLID) -- NLA_PUT_U16(msg, NL80211_STA_INFO_PLID, -- sinfo->plid); -+ if (nla_put_u16(msg, NL80211_STA_INFO_PLID, -+ sinfo->plid)) -+ goto nla_put_failure; - if (sinfo->filled & STATION_INFO_PLINK_STATE) -- NLA_PUT_U8(msg, NL80211_STA_INFO_PLINK_STATE, -- sinfo->plink_state); -+ if (nla_put_u8(msg, NL80211_STA_INFO_PLINK_STATE, -+ sinfo->plink_state)) -+ goto nla_put_failure; - if (sinfo->filled & STATION_INFO_SIGNAL) -- NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL, -- sinfo->signal); -+ if (nla_put_u8(msg, NL80211_STA_INFO_SIGNAL, -+ sinfo->signal)) -+ goto nla_put_failure; - if (sinfo->filled & STATION_INFO_SIGNAL_AVG) -- NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL_AVG, -- sinfo->signal_avg); -+ if (nla_put_u8(msg, NL80211_STA_INFO_SIGNAL_AVG, -+ sinfo->signal_avg)) -+ goto nla_put_failure; - if (sinfo->filled & STATION_INFO_TX_BITRATE) { - if (!nl80211_put_sta_rate(msg, &sinfo->txrate, - NL80211_STA_INFO_TX_BITRATE)) -@@ -2446,45 +2541,56 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, - goto nla_put_failure; - } - if (sinfo->filled & STATION_INFO_RX_PACKETS) -- NLA_PUT_U32(msg, NL80211_STA_INFO_RX_PACKETS, -- sinfo->rx_packets); -+ if (nla_put_u32(msg, NL80211_STA_INFO_RX_PACKETS, -+ sinfo->rx_packets)) -+ goto nla_put_failure; - if (sinfo->filled & STATION_INFO_TX_PACKETS) -- NLA_PUT_U32(msg, NL80211_STA_INFO_TX_PACKETS, -- sinfo->tx_packets); -+ if (nla_put_u32(msg, NL80211_STA_INFO_TX_PACKETS, -+ sinfo->tx_packets)) -+ goto nla_put_failure; - if (sinfo->filled & STATION_INFO_TX_RETRIES) -- NLA_PUT_U32(msg, NL80211_STA_INFO_TX_RETRIES, -- sinfo->tx_retries); -+ if (nla_put_u32(msg, NL80211_STA_INFO_TX_RETRIES, -+ sinfo->tx_retries)) -+ goto nla_put_failure; - if (sinfo->filled & STATION_INFO_TX_FAILED) -- NLA_PUT_U32(msg, NL80211_STA_INFO_TX_FAILED, -- sinfo->tx_failed); -+ if (nla_put_u32(msg, NL80211_STA_INFO_TX_FAILED, -+ sinfo->tx_failed)) -+ goto nla_put_failure; - if (sinfo->filled & STATION_INFO_BSS_PARAM) { - bss_param = nla_nest_start(msg, NL80211_STA_INFO_BSS_PARAM); - if (!bss_param) - goto nla_put_failure; - - if (sinfo->bss_param.flags & BSS_PARAM_FLAGS_CTS_PROT) -- NLA_PUT_FLAG(msg, NL80211_STA_BSS_PARAM_CTS_PROT); -+ if (nla_put_flag(msg, NL80211_STA_BSS_PARAM_CTS_PROT)) -+ goto nla_put_failure; - if (sinfo->bss_param.flags & BSS_PARAM_FLAGS_SHORT_PREAMBLE) -- NLA_PUT_FLAG(msg, NL80211_STA_BSS_PARAM_SHORT_PREAMBLE); -+ if (nla_put_flag(msg, NL80211_STA_BSS_PARAM_SHORT_PREAMBLE)) -+ goto nla_put_failure; - if (sinfo->bss_param.flags & BSS_PARAM_FLAGS_SHORT_SLOT_TIME) -- NLA_PUT_FLAG(msg, -- NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME); -- NLA_PUT_U8(msg, NL80211_STA_BSS_PARAM_DTIM_PERIOD, -- sinfo->bss_param.dtim_period); -- NLA_PUT_U16(msg, NL80211_STA_BSS_PARAM_BEACON_INTERVAL, -- sinfo->bss_param.beacon_interval); -+ if (nla_put_flag(msg, -+ NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_STA_BSS_PARAM_DTIM_PERIOD, -+ sinfo->bss_param.dtim_period)) -+ goto nla_put_failure; -+ if (nla_put_u16(msg, NL80211_STA_BSS_PARAM_BEACON_INTERVAL, -+ sinfo->bss_param.beacon_interval)) -+ goto nla_put_failure; - - nla_nest_end(msg, bss_param); - } - if (sinfo->filled & STATION_INFO_STA_FLAGS) -- NLA_PUT(msg, NL80211_STA_INFO_STA_FLAGS, -+ if (nla_put(msg, NL80211_STA_INFO_STA_FLAGS, - sizeof(struct nl80211_sta_flag_update), -- &sinfo->sta_flags); -+ &sinfo->sta_flags)) -+ goto nla_put_failure; - nla_nest_end(msg, sinfoattr); - - if (sinfo->filled & STATION_INFO_ASSOC_REQ_IES) -- NLA_PUT(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len, -- sinfo->assoc_req_ies); -+ if (nla_put(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len, -+ sinfo->assoc_req_ies)) -+ goto nla_put_failure; - - return genlmsg_end(msg, hdr); - -@@ -2872,36 +2978,47 @@ static int nl80211_send_mpath(struct sk_buff *msg, u32 pid, u32 seq, - if (!hdr) - return -1; - -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); -- NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, dst); -- NLA_PUT(msg, NL80211_ATTR_MPATH_NEXT_HOP, ETH_ALEN, next_hop); -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, dst)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_MPATH_NEXT_HOP, ETH_ALEN, next_hop)) -+ goto nla_put_failure; - -- NLA_PUT_U32(msg, NL80211_ATTR_GENERATION, pinfo->generation); -+ if (nla_put_u32(msg, NL80211_ATTR_GENERATION, pinfo->generation)) -+ goto nla_put_failure; - - pinfoattr = nla_nest_start(msg, NL80211_ATTR_MPATH_INFO); - if (!pinfoattr) - goto nla_put_failure; - if (pinfo->filled & MPATH_INFO_FRAME_QLEN) -- NLA_PUT_U32(msg, NL80211_MPATH_INFO_FRAME_QLEN, -- pinfo->frame_qlen); -+ if (nla_put_u32(msg, NL80211_MPATH_INFO_FRAME_QLEN, -+ pinfo->frame_qlen)) -+ goto nla_put_failure; - if (pinfo->filled & MPATH_INFO_SN) -- NLA_PUT_U32(msg, NL80211_MPATH_INFO_SN, -- pinfo->sn); -+ if (nla_put_u32(msg, NL80211_MPATH_INFO_SN, -+ pinfo->sn)) -+ goto nla_put_failure; - if (pinfo->filled & MPATH_INFO_METRIC) -- NLA_PUT_U32(msg, NL80211_MPATH_INFO_METRIC, -- pinfo->metric); -+ if (nla_put_u32(msg, NL80211_MPATH_INFO_METRIC, -+ pinfo->metric)) -+ goto nla_put_failure; - if (pinfo->filled & MPATH_INFO_EXPTIME) -- NLA_PUT_U32(msg, NL80211_MPATH_INFO_EXPTIME, -- pinfo->exptime); -+ if (nla_put_u32(msg, NL80211_MPATH_INFO_EXPTIME, -+ pinfo->exptime)) -+ goto nla_put_failure; - if (pinfo->filled & MPATH_INFO_FLAGS) -- NLA_PUT_U8(msg, NL80211_MPATH_INFO_FLAGS, -- pinfo->flags); -+ if (nla_put_u8(msg, NL80211_MPATH_INFO_FLAGS, -+ pinfo->flags)) -+ goto nla_put_failure; - if (pinfo->filled & MPATH_INFO_DISCOVERY_TIMEOUT) -- NLA_PUT_U32(msg, NL80211_MPATH_INFO_DISCOVERY_TIMEOUT, -- pinfo->discovery_timeout); -+ if (nla_put_u32(msg, NL80211_MPATH_INFO_DISCOVERY_TIMEOUT, -+ pinfo->discovery_timeout)) -+ goto nla_put_failure; - if (pinfo->filled & MPATH_INFO_DISCOVERY_RETRIES) -- NLA_PUT_U8(msg, NL80211_MPATH_INFO_DISCOVERY_RETRIES, -- pinfo->discovery_retries); -+ if (nla_put_u8(msg, NL80211_MPATH_INFO_DISCOVERY_RETRIES, -+ pinfo->discovery_retries)) -+ goto nla_put_failure; - - nla_nest_end(msg, pinfoattr); - -@@ -3227,41 +3344,59 @@ static int nl80211_get_mesh_config(struct sk_buff *skb, - pinfoattr = nla_nest_start(msg, NL80211_ATTR_MESH_CONFIG); - if (!pinfoattr) - goto nla_put_failure; -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); -- NLA_PUT_U16(msg, NL80211_MESHCONF_RETRY_TIMEOUT, -- cur_params.dot11MeshRetryTimeout); -- NLA_PUT_U16(msg, NL80211_MESHCONF_CONFIRM_TIMEOUT, -- cur_params.dot11MeshConfirmTimeout); -- NLA_PUT_U16(msg, NL80211_MESHCONF_HOLDING_TIMEOUT, -- cur_params.dot11MeshHoldingTimeout); -- NLA_PUT_U16(msg, NL80211_MESHCONF_MAX_PEER_LINKS, -- cur_params.dot11MeshMaxPeerLinks); -- NLA_PUT_U8(msg, NL80211_MESHCONF_MAX_RETRIES, -- cur_params.dot11MeshMaxRetries); -- NLA_PUT_U8(msg, NL80211_MESHCONF_TTL, -- cur_params.dot11MeshTTL); -- NLA_PUT_U8(msg, NL80211_MESHCONF_ELEMENT_TTL, -- cur_params.element_ttl); -- NLA_PUT_U8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, -- cur_params.auto_open_plinks); -- NLA_PUT_U8(msg, NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, -- cur_params.dot11MeshHWMPmaxPREQretries); -- NLA_PUT_U32(msg, NL80211_MESHCONF_PATH_REFRESH_TIME, -- cur_params.path_refresh_time); -- NLA_PUT_U16(msg, NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, -- cur_params.min_discovery_timeout); -- NLA_PUT_U32(msg, NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, -- cur_params.dot11MeshHWMPactivePathTimeout); -- NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, -- cur_params.dot11MeshHWMPpreqMinInterval); -- NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, -- cur_params.dot11MeshHWMPnetDiameterTraversalTime); -- NLA_PUT_U8(msg, NL80211_MESHCONF_HWMP_ROOTMODE, -- cur_params.dot11MeshHWMPRootMode); -- NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_RANN_INTERVAL, -- cur_params.dot11MeshHWMPRannInterval); -- NLA_PUT_U8(msg, NL80211_MESHCONF_GATE_ANNOUNCEMENTS, -- cur_params.dot11MeshGateAnnouncementProtocol); -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put_u16(msg, NL80211_MESHCONF_RETRY_TIMEOUT, -+ cur_params.dot11MeshRetryTimeout)) -+ goto nla_put_failure; -+ if (nla_put_u16(msg, NL80211_MESHCONF_CONFIRM_TIMEOUT, -+ cur_params.dot11MeshConfirmTimeout)) -+ goto nla_put_failure; -+ if (nla_put_u16(msg, NL80211_MESHCONF_HOLDING_TIMEOUT, -+ cur_params.dot11MeshHoldingTimeout)) -+ goto nla_put_failure; -+ if (nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS, -+ cur_params.dot11MeshMaxPeerLinks)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_MESHCONF_MAX_RETRIES, -+ cur_params.dot11MeshMaxRetries)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_MESHCONF_TTL, -+ cur_params.dot11MeshTTL)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_MESHCONF_ELEMENT_TTL, -+ cur_params.element_ttl)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, -+ cur_params.auto_open_plinks)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, -+ cur_params.dot11MeshHWMPmaxPREQretries)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_MESHCONF_PATH_REFRESH_TIME, -+ cur_params.path_refresh_time)) -+ goto nla_put_failure; -+ if (nla_put_u16(msg, NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, -+ cur_params.min_discovery_timeout)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, -+ cur_params.dot11MeshHWMPactivePathTimeout)) -+ goto nla_put_failure; -+ if (nla_put_u16(msg, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, -+ cur_params.dot11MeshHWMPpreqMinInterval)) -+ goto nla_put_failure; -+ if (nla_put_u16(msg, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, -+ cur_params.dot11MeshHWMPnetDiameterTraversalTime)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_MESHCONF_HWMP_ROOTMODE, -+ cur_params.dot11MeshHWMPRootMode)) -+ goto nla_put_failure; -+ if (nla_put_u16(msg, NL80211_MESHCONF_HWMP_RANN_INTERVAL, -+ cur_params.dot11MeshHWMPRannInterval)) -+ goto nla_put_failure; -+ if (nla_put_u8(msg, NL80211_MESHCONF_GATE_ANNOUNCEMENTS, -+ cur_params.dot11MeshGateAnnouncementProtocol)) -+ goto nla_put_failure; - nla_nest_end(msg, pinfoattr); - genlmsg_end(msg, hdr); - return genlmsg_reply(msg, info); -@@ -3482,8 +3617,9 @@ static int nl80211_get_reg(struct sk_buff *skb, struct genl_info *info) - if (!hdr) - goto put_failure; - -- NLA_PUT_STRING(msg, NL80211_ATTR_REG_ALPHA2, -- cfg80211_regdomain->alpha2); -+ if (nla_put_string(msg, NL80211_ATTR_REG_ALPHA2, -+ cfg80211_regdomain->alpha2)) -+ goto nla_put_failure; - - nl_reg_rules = nla_nest_start(msg, NL80211_ATTR_REG_RULES); - if (!nl_reg_rules) -@@ -3503,18 +3639,24 @@ static int nl80211_get_reg(struct sk_buff *skb, struct genl_info *info) - if (!nl_reg_rule) - goto nla_put_failure; - -- NLA_PUT_U32(msg, NL80211_ATTR_REG_RULE_FLAGS, -- reg_rule->flags); -- NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_START, -- freq_range->start_freq_khz); -- NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_END, -- freq_range->end_freq_khz); -- NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_MAX_BW, -- freq_range->max_bandwidth_khz); -- NLA_PUT_U32(msg, NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN, -- power_rule->max_antenna_gain); -- NLA_PUT_U32(msg, NL80211_ATTR_POWER_RULE_MAX_EIRP, -- power_rule->max_eirp); -+ if (nla_put_u32(msg, NL80211_ATTR_REG_RULE_FLAGS, -+ reg_rule->flags)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_FREQ_RANGE_START, -+ freq_range->start_freq_khz)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_FREQ_RANGE_END, -+ freq_range->end_freq_khz)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_FREQ_RANGE_MAX_BW, -+ freq_range->max_bandwidth_khz)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN, -+ power_rule->max_antenna_gain)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_POWER_RULE_MAX_EIRP, -+ power_rule->max_eirp)) -+ goto nla_put_failure; - - nla_nest_end(msg, nl_reg_rule); - } -@@ -4081,37 +4223,49 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, - - genl_dump_check_consistent(cb, hdr, &nl80211_fam); - -- NLA_PUT_U32(msg, NL80211_ATTR_GENERATION, rdev->bss_generation); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, wdev->netdev->ifindex); -+ if (nla_put_u32(msg, NL80211_ATTR_GENERATION, rdev->bss_generation)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, wdev->netdev->ifindex)) -+ goto nla_put_failure; - - bss = nla_nest_start(msg, NL80211_ATTR_BSS); - if (!bss) - goto nla_put_failure; - if (!is_zero_ether_addr(res->bssid)) -- NLA_PUT(msg, NL80211_BSS_BSSID, ETH_ALEN, res->bssid); -+ if (nla_put(msg, NL80211_BSS_BSSID, ETH_ALEN, res->bssid)) -+ goto nla_put_failure; - if (res->information_elements && res->len_information_elements) -- NLA_PUT(msg, NL80211_BSS_INFORMATION_ELEMENTS, -+ if (nla_put(msg, NL80211_BSS_INFORMATION_ELEMENTS, - res->len_information_elements, -- res->information_elements); -+ res->information_elements)) -+ goto nla_put_failure; - if (res->beacon_ies && res->len_beacon_ies && - res->beacon_ies != res->information_elements) -- NLA_PUT(msg, NL80211_BSS_BEACON_IES, -- res->len_beacon_ies, res->beacon_ies); -+ if (nla_put(msg, NL80211_BSS_BEACON_IES, -+ res->len_beacon_ies, res->beacon_ies)) -+ goto nla_put_failure; - if (res->tsf) -- NLA_PUT_U64(msg, NL80211_BSS_TSF, res->tsf); -+ if (nla_put_u64(msg, NL80211_BSS_TSF, res->tsf)) -+ goto nla_put_failure; - if (res->beacon_interval) -- NLA_PUT_U16(msg, NL80211_BSS_BEACON_INTERVAL, res->beacon_interval); -- NLA_PUT_U16(msg, NL80211_BSS_CAPABILITY, res->capability); -- NLA_PUT_U32(msg, NL80211_BSS_FREQUENCY, res->channel->center_freq); -- NLA_PUT_U32(msg, NL80211_BSS_SEEN_MS_AGO, -- jiffies_to_msecs(jiffies - intbss->ts)); -+ if (nla_put_u16(msg, NL80211_BSS_BEACON_INTERVAL, res->beacon_interval)) -+ goto nla_put_failure; -+ if (nla_put_u16(msg, NL80211_BSS_CAPABILITY, res->capability)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_BSS_FREQUENCY, res->channel->center_freq)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_BSS_SEEN_MS_AGO, -+ jiffies_to_msecs(jiffies - intbss->ts))) -+ goto nla_put_failure; - - switch (rdev->wiphy.signal_type) { - case CFG80211_SIGNAL_TYPE_MBM: -- NLA_PUT_U32(msg, NL80211_BSS_SIGNAL_MBM, res->signal); -+ if (nla_put_u32(msg, NL80211_BSS_SIGNAL_MBM, res->signal)) -+ goto nla_put_failure; - break; - case CFG80211_SIGNAL_TYPE_UNSPEC: -- NLA_PUT_U8(msg, NL80211_BSS_SIGNAL_UNSPEC, res->signal); -+ if (nla_put_u8(msg, NL80211_BSS_SIGNAL_UNSPEC, res->signal)) -+ goto nla_put_failure; - break; - default: - break; -@@ -4121,20 +4275,23 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_STATION: - if (intbss == wdev->current_bss) -- NLA_PUT_U32(msg, NL80211_BSS_STATUS, -- NL80211_BSS_STATUS_ASSOCIATED); -+ if (nla_put_u32(msg, NL80211_BSS_STATUS, -+ NL80211_BSS_STATUS_ASSOCIATED)) -+ goto nla_put_failure; - else for (i = 0; i < MAX_AUTH_BSSES; i++) { - if (intbss != wdev->auth_bsses[i]) - continue; -- NLA_PUT_U32(msg, NL80211_BSS_STATUS, -- NL80211_BSS_STATUS_AUTHENTICATED); -+ if (nla_put_u32(msg, NL80211_BSS_STATUS, -+ NL80211_BSS_STATUS_AUTHENTICATED)) -+ goto nla_put_failure; - break; - } - break; - case NL80211_IFTYPE_ADHOC: - if (intbss == wdev->current_bss) -- NLA_PUT_U32(msg, NL80211_BSS_STATUS, -- NL80211_BSS_STATUS_IBSS_JOINED); -+ if (nla_put_u32(msg, NL80211_BSS_STATUS, -+ NL80211_BSS_STATUS_IBSS_JOINED)) -+ goto nla_put_failure; - break; - default: - break; -@@ -4205,34 +4362,43 @@ static int nl80211_send_survey(struct sk_buff *msg, u32 pid, u32 seq, - if (!hdr) - return -ENOMEM; - -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) -+ goto nla_put_failure; - - infoattr = nla_nest_start(msg, NL80211_ATTR_SURVEY_INFO); - if (!infoattr) - goto nla_put_failure; - -- NLA_PUT_U32(msg, NL80211_SURVEY_INFO_FREQUENCY, -- survey->channel->center_freq); -+ if (nla_put_u32(msg, NL80211_SURVEY_INFO_FREQUENCY, -+ survey->channel->center_freq)) -+ goto nla_put_failure; - if (survey->filled & SURVEY_INFO_NOISE_DBM) -- NLA_PUT_U8(msg, NL80211_SURVEY_INFO_NOISE, -- survey->noise); -+ if (nla_put_u8(msg, NL80211_SURVEY_INFO_NOISE, -+ survey->noise)) -+ goto nla_put_failure; - if (survey->filled & SURVEY_INFO_IN_USE) -- NLA_PUT_FLAG(msg, NL80211_SURVEY_INFO_IN_USE); -+ if (nla_put_flag(msg, NL80211_SURVEY_INFO_IN_USE)) -+ goto nla_put_failure; - if (survey->filled & SURVEY_INFO_CHANNEL_TIME) -- NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME, -- survey->channel_time); -+ if (nla_put_u64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME, -+ survey->channel_time)) -+ goto nla_put_failure; - if (survey->filled & SURVEY_INFO_CHANNEL_TIME_BUSY) -- NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY, -- survey->channel_time_busy); -+ if (nla_put_u64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY, -+ survey->channel_time_busy)) -+ goto nla_put_failure; - if (survey->filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY) -- NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY, -- survey->channel_time_ext_busy); -+ if (nla_put_u64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY, -+ survey->channel_time_ext_busy)) -+ goto nla_put_failure; - if (survey->filled & SURVEY_INFO_CHANNEL_TIME_RX) -- NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_RX, -- survey->channel_time_rx); -+ if (nla_put_u64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_RX, -+ survey->channel_time_rx)) -+ goto nla_put_failure; - if (survey->filled & SURVEY_INFO_CHANNEL_TIME_TX) -- NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_TX, -- survey->channel_time_tx); -+ if (nla_put_u64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_TX, -+ survey->channel_time_tx)) -+ goto nla_put_failure; - - nla_nest_end(msg, infoattr); - -@@ -4900,7 +5066,8 @@ __cfg80211_testmode_alloc_skb(struct cfg80211_registered_device *rdev, - return NULL; - } - -- NLA_PUT_U32(skb, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -+ if (nla_put_u32(skb, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; - data = nla_nest_start(skb, NL80211_ATTR_TESTDATA); - - ((void **)skb->cb)[0] = rdev; -@@ -5274,7 +5441,8 @@ static int nl80211_remain_on_channel(struct sk_buff *skb, - if (err) - goto free_msg; - -- NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie); -+ if (nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -5558,7 +5726,8 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) - goto free_msg; - - if (msg) { -- NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie); -+ if (nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - return genlmsg_reply(msg, info); -@@ -5663,7 +5832,8 @@ static int nl80211_get_power_save(struct sk_buff *skb, struct genl_info *info) - else - ps_state = NL80211_PS_DISABLED; - -- NLA_PUT_U32(msg, NL80211_ATTR_PS_STATE, ps_state); -+ if (nla_put_u32(msg, NL80211_ATTR_PS_STATE, ps_state)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - return genlmsg_reply(msg, info); -@@ -5841,19 +6011,26 @@ static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info) - goto nla_put_failure; - - if (rdev->wowlan->any) -- NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_ANY); -+ if (nla_put_flag(msg, NL80211_WOWLAN_TRIG_ANY)) -+ goto nla_put_failure; - if (rdev->wowlan->disconnect) -- NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_DISCONNECT); -+ if (nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT)) -+ goto nla_put_failure; - if (rdev->wowlan->magic_pkt) -- NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT); -+ if (nla_put_flag(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT)) -+ goto nla_put_failure; - if (rdev->wowlan->gtk_rekey_failure) -- NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE); -+ if (nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE)) -+ goto nla_put_failure; - if (rdev->wowlan->eap_identity_req) -- NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST); -+ if (nla_put_flag(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST)) -+ goto nla_put_failure; - if (rdev->wowlan->four_way_handshake) -- NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE); -+ if (nla_put_flag(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE)) -+ goto nla_put_failure; - if (rdev->wowlan->rfkill_release) -- NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE); -+ if (nla_put_flag(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE)) -+ goto nla_put_failure; - if (rdev->wowlan->n_patterns) { - struct nlattr *nl_pats, *nl_pat; - int i, pat_len; -@@ -5868,12 +6045,14 @@ static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info) - if (!nl_pat) - goto nla_put_failure; - pat_len = rdev->wowlan->patterns[i].pattern_len; -- NLA_PUT(msg, NL80211_WOWLAN_PKTPAT_MASK, -+ if (nla_put(msg, NL80211_WOWLAN_PKTPAT_MASK, - DIV_ROUND_UP(pat_len, 8), -- rdev->wowlan->patterns[i].mask); -- NLA_PUT(msg, NL80211_WOWLAN_PKTPAT_PATTERN, -+ rdev->wowlan->patterns[i].mask)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_WOWLAN_PKTPAT_PATTERN, - pat_len, -- rdev->wowlan->patterns[i].pattern); -+ rdev->wowlan->patterns[i].pattern)) -+ goto nla_put_failure; - nla_nest_end(msg, nl_pat); - } - nla_nest_end(msg, nl_pats); -@@ -6146,7 +6325,8 @@ static int nl80211_probe_client(struct sk_buff *skb, - if (err) - goto free_msg; - -- NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie); -+ if (nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -6843,18 +7023,21 @@ static int nl80211_add_scan_req(struct sk_buff *msg, - if (!nest) - goto nla_put_failure; - for (i = 0; i < req->n_ssids; i++) -- NLA_PUT(msg, i, req->ssids[i].ssid_len, req->ssids[i].ssid); -+ if (nla_put(msg, i, req->ssids[i].ssid_len, req->ssids[i].ssid)) -+ goto nla_put_failure; - nla_nest_end(msg, nest); - - nest = nla_nest_start(msg, NL80211_ATTR_SCAN_FREQUENCIES); - if (!nest) - goto nla_put_failure; - for (i = 0; i < req->n_channels; i++) -- NLA_PUT_U32(msg, i, req->channels[i]->center_freq); -+ if (nla_put_u32(msg, i, req->channels[i]->center_freq)) -+ goto nla_put_failure; - nla_nest_end(msg, nest); - - if (req->ie) -- NLA_PUT(msg, NL80211_ATTR_IE, req->ie_len, req->ie); -+ if (nla_put(msg, NL80211_ATTR_IE, req->ie_len, req->ie)) -+ goto nla_put_failure; - - return 0; - nla_put_failure: -@@ -6873,8 +7056,10 @@ static int nl80211_send_scan_msg(struct sk_buff *msg, - if (!hdr) - return -1; - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; - - /* ignore errors and send incomplete event anyway */ - nl80211_add_scan_req(msg, rdev); -@@ -6898,8 +7083,10 @@ nl80211_send_sched_scan_msg(struct sk_buff *msg, - if (!hdr) - return -1; - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; - - return genlmsg_end(msg, hdr); - -@@ -7022,26 +7209,33 @@ void nl80211_send_reg_change_event(struct regulatory_request *request) - } - - /* Userspace can always count this one always being set */ -- NLA_PUT_U8(msg, NL80211_ATTR_REG_INITIATOR, request->initiator); -+ if (nla_put_u8(msg, NL80211_ATTR_REG_INITIATOR, request->initiator)) -+ goto nla_put_failure; - - if (request->alpha2[0] == '0' && request->alpha2[1] == '0') -- NLA_PUT_U8(msg, NL80211_ATTR_REG_TYPE, -- NL80211_REGDOM_TYPE_WORLD); -+ if (nla_put_u8(msg, NL80211_ATTR_REG_TYPE, -+ NL80211_REGDOM_TYPE_WORLD)) -+ goto nla_put_failure; - else if (request->alpha2[0] == '9' && request->alpha2[1] == '9') -- NLA_PUT_U8(msg, NL80211_ATTR_REG_TYPE, -- NL80211_REGDOM_TYPE_CUSTOM_WORLD); -+ if (nla_put_u8(msg, NL80211_ATTR_REG_TYPE, -+ NL80211_REGDOM_TYPE_CUSTOM_WORLD)) -+ goto nla_put_failure; - else if ((request->alpha2[0] == '9' && request->alpha2[1] == '8') || - request->intersect) -- NLA_PUT_U8(msg, NL80211_ATTR_REG_TYPE, -- NL80211_REGDOM_TYPE_INTERSECTION); -+ if (nla_put_u8(msg, NL80211_ATTR_REG_TYPE, -+ NL80211_REGDOM_TYPE_INTERSECTION)) -+ goto nla_put_failure; - else { -- NLA_PUT_U8(msg, NL80211_ATTR_REG_TYPE, -- NL80211_REGDOM_TYPE_COUNTRY); -- NLA_PUT_STRING(msg, NL80211_ATTR_REG_ALPHA2, request->alpha2); -+ if (nla_put_u8(msg, NL80211_ATTR_REG_TYPE, -+ NL80211_REGDOM_TYPE_COUNTRY)) -+ goto nla_put_failure; -+ if (nla_put_string(msg, NL80211_ATTR_REG_ALPHA2, request->alpha2)) -+ goto nla_put_failure; - } - - if (wiphy_idx_valid(request->wiphy_idx)) -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, request->wiphy_idx); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, request->wiphy_idx)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -7075,9 +7269,12 @@ static void nl80211_send_mlme_event(struct cfg80211_registered_device *rdev, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -- NLA_PUT(msg, NL80211_ATTR_FRAME, len, buf); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_FRAME, len, buf)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -7155,10 +7352,14 @@ static void nl80211_send_mlme_timeout(struct cfg80211_registered_device *rdev, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -- NLA_PUT_FLAG(msg, NL80211_ATTR_TIMED_OUT); -- NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put_flag(msg, NL80211_ATTR_TIMED_OUT)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -7206,15 +7407,21 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; - if (bssid) -- NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid); -- NLA_PUT_U16(msg, NL80211_ATTR_STATUS_CODE, status); -+ if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid)) -+ goto nla_put_failure; -+ if (nla_put_u16(msg, NL80211_ATTR_STATUS_CODE, status)) -+ goto nla_put_failure; - if (req_ie) -- NLA_PUT(msg, NL80211_ATTR_REQ_IE, req_ie_len, req_ie); -+ if (nla_put(msg, NL80211_ATTR_REQ_IE, req_ie_len, req_ie)) -+ goto nla_put_failure; - if (resp_ie) -- NLA_PUT(msg, NL80211_ATTR_RESP_IE, resp_ie_len, resp_ie); -+ if (nla_put(msg, NL80211_ATTR_RESP_IE, resp_ie_len, resp_ie)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -7246,13 +7453,18 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -- NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid)) -+ goto nla_put_failure; - if (req_ie) -- NLA_PUT(msg, NL80211_ATTR_REQ_IE, req_ie_len, req_ie); -+ if (nla_put(msg, NL80211_ATTR_REQ_IE, req_ie_len, req_ie)) -+ goto nla_put_failure; - if (resp_ie) -- NLA_PUT(msg, NL80211_ATTR_RESP_IE, resp_ie_len, resp_ie); -+ if (nla_put(msg, NL80211_ATTR_RESP_IE, resp_ie_len, resp_ie)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -7283,14 +7495,19 @@ void nl80211_send_disconnected(struct cfg80211_registered_device *rdev, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; - if (from_ap && reason) -- NLA_PUT_U16(msg, NL80211_ATTR_REASON_CODE, reason); -+ if (nla_put_u16(msg, NL80211_ATTR_REASON_CODE, reason)) -+ goto nla_put_failure; - if (from_ap) -- NLA_PUT_FLAG(msg, NL80211_ATTR_DISCONNECTED_BY_AP); -+ if (nla_put_flag(msg, NL80211_ATTR_DISCONNECTED_BY_AP)) -+ goto nla_put_failure; - if (ie) -- NLA_PUT(msg, NL80211_ATTR_IE, ie_len, ie); -+ if (nla_put(msg, NL80211_ATTR_IE, ie_len, ie)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -7321,9 +7538,12 @@ void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -- NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -7354,11 +7574,15 @@ void nl80211_send_new_peer_candidate(struct cfg80211_registered_device *rdev, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -- NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, macaddr); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, macaddr)) -+ goto nla_put_failure; - if (ie_len && ie) -- NLA_PUT(msg, NL80211_ATTR_IE, ie_len , ie); -+ if (nla_put(msg, NL80211_ATTR_IE, ie_len , ie)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -7389,15 +7613,21 @@ void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; - if (addr) -- NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); -- NLA_PUT_U32(msg, NL80211_ATTR_KEY_TYPE, key_type); -+ if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_KEY_TYPE, key_type)) -+ goto nla_put_failure; - if (key_id != -1) -- NLA_PUT_U8(msg, NL80211_ATTR_KEY_IDX, key_id); -+ if (nla_put_u8(msg, NL80211_ATTR_KEY_IDX, key_id)) -+ goto nla_put_failure; - if (tsc) -- NLA_PUT(msg, NL80211_ATTR_KEY_SEQ, 6, tsc); -+ if (nla_put(msg, NL80211_ATTR_KEY_SEQ, 6, tsc)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -7432,7 +7662,8 @@ void nl80211_send_beacon_hint_event(struct wiphy *wiphy, - * Since we are applying the beacon hint to a wiphy we know its - * wiphy_idx is valid - */ -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, get_wiphy_idx(wiphy)); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, get_wiphy_idx(wiphy))) -+ goto nla_put_failure; - - /* Before */ - nl_freq = nla_nest_start(msg, NL80211_ATTR_FREQ_BEFORE); -@@ -7484,14 +7715,20 @@ static void nl80211_send_remain_on_chan_event( - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq); -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, channel_type); -- NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, channel_type)) -+ goto nla_put_failure; -+ if (nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie)) -+ goto nla_put_failure; - - if (cmd == NL80211_CMD_REMAIN_ON_CHANNEL) -- NLA_PUT_U32(msg, NL80211_ATTR_DURATION, duration); -+ if (nla_put_u32(msg, NL80211_ATTR_DURATION, duration)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -7561,8 +7798,10 @@ void nl80211_send_sta_del_event(struct cfg80211_registered_device *rdev, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); -- NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -7632,9 +7871,12 @@ static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd, - return true; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); -- NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr)) -+ goto nla_put_failure; - - err = genlmsg_end(msg, hdr); - if (err < 0) { -@@ -7682,10 +7924,14 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, - return -ENOMEM; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq); -- NLA_PUT(msg, NL80211_ATTR_FRAME, len, buf); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_FRAME, len, buf)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -7715,12 +7961,17 @@ void nl80211_send_mgmt_tx_status(struct cfg80211_registered_device *rdev, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -- NLA_PUT(msg, NL80211_ATTR_FRAME, len, buf); -- NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_FRAME, len, buf)) -+ goto nla_put_failure; -+ if (nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie)) -+ goto nla_put_failure; - if (ack) -- NLA_PUT_FLAG(msg, NL80211_ATTR_ACK); -+ if (nla_put_flag(msg, NL80211_ATTR_ACK)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -7752,15 +8003,18 @@ nl80211_send_cqm_rssi_notify(struct cfg80211_registered_device *rdev, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; - - pinfoattr = nla_nest_start(msg, NL80211_ATTR_CQM); - if (!pinfoattr) - goto nla_put_failure; - -- NLA_PUT_U32(msg, NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT, -- rssi_event); -+ if (nla_put_u32(msg, NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT, -+ rssi_event)) -+ goto nla_put_failure; - - nla_nest_end(msg, pinfoattr); - -@@ -7793,16 +8047,20 @@ void nl80211_gtk_rekey_notify(struct cfg80211_registered_device *rdev, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -- NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid)) -+ goto nla_put_failure; - - rekey_attr = nla_nest_start(msg, NL80211_ATTR_REKEY_DATA); - if (!rekey_attr) - goto nla_put_failure; - -- NLA_PUT(msg, NL80211_REKEY_DATA_REPLAY_CTR, -- NL80211_REPLAY_CTR_LEN, replay_ctr); -+ if (nla_put(msg, NL80211_REKEY_DATA_REPLAY_CTR, -+ NL80211_REPLAY_CTR_LEN, replay_ctr)) -+ goto nla_put_failure; - - nla_nest_end(msg, rekey_attr); - -@@ -7835,17 +8093,22 @@ void nl80211_pmksa_candidate_notify(struct cfg80211_registered_device *rdev, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; - - attr = nla_nest_start(msg, NL80211_ATTR_PMKSA_CANDIDATE); - if (!attr) - goto nla_put_failure; - -- NLA_PUT_U32(msg, NL80211_PMKSA_CANDIDATE_INDEX, index); -- NLA_PUT(msg, NL80211_PMKSA_CANDIDATE_BSSID, ETH_ALEN, bssid); -+ if (nla_put_u32(msg, NL80211_PMKSA_CANDIDATE_INDEX, index)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_PMKSA_CANDIDATE_BSSID, ETH_ALEN, bssid)) -+ goto nla_put_failure; - if (preauth) -- NLA_PUT_FLAG(msg, NL80211_PMKSA_CANDIDATE_PREAUTH); -+ if (nla_put_flag(msg, NL80211_PMKSA_CANDIDATE_PREAUTH)) -+ goto nla_put_failure; - - nla_nest_end(msg, attr); - -@@ -7877,9 +8140,12 @@ void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq); -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, type); -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, type)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - -@@ -7961,15 +8227,19 @@ nl80211_send_cqm_pktloss_notify(struct cfg80211_registered_device *rdev, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); -- NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, peer); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, peer)) -+ goto nla_put_failure; - - pinfoattr = nla_nest_start(msg, NL80211_ATTR_CQM); - if (!pinfoattr) - goto nla_put_failure; - -- NLA_PUT_U32(msg, NL80211_ATTR_CQM_PKT_LOSS_EVENT, num_packets); -+ if (nla_put_u32(msg, NL80211_ATTR_CQM_PKT_LOSS_EVENT, num_packets)) -+ goto nla_put_failure; - - nla_nest_end(msg, pinfoattr); - -@@ -8003,12 +8273,17 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); -- NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); -- NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr)) -+ goto nla_put_failure; -+ if (nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie)) -+ goto nla_put_failure; - if (acked) -- NLA_PUT_FLAG(msg, NL80211_ATTR_ACK); -+ if (nla_put_flag(msg, NL80211_ATTR_ACK)) -+ goto nla_put_failure; - - err = genlmsg_end(msg, hdr); - if (err < 0) { -@@ -8048,10 +8323,13 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy, - return; - } - -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx)) -+ goto nla_put_failure; - if (freq) -- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq); -- NLA_PUT(msg, NL80211_ATTR_FRAME, len, frame); -+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq)) -+ goto nla_put_failure; -+ if (nla_put(msg, NL80211_ATTR_FRAME, len, frame)) -+ goto nla_put_failure; - - genlmsg_end(msg, hdr); - diff --git a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/0002-atheros-update-renamed-struct-members.patch b/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/0002-atheros-update-renamed-struct-members.patch deleted file mode 100644 index 767bca0cf..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/0002-atheros-update-renamed-struct-members.patch +++ /dev/null @@ -1,235 +0,0 @@ -From: Javier Viguera -Date: Fri, 13 Sep 2013 11:12:04 +0200 -Subject: [PATCH] atheros: update renamed struct members - -struct genl_info: s/snd_pid/snd_portid -struct netlink_notify: s/pid/portid -struct netlink_skb_parms: s/pid/portid - -Signed-off-by: Javier Viguera ---- - compat-wireless/net/wireless/nl80211.c | 50 ++++++++++++++++---------------- - 1 file changed, 25 insertions(+), 25 deletions(-) - -diff --git a/compat-wireless/net/wireless/nl80211.c b/compat-wireless/net/wireless/nl80211.c -index c219a2ca027f..2cba63866a90 100644 ---- a/compat-wireless/net/wireless/nl80211.c -+++ b/compat-wireless/net/wireless/nl80211.c -@@ -1122,7 +1122,7 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb) - continue; - if (++idx <= start) - continue; -- if (nl80211_send_wiphy(skb, NETLINK_CB(cb->skb).pid, -+ if (nl80211_send_wiphy(skb, NETLINK_CB(cb->skb).portid, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - dev) < 0) { - idx--; -@@ -1145,7 +1145,7 @@ static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info) - if (!msg) - return -ENOMEM; - -- if (nl80211_send_wiphy(msg, info->snd_pid, info->snd_seq, 0, dev) < 0) { -+ if (nl80211_send_wiphy(msg, info->snd_portid, info->snd_seq, 0, dev) < 0) { - nlmsg_free(msg); - return -ENOBUFS; - } -@@ -1590,7 +1590,7 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback * - if_idx++; - continue; - } -- if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).pid, -+ if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).portid, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - rdev, wdev->netdev) < 0) { - mutex_unlock(&rdev->devlist_mtx); -@@ -1621,7 +1621,7 @@ static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info) - if (!msg) - return -ENOMEM; - -- if (nl80211_send_iface(msg, info->snd_pid, info->snd_seq, 0, -+ if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0, - dev, netdev) < 0) { - nlmsg_free(msg); - return -ENOBUFS; -@@ -1922,7 +1922,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info) - if (!msg) - return -ENOMEM; - -- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, - NL80211_CMD_NEW_KEY); - if (IS_ERR(hdr)) - return PTR_ERR(hdr); -@@ -2628,7 +2628,7 @@ static int nl80211_dump_station(struct sk_buff *skb, - goto out_err; - - if (nl80211_send_station(skb, -- NETLINK_CB(cb->skb).pid, -+ NETLINK_CB(cb->skb).portid, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - netdev, mac_addr, - &sinfo) < 0) -@@ -2674,7 +2674,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info) - if (!msg) - return -ENOMEM; - -- if (nl80211_send_station(msg, info->snd_pid, info->snd_seq, 0, -+ if (nl80211_send_station(msg, info->snd_portid, info->snd_seq, 0, - dev, mac_addr, &sinfo) < 0) { - nlmsg_free(msg); - return -ENOBUFS; -@@ -3062,7 +3062,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb, - if (err) - goto out_err; - -- if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).pid, -+ if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).portid, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - netdev, dst, next_hop, - &pinfo) < 0) -@@ -3111,7 +3111,7 @@ static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info) - if (!msg) - return -ENOMEM; - -- if (nl80211_send_mpath(msg, info->snd_pid, info->snd_seq, 0, -+ if (nl80211_send_mpath(msg, info->snd_portid, info->snd_seq, 0, - dev, dst, next_hop, &pinfo) < 0) { - nlmsg_free(msg); - return -ENOBUFS; -@@ -3337,7 +3337,7 @@ static int nl80211_get_mesh_config(struct sk_buff *skb, - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return -ENOMEM; -- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, - NL80211_CMD_GET_MESH_CONFIG); - if (!hdr) - goto out; -@@ -3612,7 +3612,7 @@ static int nl80211_get_reg(struct sk_buff *skb, struct genl_info *info) - goto out; - } - -- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, - NL80211_CMD_GET_REG); - if (!hdr) - goto put_failure; -@@ -4216,7 +4216,7 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, - - ASSERT_WDEV_LOCK(wdev); - -- hdr = nl80211hdr_put(msg, NETLINK_CB(cb->skb).pid, seq, flags, -+ hdr = nl80211hdr_put(msg, NETLINK_CB(cb->skb).portid, seq, flags, - NL80211_CMD_NEW_SCAN_RESULTS); - if (!hdr) - return -1; -@@ -4451,7 +4451,7 @@ static int nl80211_dump_survey(struct sk_buff *skb, - } - - if (nl80211_send_survey(skb, -- NETLINK_CB(cb->skb).pid, -+ NETLINK_CB(cb->skb).portid, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - netdev, - &survey) < 0) -@@ -5010,7 +5010,7 @@ static int nl80211_testmode_dump(struct sk_buff *skb, - } - - while (1) { -- void *hdr = nl80211hdr_put(skb, NETLINK_CB(cb->skb).pid, -+ void *hdr = nl80211hdr_put(skb, NETLINK_CB(cb->skb).portid, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - NL80211_CMD_TESTMODE); - struct nlattr *tmdata; -@@ -5090,7 +5090,7 @@ struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, - return NULL; - - return __cfg80211_testmode_alloc_skb(rdev, approxlen, -- rdev->testmode_info->snd_pid, -+ rdev->testmode_info->snd_portid, - rdev->testmode_info->snd_seq, - GFP_KERNEL); - } -@@ -5427,7 +5427,7 @@ static int nl80211_remain_on_channel(struct sk_buff *skb, - if (!msg) - return -ENOMEM; - -- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, - NL80211_CMD_REMAIN_ON_CHANNEL); - - if (IS_ERR(hdr)) { -@@ -5638,7 +5638,7 @@ static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info) - if (!rdev->ops->mgmt_tx) - return -EOPNOTSUPP; - -- return cfg80211_mlme_register_mgmt(dev->ieee80211_ptr, info->snd_pid, -+ return cfg80211_mlme_register_mgmt(dev->ieee80211_ptr, info->snd_portid, - frame_type, - nla_data(info->attrs[NL80211_ATTR_FRAME_MATCH]), - nla_len(info->attrs[NL80211_ATTR_FRAME_MATCH])); -@@ -5708,7 +5708,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) - if (!msg) - return -ENOMEM; - -- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, - NL80211_CMD_FRAME); - - if (IS_ERR(hdr)) { -@@ -5820,7 +5820,7 @@ static int nl80211_get_power_save(struct sk_buff *skb, struct genl_info *info) - if (!msg) - return -ENOMEM; - -- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, - NL80211_CMD_GET_POWER_SAVE); - if (!hdr) { - err = -ENOBUFS; -@@ -5998,7 +5998,7 @@ static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info) - if (!msg) - return -ENOMEM; - -- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, - NL80211_CMD_GET_WOWLAN); - if (!hdr) - goto nla_put_failure; -@@ -6281,7 +6281,7 @@ static int nl80211_register_unexpected_frame(struct sk_buff *skb, - if (wdev->ap_unexpected_nlpid) - return -EBUSY; - -- wdev->ap_unexpected_nlpid = info->snd_pid; -+ wdev->ap_unexpected_nlpid = info->snd_portid; - return 0; - } - -@@ -6311,7 +6311,7 @@ static int nl80211_probe_client(struct sk_buff *skb, - if (!msg) - return -ENOMEM; - -- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, - NL80211_CMD_PROBE_CLIENT); - - if (IS_ERR(hdr)) { -@@ -6349,7 +6349,7 @@ static int nl80211_register_beacons(struct sk_buff *skb, struct genl_info *info) - if (rdev->ap_beacons_nlpid) - return -EBUSY; - -- rdev->ap_beacons_nlpid = info->snd_pid; -+ rdev->ap_beacons_nlpid = info->snd_portid; - - return 0; - } -@@ -8357,8 +8357,8 @@ static int nl80211_netlink_notify(struct notifier_block * nb, - - list_for_each_entry_rcu(rdev, &cfg80211_rdev_list, list) { - list_for_each_entry_rcu(wdev, &rdev->netdev_list, list) -- cfg80211_mlme_unregister_socket(wdev, notify->pid); -- if (rdev->ap_beacons_nlpid == notify->pid) -+ cfg80211_mlme_unregister_socket(wdev, notify->portid); -+ if (rdev->ap_beacons_nlpid == notify->portid) - rdev->ap_beacons_nlpid = 0; - } - diff --git a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/Makefile b/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/Makefile deleted file mode 100644 index 260054a7a..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -ATH_DRV_BASEDIR := compat-wireless - -ifneq ($(KERNELRELEASE),) - -ATH_DEFINES += \ - -DCOMPAT_BASE_TREE="\"$(shell cat $(src)/$(ATH_DRV_BASEDIR)/compat_base_tree)\"" \ - -DCOMPAT_BASE_TREE_VERSION="\"$(shell cat $(src)/$(ATH_DRV_BASEDIR)/compat_base_tree_version)\"" \ - -DCOMPAT_PROJECT="\"Compat-wireless\"" \ - -DCOMPAT_VERSION="\"$(shell cat $(src)/$(ATH_DRV_BASEDIR)/compat_version)\"" - -NOSTDINC_FLAGS := -I$(M)/$(ATH_DRV_BASEDIR)/include/ \ - -include $(M)/$(ATH_DRV_BASEDIR)/include/linux/compat-2.6.h \ - $(ATH_DEFINES) - -include $(src)/$(ATH_DRV_BASEDIR)/config.mk - -SHELL_EXPORT := PATH=$(src)/$(ATH_DRV_BASEDIR)/scripts:$${PATH} \ - COMPAT_CONFIG=$(src)/$(ATH_DRV_BASEDIR)/config.mk \ - CONFIG_CHECK=.$(COMPAT_CONFIG)_md5sum.txt \ - COMPAT_AUTOCONF=$(src)/$(ATH_DRV_BASEDIR)/include/linux/compat_autoconf.h - -dummy := $(shell $(SHELL_EXPORT) bash -c "cd $(src)/$(ATH_DRV_BASEDIR) && ./scripts/check_config.sh || true") - -obj-y := $(ATH_DRV_BASEDIR)/compat/ -obj-y += $(ATH_DRV_BASEDIR)/net/wireless/ -obj-y += $(ATH_DRV_BASEDIR)/drivers/net/wireless/ath/ath6kl/ - -else #ifneq ($(KERNELRELEASE),) - -SRC := $(shell pwd) - -all: - $(MAKE) -C $(KERNEL_SRC) M=$(SRC) - -modules_install: - $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install - # Fix installation directory of the modules. - find $(INSTALL_MOD_PATH)/lib/modules/$(KERNEL_VERSION)/extra/$(ATH_DRV_BASEDIR) -type f -name '*.ko' | \ - xargs -I modfile mv -f modfile $(INSTALL_MOD_PATH)/lib/modules/$(KERNEL_VERSION)/extra/ - rm -rf $(INSTALL_MOD_PATH)/lib/modules/*/extra/$(ATH_DRV_BASEDIR) - -endif #ifneq ($(KERNELRELEASE),) diff --git a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/atheros-pre-up b/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/atheros-pre-up deleted file mode 100644 index 78e776de3..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-atheros/kernel-module-atheros/atheros-pre-up +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/sh -#=============================================================================== -# -# 10-atheros_pre-up -# -# Copyright (C) 2012 by Digi International Inc. -# All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 as published by -# the Free Software Foundation. -# -# -# !Description: Load Atheros' wireless driver -# -#=============================================================================== - -set -e - -[ "${IFACE}" != "wlan0" ] && exit 0 - -FIRMWARE_DIR="/lib/firmware/ath6k/AR6003/hw2.1.1" - -ATH6KL_DBG_NONE=0x0 -ATH6KL_DBG_CREDIT=0x00000001 -ATH6KL_DBG_WLAN_TX=0x00000004 -ATH6KL_DBG_WLAN_RX=0x00000008 -ATH6KL_DBG_BMI=0x00000010 -ATH6KL_DBG_HTC=0x00000020 -ATH6KL_DBG_HIF=0x00000040 -ATH6KL_DBG_IRQ=0x00000080 -ATH6KL_DBG_WMI=0x00000400 -ATH6KL_DBG_TRC=0x00000800 -ATH6KL_DBG_SCATTER=0x00001000 -ATH6KL_DBG_WLAN_CFG=0x00002000 -ATH6KL_DBG_RAW_BYTES=0x00004000 -ATH6KL_DBG_AGGR=0x00008000 -ATH6KL_DBG_SDIO=0x00010000 -ATH6KL_DBG_SDIO_DUMP=0x00020000 -ATH6KL_DBG_BOOT=0x00040000 -ATH6KL_DBG_WMI_DUMP=0x00080000 -ATH6KL_DBG_SUSPEND=0x00100000 -ATH6KL_DBG_USB=0x00200000 -ATH6KL_DBG_RECOVERY=0x00400000 -ATH6KL_DBG_ANY=0xffffffff - -ATH6KL_DEBUG_MASK="${ATH6KL_DBG_NONE}" - -# -# Get the wlan MAC address from kernel command line. Use a default -# value if the address has not been set. -# -if [ -f "/proc/device-tree/wireless/mac-address" ]; then - MAC_ADDR="$(hexdump -ve '1/1 "%02X" ":"' /proc/device-tree/wireless/mac-address | sed 's/:$//g')" -else - MAC_ADDR="$(sed -ne 's,^.*ethaddr2=\([^[:blank:]]\+\)[:blank:]*.*,\1,g;T;p' /proc/cmdline)" -fi -if [ -z "${MAC_ADDR}" -o "${MAC_ADDR}" = "00:00:00:00:00:00" ]; then - MAC_ADDR="00:04:F3:4C:B1:D3" -fi - -# We need to write the WLAN MAC address to softmac in the ath6k firmware -# directory. However, we don't want to rewrite the file if it already exists -# and the address is the same because we don't want to wear out NAND flash. -# -# So create the file on the RAM DRIVE first and compare the two. Only update -# the copy on NAND if the address has changed. -# -mac1="$(echo ${MAC_ADDR} | cut -d':' -f1)" -mac2="$(echo ${MAC_ADDR} | cut -d':' -f2)" -mac3="$(echo ${MAC_ADDR} | cut -d':' -f3)" -mac4="$(echo ${MAC_ADDR} | cut -d':' -f4)" -mac5="$(echo ${MAC_ADDR} | cut -d':' -f5)" -mac6="$(echo ${MAC_ADDR} | cut -d':' -f6)" - -TMP_MACFILE="$(mktemp -t softmac.XXXXXX)" -printf "\x${mac1}\x${mac2}\x${mac3}\x${mac4}\x${mac5}\x${mac6}" > ${TMP_MACFILE} -if ! cmp -s ${TMP_MACFILE} ${FIRMWARE_DIR}/softmac; then - cp ${TMP_MACFILE} ${FIRMWARE_DIR}/softmac -fi -rm -f ${TMP_MACFILE} - -# Figure out which wireless region we are in. The US has rules for -# what channels can be used and at what power level. We use a different set of -# rules for the other regions in the world that we sell into. The mod_cert field -# in OTP will be set to 0x0 for the US. Once we know the region, make sure the -# appropriate calibration file is loaded. -# -MACHINE="$(cat /proc/device-tree/digi,machine,name 2>/dev/null || \ - cat /sys/kernel/machine/name)" -MOD_VARIANT="$(cat /proc/device-tree/digi,hwid,variant 2>/dev/null || \ - cat /sys/kernel/${MACHINE}/mod_variant)" -REGION_CODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null || \ - cat /sys/kernel/${MACHINE}/mod_cert)" - -# 'ccimx6sbc' variants 0x05, 0x07 and 0x0a do not have bluetooth -# and use a different calibration file -US_CODE="0x0" -case "${MACHINE}:${MOD_VARIANT}:${REGION_CODE}" in - ccimx6sbc:0x05:${US_CODE}|ccimx6sbc:0x07:${US_CODE}|ccimx6sbc:0x0a:${US_CODE}) - BDATA_SOURCE="Digi_6203_2_ANT-US.bin" - logger -t atheros "Setting US wireless region (no bluetooth)";; - ccimx6sbc:0x05:*|ccimx6sbc:0x07:*|ccimx6sbc:0x0a:*) - BDATA_SOURCE="Digi_6203_2_ANT-World.bin" - logger -t atheros "Setting non-US (world) wireless region (no bluetooth)";; - *:*:${US_CODE}) - BDATA_SOURCE="Digi_6203-6233-US.bin" - logger -t atheros "Setting US wireless region";; - *:*:*) - BDATA_SOURCE="Digi_6203-6233-World.bin" - logger -t atheros "Setting non-US (world) wireless region";; -esac - -# We don't want to rewrite NAND every time we boot so only -# change the link if it is wrong. -BDATA_LINK="${FIRMWARE_DIR}/bdata.bin" -if [ ! -e "${BDATA_LINK}" ] || ! cmp -s "${BDATA_LINK}" "${FIRMWARE_DIR}/${BDATA_SOURCE}"; then - ln -sf "${BDATA_SOURCE}" "${BDATA_LINK}" -fi - -# Load 'cfg80211' and let it settle down (needed by 'ath6kl_sdio') -modprobe -q cfg80211 && sleep 0.2 - -# ath6kl_sdio.ko -if ! grep -qs ath6kl_sdio /proc/modules; then - RETRIES="5" - while [ "${RETRIES}" -gt "0" ]; do - modprobe --ignore-install -q ath6kl_sdio debug_mask="${ATH6KL_DEBUG_MASK}" || true - [ -d "/sys/class/net/wlan0" ] && break - RETRIES="$((RETRIES - 1))" - rmmod ath6kl_sdio > /dev/null - echo "Retrying to load wireless" - sleep 2 - done - [ "${RETRIES}" -eq "0" ] && echo "Loading ath6kl_sdio module: [FAILED]" -fi - -# Delay required for the interface 'wlan0' to settle down before trying to configure it. -sleep 0.5 diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb index 40c72fcdf..be2979cd2 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb @@ -56,4 +56,4 @@ FILES_${PN} += " \ ${base_libdir}/firmware/wlan/qcom_cfg.ini \ " -COMPATIBLE_MACHINE = "(ccimx6ul)" +COMPATIBLE_MACHINE = "(ccimx6qpsbc|ccimx6ul)" diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv/0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv-5.0.11.p8.6+fslc/0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch similarity index 100% rename from meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv/0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch rename to meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv-5.0.11.p8.6+fslc/0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv/0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv-5.0.11.p8.6+fslc/0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch similarity index 100% rename from meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv/0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch rename to meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv-5.0.11.p8.6+fslc/0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv/0003-gpu-Get-GPU-reserved-memory-from-DT.patch b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv-5.0.11.p8.6+fslc/0003-gpu-Get-GPU-reserved-memory-from-DT.patch similarity index 100% rename from meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv/0003-gpu-Get-GPU-reserved-memory-from-DT.patch rename to meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv-5.0.11.p8.6+fslc/0003-gpu-Get-GPU-reserved-memory-from-DT.patch diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv-6.2.2.p0+fslc/0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv-6.2.2.p0+fslc/0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch new file mode 100644 index 000000000..bd664fb07 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv-6.2.2.p0+fslc/0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch @@ -0,0 +1,71 @@ +From: Javier Viguera +Date: Tue, 10 Nov 2015 17:45:37 +0100 +Subject: [PATCH] mxc: gpu: use recommended values for minimum GPU frequency + divisor + +Freescale recommends the following default minimum GPU frequency divisors +depending on the CPU family: + - 3 for Dual/Quad + - 8 for DualLite/Solo + +Adapted for the external Vivante GPU driver from commit a790ad3 in linux +git repository. + +Signed-off-by: Javier Viguera +--- + .../hal/os/linux/kernel/gc_hal_kernel_driver.c | 14 +++++++++++++- + .../platform/freescale/gc_hal_kernel_platform_imx6.c | 2 +- + 2 files changed, 13 insertions(+), 2 deletions(-) + +diff --git a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_driver.c b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_driver.c +index 816aae0..15a8753 100644 +--- a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_driver.c ++++ b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_driver.c +@@ -54,6 +54,7 @@ + + + #include ++#include + #include + #include + +@@ -199,7 +200,7 @@ static uint type = 0; + module_param(type, uint, 0664); + MODULE_PARM_DESC(type, "0 - Char Driver (Default), 1 - Misc Driver"); + +-static int gpu3DMinClock = 1; ++static int gpu3DMinClock = 0; + + static int contiguousRequested = 0; + +@@ -1138,6 +1139,17 @@ static int __devinit gpu_probe(struct platform_device *pdev) + } + } + else { ++ /* If undefined, set Freescale recommended value. Else use the min freq. */ ++ if (gpu3DMinClock == 0) { ++ if (of_machine_is_compatible("fsl,imx6dl")) ++ gpu3DMinClock = 8; ++ else if (of_machine_is_compatible("fsl,imx6q") || ++ of_machine_is_compatible("fsl,imx6qp")) ++ gpu3DMinClock = 3; ++ else ++ gpu3DMinClock = 1; ++ } ++ + ret = drv_init(); + if (!ret) { + platform_set_drvdata(pdev, galDevice); +diff --git a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c +index 89706ec..65a54e2 100644 +--- a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c ++++ b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c +@@ -123,7 +123,7 @@ extern int unregister_thermal_notifier(struct notifier_block *nb); + #define gcdFSL_CONTIGUOUS_SIZE (4 << 20) + #endif + +-static int initgpu3DMinClock = 1; ++static int initgpu3DMinClock = 0; + module_param(initgpu3DMinClock, int, 0644); + + struct platform_device *pdevice; diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv-6.2.2.p0+fslc/0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv-6.2.2.p0+fslc/0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch new file mode 100644 index 000000000..4273613a2 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv-6.2.2.p0+fslc/0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch @@ -0,0 +1,26 @@ +From: Hector Palacios +Date: Tue, 1 Dec 2015 11:36:24 +0100 +Subject: [PATCH] Use busfreq-imx6.h up to 3.15 kernel + +For CC6 we're using Freescale 3.14.28 BSP. Even though we apply stability +patches that move the kernel version beyond 3.14.29 we still want to use +the GPU vivante external module build with the original BSP. + +Signed-off-by: Hector Palacios +--- + .../os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c +index 0eae8262c2ce..f166680affa2 100644 +--- a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c ++++ b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c +@@ -81,7 +81,7 @@ + #include + #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0) + #include +-#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 29) ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) + #include + #include + #else diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv-6.2.2.p0+fslc/0003-gpu-Get-GPU-reserved-memory-from-DT.patch b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv-6.2.2.p0+fslc/0003-gpu-Get-GPU-reserved-memory-from-DT.patch new file mode 100644 index 000000000..4615d9d93 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv-6.2.2.p0+fslc/0003-gpu-Get-GPU-reserved-memory-from-DT.patch @@ -0,0 +1,38 @@ +From: Mike Engel +Date: Tue, 11 Apr 2017 11:13:23 +0200 +Subject: [PATCH] gpu: Get GPU reserved memory from DT. + +This commit adds support to specify the GPU reserved memory in +the DT. + +Signed-off-by: Mike Engel + +https://jira.digi.com/browse/DEL-3868 +--- + .../linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c +index dc7c976..fd2dbd3 100644 +--- a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c ++++ b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.c +@@ -568,7 +568,7 @@ gckPLATFORM_AdjustParam( + Args->registerMemSizeVG = res->end - res->start + 1; + } + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "contiguous_mem"); + if (res) + { +@@ -577,8 +577,6 @@ gckPLATFORM_AdjustParam( + if( Args->contiguousSize == ~0U ) + Args->contiguousSize = res->end - res->start + 1; + } +-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) +- Args->contiguousBase = 0; + #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) + prop = of_get_property(dn, "contiguousbase", NULL); + if(prop) + + diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_%.bbappend b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_%.bbappend deleted file mode 100644 index a6c6597d8..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_%.bbappend +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (C) 2015-2017 Digi International - -FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" - -SRC_URI += " \ - file://0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch \ - file://0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch \ - file://0003-gpu-Get-GPU-reserved-memory-from-DT.patch \ -" diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_5.0.11.p8.6+fslc.bbappend b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_5.0.11.p8.6+fslc.bbappend new file mode 100644 index 000000000..a0c759e21 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_5.0.11.p8.6+fslc.bbappend @@ -0,0 +1,11 @@ +# Copyright (C) 2015-2017 Digi International + +VER_DIR = "${@d.getVar('PV', True).split('+git')[0]}" + +FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}-${VER_DIR}:" + +SRC_URI += " \ + file://0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch \ + file://0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch \ + file://0003-gpu-Get-GPU-reserved-memory-from-DT.patch \ +" diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_6.2.2.p0+fslc.bb b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_6.2.2.p0+fslc.bb new file mode 100644 index 000000000..158d147a0 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_6.2.2.p0+fslc.bb @@ -0,0 +1,18 @@ +# Copyright (C) 2017 Digi International + +SUMMARY = "Kernel loadable module for Vivante GPU" +DESCRIPTION = "This package uses an exact copy of the GPU kernel driver source code of \ +the same version as base and include fixes and improvements developed by FSL Community" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" + +PV .= "+git${SRCPV}" + +SRCREV = "3b9e057f29853fd29364aa666328a92b807007d7" +SRC_URI = "git://github.com/Freescale/kernel-module-imx-gpu-viv.git;protocol=https" + +S = "${WORKDIR}/git" + +inherit module + +KERNEL_MODULE_AUTOLOAD = "galcore" diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_6.2.2.p0+fslc.bbappend b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_6.2.2.p0+fslc.bbappend new file mode 100644 index 000000000..bbf63d7d9 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_6.2.2.p0+fslc.bbappend @@ -0,0 +1,11 @@ +# Copyright (C) 2017 Digi International + +VER_DIR = "${@d.getVar('PV', True).split('+git')[0]}" + +FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}-${VER_DIR}:" + +SRC_URI += " \ + file://0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch \ + file://0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch \ + file://0003-gpu-Get-GPU-reserved-memory-from-DT.patch \ +" diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey-3.10/ccardimx28js/defconfig b/meta-digi-arm/recipes-kernel/linux/linux-dey-3.10/ccardimx28js/defconfig deleted file mode 100644 index 2699f0629..000000000 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey-3.10/ccardimx28js/defconfig +++ /dev/null @@ -1,212 +0,0 @@ -# CONFIG_SWAP is not set -CONFIG_SYSVIPC=y -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -# CONFIG_UTS_NS is not set -# CONFIG_IPC_NS is not set -# CONFIG_PID_NS is not set -# CONFIG_NET_NS is not set -CONFIG_RELAY=y -CONFIG_BLK_DEV_INITRD=y -CONFIG_PERF_EVENTS=y -# CONFIG_COMPAT_BRK is not set -CONFIG_MODULES=y -CONFIG_MODULE_FORCE_LOAD=y -CONFIG_MODULE_UNLOAD=y -CONFIG_MODVERSIONS=y -CONFIG_BLK_DEV_INTEGRITY=y -# CONFIG_IOSCHED_DEADLINE is not set -# CONFIG_IOSCHED_CFQ is not set -# CONFIG_ARCH_MULTI_V7 is not set -CONFIG_ARCH_MXS=y -# CONFIG_ARM_THUMB is not set -CONFIG_PREEMPT_VOLUNTARY=y -CONFIG_AEABI=y -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=y -CONFIG_CPU_FREQ_GOV_USERSPACE=y -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -CONFIG_FPE_NWFPE=y -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_SYN_COOKIES=y -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -# CONFIG_INET_LRO is not set -# CONFIG_INET_DIAG is not set -# CONFIG_IPV6 is not set -CONFIG_BRIDGE=y -CONFIG_NET_SCHED=y -CONFIG_CAN=y -# CONFIG_CAN_GW is not set -CONFIG_CAN_FLEXCAN=y -CONFIG_BT=y -CONFIG_BT_RFCOMM=y -CONFIG_BT_RFCOMM_TTY=y -CONFIG_BT_BNEP=y -CONFIG_BT_BNEP_MC_FILTER=y -CONFIG_BT_BNEP_PROTO_FILTER=y -CONFIG_BT_HIDP=y -CONFIG_BT_HCIUART=y -CONFIG_BT_HCIUART_ATH3K=y -CONFIG_WIRELESS_EXT=y -CONFIG_RFKILL=y -CONFIG_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -# CONFIG_FIRMWARE_IN_KERNEL is not set -# CONFIG_FW_LOADER_USER_HELPER is not set -CONFIG_MTD=y -CONFIG_MTD_CMDLINE_PARTS=y -CONFIG_MTD_BLOCK=y -CONFIG_MTD_SST25L=y -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_GPMI_NAND=y -CONFIG_MTD_UBI=y -CONFIG_PROC_DEVICETREE=y -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_SIZE=16384 -CONFIG_SRAM=y -CONFIG_EEPROM_AT24=y -CONFIG_SCSI=y -CONFIG_BLK_DEV_SD=y -# CONFIG_SCSI_LOWLEVEL is not set -CONFIG_NETDEVICES=y -# CONFIG_NET_CADENCE is not set -# CONFIG_NET_VENDOR_BROADCOM is not set -# CONFIG_NET_VENDOR_CIRRUS is not set -# CONFIG_NET_VENDOR_FARADAY is not set -# CONFIG_NET_VENDOR_INTEL is not set -# CONFIG_NET_VENDOR_MARVELL is not set -# CONFIG_NET_VENDOR_MICREL is not set -# CONFIG_NET_VENDOR_MICROCHIP is not set -# CONFIG_NET_VENDOR_NATSEMI is not set -# CONFIG_NET_VENDOR_SEEQ is not set -# CONFIG_NET_VENDOR_SMSC is not set -# CONFIG_NET_VENDOR_STMICRO is not set -# CONFIG_NET_VENDOR_WIZNET is not set -CONFIG_SMSC_PHY=y -CONFIG_ICPLUS_PHY=y -CONFIG_REALTEK_PHY=y -CONFIG_MICREL_PHY=y -CONFIG_USB_USBNET=y -CONFIG_USB_NET_SMSC95XX=y -# CONFIG_WLAN is not set -# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -CONFIG_INPUT_EVDEV=y -# CONFIG_KEYBOARD_ATKBD is not set -CONFIG_KEYBOARD_MXS_PSWITCH=y -# CONFIG_INPUT_MOUSE is not set -# CONFIG_SERIO is not set -CONFIG_VT_HW_CONSOLE_BINDING=y -CONFIG_DEVPTS_MULTIPLE_INSTANCES=y -# CONFIG_LEGACY_PTYS is not set -# CONFIG_DEVKMEM is not set -CONFIG_SERIAL_AMBA_PL011=y -CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -CONFIG_SERIAL_MXS_AUART=y -# CONFIG_HW_RANDOM is not set -CONFIG_I2C=y -# CONFIG_I2C_COMPAT is not set -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_MXS=y -CONFIG_SPI=y -CONFIG_SPI_GPIO=y -CONFIG_SPI_MXS=y -CONFIG_SPI_SPIDEV=y -CONFIG_GPIO_SYSFS=y -CONFIG_W1=y -CONFIG_W1_MASTER_DS2482=y -CONFIG_W1_SLAVE_DS2431=y -# CONFIG_HWMON is not set -CONFIG_WATCHDOG=y -CONFIG_STMP3XXX_RTC_WATCHDOG=y -CONFIG_REGULATOR=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y -CONFIG_FB=y -CONFIG_FB_MXS=y -CONFIG_BACKLIGHT_LCD_SUPPORT=y -CONFIG_LCD_CLASS_DEVICE=y -CONFIG_BACKLIGHT_CLASS_DEVICE=y -CONFIG_BACKLIGHT_PWM=y -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_FONTS=y -CONFIG_LOGO=y -CONFIG_FB_LOGO_CENTERED=y -CONFIG_SOUND=y -CONFIG_SND=y -CONFIG_SND_MIXER_OSS=y -CONFIG_SND_PCM_OSS=y -CONFIG_SND_DYNAMIC_MINORS=y -# CONFIG_SND_DRIVERS is not set -# CONFIG_SND_ARM is not set -# CONFIG_SND_SPI is not set -# CONFIG_SND_USB is not set -CONFIG_SND_SOC=y -CONFIG_SND_MXS_SOC=y -CONFIG_SND_SOC_MXS_SGTL5000=y -CONFIG_USB=y -CONFIG_USB_EHCI_HCD=y -CONFIG_USB_STORAGE=y -CONFIG_USB_CHIPIDEA=y -CONFIG_USB_CHIPIDEA_UDC=y -CONFIG_USB_CHIPIDEA_HOST=y -CONFIG_USB_PHY=y -CONFIG_USB_MXS_PHY=y -CONFIG_USB_GADGET=y -CONFIG_USB_ETH=m -CONFIG_USB_MASS_STORAGE=m -CONFIG_USB_G_SERIAL=m -CONFIG_MMC=y -CONFIG_MMC_UNSAFE_RESUME=y -CONFIG_MMC_MXS=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_DRV_STMP=y -CONFIG_DMADEVICES=y -CONFIG_MXS_DMA=y -CONFIG_STAGING=y -CONFIG_MXS_LRADC=y -CONFIG_IIO_SYSFS_TRIGGER=y -CONFIG_COMMON_CLK_DEBUG=y -CONFIG_IIO=y -CONFIG_PWM=y -CONFIG_PWM_MXS=y -CONFIG_EXT2_FS=y -CONFIG_EXT2_FS_XATTR=y -CONFIG_EXT3_FS=y -CONFIG_EXT4_FS=y -# CONFIG_DNOTIFY is not set -CONFIG_VFAT_FS=y -CONFIG_TMPFS=y -CONFIG_TMPFS_POSIX_ACL=y -CONFIG_JFFS2_FS=y -CONFIG_JFFS2_COMPRESSION_OPTIONS=y -CONFIG_JFFS2_LZO=y -CONFIG_JFFS2_RUBIN=y -CONFIG_UBIFS_FS=y -CONFIG_UBIFS_FS_ADVANCED_COMPR=y -CONFIG_NFS_FS=y -CONFIG_NFS_V3_ACL=y -CONFIG_NFS_V4=y -CONFIG_ROOT_NFS=y -CONFIG_NLS_CODEPAGE_437=y -CONFIG_NLS_CODEPAGE_850=y -CONFIG_NLS_ISO8859_1=y -CONFIG_NLS_ISO8859_15=y -CONFIG_PRINTK_TIME=y -CONFIG_FRAME_WARN=2048 -CONFIG_UNUSED_SYMBOLS=y -CONFIG_DEBUG_KERNEL=y -# CONFIG_FTRACE is not set -# CONFIG_ARM_UNWIND is not set -# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set -# CONFIG_CRYPTO_ANSI_CPRNG is not set -# CONFIG_CRYPTO_HW is not set diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6sbc/defconfig b/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6sbc/defconfig index 3ffe94b7d..f53e48f62 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6sbc/defconfig +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6sbc/defconfig @@ -180,7 +180,7 @@ CONFIG_I2C_CHARDEV=y CONFIG_I2C_IMX=y CONFIG_SPI=y CONFIG_SPI_IMX=y -CONFIG_SPI_SPIDEV=y +CONFIG_SPI_SPIDEV=m CONFIG_SPI_SLAVE=y CONFIG_SPI_SLAVE_TIME=y CONFIG_SPI_SLAVE_SYSTEM_CONTROL=y diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6ul/defconfig b/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6ul/defconfig index 71f754fe4..0733a5a89 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6ul/defconfig +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6ul/defconfig @@ -185,7 +185,7 @@ CONFIG_I2C_IMX=y CONFIG_SPI=y CONFIG_SPI_GPIO=y CONFIG_SPI_IMX=y -CONFIG_SPI_SPIDEV=y +CONFIG_SPI_SPIDEV=m CONFIG_SPI_SLAVE=y CONFIG_SPI_SLAVE_TIME=y CONFIG_SPI_SLAVE_SYSTEM_CONTROL=y diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey-4.9/ccimx6qpsbc/defconfig b/meta-digi-arm/recipes-kernel/linux/linux-dey-4.9/ccimx6qpsbc/defconfig new file mode 100644 index 000000000..ae8df27c7 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey-4.9/ccimx6qpsbc/defconfig @@ -0,0 +1,331 @@ +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_KERNEL_LZO=y +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=18 +CONFIG_CGROUPS=y +CONFIG_MEMCG=y +CONFIG_MEMCG_SWAP=y +CONFIG_BLK_CGROUP=y +CONFIG_CGROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_RT_GROUP_SCHED=y +CONFIG_CGROUP_FREEZER=y +CONFIG_CPUSETS=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_CGROUP_PERF=y +CONFIG_NAMESPACES=y +CONFIG_USER_NS=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_EMBEDDED=y +CONFIG_PERF_EVENTS=y +# CONFIG_SLUB_DEBUG is not set +# CONFIG_COMPAT_BRK is not set +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODVERSIONS=y +# CONFIG_BLK_DEV_BSG is not set +CONFIG_ARCH_MXC=y +CONFIG_SOC_IMX6Q=y +CONFIG_SOC_VF610=y +CONFIG_ARM_ERRATA_814220=y +CONFIG_PCI=y +CONFIG_PCI_MSI=y +CONFIG_PCI_IMX6=y +CONFIG_SMP=y +CONFIG_HAVE_ARM_ARCH_TIMER=y +CONFIG_VMSPLIT_2G=y +CONFIG_PREEMPT_VOLUNTARY=y +CONFIG_AEABI=y +CONFIG_HIGHMEM=y +CONFIG_CMA=y +CONFIG_SECCOMP=y +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZBOOT_ROM_BSS=0x0 +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_STAT=y +CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_ARM_IMX6Q_CPUFREQ=y +CONFIG_CPU_IDLE=y +CONFIG_VFP=y +CONFIG_NEON=y +CONFIG_PM_DEBUG=y +CONFIG_PM_TEST_SUSPEND=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_SYN_COOKIES=y +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +CONFIG_NETFILTER=y +CONFIG_BRIDGE=y +CONFIG_NET_SCHED=y +CONFIG_CAN=y +CONFIG_CAN_FLEXCAN=y +CONFIG_BT=y +CONFIG_BT_RFCOMM=y +CONFIG_BT_RFCOMM_TTY=y +CONFIG_BT_BNEP=y +CONFIG_BT_BNEP_MC_FILTER=y +CONFIG_BT_BNEP_PROTO_FILTER=y +CONFIG_BT_HIDP=y +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_ATH3K=y +CONFIG_BT_HCIUART_3WIRE=y +CONFIG_BT_HCIUART_IBS=y +CONFIG_CFG80211=y +CONFIG_CFG80211_CERTIFICATION_ONUS=y +CONFIG_CFG80211_WEXT=y +CONFIG_RFKILL=y +CONFIG_RFKILL_INPUT=y +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +# CONFIG_STANDALONE is not set +CONFIG_DMA_CMA=y +CONFIG_CMA_SIZE_PERCENTAGE=40 +CONFIG_CMA_SIZE_SEL_PERCENTAGE=y +CONFIG_IMX_WEIM=y +CONFIG_CONNECTOR=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=65536 +CONFIG_EEPROM_AT24=y +CONFIG_EEPROM_AT25=y +# CONFIG_SCSI_PROC_FS is not set +CONFIG_BLK_DEV_SD=y +CONFIG_SCSI_CONSTANTS=y +CONFIG_SCSI_LOGGING=y +CONFIG_SCSI_SCAN_ASYNC=y +# CONFIG_SCSI_LOWLEVEL is not set +CONFIG_ATA=y +CONFIG_SATA_AHCI_PLATFORM=y +CONFIG_AHCI_IMX=y +CONFIG_PATA_IMX=y +CONFIG_MD=y +CONFIG_BLK_DEV_DM=y +CONFIG_DM_CRYPT=y +CONFIG_NETDEVICES=y +# CONFIG_NET_CADENCE is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_NET_VENDOR_CIRRUS is not set +# CONFIG_NET_VENDOR_FARADAY is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SMSC is not set +# CONFIG_NET_VENDOR_STMICRO is not set +# CONFIG_NET_VENDOR_WIZNET is not set +CONFIG_MICREL_PHY=y +CONFIG_SMSC_PHY=y +CONFIG_PPP=y +CONFIG_PPP_BSDCOMP=y +CONFIG_PPP_DEFLATE=y +CONFIG_PPP_ASYNC=y +CONFIG_USB_USBNET=y +CONFIG_USB_NET_CDC_EEM=y +CONFIG_USB_NET_CDC_MBIM=y +CONFIG_USB_NET_QMI_WWAN=y +CONFIG_USB_SIERRA_NET=y +CONFIG_ATH6KL=m +CONFIG_ATH6KL_SDIO=m +CONFIG_ATH6KL_DEBUG=y +CONFIG_ATH6KL_REGDOMAIN=y +CONFIG_HOSTAP=y +CONFIG_HOSTAP_FIRMWARE=y +CONFIG_INPUT_EVDEV=y +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_IMX=y +# CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_FUSION_7_10=y +CONFIG_TOUCHSCREEN_MC13783=y +CONFIG_INPUT_MISC=y +CONFIG_INPUT_MMA8450=y +CONFIG_INPUT_DA9063_ONKEY=y +CONFIG_INPUT_ISL29023=y +# CONFIG_LEGACY_PTYS is not set +# CONFIG_DEVKMEM is not set +CONFIG_SERIAL_IMX=y +CONFIG_SERIAL_IMX_CONSOLE=y +CONFIG_SERIAL_FSL_LPUART=y +CONFIG_SERIAL_FSL_LPUART_CONSOLE=y +CONFIG_FSL_OTP=y +# CONFIG_I2C_COMPAT is not set +CONFIG_I2C_CHARDEV=y +# CONFIG_I2C_HELPER_AUTO is not set +CONFIG_I2C_IMX=y +CONFIG_I2C_IMX_LPI2C=y +CONFIG_SPI=y +CONFIG_SPI_IMX=y +CONFIG_SPI_FSL_LPSPI=y +CONFIG_SPI_SPIDEV=m +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_DA9063=y +CONFIG_POWER_SUPPLY=y +CONFIG_SENSORS_DA9063=y +CONFIG_SENSORS_MAG3110=y +CONFIG_THERMAL=y +CONFIG_THERMAL_WRITABLE_TRIPS=y +CONFIG_CPU_THERMAL=y +CONFIG_IMX_THERMAL=y +CONFIG_DEVICE_THERMAL=y +CONFIG_WATCHDOG=y +CONFIG_IMX2_WDT=y +CONFIG_MFD_DA9052_I2C=y +CONFIG_MFD_DA9063=y +CONFIG_MFD_MC13XXX_SPI=y +CONFIG_MFD_MC13XXX_I2C=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_REGULATOR_ANATOP=y +CONFIG_REGULATOR_DA9052=y +CONFIG_REGULATOR_DA9063=y +CONFIG_REGULATOR_MC13783=y +CONFIG_REGULATOR_MC13892=y +CONFIG_REGULATOR_PFUZE100=y +CONFIG_MEDIA_SUPPORT=y +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_USB_SUPPORT=y +CONFIG_USB_VIDEO_CLASS=y +# CONFIG_USB_GSPCA is not set +CONFIG_V4L_PLATFORM_DRIVERS=y +CONFIG_VIDEO_MXC_OUTPUT=y +CONFIG_VIDEO_MXC_CAPTURE=y +CONFIG_MXC_CAMERA_OV5642=y +CONFIG_MXC_CAMERA_OV5640_MIPI=y +CONFIG_MXC_IPU_DEVICE_QUEUE_SDC=y +CONFIG_VIDEO_MXC_IPU_OUTPUT=y +CONFIG_VIDEO_MXC_PXP_V4L2=y +CONFIG_SOC_CAMERA=y +CONFIG_SOC_CAMERA_OV2640=y +# CONFIG_VGA_ARB is not set +CONFIG_DRM=y +CONFIG_DRM_VIVANTE=y +CONFIG_FB_MXS=y +CONFIG_FB_MXC_SYNC_PANEL=y +CONFIG_FB_MXC_OVERLAY=y +CONFIG_FB_MXC_MIPI_DSI=y +CONFIG_FB_MXC_TRULY_WVGA_SYNC_PANEL=y +CONFIG_FB_MXC_LDB=y +CONFIG_FB_MXC_HDMI=y +CONFIG_FB_MXC_AD9389=y +CONFIG_LCD_CLASS_DEVICE=y +CONFIG_LCD_L4F00242T03=y +CONFIG_LCD_PLATFORM=y +CONFIG_BACKLIGHT_PWM=y +CONFIG_BACKLIGHT_GPIO=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_LOGO=y +CONFIG_FB_LOGO_CENTERED=y +CONFIG_FB_LOGO_FORCE_SINGLE=y +# CONFIG_LOGO_LINUX_MONO is not set +# CONFIG_LOGO_LINUX_VGA16 is not set +# CONFIG_LOGO_LINUX_CLUT224 is not set +CONFIG_SOUND=y +CONFIG_SND=y +# CONFIG_SND_SUPPORT_OLD_API is not set +# CONFIG_SND_VERBOSE_PROCFS is not set +# CONFIG_SND_DRIVERS is not set +# CONFIG_SND_PCI is not set +# CONFIG_SND_ARM is not set +# CONFIG_SND_SPI is not set +# CONFIG_SND_USB is not set +CONFIG_SND_SOC=y +CONFIG_SND_IMX_SOC=y +CONFIG_SND_SOC_IMX_SGTL5000=y +CONFIG_SND_SOC_IMX_HDMI=y +CONFIG_HID_MULTITOUCH=y +CONFIG_USB=y +CONFIG_USB_OTG=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_ACM=y +CONFIG_USB_STORAGE=y +CONFIG_USB_CHIPIDEA=y +CONFIG_USB_CHIPIDEA_UDC=y +CONFIG_USB_CHIPIDEA_HOST=y +CONFIG_USB_SERIAL=y +CONFIG_USB_SERIAL_QUALCOMM=y +CONFIG_USB_SERIAL_SIERRAWIRELESS=y +CONFIG_USB_SERIAL_OPTION=y +CONFIG_USB_MXS_PHY=y +CONFIG_USB_GADGET=y +CONFIG_USB_ETH=m +CONFIG_USB_MASS_STORAGE=m +CONFIG_USB_G_SERIAL=m +CONFIG_USB_CDC_COMPOSITE=m +CONFIG_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SDHCI_ESDHC_IMX=y +CONFIG_MXC_IPU=y +CONFIG_MXC_IPU_V3_PRE=y +CONFIG_MXC_MIPI_CSI2=y +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_DA9063=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_INTF_DEV_UIE_EMUL=y +CONFIG_RTC_DRV_DA9063=y +CONFIG_RTC_DRV_MC13XXX=y +CONFIG_RTC_DRV_MXC=y +CONFIG_RTC_DRV_SNVS=y +CONFIG_DMADEVICES=y +CONFIG_IMX_SDMA=y +CONFIG_MXS_DMA=y +CONFIG_MXC_PXP_V2=y +# CONFIG_IOMMU_SUPPORT is not set +CONFIG_EXTCON_USB_GPIO=y +CONFIG_PWM=y +CONFIG_PWM_IMX=y +CONFIG_EXT4_FS=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +CONFIG_OVERLAY_FS=y +CONFIG_MSDOS_FS=y +CONFIG_VFAT_FS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +# CONFIG_MISC_FILESYSTEMS is not set +CONFIG_NFS_FS=y +CONFIG_NFS_V3_ACL=y +CONFIG_NFS_V4=y +CONFIG_ROOT_NFS=y +CONFIG_NLS_DEFAULT="cp437" +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_CODEPAGE_850=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NLS_ISO8859_15=y +CONFIG_NLS_UTF8=y +CONFIG_DYNAMIC_DEBUG=y +CONFIG_DEBUG_FS=y +# CONFIG_SCHED_DEBUG is not set +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_FTRACE is not set +# CONFIG_ARM_UNWIND is not set +CONFIG_SECURITYFS=y +CONFIG_CRYPTO_TEST=m +CONFIG_CRYPTO_XTS=y +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_LZO=y +CONFIG_CRYPTO_USER_API_HASH=y +CONFIG_CRYPTO_USER_API_SKCIPHER=y +CONFIG_CRYPTO_DEV_FSL_CAAM=y +CONFIG_FONTS=y +CONFIG_VIRTUALIZATION=y diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey-4.9/ccimx6ul/defconfig b/meta-digi-arm/recipes-kernel/linux/linux-dey-4.9/ccimx6ul/defconfig new file mode 100644 index 000000000..22f448883 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey-4.9/ccimx6ul/defconfig @@ -0,0 +1,363 @@ +CONFIG_KERNEL_LZO=y +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=18 +CONFIG_CGROUPS=y +CONFIG_MEMCG=y +CONFIG_MEMCG_SWAP=y +CONFIG_BLK_CGROUP=y +CONFIG_CGROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_RT_GROUP_SCHED=y +CONFIG_CGROUP_FREEZER=y +CONFIG_CPUSETS=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_CGROUP_PERF=y +CONFIG_NAMESPACES=y +CONFIG_USER_NS=y +CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y +# CONFIG_RD_LZMA is not set +# CONFIG_RD_XZ is not set +# CONFIG_RD_LZ4 is not set +CONFIG_EXPERT=y +CONFIG_KALLSYMS_ALL=y +CONFIG_PERF_EVENTS=y +# CONFIG_SLUB_DEBUG is not set +# CONFIG_COMPAT_BRK is not set +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODVERSIONS=y +CONFIG_MODULE_SRCVERSION_ALL=y +# CONFIG_BLK_DEV_BSG is not set +CONFIG_ARCH_MXC=y +CONFIG_SOC_IMX6UL=y +# CONFIG_SWP_EMULATE is not set +CONFIG_ARM_ERRATA_764369=y +CONFIG_SMP=y +CONFIG_HAVE_ARM_ARCH_TIMER=y +CONFIG_VMSPLIT_2G=y +CONFIG_PREEMPT=y +CONFIG_AEABI=y +CONFIG_HIGHMEM=y +CONFIG_CMA=y +CONFIG_SECCOMP=y +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_CPU_FREQ_GOV_INTERACTIVE=y +CONFIG_ARM_IMX6Q_CPUFREQ=y +CONFIG_CPU_IDLE=y +CONFIG_VFP=y +CONFIG_NEON=y +CONFIG_PM_DEBUG=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +CONFIG_BRIDGE=y +CONFIG_VLAN_8021Q=y +CONFIG_LLC2=y +CONFIG_CAN=y +CONFIG_CAN_FLEXCAN=y +CONFIG_BT=y +CONFIG_BT_RFCOMM=y +CONFIG_BT_RFCOMM_TTY=y +CONFIG_BT_BNEP=y +CONFIG_BT_BNEP_MC_FILTER=y +CONFIG_BT_BNEP_PROTO_FILTER=y +CONFIG_BT_HIDP=y +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_ATH3K=y +CONFIG_BT_HCIUART_IBS=y +CONFIG_CFG80211=y +CONFIG_CFG80211_CERTIFICATION_ONUS=y +CONFIG_CFG80211_DEBUGFS=y +CONFIG_CFG80211_WEXT=y +CONFIG_RFKILL=y +CONFIG_RFKILL_INPUT=y +CONFIG_RFKILL_REGULATOR=y +CONFIG_RFKILL_GPIO=y +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +# CONFIG_STANDALONE is not set +# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set +CONFIG_DMA_CMA=y +CONFIG_CMA_SIZE_MBYTES=0 +CONFIG_IMX_WEIM=y +CONFIG_CONNECTOR=y +CONFIG_MTD=y +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_CFI=y +CONFIG_MTD_JEDECPROBE=y +CONFIG_MTD_CFI_INTELEXT=y +CONFIG_MTD_CFI_AMDSTD=y +CONFIG_MTD_CFI_STAA=y +CONFIG_MTD_PHYSMAP_OF=y +CONFIG_MTD_NAND=y +CONFIG_MTD_NAND_GPMI_NAND=y +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_FASTMAP=y +CONFIG_MTD_UBI_BLOCK=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=65536 +CONFIG_EEPROM_AT24=y +CONFIG_EEPROM_AT25=y +CONFIG_SCSI=y +# CONFIG_SCSI_PROC_FS is not set +CONFIG_BLK_DEV_SD=y +CONFIG_NETDEVICES=y +# CONFIG_NET_VENDOR_ARC is not set +# CONFIG_NET_CADENCE is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_NET_VENDOR_CIRRUS is not set +# CONFIG_NET_VENDOR_FARADAY is not set +# CONFIG_NET_VENDOR_HISILICON is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_QUALCOMM is not set +# CONFIG_NET_VENDOR_ROCKER is not set +# CONFIG_NET_VENDOR_SAMSUNG is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SMSC is not set +# CONFIG_NET_VENDOR_STMICRO is not set +# CONFIG_NET_VENDOR_VIA is not set +# CONFIG_NET_VENDOR_WIZNET is not set +CONFIG_SMSC_PHY=y +CONFIG_PPP=y +CONFIG_PPP_BSDCOMP=y +CONFIG_PPP_DEFLATE=y +CONFIG_PPP_ASYNC=y +CONFIG_USB_USBNET=y +# CONFIG_USB_NET_AX8817X is not set +# CONFIG_USB_NET_AX88179_178A is not set +CONFIG_USB_NET_CDC_EEM=y +CONFIG_USB_NET_CDC_MBIM=y +# CONFIG_USB_NET_NET1080 is not set +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +CONFIG_USB_NET_QMI_WWAN=y +CONFIG_USB_SIERRA_NET=y +CONFIG_HOSTAP=y +CONFIG_HOSTAP_FIRMWARE=y +CONFIG_HOSTAP_FIRMWARE_NVRAM=y +CONFIG_INPUT_POLLDEV=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_EVDEV=y +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_IMX=y +# CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_FUSION_7_10=y +CONFIG_TOUCHSCREEN_IMX6UL_TSC=y +CONFIG_INPUT_MISC=y +CONFIG_INPUT_MCA_CC6UL_PWRKEY=y +# CONFIG_SERIO_SERPORT is not set +# CONFIG_LEGACY_PTYS is not set +# CONFIG_DEVKMEM is not set +CONFIG_SERIAL_IMX=y +CONFIG_SERIAL_IMX_CONSOLE=y +CONFIG_SERIAL_MCA_CC6UL=y +CONFIG_FSL_OTP=y +# CONFIG_I2C_COMPAT is not set +CONFIG_I2C_CHARDEV=y +# CONFIG_I2C_HELPER_AUTO is not set +CONFIG_I2C_ALGOBIT=y +CONFIG_I2C_IMX=y +CONFIG_I2C_IMX_LPI2C=y +CONFIG_SPI=y +CONFIG_SPI_GPIO=y +CONFIG_SPI_IMX=y +CONFIG_SPI_FSL_LPSPI=y +CONFIG_SPI_SPIDEV=m +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_MCA_CC6UL=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_SYSCON=y +CONFIG_POWER_RESET_SYSCON_POWEROFF=y +CONFIG_POWER_SUPPLY=y +# CONFIG_MXC_MMA8451 is not set +CONFIG_THERMAL=y +CONFIG_CPU_THERMAL=y +CONFIG_IMX_THERMAL=y +CONFIG_DEVICE_THERMAL=y +CONFIG_WATCHDOG=y +CONFIG_WATCHDOG_NOWAYOUT=y +CONFIG_MCA_CC6UL_WATCHDOG=y +CONFIG_IMX2_WDT=y +CONFIG_MFD_MCA_IOEXP=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_REGULATOR_ANATOP=y +CONFIG_REGULATOR_GPIO=y +CONFIG_REGULATOR_PFUZE100=y +CONFIG_MEDIA_SUPPORT=y +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_V4L_PLATFORM_DRIVERS=y +CONFIG_VIDEO_MXC_OUTPUT=y +CONFIG_VIDEO_MXC_CAPTURE=y +CONFIG_MXC_IPU_DEVICE_QUEUE_SDC=y +# CONFIG_MXC_IPU_PRP_ENC is not set +CONFIG_VIDEO_MXC_PXP_V4L2=y +CONFIG_VIDEO_MXC_CSI_CAMERA=y +CONFIG_MXC_SUBDEV_CAMERA_OV5640=y +CONFIG_MXC_SUBDEV_CAMERA_OV5642=y +CONFIG_SOC_CAMERA=y +CONFIG_V4L_MEM2MEM_DRIVERS=y +CONFIG_VIDEO_CODA=y +CONFIG_FB=y +# CONFIG_FB_MX3 is not set +CONFIG_FB_MXS=y +CONFIG_FB_MXC_SYNC_PANEL=y +CONFIG_FB_MXC_LDB=y +# CONFIG_FB_MXC_EDID is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +CONFIG_LCD_CLASS_DEVICE=y +CONFIG_LCD_PLATFORM=y +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_BACKLIGHT_PWM=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +CONFIG_LOGO=y +CONFIG_FB_LOGO_CENTERED=y +# CONFIG_LOGO_LINUX_MONO is not set +# CONFIG_LOGO_LINUX_VGA16 is not set +# CONFIG_LOGO_LINUX_CLUT224 is not set +CONFIG_SOUND=y +CONFIG_SND=y +# CONFIG_SND_SPI is not set +# CONFIG_SND_USB is not set +CONFIG_SND_SOC=y +CONFIG_SND_SOC_FSL_ASRC=y +CONFIG_SND_IMX_SOC=y +CONFIG_SND_SOC_IMX_MAX98088=y +CONFIG_SND_SOC_IMX_SPDIF=y +CONFIG_SND_SOC_FSL_ASOC_CARD=y +CONFIG_USB=y +CONFIG_USB_OTG_WHITELIST=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_MXC=y +CONFIG_USB_HCD_TEST_MODE=y +CONFIG_USB_ACM=y +CONFIG_USB_STORAGE=y +CONFIG_USB_CHIPIDEA=y +CONFIG_USB_CHIPIDEA_UDC=y +CONFIG_USB_CHIPIDEA_HOST=y +CONFIG_USB_SERIAL=y +CONFIG_USB_SERIAL_GENERIC=y +CONFIG_USB_SERIAL_QUALCOMM=y +CONFIG_USB_SERIAL_SIERRAWIRELESS=y +CONFIG_USB_SERIAL_OPTION=y +CONFIG_USB_EHSET_TEST_FIXTURE=y +CONFIG_NOP_USB_XCEIV=y +CONFIG_USB_MXS_PHY=y +CONFIG_USB_GADGET=y +CONFIG_USB_FSL_USB2=y +CONFIG_USB_ETH=m +CONFIG_USB_MASS_STORAGE=m +CONFIG_USB_G_SERIAL=m +CONFIG_USB_CDC_COMPOSITE=m +CONFIG_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SDHCI_ESDHC_IMX=y +CONFIG_MXC_IPU=y +CONFIG_MXC_SIM=y +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_PWM=y +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_INTF_DEV_UIE_EMUL=y +CONFIG_RTC_DRV_MCA_CC6UL=y +CONFIG_RTC_DRV_MXC=y +CONFIG_RTC_DRV_SNVS=y +CONFIG_DMADEVICES=y +CONFIG_IMX_SDMA=y +CONFIG_MXS_DMA=y +CONFIG_MXC_PXP_V2=y +CONFIG_MXC_PXP_V3=y +CONFIG_STAGING=y +CONFIG_STAGING_MEDIA=y +# CONFIG_IOMMU_SUPPORT is not set +CONFIG_IIO=y +CONFIG_MCA_CC6UL_ADC=y +CONFIG_VF610_ADC=y +CONFIG_TAMPER_MCA_CC6UL=y +CONFIG_PWM=y +CONFIG_PWM_IMX=y +# CONFIG_RESET_GPIO is not set +CONFIG_NVMEM_IMX_OCOTP=y +CONFIG_EXT4_FS=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +CONFIG_AUTOFS4_FS=y +CONFIG_OVERLAY_FS=y +CONFIG_VFAT_FS=y +CONFIG_TMPFS=y +CONFIG_UBIFS_FS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V3_ACL=y +CONFIG_NFS_V4=y +CONFIG_ROOT_NFS=y +CONFIG_NLS_DEFAULT="cp437" +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NLS_UTF8=y +CONFIG_DEBUG_FS=y +CONFIG_MAGIC_SYSRQ=y +# CONFIG_SCHED_DEBUG is not set +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_FTRACE is not set +CONFIG_CRYPTO_USER=y +CONFIG_CRYPTO_CBC=y +CONFIG_CRYPTO_CTR=y +CONFIG_CRYPTO_CTS=y +CONFIG_CRYPTO_LRW=y +CONFIG_CRYPTO_XTS=y +CONFIG_CRYPTO_GHASH=y +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_MD5=y +CONFIG_CRYPTO_RMD128=y +CONFIG_CRYPTO_RMD160=y +CONFIG_CRYPTO_RMD256=y +CONFIG_CRYPTO_RMD320=y +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_SHA512=y +CONFIG_CRYPTO_TGR192=y +CONFIG_CRYPTO_WP512=y +CONFIG_CRYPTO_BLOWFISH=y +CONFIG_CRYPTO_CAMELLIA=y +CONFIG_CRYPTO_TWOFISH=y +CONFIG_CRYPTO_DEV_FSL_CAAM=y +CONFIG_CRYPTO_DEV_FSL_CAAM_SM=y +CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO=y +CONFIG_CRC_T10DIF=y +CONFIG_FONTS=y +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +CONFIG_VIRTUALIZATION=y diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey_3.10.bb b/meta-digi-arm/recipes-kernel/linux/linux-dey_3.10.bb deleted file mode 100644 index 6d7e0ec69..000000000 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey_3.10.bb +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (C) 2012 Digi International - -require recipes-kernel/linux/linux-dey.inc -require recipes-kernel/linux/linux-dtb.inc - -SRCBRANCH = "v3.10/dey-1.4/maint" -SRCREV = "${AUTOREV}" - -config_dts() { - for DTB in ${KERNEL_DEVICETREE}; do - if [ "${1}" = "enable" ]; then - sed -i -e "/${2}/{s,^///include,/include,g}" ${S}/arch/arm/boot/dts/${DTB%b}s - elif [ "${1}" = "disable" ]; then - sed -i -e "/${2}/{s,^/include,///include,g}" ${S}/arch/arm/boot/dts/${DTB%b}s - fi - done -} - -do_update_dts() { - if [ -n "${HAVE_WIFI}" ]; then - config_dts enable '_ssp2_mmc_wifi.dtsi' - else - config_dts disable '_ssp2_mmc_wifi.dtsi' - fi - if [ -n "${HAVE_SECOND_ETH}" ]; then - config_dts enable '_ethernet1.dtsi' - else - config_dts disable '_ethernet1.dtsi' - fi - if [ -n "${HAVE_BT}" ]; then - config_dts enable '_auart0_bluetooth.dtsi' - else - config_dts disable '_auart0_bluetooth.dtsi' - fi - if [ -n "${HAVE_1WIRE}" ]; then - config_dts enable '_onewire_i2c1.dtsi' - config_dts disable '_auart2_4wires.dtsi' - else - config_dts disable '_onewire_i2c1.dtsi' - fi - if [ -n "${HAVE_GUI}" ]; then - # Enable LCD - config_dts enable '_display_' - config_dts disable '_auart1_' - # Enable touch - config_dts enable '_lradc_touchscreen' - config_dts disable '_ssp1_' - config_dts disable '_auart1_4wires' - config_dts disable '_ethernet0_leds' - else - # spidev conflicts with touchscreen, thus enable it only - # when touch is disabled - if [ -n "${HAVE_EXAMPLE}" ]; then - config_dts enable 'ssp1_spi_gpio.dtsi' - config_dts enable 'ssp1_spi_gpio_spidev.dtsi' - fi - fi -} -addtask update_dts before do_install after do_sizecheck - -COMPATIBLE_MACHINE = "(ccardimx28)" diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey_3.14.bb b/meta-digi-arm/recipes-kernel/linux/linux-dey_3.14.bb index 6819a65b9..6d707e524 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey_3.14.bb +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey_3.14.bb @@ -1,4 +1,4 @@ -# Copyright (C) 2015 Digi International +# Copyright (C) 2015-2017 Digi International require recipes-kernel/linux/linux-dey.inc require recipes-kernel/linux/linux-dtb.inc @@ -8,4 +8,4 @@ inherit fsl-vivante-kernel-driver-handler SRCBRANCH = "v3.14/dey-2.0/maint" SRCREV = "${AUTOREV}" -COMPATIBLE_MACHINE = "(ccimx6$)" +COMPATIBLE_MACHINE = "(ccimx6sbc)" diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey_4.1.bb b/meta-digi-arm/recipes-kernel/linux/linux-dey_4.1.bb index 3718a6da4..c3a37c42c 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey_4.1.bb +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey_4.1.bb @@ -6,4 +6,4 @@ require recipes-kernel/linux/linux-dtb.inc SRCBRANCH = "v4.1/dey-2.2/maint" SRCREV = "${AUTOREV}" -COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul)" +COMPATIBLE_MACHINE = "(ccimx6sbc|ccimx6ul)" diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey_4.9.bb b/meta-digi-arm/recipes-kernel/linux/linux-dey_4.9.bb new file mode 100644 index 000000000..4bd073c7e --- /dev/null +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey_4.9.bb @@ -0,0 +1,9 @@ +# Copyright (C) 2017 Digi International + +require recipes-kernel/linux/linux-dey.inc +require recipes-kernel/linux/linux-dtb.inc + +SRCBRANCH = "v4.9/dey-2.2/maint" +SRCREV = "${AUTOREV}" + +COMPATIBLE_MACHINE = "(ccimx6qpsbc|ccimx6ul)" diff --git a/meta-digi-dey/README b/meta-digi-dey/README index 75c63473c..fa258ad44 100644 --- a/meta-digi-dey/README +++ b/meta-digi-dey/README @@ -29,4 +29,4 @@ Support ------- This layer is provided 'as is' with no guarantee. However, some support -may be available from support@digi.com +may be available from tech.support@digi.com diff --git a/meta-digi-dey/classes/dey-image.bbclass b/meta-digi-dey/classes/dey-image.bbclass index 8d19292dd..cea4ffe8d 100644 --- a/meta-digi-dey/classes/dey-image.bbclass +++ b/meta-digi-dey/classes/dey-image.bbclass @@ -32,3 +32,27 @@ inherit ${@bb.utils.contains("IMAGE_FEATURES", "dey-qt", "populate_sdk_qt5", "", # DEY_IMAGE_INSTALLER ?= "0" inherit ${@base_conditional("DEY_IMAGE_INSTALLER", "1", "dey-image-installer", "", d)} + +# +# Create a dey-version file when populating the toolchain/SDK +# +# 'SDK_POSTPROCESS_COMMAND' variable is originally defined in populate_sdk_base +# class: poky/meta/classes/populate_sdk_base.bbclass +# It is redefined here to be able to tweak the resulting SDK before packaging, +# using the proper 'IMAGE_BASENAME' value. +# +SDK_PREPACKAGING_COMMAND ?= "toolchain_create_sdk_dey_version" +SDK_POSTPROCESS_COMMAND = " create_sdk_files; check_sdk_sysroots; ${SDK_PREPACKAGING_COMMAND}; tar_sdk; ${SDK_PACKAGING_COMMAND} " + +# This function creates a DEY version information file +fakeroot toolchain_create_sdk_dey_version() { + local deyversionfile="${SDK_OUTPUT}/${SDKPATH}/dey-version-${REAL_MULTIMACH_TARGET_SYS}" + + rm -f $deyversionfile + touch $deyversionfile + echo 'Machine: ${MACHINE}' >> $deyversionfile + echo 'Version: ${DISTRO_VERSION}-${DATETIME}' >> $deyversionfile + echo 'Image: ${IMAGE_BASENAME}' >> $deyversionfile +} +toolchain_create_sdk_dey_version[vardepsexclude] = "DATETIME" + diff --git a/meta-digi-dey/conf/distro/dey.conf b/meta-digi-dey/conf/distro/dey.conf index 8f6e963f1..8a2f1e3b1 100644 --- a/meta-digi-dey/conf/distro/dey.conf +++ b/meta-digi-dey/conf/distro/dey.conf @@ -1,11 +1,11 @@ DISTRO = "dey" DISTRO_NAME = "Digi Embedded Yocto" -DISTRO_VERSION = "2.2-r2" +DISTRO_VERSION = "2.2-r3" DISTRO_CODENAME = "morty" SDK_VENDOR = "-deysdk" SDK_VERSION := "${@'${DISTRO_VERSION}'}" -MAINTAINER = "Digi Support " +MAINTAINER = "Digi Support " TARGET_VENDOR = "-dey" @@ -57,6 +57,9 @@ PREFERRED_VERSION_linux-yocto_qemumips ?= "4.8%" PREFERRED_VERSION_linux-yocto_qemumips64 ?= "4.8%" PREFERRED_VERSION_linux-yocto_qemuppc ?= "4.8%" +# Use git recipe for libsoc +PREFERRED_VERSION_libsoc = "git" + SDK_NAME = "${DISTRO}-${TCLIBC}-${SDK_ARCH}-${IMAGE_BASENAME}-${TUNE_PKGARCH}" SDKPATH = "/opt/${DISTRO}/${SDK_VERSION}" diff --git a/meta-digi-dey/recipes-aws/greengrass/greengrass/0001-greengrassd-remove-bashisms-in-launcher-shell-script.patch b/meta-digi-dey/recipes-aws/greengrass/greengrass-1.0.0/0001-greengrassd-remove-bashisms-in-launcher-shell-script.patch similarity index 100% rename from meta-digi-dey/recipes-aws/greengrass/greengrass/0001-greengrassd-remove-bashisms-in-launcher-shell-script.patch rename to meta-digi-dey/recipes-aws/greengrass/greengrass-1.0.0/0001-greengrassd-remove-bashisms-in-launcher-shell-script.patch diff --git a/meta-digi-dey/recipes-aws/greengrass/greengrass-1.1.0/0001-greengrassd-remove-bashisms-in-launcher-shell-script.patch b/meta-digi-dey/recipes-aws/greengrass/greengrass-1.1.0/0001-greengrassd-remove-bashisms-in-launcher-shell-script.patch new file mode 100644 index 000000000..adcdea806 --- /dev/null +++ b/meta-digi-dey/recipes-aws/greengrass/greengrass-1.1.0/0001-greengrassd-remove-bashisms-in-launcher-shell-script.patch @@ -0,0 +1,114 @@ +From: Tatiana Leon +Date: Mon, 13 Nov 2017 20:01:59 +0100 +Subject: [PATCH] greengrassd: remove bashisms in launcher shell script + +So it runs properly in other Posix shells (like the one in Busybox) + +Signed-off-by: Tatiana Leon +--- + .../ggc/packages/1.1.0/greengrassd | 27 +++++++++++----------- + 1 file changed, 14 insertions(+), 13 deletions(-) + +diff --git a/ggc/packages/1.1.0/greengrassd +index 9bece0c..4d68477 100755 +--- a/ggc/packages/1.1.0/greengrassd ++++ b/ggc/packages/1.1.0/greengrassd +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + ##########Environment Requirement for Greengrass Daemon########## + # by default, the daemon assumes it's going to be launched from a directory +@@ -42,20 +42,21 @@ setup() { + mkdir -p $GGC_ROOT_FS + + # Mask greengrass directory for containers +- mknod $GGC_ROOT_FS/greengrass c 1 3 &>/dev/null || true ++ mknod $GGC_ROOT_FS/greengrass c 1 3 >/dev/null 2>&1 || true + + mkdir -p $(dirname "$CRASH_LOG") + } + + validatePlatformSecurity() { + +- if [[ -f $FS_SETTINGS/protected_hardlinks && +- -f $FS_SETTINGS/protected_symlinks ]]; then ++ if [ -f $FS_SETTINGS/protected_hardlinks ] && ++ [ -f $FS_SETTINGS/protected_symlinks ]; then ++ + + PROT_HARDLINK_VAL=$(cat $FS_SETTINGS/protected_hardlinks) + PROT_SOFTLINK_VAL=$(cat $FS_SETTINGS/protected_symlinks) + +- if [[ "$PROT_HARDLINK_VAL" -ne 1 || "$PROT_SOFTLINK_VAL" -ne 1 ]]; then ++ if [ "$PROT_HARDLINK_VAL" -ne 1 ] || [ "$PROT_SOFTLINK_VAL" -ne 1 ]; then + echo "AWS Greengrass detected insecure OS configuration: No hardlink/softlink protection enabled." | tee -a $CRASH_LOG + exit 1 + fi +@@ -134,13 +135,13 @@ finish() { + pid=$1 + echo "$pid" > $PID_FILE + echo "" +- echo -e "\e[0;32mGreengrass successfully started with PID: $pid\e[0m" ++ printf "\e[0;32mGreengrass successfully started with PID: $pid\e[0m\n" + exit 0 + } + + start() { + setup +- if [[ $INSECURE -ne 1 ]]; then ++ if [ "${INSECURE}" != "1" ]; then + validatePlatformSecurity + fi + +@@ -159,7 +160,7 @@ start() { + + echo "" + echo "Greengrass daemon $pid failed to start" +- echo -e "\e[0;31m$(cat $CRASH_LOG)\e[0m" ++ printf "\e[0;31m$(cat $CRASH_LOG)\e[0m\n" + exit 1 + else + echo "Failed to start Greengrass daemon" +@@ -191,7 +192,7 @@ stop() { + # If the pid no longer exists, we're done, remove the pid file and exit. Otherwise, just increment the loop counter + if [ ! -e "/proc/$PID" ]; then + rm $PID_FILE +- echo -e "\nStopped greengrass daemon, exiting with success" ++ printf "\nStopped greengrass daemon, exiting with success\n" + break + else + total_sleep_seconds=$(($total_sleep_seconds+1)) +@@ -207,7 +208,7 @@ stop() { + if [ $total_sleep_seconds -ge $MAX_DAEMON_KILL_WAIT_SECONDS ] && [ -e "/proc/$PID" ]; then + # If we are here, we never exited in the previous loop and the pid still exists. Exit with failure. + kill -9 "$PID" > /dev/null 2>&1 +- echo -e "\nProcess with pid $PID still alive after timeout of $MAX_DAEMON_KILL_WAIT_SECONDS seconds. Forced kill process, exiting with failure." ++ printf "\nProcess with pid $PID still alive after timeout of $MAX_DAEMON_KILL_WAIT_SECONDS seconds. Unable to kill process, exiting with failure.\n" + exit 1 + fi + fi +@@ -217,12 +218,12 @@ usage() { + echo "" + echo "Usage: $0 [FLAGS] {start|stop|restart}" + echo "" +- echo -e "[FLAGS]: \n -i, --insecure \t Run GGC in insecure mode without hardlink/softlink protection, (highly discouraged for production use) \n -v, --version \t\t Outputs the version of GGC." ++ printf "[FLAGS]: \n -i, --insecure \t Run GGC in insecure mode without hardlink/softlink protection, (highly discouraged for production use) \n -v, --version \t\t Outputs the version of GGC.\n" + echo "" + exit 1 + } + +-if [[ $# -eq 0 ]]; then ++if [ $# -eq 0 ]; then + usage + fi + +@@ -236,7 +237,7 @@ do + esac + done + +-while [[ $# -gt 0 ]] ++while [ $# -gt 0 ] + do + key="$1" + case $key in diff --git a/meta-digi-dey/recipes-aws/greengrass/greengrass/greengrass-init b/meta-digi-dey/recipes-aws/greengrass/greengrass/greengrass-init index 8af4aafde..ed6fbb74a 100644 --- a/meta-digi-dey/recipes-aws/greengrass/greengrass/greengrass-init +++ b/meta-digi-dey/recipes-aws/greengrass/greengrass/greengrass-init @@ -18,7 +18,7 @@ # GG_INSTALL_DIR="##GG_INSTALL_DIR##" -GG_LAUNCHER="${GG_INSTALL_DIR}/greengrassd" +GG_LAUNCHER="$(find ${GG_INSTALL_DIR} -type f -name greengrassd)" case "${1}" in start | stop | restart) diff --git a/meta-digi-dey/recipes-aws/greengrass/greengrass_1.1.0.bb b/meta-digi-dey/recipes-aws/greengrass/greengrass_1.1.0.bb new file mode 100644 index 000000000..a43a586cd --- /dev/null +++ b/meta-digi-dey/recipes-aws/greengrass/greengrass_1.1.0.bb @@ -0,0 +1,203 @@ +# Copyright (C) 2017, Digi International Inc. + +SUMMARY = "AWS IoT Greengrass core" +HOMEPAGE = "https://aws.amazon.com/greengrass/" +# +# The package includes different licenses: +# +# [Apache-2.0] +# ggc/core/LICENSE/attributions/github_aws_aws_sdk_go_License.txt +# ggc/core/LICENSE/attributions/github_coreos_go_systemd_License.txt +# ggc/core/LICENSE/attributions/github_docker_docker_License.txt +# ggc/core/LICENSE/attributions/github_docker_go_units_License.txt +# ggc/core/LICENSE/attributions/github_go_ini_ini_License.txt +# ggc/core/LICENSE/attributions/github_jmespath_go_jmespath_License.txt +# ggc/core/LICENSE/attributions/github_opencontainers_runc_License.txt +# ggc/core/LICENSE/attributions/github_opencontainers_runtime_spec_License.txt +# ggc/core/LICENSE/attributions/github_pquerna_ffjson_License.txt +# ggc/core/LICENSE/attributions/github_vishvananda_netlink_License.txt +# [BSD-2-Clause] +# ggc/core/LICENSE/attributions/github_godbus_dbus_License.txt +# ggc/core/LICENSE/attributions/github_huin_gobinarytest_License.txt +# ggc/core/LICENSE/attributions/github_seccomp_libseccomp_golang_License.txt +# ggc/core/LICENSE/attributions/github_syndtr_gocapability_License.txt +# [BSD-3-Clause] +# ggc/core/LICENSE/attributions/github_fsnotify_fsnotify_License.txt +# ggc/core/LICENSE/attributions/github_golang_protobuf_License.txt +# ggc/core/LICENSE/attributions/github_jeffallen_mqtt_License.txt +# ggc/core/LICENSE/attributions/Golang_License.txt +# [MIT] +# ggc/core/LICENSE/attributions/github_huin_mqtt_License.txt +# ggc/core/LICENSE/attributions/github_mattn_go_sqlite3_License.txt +# ggc/core/LICENSE/attributions/github_nu7hatch_gouuid_License.txt +# ggc/core/LICENSE/attributions/github_Sirupsen_logrus_License.txt +# ggc/core/LICENSE/attributions/github_urfave_cli_License.txt +# ggc/core/LICENSE/attributions/github_yosssi_gmq_License.txt +# [PD] +# ggc/core/LICENSE/attributions/sqlite_org_License.txt +# [Proprietary] +# ggc/core/LICENSE/Greengrass AWS SW License (IoT additiona) vr6.txt +# +LICENSE = "Apache-2.0 | BSD-2-Clause | BSD-3-Clause | MIT | PD | Proprietary" +LIC_FILES_CHKSUM = " \ + file://ggc/core/LICENSE/attributions/github_aws_aws_sdk_go_License.txt;md5=d273d63619c9aeaf15cdaf76422c4f87 \ + file://ggc/core/LICENSE/attributions/github_coreos_go_systemd_License.txt;md5=715f3348ed8b9bf4fac3b08133384a4d \ + file://ggc/core/LICENSE/attributions/github_docker_docker_License.txt;md5=bba4ee48af378e39b452d742d29c710b \ + file://ggc/core/LICENSE/attributions/github_docker_go_units_License.txt;md5=bb99db20f1c48c2c4952c27c72855e36 \ + file://ggc/core/LICENSE/attributions/github_fsnotify_fsnotify_License.txt;md5=c38914c9a7ab03bb2b96d4baaee10769 \ + file://ggc/core/LICENSE/attributions/github_godbus_dbus_License.txt;md5=b03a62440372a9acf9692ad365932c87 \ + file://ggc/core/LICENSE/attributions/github_go_ini_ini_License.txt;md5=715f3348ed8b9bf4fac3b08133384a4d \ + file://ggc/core/LICENSE/attributions/github_golang_protobuf_License.txt;md5=16fe162f7848190010b6ec7bfaac030a \ + file://ggc/core/LICENSE/attributions/github_huin_gobinarytest_License.txt;md5=f2b3138d9d314bccf5297dea7e3e6d14 \ + file://ggc/core/LICENSE/attributions/github_huin_mqtt_License.txt;md5=12fd125064676697934b7d8c09bed0e8 \ + file://ggc/core/LICENSE/attributions/github_jeffallen_mqtt_License.txt;md5=b7269d52765d477e10f319c19d8a9d33 \ + file://ggc/core/LICENSE/attributions/github_jmespath_go_jmespath_License.txt;md5=640d33f0070c9dc3a194d2ed7db02974 \ + file://ggc/core/LICENSE/attributions/github_mattn_go_sqlite3_License.txt;md5=948f36a2300ac729e60416063190f664 \ + file://ggc/core/LICENSE/attributions/github_nu7hatch_gouuid_License.txt;md5=6b18748dcc29fda05fa5aaef44d517fd \ + file://ggc/core/LICENSE/attributions/github_opencontainers_runc_License.txt;md5=587c01b2dcc5dc3b4bed51b918c64731 \ + file://ggc/core/LICENSE/attributions/github_opencontainers_runtime_spec_License.txt;md5=ef95ed297310c3d09ba16c06d5e161a5 \ + file://ggc/core/LICENSE/attributions/github_pquerna_ffjson_License.txt;md5=d273d63619c9aeaf15cdaf76422c4f87 \ + file://ggc/core/LICENSE/attributions/github_seccomp_libseccomp_golang_License.txt;md5=9205c4c469bfb9d3a63f346539ee445b \ + file://ggc/core/LICENSE/attributions/github_Sirupsen_logrus_License.txt;md5=29baae91637760ae68feb57ca93e5a0a \ + file://ggc/core/LICENSE/attributions/github_syndtr_gocapability_License.txt;md5=321f58fa53a0b1bb9a887f14660d436b \ + file://ggc/core/LICENSE/attributions/github_urfave_cli_License.txt;md5=f1f14a2449300559aed90bedc36a71ed \ + file://ggc/core/LICENSE/attributions/github_vishvananda_netlink_License.txt;md5=c95fd0efd62139c155e956a448df8fd6 \ + file://ggc/core/LICENSE/attributions/github_yosssi_gmq_License.txt;md5=2509f45544da1ecce869ce2de1aa44dd \ + file://ggc/core/LICENSE/attributions/Golang_License.txt;md5=3d7ed06383c65a3161b36c6a0b0b98f5 \ + file://ggc/core/LICENSE/attributions/sqlite_org_License.txt;md5=380e2694a297aa32879ca2ae9c6c029b \ +" + +# Bitbake does not support spaces in filenames, but GG License does have spaces, +# so workaround the problem by renaming the file before using it. +GG_LIC_FILENAME = "Greengrass AWS SW License (IoT additiona) vr6.txt" +GG_LIC_FILENAME_NOSPACES = "${@d.getVar('GG_LIC_FILENAME', True).replace(' ','_')}" +LIC_FILES_CHKSUM += "file://ggc/core/LICENSE/${GG_LIC_FILENAME_NOSPACES};md5=7df5bf535d02b2f83c260250fe330b6c" + +SRC_URI = " \ + http:///not/exist/greengrass-linux-armv7l-${PV}.tar.gz \ + file://greengrass-init \ + file://0001-greengrassd-remove-bashisms-in-launcher-shell-script.patch \ +" +SRC_URI[md5sum] = "6a13664c6a36e495e773f43ab92b8bdf" +SRC_URI[sha256sum] = "13c2637188eaf01049d875c99dc6929e8e206e4b4c98a4194a0cea827dca306d" + +GG_TARBALL_LOCAL_PATH ?= "" + +# The tarball is only available for downloading after registration, so provide +# a PREMIRROR to a local directory that can be configured in the project's +# local.conf file using GG_TARBALL_LOCAL_PATH variable. +python() { + gg_tarball_local_path = d.getVar('GG_TARBALL_LOCAL_PATH', True) + if gg_tarball_local_path: + premirrors = d.getVar('PREMIRRORS', True) + d.setVar('PREMIRRORS', "http:///not/exist/greengrass.* file://%s \\n %s" % (gg_tarball_local_path, premirrors)) +} + +S = "${WORKDIR}/${BPN}" + +inherit aws-iot update-rc.d useradd + +GG_USESYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'yes', 'no', d)}" + +# Rename GG license file +do_unpack[postfuncs] += "rename_license" +rename_license() { + cd ${S}/ggc/core/LICENSE/ + mv "${GG_LIC_FILENAME}" "${GG_LIC_FILENAME_NOSPACES}" +} + +# Disable tasks not needed for the binary package +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install() { + install -d ${D}/${BPN} + tar --no-same-owner --exclude='./patches' --exclude='./.pc' -cpf - -C ${S} . \ + | tar --no-same-owner -xpf - -C ${D}/${BPN} + + # Install wrapper bootscript to launch Greengrass core on boot + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/greengrass-init ${D}${sysconfdir}/init.d/greengrass + sed -i -e "s,##GG_INSTALL_DIR##,/${BPN},g" ${D}${sysconfdir}/init.d/greengrass + + # If certificates do exist, install them and update the config file + if [ -f "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_ROOT_CA}" ] && \ + [ -f "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_CERTIFICATE}" ] && \ + [ -f "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_PRIVATE_KEY}" ]; then + install -m 0644 "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_ROOT_CA}" \ + "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_CERTIFICATE}" \ + "${AWS_IOT_CERTS_DIR}/${AWS_GGCORE_PRIVATE_KEY}" \ + ${D}/${BPN}/certs/ + sed -i -e "s,\[ROOT_CA_PEM_HERE],${AWS_GGCORE_ROOT_CA},g" \ + -e "s,\[CLOUD_PEM_CRT_HERE],${AWS_GGCORE_CERTIFICATE},g" \ + -e "s,\[CLOUD_PEM_KEY_HERE],${AWS_GGCORE_PRIVATE_KEY},g" \ + ${D}/${BPN}/config/config.json + fi + + # Configure the rest of GG Core parameters + [ -n "${AWS_GGCORE_THING_ARN}" ] && sed -i -e "s,\[THING_ARN_HERE],${AWS_GGCORE_THING_ARN},g" ${D}/${BPN}/config/config.json + if [ -n "${AWS_GGCORE_IOT_HOST}" ]; then + AWS_GGCORE_HOST_PREFIX="$(echo ${AWS_GGCORE_IOT_HOST} | sed -e 's,\([^.]\+\)\.iot.*,\1,g')" + AWS_GGCORE_REGION="$(echo ${AWS_GGCORE_IOT_HOST} | sed -e 's,.*.iot\.\([^.]\+\)\..*,\1,g')" + [ -n "${AWS_GGCORE_HOST_PREFIX}" ] && sed -i -e "s,\[HOST_PREFIX_HERE],${AWS_GGCORE_HOST_PREFIX},g" ${D}/${BPN}/config/config.json + [ -n "${AWS_GGCORE_REGION}" ] && sed -i -e "s,\[AWS_REGION_HERE],${AWS_GGCORE_REGION},g" ${D}/${BPN}/config/config.json + fi + + # Configure whether to use systemd or not + sed -i -e "/useSystemd/{s,\[yes|no],${GG_USESYSTEMD},g}" ${D}/${BPN}/config/config.json +} + +pkg_postinst_${PN}() { + # Enable protection for hardlinks and symlinks + if ! grep -qs 'protected_.*links' $D${sysconfdir}/sysctl.conf; then + cat >> $D${sysconfdir}/sysctl.conf <<-_EOF_ + # Greengrass: protect hardlinks/symlinks + fs.protected_hardlinks = 1 + fs.protected_symlinks = 1 + _EOF_ + fi + + # Customize '/etc/fstab' + if [ -f "$D${sysconfdir}/fstab" ]; then + # Disable TMPFS /var/volatile + sed -i -e '\#^tmpfs[[:blank:]]\+/var/volatile#s,^,#,g' $D${sysconfdir}/fstab + + # Mount a cgroup hierarchy with all available subsystems + if ! grep -qs '^cgroup' $D${sysconfdir}/fstab; then + cat >> $D${sysconfdir}/fstab <<-_EOF_ + # Greengrass: mount cgroups + cgroup /sys/fs/cgroup cgroup defaults 0 0 + _EOF_ + fi + fi + + # Disable '/etc/resolv.conf' symlink + if [ -f "$D${sysconfdir}/default/volatiles/00_core" ]; then + sed -i -e '/resolv.conf/d' $D${sysconfdir}/default/volatiles/00_core + cat >> $D${sysconfdir}/default/volatiles/00_core <<-_EOF_ + # Greengrass: create a real (no symlink) resolv.conf + f root root 0644 /etc/resolv.conf none + _EOF_ + fi +} + +FILES_${PN} = "/${BPN} ${sysconfdir}" + +CONFFILES_${PN} += "/${BPN}/config/config.json" + +INITSCRIPT_NAME = "greengrass" +INITSCRIPT_PARAMS = "defaults 80 20" + +USERADD_PACKAGES = "${PN}" +GROUPADD_PARAM_${PN} = "-r ggc_group" +USERADD_PARAM_${PN} = "-r -M -N -g ggc_group -s /bin/false ggc_user" + +# +# Disable failing QA checks: +# +# Binary was already stripped +# No GNU_HASH in the elf binary +# +INSANE_SKIP_${PN} += "already-stripped ldflags" + +RDEPENDS_${PN} += "ca-certificates python-argparse python-json python-numbers sqlite3" diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez4/bluez-init b/meta-digi-dey/recipes-connectivity/bluez/bluez4/bluez-init index 88d87dc5f..e2c4b9815 100755 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez4/bluez-init +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez4/bluez-init @@ -25,9 +25,7 @@ SCRIPTNAME="$(basename "${0}")" MACHINENAME="$(cat /proc/device-tree/digi,machine,name 2>/dev/null)" bt_init() { - if [ "${MACHINENAME}" = "ccardimx28" ]; then - BT_PWR_GPIO_NR="21" - elif [ "${MACHINENAME}" = "ccimx6sbc" ]; then + if [ "${MACHINENAME}" = "ccimx6sbc" ]; then BT_PWR_GPIO_NR="244" fi diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0025-port-test-discovery-to-python3.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0003-port-test-discovery-to-python3.patch similarity index 100% rename from meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0025-port-test-discovery-to-python3.patch rename to meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0003-port-test-discovery-to-python3.patch diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0004-example-gatt-server-update-example-to-master-version.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0004-example-gatt-server-update-example-to-master-version.patch new file mode 100644 index 000000000..081a65dbc --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0004-example-gatt-server-update-example-to-master-version.patch @@ -0,0 +1,124 @@ +From: Isaac Hermida +Date: Wed, 27 Sep 2017 10:00:15 +0200 +Subject: [PATCH] example-gatt-server: update example to master version + +Current test example was not registering correctly the services, so the BLEGATT +server was not working properly. +Update this example to current version in master (commit ed63d7e5a9f6). + +Note: In order to run it, the bluetoothd daemon needs to be started with the +experimental (-E) flag and needs to enable and advertise the BLE +functionallity (btmgmt le on/connectable on/advertisement on). + +https://jira.digi.com/browse/DEL-5023 + +Signed-off-by: Isaac Hermida +--- + test/example-gatt-server | 28 +++++++++++++++++++++------- + 1 file changed, 21 insertions(+), 7 deletions(-) + +diff --git a/test/example-gatt-server b/test/example-gatt-server +index 84905f3d0856..24aaff973b11 100755 +--- a/test/example-gatt-server ++++ b/test/example-gatt-server +@@ -42,6 +42,9 @@ class FailedException(dbus.exceptions.DBusException): + + + class Application(dbus.service.Object): ++ """ ++ org.bluez.GattApplication1 interface implementation ++ """ + def __init__(self, bus): + self.path = '/' + self.services = [] +@@ -74,6 +77,9 @@ class Application(dbus.service.Object): + + + class Service(dbus.service.Object): ++ """ ++ org.bluez.GattService1 interface implementation ++ """ + PATH_BASE = '/org/bluez/example/service' + + def __init__(self, bus, index, uuid, primary): +@@ -121,6 +127,9 @@ class Service(dbus.service.Object): + + + class Characteristic(dbus.service.Object): ++ """ ++ org.bluez.GattCharacteristic1 interface implementation ++ """ + def __init__(self, bus, index, uuid, flags, service): + self.path = service.path + '/char' + str(index) + self.bus = bus +@@ -195,6 +204,9 @@ class Characteristic(dbus.service.Object): + + + class Descriptor(dbus.service.Object): ++ """ ++ org.bluez.GattDescriptor1 interface implementation ++ """ + def __init__(self, bus, index, uuid, flags, characteristic): + self.path = characteristic.path + '/desc' + str(index) + self.bus = bus +@@ -222,7 +234,7 @@ class Descriptor(dbus.service.Object): + if interface != GATT_DESC_IFACE: + raise InvalidArgsException() + +- return self.get_properties()[GATT_CHRC_IFACE] ++ return self.get_properties()[GATT_DESC_IFACE] + + @dbus.service.method(GATT_DESC_IFACE, + in_signature='a{sv}', +@@ -426,7 +438,7 @@ class TestService(Service): + TEST_SVC_UUID = '12345678-1234-5678-1234-56789abcdef0' + + def __init__(self, bus, index): +- Service.__init__(self, bus, index, self.TEST_SVC_UUID, False) ++ Service.__init__(self, bus, index, self.TEST_SVC_UUID, True) + self.add_characteristic(TestCharacteristic(bus, 0, self)) + self.add_characteristic(TestEncryptCharacteristic(bus, 1, self)) + self.add_characteristic(TestSecureCharacteristic(bus, 2, self)) +@@ -523,11 +535,11 @@ class TestEncryptCharacteristic(Characteristic): + CharacteristicUserDescriptionDescriptor(bus, 3, self)) + + def ReadValue(self, options): +- print('TestCharacteristic Read: ' + repr(self.value)) ++ print('TestEncryptCharacteristic Read: ' + repr(self.value)) + return self.value + + def WriteValue(self, value, options): +- print('TestCharacteristic Write: ' + repr(value)) ++ print('TestEncryptCharacteristic Write: ' + repr(value)) + self.value = value + + class TestEncryptDescriptor(Descriptor): +@@ -564,16 +576,16 @@ class TestSecureCharacteristic(Characteristic): + ['secure-read', 'secure-write'], + service) + self.value = [] +- self.add_descriptor(TestEncryptDescriptor(bus, 2, self)) ++ self.add_descriptor(TestSecureDescriptor(bus, 2, self)) + self.add_descriptor( + CharacteristicUserDescriptionDescriptor(bus, 3, self)) + + def ReadValue(self, options): +- print('TestCharacteristic Read: ' + repr(self.value)) ++ print('TestSecureCharacteristic Read: ' + repr(self.value)) + return self.value + + def WriteValue(self, value, options): +- print('TestCharacteristic Write: ' + repr(value)) ++ print('TestSecureCharacteristic Write: ' + repr(value)) + self.value = value + + +@@ -636,6 +648,8 @@ def main(): + + mainloop = GObject.MainLoop() + ++ print('Registering GATT application...') ++ + service_manager.RegisterApplication(app.get_path(), {}, + reply_handler=register_app_cb, + error_handler=register_app_error_cb) diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0005-core-Prefer-BR-EDR-over-LE-if-it-set-in-advertisemen.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0005-core-Prefer-BR-EDR-over-LE-if-it-set-in-advertisemen.patch new file mode 100644 index 000000000..310dd5a1b --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0005-core-Prefer-BR-EDR-over-LE-if-it-set-in-advertisemen.patch @@ -0,0 +1,47 @@ +From 2f78f64aee11dde478fd76f1e15bb1b977ba7099 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz +Date: Wed, 10 Aug 2016 16:23:56 +0300 +Subject: [PATCH 1/7] core: Prefer BR/EDR over LE if it set in advertisement + flag + +This makes the code prefer BR/EDR if the last advertisement has it set +in the flags. +--- + src/adapter.c | 5 ++++- + src/device.c | 6 +++++- + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/src/adapter.c b/src/adapter.c +index 37423985dfb4..ddabf2de5462 100644 +--- a/src/adapter.c ++++ b/src/adapter.c +@@ -5488,8 +5488,11 @@ static void update_found_devices(struct btd_adapter *adapter, + * supports this we can make the non-zero check conditional. + */ + if (bdaddr_type != BDADDR_BREDR && eir_data.flags && +- !(eir_data.flags & EIR_BREDR_UNSUP)) ++ !(eir_data.flags & EIR_BREDR_UNSUP)) { + device_set_bredr_support(dev); ++ /* Update last seen for BR/EDR in case its flag is set */ ++ device_update_last_seen(dev, BDADDR_BREDR); ++ } + + if (eir_data.name != NULL && eir_data.name_complete) + device_store_cached_name(dev, eir_data.name); +diff --git a/src/device.c b/src/device.c +index 82704f8bb343..7f40af44cd01 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -1763,7 +1763,11 @@ static uint8_t select_conn_bearer(struct btd_device *dev) + if (dev->le && (!dev->bredr || bredr_last == NVAL_TIME)) + return dev->bdaddr_type; + +- if (bredr_last < le_last) ++ /* ++ * Prefer BR/EDR if time is the same since it might be from an ++ * advertisement with BR/EDR flag set. ++ */ ++ if (bredr_last <= le_last) + return BDADDR_BREDR; + + return dev->bdaddr_type; diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0006-core-device-Fix-not-connecting-services-properly.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0006-core-device-Fix-not-connecting-services-properly.patch new file mode 100644 index 000000000..11fa4e12f --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0006-core-device-Fix-not-connecting-services-properly.patch @@ -0,0 +1,38 @@ +From 727cf85d5c710193df9b386b2a87afccbbc766ff Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz +Date: Fri, 12 Aug 2016 11:20:10 +0300 +Subject: [PATCH 2/7] core/device: Fix not connecting services properly + +Device.Connect shall check if the service discovery is pending or no +service have been connected yet before switching to LE otherwise these +services may never be connected. +--- + src/device.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/src/device.c b/src/device.c +index 7f40af44cd01..460a9980fc63 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -1779,9 +1779,18 @@ static DBusMessage *dev_connect(DBusConnection *conn, DBusMessage *msg, + struct btd_device *dev = user_data; + uint8_t bdaddr_type; + +- if (dev->bredr_state.connected) +- bdaddr_type = dev->bdaddr_type; +- else if (dev->le_state.connected && dev->bredr) ++ if (dev->bredr_state.connected) { ++ /* ++ * Check if services have been resolved and there is at list ++ * one connected before switching to connect LE. ++ */ ++ if (dev->bredr_state.svc_resolved && ++ find_service_with_state(dev->services, ++ BTD_SERVICE_STATE_CONNECTED)) ++ bdaddr_type = dev->bdaddr_type; ++ else ++ bdaddr_type = BDADDR_BREDR; ++ } else if (dev->le_state.connected && dev->bredr) + bdaddr_type = BDADDR_BREDR; + else + bdaddr_type = select_conn_bearer(dev); diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0007-core-device-Fix-marking-auto-connect-flag.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0007-core-device-Fix-marking-auto-connect-flag.patch new file mode 100644 index 000000000..39278978b --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0007-core-device-Fix-marking-auto-connect-flag.patch @@ -0,0 +1,29 @@ +From 7e6b4a0de4580af0cefa8b3d45677f2f9f103f65 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz +Date: Mon, 22 Aug 2016 13:04:15 +0300 +Subject: [PATCH 3/7] core/device: Fix marking auto-connect flag + +Device auto-connect shall be set only if the profile is able to accept +incoming connections, this fixes the wrong behavior or connecting LE +with dual mode devices immediatelly after probing service as profiles +may have auto-connect flag for outgoing connection (usually BR/EDR only). +--- + src/device.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/device.c b/src/device.c +index 460a9980fc63..0b13a3190539 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -4084,7 +4084,10 @@ static struct btd_service *probe_service(struct btd_device *device, + return NULL; + } + +- if (profile->auto_connect) ++ /* Only set auto connect if profile has set the flag and can really ++ * accept connections. ++ */ ++ if (profile->auto_connect && profile->accept) + device_set_auto_connect(device, TRUE); + + return service; diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0008-core-device-Prefer-bonded-bearers-when-connecting.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0008-core-device-Prefer-bonded-bearers-when-connecting.patch new file mode 100644 index 000000000..bf111f2f2 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0008-core-device-Prefer-bonded-bearers-when-connecting.patch @@ -0,0 +1,30 @@ +From 3a908f611b0ea84e3388215ae800d9bec05b10b6 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz +Date: Tue, 23 Aug 2016 12:58:03 +0300 +Subject: [PATCH 4/7] core/device: Prefer bonded bearers when connecting + +When attempting to connect a dual-mode device prefer bonded bearer if +only one has been marked as bonded. This prevents connecting to a +different bearer after pairing is complete and cross transport pairing +is not supported. +--- + src/device.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/device.c b/src/device.c +index 0b13a3190539..ade74e58a3bf 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -1742,6 +1742,12 @@ static uint8_t select_conn_bearer(struct btd_device *dev) + time_t bredr_last = NVAL_TIME, le_last = NVAL_TIME; + time_t current = time(NULL); + ++ /* Prefer bonded bearer in case only one is bonded */ ++ if (dev->bredr_state.bonded && !dev->le_state.bonded ) ++ return BDADDR_BREDR; ++ else if (!dev->bredr_state.bonded && dev->le_state.bonded) ++ return dev->bdaddr_type; ++ + if (dev->bredr_seen) { + bredr_last = current - dev->bredr_seen; + if (bredr_last > SEEN_TRESHHOLD) diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0009-input-hog-Use-.accept-and-.disconnect-instead-of-att.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0009-input-hog-Use-.accept-and-.disconnect-instead-of-att.patch new file mode 100644 index 000000000..168932afc --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0009-input-hog-Use-.accept-and-.disconnect-instead-of-att.patch @@ -0,0 +1,137 @@ +From ddaa8ad58cd798c218ed9cc2c798cdaac6ed4924 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz +Date: Mon, 26 Sep 2016 16:44:03 +0300 +Subject: [PATCH 5/7] input/hog: Use .accept and .disconnect instead of attio + +This adds .accept and .disconnect callbacks instead of attio which +is deprecated. +--- + profiles/input/hog.c | 56 ++++++++++++++++++++++++++-------------------------- + src/device.c | 8 ++++++++ + src/device.h | 1 + + 3 files changed, 37 insertions(+), 28 deletions(-) + +diff --git a/profiles/input/hog.c b/profiles/input/hog.c +index a934c6238525..b25437917188 100644 +--- a/profiles/input/hog.c ++++ b/profiles/input/hog.c +@@ -69,24 +69,6 @@ struct hog_device { + static gboolean suspend_supported = FALSE; + static struct queue *devices = NULL; + +-static void attio_connected_cb(GAttrib *attrib, gpointer user_data) +-{ +- struct hog_device *dev = user_data; +- +- DBG("HoG connected"); +- +- bt_hog_attach(dev->hog, attrib); +-} +- +-static void attio_disconnected_cb(gpointer user_data) +-{ +- struct hog_device *dev = user_data; +- +- DBG("HoG disconnected"); +- +- bt_hog_detach(dev->hog); +-} +- + static struct hog_device *hog_device_new(struct btd_device *device, + struct gatt_primary *prim) + { +@@ -115,15 +97,6 @@ static struct hog_device *hog_device_new(struct btd_device *device, + + dev->device = btd_device_ref(device); + +- /* +- * TODO: Remove attio callback and use .accept once using +- * bt_gatt_client. +- */ +- dev->attioid = btd_device_add_attio_callback(device, +- attio_connected_cb, +- attio_disconnected_cb, +- dev); +- + if (!devices) + devices = queue_new(); + +@@ -142,7 +115,6 @@ static void hog_device_free(void *data) + devices = NULL; + } + +- btd_device_remove_attio_callback(dev->device, dev->attioid); + btd_device_unref(dev->device); + bt_hog_unref(dev->hog); + free(dev); +@@ -215,11 +187,39 @@ static void hog_remove(struct btd_service *service) + hog_device_free(dev); + } + ++static int hog_accept(struct btd_service *service) ++{ ++ struct hog_device *dev = btd_service_get_user_data(service); ++ struct btd_device *device = btd_service_get_device(service); ++ GAttrib *attrib = btd_device_get_attrib(device); ++ ++ /* TODO: Replace GAttrib with bt_gatt_client */ ++ bt_hog_attach(dev->hog, attrib); ++ ++ btd_service_connecting_complete(service, 0); ++ ++ return 0; ++} ++ ++static int hog_disconnect(struct btd_service *service) ++{ ++ struct hog_device *dev = btd_service_get_user_data(service); ++ ++ bt_hog_detach(dev->hog); ++ ++ btd_service_disconnecting_complete(service, 0); ++ ++ return 0; ++} ++ + static struct btd_profile hog_profile = { + .name = "input-hog", + .remote_uuid = HOG_UUID, + .device_probe = hog_probe, + .device_remove = hog_remove, ++ .accept = hog_accept, ++ .disconnect = hog_disconnect, ++ .auto_connect = true, + }; + + static int hog_init(void) +diff --git a/src/device.c b/src/device.c +index ade74e58a3bf..2a77a2e67232 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -5921,6 +5921,14 @@ struct bt_gatt_client *btd_device_get_gatt_client(struct btd_device *device) + return device->client; + } + ++void *btd_device_get_attrib(struct btd_device *device) ++{ ++ if (!device) ++ return NULL; ++ ++ return device->attrib; ++} ++ + struct bt_gatt_server *btd_device_get_gatt_server(struct btd_device *device) + { + if (!device) +diff --git a/src/device.h b/src/device.h +index db108278a12e..387f598fb2e5 100644 +--- a/src/device.h ++++ b/src/device.h +@@ -70,6 +70,7 @@ GSList *btd_device_get_primaries(struct btd_device *device); + struct gatt_db *btd_device_get_gatt_db(struct btd_device *device); + struct bt_gatt_client *btd_device_get_gatt_client(struct btd_device *device); + struct bt_gatt_server *btd_device_get_gatt_server(struct btd_device *device); ++void *btd_device_get_attrib(struct btd_device *device); + void btd_device_gatt_set_service_changed(struct btd_device *device, + uint16_t start, uint16_t end); + bool device_attach_att(struct btd_device *dev, GIOChannel *io); diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0010-src-device-Free-bonding-while-failed-to-pair-device.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0010-src-device-Free-bonding-while-failed-to-pair-device.patch new file mode 100644 index 000000000..3e11556d4 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0010-src-device-Free-bonding-while-failed-to-pair-device.patch @@ -0,0 +1,99 @@ +From c0202538bc31e25f37fc45681d07873c8a127ecb Mon Sep 17 00:00:00 2001 +From: Jiangbo Wu +Date: Sun, 2 Oct 2016 20:38:31 +0800 +Subject: [PATCH 6/7] src/device: Free bonding while failed to pair device + +device unable pair since another pairng is in progress, and need to +free bonding before it created for next pairing. +--- + src/device.c | 62 +++++++++++++++++++++++++++++++----------------------------- + 1 file changed, 32 insertions(+), 30 deletions(-) + +diff --git a/src/device.c b/src/device.c +index 2a77a2e67232..97d7c4e899f6 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -2330,6 +2330,35 @@ static void create_bond_req_exit(DBusConnection *conn, void *user_data) + } + } + ++static void bonding_request_free(struct bonding_req *bonding) ++{ ++ if (!bonding) ++ return; ++ ++ if (bonding->listener_id) ++ g_dbus_remove_watch(dbus_conn, bonding->listener_id); ++ ++ if (bonding->msg) ++ dbus_message_unref(bonding->msg); ++ ++ if (bonding->cb_iter) ++ g_free(bonding->cb_iter); ++ ++ if (bonding->agent) { ++ agent_cancel(bonding->agent); ++ agent_unref(bonding->agent); ++ bonding->agent = NULL; ++ } ++ ++ if (bonding->retry_timer) ++ g_source_remove(bonding->retry_timer); ++ ++ if (bonding->device) ++ bonding->device->bonding = NULL; ++ ++ g_free(bonding); ++} ++ + static DBusMessage *pair_device(DBusConnection *conn, DBusMessage *msg, + void *data) + { +@@ -2400,8 +2429,10 @@ static DBusMessage *pair_device(DBusConnection *conn, DBusMessage *msg, + BDADDR_BREDR, io_cap); + } + +- if (err < 0) ++ if (err < 0) { ++ bonding_request_free(device->bonding); + return btd_error_failed(msg, strerror(-err)); ++ } + + return NULL; + } +@@ -2442,35 +2473,6 @@ static DBusMessage *new_authentication_return(DBusMessage *msg, uint8_t status) + } + } + +-static void bonding_request_free(struct bonding_req *bonding) +-{ +- if (!bonding) +- return; +- +- if (bonding->listener_id) +- g_dbus_remove_watch(dbus_conn, bonding->listener_id); +- +- if (bonding->msg) +- dbus_message_unref(bonding->msg); +- +- if (bonding->cb_iter) +- g_free(bonding->cb_iter); +- +- if (bonding->agent) { +- agent_cancel(bonding->agent); +- agent_unref(bonding->agent); +- bonding->agent = NULL; +- } +- +- if (bonding->retry_timer) +- g_source_remove(bonding->retry_timer); +- +- if (bonding->device) +- bonding->device->bonding = NULL; +- +- g_free(bonding); +-} +- + static void device_cancel_bonding(struct btd_device *device, uint8_t status) + { + struct bonding_req *bonding = device->bonding; diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0011-core-Fix-BR-EDR-pairing-for-dual-mode-devices.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0011-core-Fix-BR-EDR-pairing-for-dual-mode-devices.patch new file mode 100644 index 000000000..f667587a9 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0011-core-Fix-BR-EDR-pairing-for-dual-mode-devices.patch @@ -0,0 +1,189 @@ +From 4fbef59d01931111c3181194ec4d38cbcb4da45a Mon Sep 17 00:00:00 2001 +From: Szymon Janc +Date: Fri, 21 Oct 2016 21:41:18 +0200 +Subject: [PATCH 7/7] core: Fix BR/EDR pairing for dual mode devices + +For dual mode devices we need to pass address type used in pairing +events to reply with correct one on agent reply. Otherwise reply for +BR/EDR pairing of dual mode device would use address type (which is +valid only for LE address) resulting in reply being ignored by kernel +and eventually pairing timeout. +--- + src/adapter.c | 7 ++++--- + src/device.c | 31 +++++++++++++++++-------------- + src/device.h | 10 +++++----- + 3 files changed, 26 insertions(+), 22 deletions(-) + +diff --git a/src/adapter.c b/src/adapter.c +index ddabf2de5462..5ebe3d7c8eec 100644 +--- a/src/adapter.c ++++ b/src/adapter.c +@@ -6180,7 +6180,7 @@ static void user_confirm_request_callback(uint16_t index, uint16_t length, + return; + } + +- err = device_confirm_passkey(device, btohl(ev->value), ++ err = device_confirm_passkey(device, ev->addr.type, btohl(ev->value), + ev->confirm_hint); + if (err < 0) { + btd_error(adapter->dev_id, +@@ -6254,7 +6254,7 @@ static void user_passkey_request_callback(uint16_t index, uint16_t length, + return; + } + +- err = device_request_passkey(device); ++ err = device_request_passkey(device, ev->addr.type); + if (err < 0) { + btd_error(adapter->dev_id, + "device_request_passkey: %s", strerror(-err)); +@@ -6293,7 +6293,8 @@ static void user_passkey_notify_callback(uint16_t index, uint16_t length, + + DBG("passkey %06u entered %u", passkey, ev->entered); + +- err = device_notify_passkey(device, passkey, ev->entered); ++ err = device_notify_passkey(device, ev->addr.type, passkey, ++ ev->entered); + if (err < 0) + btd_error(adapter->dev_id, + "device_notify_passkey: %s", strerror(-err)); +diff --git a/src/device.c b/src/device.c +index 97d7c4e899f6..d6be3fcf82c2 100644 +--- a/src/device.c ++++ b/src/device.c +@@ -127,6 +127,7 @@ struct authentication_req { + auth_type_t type; + struct agent *agent; + struct btd_device *device; ++ uint8_t addr_type; + uint32_t passkey; + char *pincode; + gboolean secure; +@@ -5644,7 +5645,7 @@ static void confirm_cb(struct agent *agent, DBusError *err, void *data) + return; + + btd_adapter_confirm_reply(device->adapter, &device->bdaddr, +- device->bdaddr_type, ++ auth->addr_type, + err ? FALSE : TRUE); + + agent_unref(device->authr->agent); +@@ -5665,7 +5666,7 @@ static void passkey_cb(struct agent *agent, DBusError *err, + passkey = INVALID_PASSKEY; + + btd_adapter_passkey_reply(device->adapter, &device->bdaddr, +- device->bdaddr_type, passkey); ++ auth->addr_type, passkey); + + agent_unref(device->authr->agent); + device->authr->agent = NULL; +@@ -5683,7 +5684,9 @@ static void display_pincode_cb(struct agent *agent, DBusError *err, void *data) + } + + static struct authentication_req *new_auth(struct btd_device *device, +- auth_type_t type, gboolean secure) ++ uint8_t addr_type, ++ auth_type_t type, ++ gboolean secure) + { + struct authentication_req *auth; + struct agent *agent; +@@ -5711,6 +5714,7 @@ static struct authentication_req *new_auth(struct btd_device *device, + auth->agent = agent; + auth->device = device; + auth->type = type; ++ auth->addr_type = addr_type; + auth->secure = secure; + device->authr = auth; + +@@ -5722,7 +5726,7 @@ int device_request_pincode(struct btd_device *device, gboolean secure) + struct authentication_req *auth; + int err; + +- auth = new_auth(device, AUTH_TYPE_PINCODE, secure); ++ auth = new_auth(device, BDADDR_BREDR, AUTH_TYPE_PINCODE, secure); + if (!auth) + return -EPERM; + +@@ -5736,12 +5740,12 @@ int device_request_pincode(struct btd_device *device, gboolean secure) + return err; + } + +-int device_request_passkey(struct btd_device *device) ++int device_request_passkey(struct btd_device *device, uint8_t type) + { + struct authentication_req *auth; + int err; + +- auth = new_auth(device, AUTH_TYPE_PASSKEY, FALSE); ++ auth = new_auth(device, type, AUTH_TYPE_PASSKEY, FALSE); + if (!auth) + return -EPERM; + +@@ -5755,14 +5759,13 @@ int device_request_passkey(struct btd_device *device) + return err; + } + +-int device_confirm_passkey(struct btd_device *device, uint32_t passkey, +- uint8_t confirm_hint) +- ++int device_confirm_passkey(struct btd_device *device, uint8_t type, ++ int32_t passkey, uint8_t confirm_hint) + { + struct authentication_req *auth; + int err; + +- auth = new_auth(device, AUTH_TYPE_CONFIRM, FALSE); ++ auth = new_auth(device, type, AUTH_TYPE_CONFIRM, FALSE); + if (!auth) + return -EPERM; + +@@ -5783,8 +5786,8 @@ int device_confirm_passkey(struct btd_device *device, uint32_t passkey, + return err; + } + +-int device_notify_passkey(struct btd_device *device, uint32_t passkey, +- uint8_t entered) ++int device_notify_passkey(struct btd_device *device, uint8_t type, ++ uint32_t passkey, uint8_t entered) + { + struct authentication_req *auth; + int err; +@@ -5794,7 +5797,7 @@ int device_notify_passkey(struct btd_device *device, uint32_t passkey, + if (auth->type != AUTH_TYPE_NOTIFY_PASSKEY) + return -EPERM; + } else { +- auth = new_auth(device, AUTH_TYPE_NOTIFY_PASSKEY, FALSE); ++ auth = new_auth(device, type, AUTH_TYPE_NOTIFY_PASSKEY, FALSE); + if (!auth) + return -EPERM; + } +@@ -5814,7 +5817,7 @@ int device_notify_pincode(struct btd_device *device, gboolean secure, + struct authentication_req *auth; + int err; + +- auth = new_auth(device, AUTH_TYPE_NOTIFY_PINCODE, secure); ++ auth = new_auth(device, BDADDR_BREDR, AUTH_TYPE_NOTIFY_PINCODE, secure); + if (!auth) + return -EPERM; + +diff --git a/src/device.h b/src/device.h +index 387f598fb2e5..dd7c4f300be1 100644 +--- a/src/device.h ++++ b/src/device.h +@@ -110,11 +110,11 @@ int device_bonding_attempt_retry(struct btd_device *device); + long device_bonding_last_duration(struct btd_device *device); + void device_bonding_restart_timer(struct btd_device *device); + int device_request_pincode(struct btd_device *device, gboolean secure); +-int device_request_passkey(struct btd_device *device); +-int device_confirm_passkey(struct btd_device *device, uint32_t passkey, +- uint8_t confirm_hint); +-int device_notify_passkey(struct btd_device *device, uint32_t passkey, +- uint8_t entered); ++int device_request_passkey(struct btd_device *device, uint8_t type); ++int device_confirm_passkey(struct btd_device *device, uint8_t type, ++ int32_t passkey, uint8_t confirm_hint); ++int device_notify_passkey(struct btd_device *device, uint8_t type, ++ uint32_t passkey, uint8_t entered); + int device_notify_pincode(struct btd_device *device, gboolean secure, + const char *pincode); + void device_cancel_authentication(struct btd_device *device, gboolean aborted); diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0012-QCA_bluetooth_chip_support.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0012-QCA_bluetooth_chip_support.patch new file mode 100644 index 000000000..1f6e178c4 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0012-QCA_bluetooth_chip_support.patch @@ -0,0 +1,4190 @@ +Add hciattach rome support for Qualcomm chip QCA6564 + +This is a multiple patch including all the specific qualcomm commits to add +support for its chip in bluez stack (hciattach rome). + +Signed-off-by: Isaac Hermida + +From e6d2fb7efcde66f9ab22a42bd6d7039a4f0c02cd Mon Sep 17 00:00:00 2001 +From: Anantha Krishnan +Date: Tue, 19 Aug 2014 20:23:01 +0530 +Subject: [PATCH 01/19] bluetooth : Add bluetooth support for QCA6174 chip. + +Register the QCA6174 initialization routine with hciattach for +downloading firmware patches to the bluetooth controller. +Add optional support 'f' to control installation of line +discipline driver. Invoke hciattach from command line and +download the firmware patches: + hciattach /dev/ttyHS0 qca 3000000 -t120 flow -f0 + +Change-Id: I87f2927d7096904071a02d73d3afef0dc34db414 +Signed-off-by: Rupesh Tatiya +--- + Makefile.tools | 3 +- + tools/hciattach.c | 25 +- + tools/hciattach.h | 8 +- + tools/hciattach_rome.c | 1578 ++++++++++++++++++++++++++++++++++++++++++++++++ + tools/hciattach_rome.h | 317 ++++++++++ + 5 files changed, 1926 insertions(+), 5 deletions(-) + create mode 100644 tools/hciattach_rome.c + create mode 100644 tools/hciattach_rome.h + +diff --git a/Makefile.tools b/Makefile.tools +index 0d5f1431e013..8f087c597490 100644 +--- a/Makefile.tools ++++ b/Makefile.tools +@@ -164,7 +164,8 @@ tools_hciattach_SOURCES = tools/hciattach.c tools/hciattach.h \ + tools/hciattach_ath3k.c \ + tools/hciattach_qualcomm.c \ + tools/hciattach_intel.c \ +- tools/hciattach_bcm43xx.c ++ tools/hciattach_bcm43xx.c \ ++ tools/hciattach_rome.c tools/hciattach_rome.h + tools_hciattach_LDADD = lib/libbluetooth-internal.la + + tools_hciconfig_SOURCES = tools/hciconfig.c tools/csr.h tools/csr.c +diff --git a/tools/hciattach.c b/tools/hciattach.c +index fad176c9b804..73811d4c4c2a 100644 +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -69,6 +69,8 @@ struct uart_t { + #define ENABLE_PM 1 + #define DISABLE_PM 0 + ++int line_disp = 1; ++ + static volatile sig_atomic_t __io_canceled = 0; + + static void sig_hup(int sig) +@@ -263,6 +265,12 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti) + return ath3k_post(fd, u->pm); + } + ++static int qca(int fd, struct uart_t *u, struct termios *ti) ++{ ++ fprintf(stderr,"qca\n"); ++ return qca_soc_init(fd, u->bdaddr); ++} ++ + static int qualcomm(int fd, struct uart_t *u, struct termios *ti) + { + return qualcomm_init(fd, u->speed, ti, u->bdaddr); +@@ -1093,6 +1101,10 @@ struct uart_t uart[] = { + { "ath3k", 0x0000, 0x0000, HCI_UART_ATH3K, 115200, 115200, + FLOW_CTL, DISABLE_PM, NULL, ath3k_ps, ath3k_pm }, + ++ /* QCA ROME */ ++ { "qca", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, ++ FLOW_CTL, DISABLE_PM, NULL, qca, NULL }, ++ + /* QUALCOMM BTS */ + { "qualcomm", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, + FLOW_CTL, DISABLE_PM, NULL, qualcomm, NULL }, +@@ -1195,6 +1207,7 @@ static int init_uart(char *dev, struct uart_t *u, int send_break, int raw) + goto fail; + } + ++if (line_disp) { + /* Set TTY to N_HCI line discipline */ + i = N_HCI; + if (ioctl(fd, TIOCSETD, &i) < 0) { +@@ -1211,6 +1224,7 @@ static int init_uart(char *dev, struct uart_t *u, int send_break, int raw) + perror("Can't set device"); + goto fail; + } ++} + + if (u->post && u->post(fd, u, &ti) < 0) + goto fail; +@@ -1249,7 +1263,7 @@ int main(int argc, char *argv[]) + printpid = 0; + raw = 0; + +- while ((opt=getopt(argc, argv, "bnpt:s:lr")) != EOF) { ++ while ((opt=getopt(argc, argv, "bnpt:s:lrf:")) != EOF) { + switch(opt) { + case 'b': + send_break = 1; +@@ -1282,6 +1296,11 @@ int main(int argc, char *argv[]) + raw = 1; + break; + ++ case 'f': ++ line_disp = atoi(optarg); ++ fprintf(stderr, "Line_disp val : %d\n", line_disp); ++ break; ++ + default: + usage(); + exit(1); +@@ -1350,6 +1369,7 @@ int main(int argc, char *argv[]) + case 5: + u->bdaddr = argv[optind]; + break; ++ + } + } + +@@ -1426,12 +1446,15 @@ int main(int argc, char *argv[]) + break; + } + ++if (line_disp) { + /* Restore TTY line discipline */ ++ fprintf(stderr, "Restoring the Line Discipline driver\n"); + ld = N_TTY; + if (ioctl(n, TIOCSETD, &ld) < 0) { + perror("Can't restore line discipline"); + exit(1); + } ++} + + return 0; + } +diff --git a/tools/hciattach.h b/tools/hciattach.h +index 4279a3361749..0656a845223c 100644 +--- a/tools/hciattach.h ++++ b/tools/hciattach.h +@@ -39,9 +39,10 @@ + #define HCI_UART_H4DS 3 + #define HCI_UART_LL 4 + #define HCI_UART_ATH3K 5 +-#define HCI_UART_INTEL 6 +-#define HCI_UART_BCM 7 +-#define HCI_UART_QCA 8 ++#define HCI_UART_IBS 6 ++#define HCI_UART_INTEL 7 ++#define HCI_UART_BCM 8 ++#define HCI_UART_QCA 9 + + #define HCI_UART_RAW_DEVICE 0 + #define HCI_UART_RESET_ON_INIT 1 +@@ -63,6 +64,7 @@ int ath3k_init(int fd, int speed, int init_speed, char *bdaddr, + struct termios *ti); + int ath3k_post(int fd, int pm); + int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr); ++int qca_soc_init(int fd, char *bdaddr); + int intel_init(int fd, int init_speed, int *speed, struct termios *ti); + int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti, + const char *bdaddr); +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +new file mode 100644 +index 000000000000..f31be43c09e4 +--- /dev/null ++++ b/tools/hciattach_rome.c +@@ -0,0 +1,1578 @@ ++/* ++ * ++ * Copyright (c) 2013, The Linux Foundation. All rights reserved. ++ * Not a Contribution. ++ * ++ * Copyright 2012 The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); you ++ * may not use this file except in compliance with the License. You may ++ * obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ++ * implied. See the License for the specific language governing ++ * permissions and limitations under the License. ++ * ++ */ ++ ++/****************************************************************************** ++ * ++ * Filename: hciattach_rome.c ++ * ++ * Description: Contains controller-specific functions, like ++ * firmware patch download ++ * low power mode operations ++ * ++ ******************************************************************************/ ++ ++#define LOG_TAG "bt_vendor" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "hciattach_rome.h" ++#include "hciattach.h" ++ ++#ifdef __cplusplus ++} ++#endif ++ ++ ++/****************************************************************************** ++** Variables ++******************************************************************************/ ++FILE *file; ++unsigned char *phdr_buffer; ++unsigned char *pdata_buffer = NULL; ++patch_info rampatch_patch_info; ++int rome_ver = ROME_VER_UNKNOWN; ++unsigned char gTlv_type; ++char *rampatch_file_path; ++char *nvm_file_path; ++vnd_userial_cb_t vnd_userial; ++/****************************************************************************** ++** Extern variables ++******************************************************************************/ ++//extern unsigned char vnd_local_bd_addr[6]; ++ ++/***************************************************************************** ++** Functions ++*****************************************************************************/ ++ ++/******************************************************************************* ++** ++** Function userial_to_tcio_baud ++** ++** Description helper function converts USERIAL baud rates into TCIO ++** conforming baud rates ++** ++** Returns TRUE/FALSE ++** ++*******************************************************************************/ ++unsigned char userial_to_tcio_baud(unsigned char cfg_baud, unsigned int *baud) ++{ ++ if (cfg_baud == USERIAL_BAUD_115200) ++ *baud = B115200; ++ else if (cfg_baud == USERIAL_BAUD_4M) ++ *baud = B4000000; ++ else if (cfg_baud == USERIAL_BAUD_3M) ++ *baud = B3000000; ++ else if (cfg_baud == USERIAL_BAUD_2M) ++ *baud = B2000000; ++ else if (cfg_baud == USERIAL_BAUD_1M) ++ *baud = B1000000; ++ else if (cfg_baud == USERIAL_BAUD_921600) ++ *baud = B921600; ++ else if (cfg_baud == USERIAL_BAUD_460800) ++ *baud = B460800; ++ else if (cfg_baud == USERIAL_BAUD_230400) ++ *baud = B230400; ++ else if (cfg_baud == USERIAL_BAUD_57600) ++ *baud = B57600; ++ else if (cfg_baud == USERIAL_BAUD_19200) ++ *baud = B19200; ++ else if (cfg_baud == USERIAL_BAUD_9600) ++ *baud = B9600; ++ else if (cfg_baud == USERIAL_BAUD_1200) ++ *baud = B1200; ++ else if (cfg_baud == USERIAL_BAUD_600) ++ *baud = B600; ++ else ++ { ++ fprintf(stderr, "userial vendor open: unsupported baud idx %i\n", cfg_baud); ++ *baud = B115200; ++ return FALSE; ++ } ++ ++ return TRUE; ++} ++ ++ ++/******************************************************************************* ++** ++** Function userial_vendor_set_baud ++** ++** Description Set new baud rate ++** ++** Returns None ++** ++*******************************************************************************/ ++void userial_vendor_set_baud(unsigned char userial_baud) ++{ ++ unsigned int tcio_baud; ++ fprintf(stderr, "## userial_vendor_set_baud: %d\n", userial_baud); ++ ++ userial_to_tcio_baud(userial_baud, &tcio_baud); ++ ++ cfsetospeed(&vnd_userial.termios, tcio_baud); ++ cfsetispeed(&vnd_userial.termios, tcio_baud); ++ tcsetattr(vnd_userial.fd, TCSADRAIN, &vnd_userial.termios); /* don't change speed until last write done */ ++ ++} ++ ++ ++/******************************************************************************* ++** ++** Function userial_vendor_ioctl ++** ++** Description ioctl inteface ++** ++** Returns None ++** ++*******************************************************************************/ ++int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data) ++{ ++ int err = -1; ++ struct termios ti; ++ ++ if (tcgetattr(fd, &ti) < 0) { ++ perror("Can't get port settings"); ++ return -1; ++ } ++ cfmakeraw(&ti); ++ ti.c_cflag |= CLOCAL; ++ ++ switch(op) ++ { ++#if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) ++ case USERIAL_OP_ASSERT_BT_WAKE: ++ VNDUSERIALDBG("## userial_vendor_ioctl: Asserting BT_Wake ##"); ++ err = ioctl(fd, USERIAL_IOCTL_BT_WAKE_ASSERT, NULL); ++ break; ++ ++ case USERIAL_OP_DEASSERT_BT_WAKE: ++ VNDUSERIALDBG("## userial_vendor_ioctl: De-asserting BT_Wake ##"); ++ err = ioctl(fd, USERIAL_IOCTL_BT_WAKE_DEASSERT, NULL); ++ break; ++ ++ case USERIAL_OP_GET_BT_WAKE_STATE: ++ err = ioctl(fd, USERIAL_IOCTL_BT_WAKE_GET_ST, p_data); ++ break; ++#endif // (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) ++ case USERIAL_OP_FLOW_ON: ++ fprintf(stderr, "## userial_vendor_ioctl: UART Flow On\n "); ++ ti.c_cflag |= CRTSCTS; ++ ++ if (err = tcsetattr(fd, TCSANOW, &ti) < 0) { ++ perror("Can't set port settings"); ++ return -1; ++ } ++ ++ break; ++ ++ case USERIAL_OP_FLOW_OFF: ++ fprintf(stderr, "## userial_vendor_ioctl: UART Flow Off\n "); ++ ti.c_cflag &= ~CRTSCTS; ++ if (err = tcsetattr(fd, TCSANOW, &ti) < 0) { ++ fprintf(stderr, "Can't set port settings"); ++ return -1; ++ } ++ break; ++ ++ default: ++ break; ++ } ++ ++ return err; ++} ++ ++ ++int get_vs_hci_event(unsigned char *rsp) ++{ ++ int err = 0, soc_id =0; ++ unsigned char paramlen = 0; ++ ++ if( (rsp[EVENTCODE_OFFSET] == VSEVENT_CODE) || (rsp[EVENTCODE_OFFSET] == EVT_CMD_COMPLETE)) ++ fprintf(stderr, "%s: Received HCI-Vendor Specific event\n", __FUNCTION__); ++ else { ++ fprintf(stderr, "%s: Failed to receive HCI-Vendor Specific event\n", __FUNCTION__); ++ err = -EIO; ++ goto failed; ++ } ++ ++ fprintf(stderr, "%s: Parameter Length: 0x%x\n", __FUNCTION__, paramlen = rsp[EVT_PLEN]); ++ fprintf(stderr, "%s: Command response: 0x%x\n", __FUNCTION__, rsp[CMD_RSP_OFFSET]); ++ fprintf(stderr, "%s: Response type : 0x%x\n", __FUNCTION__, rsp[RSP_TYPE_OFFSET]); ++ ++ /* Check the status of the operation */ ++ switch ( rsp[CMD_RSP_OFFSET] ) ++ { ++ case EDL_CMD_REQ_RES_EVT: ++ fprintf(stderr, "%s: Command Request Response\n", __FUNCTION__); ++ switch(rsp[RSP_TYPE_OFFSET]) ++ { ++ case EDL_PATCH_VER_RES_EVT: ++ case EDL_APP_VER_RES_EVT: ++ fprintf(stderr, "\t Current Product ID\t\t: 0x%08x\n", ++ (unsigned int)(rsp[PATCH_PROD_ID_OFFSET +3] << 24 | ++ rsp[PATCH_PROD_ID_OFFSET+2] << 16 | ++ rsp[PATCH_PROD_ID_OFFSET+1] << 8 | ++ rsp[PATCH_PROD_ID_OFFSET] )); ++ ++ /* Patch Version indicates FW patch version */ ++ fprintf(stderr, "\t Current Patch Version\t\t: 0x%04x\n", ++ (unsigned short)(rsp[PATCH_PATCH_VER_OFFSET + 1] << 8 | ++ rsp[PATCH_PATCH_VER_OFFSET] )); ++ ++ /* ROM Build Version indicates ROM build version like 1.0/1.1/2.0 */ ++ fprintf(stderr, "\t Current ROM Build Version\t: 0x%04x\n", rome_ver = ++ (int)(rsp[PATCH_ROM_BUILD_VER_OFFSET + 1] << 8 | ++ rsp[PATCH_ROM_BUILD_VER_OFFSET] )); ++ ++ /* In case rome 1.0/1.1, there is no SOC ID version available */ ++ if (paramlen - 10) ++ { ++ fprintf(stderr, "\t Current SOC Version\t\t: 0x%08x\n", soc_id = ++ (unsigned int)(rsp[PATCH_SOC_VER_OFFSET +3] << 24 | ++ rsp[PATCH_SOC_VER_OFFSET+2] << 16 | ++ rsp[PATCH_SOC_VER_OFFSET+1] << 8 | ++ rsp[PATCH_SOC_VER_OFFSET] )); ++ } ++ ++ /* Rome Chipset Version can be decided by Patch version and SOC version, ++ Upper 2 bytes will be used for Patch version and Lower 2 bytes will be ++ used for SOC as combination for BT host driver */ ++ rome_ver = (rome_ver << 16) | (soc_id & 0x0000ffff); ++ break; ++ case EDL_TVL_DNLD_RES_EVT: ++ case EDL_CMD_EXE_STATUS_EVT: ++ switch (err = rsp[CMD_STATUS_OFFSET]) ++ { ++ case HCI_CMD_SUCCESS: ++ fprintf(stderr, "%s: Download Packet successfully!\n", __FUNCTION__); ++ break; ++ case PATCH_LEN_ERROR: ++ fprintf(stderr, "%s: Invalid patch length argument passed for EDL PATCH " ++ "SET REQ cmd\n", __FUNCTION__); ++ break; ++ case PATCH_VER_ERROR: ++ fprintf(stderr, "%s: Invalid patch version argument passed for EDL PATCH " ++ "SET REQ cmd\n", __FUNCTION__); ++ break; ++ case PATCH_CRC_ERROR: ++ fprintf(stderr, "%s: CRC check of patch failed!!!\n", __FUNCTION__); ++ break; ++ case PATCH_NOT_FOUND: ++ fprintf(stderr, "%s: Invalid patch data!!!\n", __FUNCTION__); ++ break; ++ case TLV_TYPE_ERROR: ++ fprintf(stderr, "%s: TLV Type Error !!!\n", __FUNCTION__); ++ break; ++ default: ++ fprintf(stderr, "%s: Undefined error (0x%x)", __FUNCTION__, err); ++ break; ++ } ++ break; ++ } ++ break; ++ ++ case NVM_ACCESS_CODE: ++ fprintf(stderr, "%s: NVM Access Code!!!\n", __FUNCTION__); ++ err = HCI_CMD_SUCCESS; ++ break; ++ case EDL_SET_BAUDRATE_RSP_EVT: ++ /* Rome 1.1 has bug with the response, so it should ignore it. */ ++ if (rsp[BAUDRATE_RSP_STATUS_OFFSET] != BAUDRATE_CHANGE_SUCCESS) ++ { ++ fprintf(stderr, "%s: Set Baudrate request failed - 0x%x\n", __FUNCTION__, ++ rsp[CMD_STATUS_OFFSET]); ++ err = -1; ++ } ++ break; ++ default: ++ fprintf(stderr, "%s: Not a valid status!!!\n", __FUNCTION__); ++ err = -1; ++ break; ++ } ++ ++failed: ++ return err; ++} ++ ++ ++/* ++ * Read an VS HCI event from the given file descriptor. ++ */ ++int read_vs_hci_event(int fd, unsigned char* buf, int size) ++{ ++ int remain, r; ++ int count = 0; ++ ++ if (size <= 0) { ++ fprintf(stderr, "Invalid size arguement!\n"); ++ return -1; ++ } ++ ++ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", __FUNCTION__); ++ ++ /* The first byte identifies the packet type. For HCI event packets, it ++ * should be 0x04, so we read until we get to the 0x04. */ ++ /* It will keep reading until find 0x04 byte */ ++ while (1) { ++ r = read(fd, buf, 1); ++ if (r <= 0) ++ return -1; ++ if (buf[0] == 0x04) ++ break; ++ } ++ count++; ++ ++ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[0] - 0x%x\n", __FUNCTION__, buf[0]); ++ /* The next two bytes are the event code and parameter total length. */ ++ while (count < 3) { ++ r = read(fd, buf + count, 3 - count); ++ if ((r <= 0) || (buf[1] != 0xFF )) { ++ fprintf(stderr, "It is not VS event !!\n"); ++ return -1; ++ } ++ count += r; ++ } ++ ++ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[1] - 0x%x\n", __FUNCTION__, buf[1]); ++ /* Now we read the parameters. */ ++ if (buf[2] < (size - 3)) ++ remain = buf[2]; ++ else ++ remain = size - 3; ++ ++ while ((count - 3) < remain) { ++ r = read(fd, buf + count, remain - (count - 3)); ++ if (r <= 0) ++ return -1; ++ count += r; ++ } ++ ++ /* Check if the set patch command is successful or not */ ++ if(get_vs_hci_event(buf) != HCI_CMD_SUCCESS) ++ return -1; ++ ++ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, count - 0x%x\n", __FUNCTION__, count); ++ return count; ++} ++ ++ ++int hci_send_vs_cmd(int fd, unsigned char *cmd, unsigned char *rsp, int size) ++{ ++ int ret = 0; ++ ++ /* Send the HCI command packet to UART for transmission */ ++ ret = write(fd, cmd, size); ++ if (ret != size) { ++ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, ret); ++ goto failed; ++ } ++ ++ /* Check for response from the Controller */ ++ if (read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE) < 0) { ++ ret = -ETIMEDOUT; ++ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); ++ goto failed; ++ } ++ ++ fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); ++failed: ++ return ret; ++} ++ ++void frame_hci_cmd_pkt( ++ unsigned char *cmd, ++ int edl_cmd, unsigned int p_base_addr, ++ int segtNo, int size ++ ) ++{ ++ int offset = 0; ++ hci_command_hdr *cmd_hdr; ++ ++ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); ++ ++ cmd_hdr = (void *) (cmd + 1); ++ ++ cmd[0] = HCI_COMMAND_PKT; ++ cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, HCI_PATCH_CMD_OCF); ++ cmd_hdr->plen = size; ++ cmd[4] = edl_cmd; ++ ++ switch (edl_cmd) ++ { ++ case EDL_PATCH_SET_REQ_CMD: ++ /* Copy the patch header info as CMD params */ ++ memcpy(&cmd[5], phdr_buffer, PATCH_HDR_LEN); ++ fprintf(stderr, "%s: Sending EDL_PATCH_SET_REQ_CMD\n", __FUNCTION__); ++ fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); ++ break; ++ case EDL_PATCH_DLD_REQ_CMD: ++ offset = ((segtNo - 1) * MAX_DATA_PER_SEGMENT); ++ p_base_addr += offset; ++ cmd_hdr->plen = (size + 6); ++ cmd[5] = (size + 4); ++ cmd[6] = EXTRACT_BYTE(p_base_addr, 0); ++ cmd[7] = EXTRACT_BYTE(p_base_addr, 1); ++ cmd[8] = EXTRACT_BYTE(p_base_addr, 2); ++ cmd[9] = EXTRACT_BYTE(p_base_addr, 3); ++ memcpy(&cmd[10], (pdata_buffer + offset), size); ++ ++ fprintf(stderr, "%s: Sending EDL_PATCH_DLD_REQ_CMD: size: %d bytes\n", ++ __FUNCTION__, size); ++ fprintf(stderr, "HCI-CMD %d:\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t" ++ "0x%x\t0x%x\t0x%x\t\n", segtNo, cmd[0], cmd[1], cmd[2], ++ cmd[3], cmd[4], cmd[5], cmd[6], cmd[7], cmd[8], cmd[9]); ++ break; ++ case EDL_PATCH_ATCH_REQ_CMD: ++ fprintf(stderr, "%s: Sending EDL_PATCH_ATTACH_REQ_CMD\n", __FUNCTION__); ++ fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); ++ break; ++ case EDL_PATCH_RST_REQ_CMD: ++ fprintf(stderr, "%s: Sending EDL_PATCH_RESET_REQ_CMD\n", __FUNCTION__); ++ fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); ++ break; ++ case EDL_PATCH_VER_REQ_CMD: ++ fprintf(stderr, "%s: Sending EDL_PATCH_VER_REQ_CMD\n", __FUNCTION__); ++ fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); ++ break; ++ case EDL_PATCH_TLV_REQ_CMD: ++ fprintf(stderr, "%s: Sending EDL_PATCH_TLV_REQ_CMD\n", __FUNCTION__); ++ /* Parameter Total Length */ ++ cmd[3] = size +2; ++ ++ /* TLV Segment Length */ ++ cmd[5] = size; ++ fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5]); ++ offset = (segtNo * MAX_SIZE_PER_TLV_SEGMENT); ++ memcpy(&cmd[6], (pdata_buffer + offset), size); ++ break; ++ default: ++ fprintf(stderr, "%s: Unknown EDL CMD !!!\n", __FUNCTION__); ++ } ++} ++ ++void rome_extract_patch_header_info(unsigned char *buf) ++{ ++ int index; ++ ++ /* Extract patch id */ ++ for (index = 0; index < 4; index++) ++ rampatch_patch_info.patch_id |= ++ (LSH(buf[index + P_ID_OFFSET], (index * 8))); ++ ++ /* Extract (ROM and BUILD) version information */ ++ for (index = 0; index < 2; index++) ++ rampatch_patch_info.patch_ver.rom_version |= ++ (LSH(buf[index + P_ROME_VER_OFFSET], (index * 8))); ++ ++ for (index = 0; index < 2; index++) ++ rampatch_patch_info.patch_ver.build_version |= ++ (LSH(buf[index + P_BUILD_VER_OFFSET], (index * 8))); ++ ++ /* Extract patch base and entry addresses */ ++ for (index = 0; index < 4; index++) ++ rampatch_patch_info.patch_base_addr |= ++ (LSH(buf[index + P_BASE_ADDR_OFFSET], (index * 8))); ++ ++ /* Patch BASE & ENTRY addresses are same */ ++ rampatch_patch_info.patch_entry_addr = rampatch_patch_info.patch_base_addr; ++ ++ /* Extract total length of the patch payload */ ++ for (index = 0; index < 4; index++) ++ rampatch_patch_info.patch_length |= ++ (LSH(buf[index + P_LEN_OFFSET], (index * 8))); ++ ++ /* Extract the CRC checksum of the patch payload */ ++ for (index = 0; index < 4; index++) ++ rampatch_patch_info.patch_crc |= ++ (LSH(buf[index + P_CRC_OFFSET], (index * 8))); ++ ++ /* Extract patch control value */ ++ for (index = 0; index < 4; index++) ++ rampatch_patch_info.patch_ctrl |= ++ (LSH(buf[index + P_CONTROL_OFFSET], (index * 8))); ++ ++ fprintf(stderr, "PATCH_ID\t : 0x%x\n", rampatch_patch_info.patch_id); ++ fprintf(stderr, "ROM_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.rom_version); ++ fprintf(stderr, "BUILD_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.build_version); ++ fprintf(stderr, "PATCH_LENGTH\t : 0x%x\n", rampatch_patch_info.patch_length); ++ fprintf(stderr, "PATCH_CRC\t : 0x%x\n", rampatch_patch_info.patch_crc); ++ fprintf(stderr, "PATCH_CONTROL\t : 0x%x\n", rampatch_patch_info.patch_ctrl); ++ fprintf(stderr, "PATCH_BASE_ADDR\t : 0x%x\n", rampatch_patch_info.patch_base_addr); ++ ++} ++ ++int rome_edl_set_patch_request(int fd) ++{ ++ int size, err; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++ /* Frame the HCI CMD to be sent to the Controller */ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_SET_REQ_CMD, 0, ++ -1, PATCH_HDR_LEN + 1); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if ( err != size) { ++ fprintf(stderr, "Failed to set the patch info to the Controller!\n"); ++ goto error; ++ } ++ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s: Successfully set patch info on the Controller\n", __FUNCTION__); ++error: ++ return err; ++} ++ ++int rome_edl_patch_download_request(int fd) ++{ ++ int no_of_patch_segment; ++ int index = 1, err = 0, size = 0; ++ unsigned int p_base_addr; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++ no_of_patch_segment = (rampatch_patch_info.patch_length / ++ MAX_DATA_PER_SEGMENT); ++ fprintf(stderr, "%s: %d patch segments to be d'loaded from patch base addr: 0x%x\n", ++ __FUNCTION__, no_of_patch_segment, ++ rampatch_patch_info.patch_base_addr); ++ ++ /* Initialize the patch base address from the one read from bin file */ ++ p_base_addr = rampatch_patch_info.patch_base_addr; ++ ++ /* ++ * Depending upon size of the patch payload, download the patches in ++ * segments with a max. size of 239 bytes ++ */ ++ for (index = 1; index <= no_of_patch_segment; index++) { ++ ++ fprintf(stderr, "%s: Downloading patch segment: %d\n", __FUNCTION__, index); ++ ++ /* Frame the HCI CMD PKT to be sent to Controller*/ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_DLD_REQ_CMD, p_base_addr, ++ index, MAX_DATA_PER_SEGMENT); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ ++ /* Initialize the RSP packet everytime to 0 */ ++ memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if ( err != size) { ++ fprintf(stderr, "Failed to send the patch payload to the Controller!\n"); ++ goto error; ++ } ++ ++ /* Read Command Complete Event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to downlaod patch segment: %d!\n", ++ __FUNCTION__, index); ++ goto error; ++ } ++ fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", ++ __FUNCTION__, index); ++ } ++ ++ /* Check if any pending patch data to be sent */ ++ size = (rampatch_patch_info.patch_length < MAX_DATA_PER_SEGMENT) ? ++ rampatch_patch_info.patch_length : ++ (rampatch_patch_info.patch_length % MAX_DATA_PER_SEGMENT); ++ ++ if (size) ++ { ++ /* Frame the HCI CMD PKT to be sent to Controller*/ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_DLD_REQ_CMD, p_base_addr, index, size); ++ ++ /* Initialize the RSP packet everytime to 0 */ ++ memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if ( err != size) { ++ fprintf(stderr, "Failed to send the patch payload to the Controller!\n"); ++ goto error; ++ } ++ ++ /* Read Command Complete Event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to downlaod patch segment: %d!\n", ++ __FUNCTION__, index); ++ goto error; ++ } ++ ++ fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", ++ __FUNCTION__, index); ++ } ++ ++error: ++ return err; ++} ++ ++static int rome_download_rampatch(int fd) ++{ ++ int c, size, index, ret = -1; ++ ++ fprintf(stderr, "%s:\n", __FUNCTION__); ++ ++ /* Get handle to the RAMPATCH binary file */ ++ fprintf(stderr, "%s: Getting handle to the RAMPATCH binary file from %s\n", __FUNCTION__, ROME_FW_PATH); ++ file = fopen(ROME_FW_PATH, "r"); ++ if (file == NULL) { ++ fprintf(stderr, "%s: Failed to get handle to the RAMPATCH bin file!\n", ++ __FUNCTION__); ++ return -ENFILE; ++ } ++ ++ /* Allocate memory for the patch headder info */ ++ fprintf(stderr, "%s: Allocating memory for the patch header\n", __FUNCTION__); ++ phdr_buffer = (unsigned char *) malloc(PATCH_HDR_LEN + 1); ++ if (phdr_buffer == NULL) { ++ fprintf(stderr, "%s: Failed to allocate memory for patch header\n", ++ __FUNCTION__); ++ goto phdr_alloc_failed; ++ } ++ for (index = 0; index < PATCH_HDR_LEN + 1; index++) ++ phdr_buffer[index] = 0x0; ++ ++ /* Read 28 bytes of patch header information */ ++ fprintf(stderr, "%s: Reading patch header info\n", __FUNCTION__); ++ index = 0; ++ do { ++ c = fgetc (file); ++ phdr_buffer[index++] = (unsigned char)c; ++ } while (index != PATCH_HDR_LEN); ++ ++ /* Save the patch header info into local structure */ ++ fprintf(stderr, "%s: Saving patch hdr. info\n", __FUNCTION__); ++ rome_extract_patch_header_info((unsigned char *)phdr_buffer); ++ ++ /* Set the patch header info onto the Controller */ ++ ret = rome_edl_set_patch_request(fd); ++ if (ret < 0) { ++ fprintf(stderr, "%s: Error setting the patchheader info!\n", __FUNCTION__); ++ goto pdata_alloc_failed; ++ } ++ ++ /* Allocate memory for the patch payload */ ++ fprintf(stderr, "%s: Allocating memory for patch payload\n", __FUNCTION__); ++ size = rampatch_patch_info.patch_length; ++ pdata_buffer = (unsigned char *) malloc(size+1); ++ if (pdata_buffer == NULL) { ++ fprintf(stderr, "%s: Failed to allocate memory for patch payload\n", ++ __FUNCTION__); ++ goto pdata_alloc_failed; ++ } ++ for (index = 0; index < size+1; index++) ++ pdata_buffer[index] = 0x0; ++ ++ /* Read the patch data from Rampatch binary image */ ++ fprintf(stderr, "%s: Reading patch payload from RAMPATCH file\n", __FUNCTION__); ++ index = 0; ++ do { ++ c = fgetc (file); ++ pdata_buffer[index++] = (unsigned char)c; ++ } while (c != EOF); ++ ++ /* Downloading patches in segments to controller */ ++ ret = rome_edl_patch_download_request(fd); ++ if (ret < 0) { ++ fprintf(stderr, "%s: Error downloading patch segments!\n", __FUNCTION__); ++ goto cleanup; ++ } ++cleanup: ++ free(pdata_buffer); ++pdata_alloc_failed: ++ free(phdr_buffer); ++phdr_alloc_failed: ++ fclose(file); ++ ++ return ret; ++} ++ ++int rome_attach_rampatch(int fd) ++{ ++ int size, err; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++ /* Frame the HCI CMD to be sent to the Controller */ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_ATCH_REQ_CMD, 0, ++ -1, EDL_PATCH_CMD_LEN); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if ( err != size) { ++ fprintf(stderr, "Failed to attach the patch payload to the Controller!\n"); ++ goto error; ++ } ++ ++ /* Read Command Complete Event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to attach the patch segment(s)\n", __FUNCTION__); ++ goto error; ++ } ++error: ++ return err; ++} ++ ++int rome_rampatch_reset(int fd) ++{ ++ int size, err = 0; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ struct timespec tm = { 0, 100*1000*1000 }; /* 100 ms */ ++ ++ /* Frame the HCI CMD to be sent to the Controller */ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_RST_REQ_CMD, 0, ++ -1, EDL_PATCH_CMD_LEN); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); ++ ++ /* Send HCI Command packet to Controller */ ++ err = write(fd, cmd, size); ++ if (err != size) { ++ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); ++ goto error; ++ } ++ ++ /* ++ * Controller doesn't sends any response for the patch reset ++ * command. HOST has to wait for 100ms before proceeding. ++ */ ++ nanosleep(&tm, NULL); ++ ++error: ++ return err; ++} ++ ++int rome_get_tlv_file(char *file_path) ++{ ++ FILE * pFile; ++ long fileSize; ++ int readSize, nvm_length, nvm_index, i; ++ unsigned short nvm_tag_len; ++ tlv_patch_info *ptlv_header; ++ tlv_nvm_hdr *nvm_ptr; ++ unsigned char data_buf[PRINT_BUF_SIZE]={0,}; ++ unsigned char *nvm_byte_ptr; ++ ++ fprintf(stderr, "File Open (%s)\n", file_path); ++ pFile = fopen ( file_path , "r" ); ++ if (pFile==NULL) {; ++ fprintf(stderr, "%s File Open Fail\n", file_path); ++ return -1; ++ } ++ ++ /* Get File Size */ ++ fseek (pFile , 0 , SEEK_END); ++ fileSize = ftell (pFile); ++ rewind (pFile); ++ ++ pdata_buffer = (unsigned char*) malloc (sizeof(char)*fileSize); ++ if (pdata_buffer == NULL) { ++ fprintf(stderr, "Allocated Memory failed\n"); ++ fclose (pFile); ++ return -1; ++ } ++ ++ /* Copy file into allocated buffer */ ++ readSize = fread (pdata_buffer,1,fileSize,pFile); ++ ++ /* File Close */ ++ fclose (pFile); ++ ++ if (readSize != fileSize) { ++ fprintf(stderr, "Read file size(%d) not matched with actual file size (%ld bytes)\n",readSize,fileSize); ++ return -1; ++ } ++ ++ ptlv_header = (tlv_patch_info *) pdata_buffer; ++ ++ /* To handle different event between rampatch and NVM */ ++ gTlv_type = ptlv_header->tlv_type; ++ ++ if(ptlv_header->tlv_type == TLV_TYPE_PATCH){ ++ fprintf(stderr, "====================================================\n"); ++ fprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type); ++ fprintf(stderr, "Length\t\t\t : %d bytes\n", (ptlv_header->tlv_length1) | ++ (ptlv_header->tlv_length2 << 8) | ++ (ptlv_header->tlv_length3 << 16)); ++ fprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv_data_len); ++ fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv_patch_data_len); ++ fprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver); ++ fprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm); ++ fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1); ++ fprintf(stderr, "Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id); ++ fprintf(stderr, "Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver); ++ fprintf(stderr, "Patch Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.patch_ver); ++ fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved2); ++ fprintf(stderr, "Patch Entry Address\t\t : 0x%x\n", (ptlv_header->tlv.patch.patch_entry_addr)); ++ fprintf(stderr, "====================================================\n"); ++ ++ } else if(ptlv_header->tlv_type == TLV_TYPE_NVM) { ++ fprintf(stderr, "====================================================\n"); ++ fprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type); ++ fprintf(stderr, "Length\t\t\t : %d bytes\n", nvm_length = (ptlv_header->tlv_length1) | ++ (ptlv_header->tlv_length2 << 8) | ++ (ptlv_header->tlv_length3 << 16)); ++ ++ if(nvm_length <= 0) ++ return readSize; ++ ++ for(nvm_byte_ptr=(unsigned char *)(nvm_ptr = &(ptlv_header->tlv.nvm)), nvm_index=0; ++ nvm_index < nvm_length ; nvm_ptr = (tlv_nvm_hdr *) nvm_byte_ptr) ++ { ++ fprintf(stderr, "TAG ID\t\t\t : %d\n", nvm_ptr->tag_id); ++ fprintf(stderr, "TAG Length\t\t\t : %d\n", nvm_tag_len = nvm_ptr->tag_len); ++ fprintf(stderr, "TAG Pointer\t\t\t : %d\n", nvm_ptr->tag_ptr); ++ fprintf(stderr, "TAG Extended Flag\t\t : %d\n", nvm_ptr->tag_ex_flag); ++ ++ /* Increase nvm_index to NVM data */ ++ nvm_index+=sizeof(tlv_nvm_hdr); ++ nvm_byte_ptr+=sizeof(tlv_nvm_hdr); ++ ++ /* Write BD Address */ ++ if(nvm_ptr->tag_id == TAG_NUM_2){ ++ memcpy(nvm_byte_ptr, vnd_local_bd_addr, 6); ++ fprintf(stderr, "BD Address: %.02x:%.02x:%.02x:%.02x:%.02x:%.02x\n", ++ *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), ++ *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); ++ } ++ ++ for(i =0;(itag_len && (i*3 + 2) tag_len; ++ nvm_byte_ptr +=nvm_ptr->tag_len; ++ } ++ ++ fprintf(stderr, "====================================================\n"); ++ ++ } else { ++ fprintf(stderr, "TLV Header type is unknown (%d) \n", ptlv_header->tlv_type); ++ } ++ ++ return readSize; ++} ++ ++int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc_evt) ++{ ++ int size=0, err = -1; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++ fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d\n", __FUNCTION__, index, seg_size); ++ ++ /* Frame the HCI CMD PKT to be sent to Controller*/ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_TLV_REQ_CMD, 0, index, seg_size); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ ++ /* Initialize the RSP packet everytime to 0 */ ++ memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if ( err != size) { ++ fprintf(stderr, "Failed to send the patch payload to the Controller! 0x%x\n", err); ++ return err; ++ } ++ ++ if(wait_cc_evt) { ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to downlaod patch segment: %d!\n", __FUNCTION__, index); ++ return err; ++ } ++ } ++ ++ fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", __FUNCTION__, index); ++ return err; ++} ++ ++int rome_tlv_dnld_req(int fd, int tlv_size) ++{ ++ int total_segment, remain_size, i, err = -1; ++ unsigned char wait_cc_evt; ++ ++ total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT; ++ remain_size = (tlv_size < MAX_SIZE_PER_TLV_SEGMENT)?\ ++ tlv_size: (tlv_size%MAX_SIZE_PER_TLV_SEGMENT); ++ ++ fprintf(stderr, "%s: TLV size: %d, Total Seg num: %d, remain size: %d\n", ++ __FUNCTION__,tlv_size, total_segment, remain_size); ++ ++ for(i=0;i= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH ) ++ && !remain_size && ((i+1) == total_segment))? FALSE: TRUE; ++ if((err = rome_tlv_dnld_segment(fd, i, MAX_SIZE_PER_TLV_SEGMENT, wait_cc_evt )) < 0) ++ goto error; ++ } ++ ++ /* In case remain data still remain, last rampatch segment command will not wait ++ for command complete event here */ ++ wait_cc_evt = ((rome_ver >= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH ) ++ && remain_size )? FALSE:TRUE; ++ ++ if(remain_size) err =rome_tlv_dnld_segment(fd, i, remain_size, wait_cc_evt); ++ ++error: ++ return err; ++} ++ ++int rome_download_tlv_file(int fd) ++{ ++ int tlv_size, err = -1; ++ ++ /* Rampatch TLV file Downloading */ ++ pdata_buffer = NULL; ++ ++ if((tlv_size = rome_get_tlv_file(rampatch_file_path)) < 0) ++ goto error; ++ ++ if((err =rome_tlv_dnld_req(fd, tlv_size)) <0 ) ++ goto error; ++ ++ if (pdata_buffer != NULL){ ++ free (pdata_buffer); ++ pdata_buffer = NULL; ++ } ++ ++ /* NVM TLV file Downloading */ ++ if((tlv_size = rome_get_tlv_file(nvm_file_path)) < 0) ++ goto error; ++ ++ if((err =rome_tlv_dnld_req(fd, tlv_size)) <0 ) ++ goto error; ++ ++error: ++ if (pdata_buffer != NULL) ++ free (pdata_buffer); ++ ++ return err; ++} ++ ++int rome_1_0_nvm_tag_dnld(int fd) ++{ ++ int i, size, err = 0; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++#if (NVM_VERSION >= ROME_1_0_100019) ++ unsigned char cmds[MAX_TAG_CMD][HCI_MAX_CMD_SIZE] = ++ { ++ /* Tag 2 */ /* BD Address */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 9, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 2, ++ /* Tag Len */ 6, ++ /* Tag Value */ 0x77,0x78,0x23,0x01,0x56,0x22 ++ }, ++ /* Tag 6 */ /* Bluetooth Support Features */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 11, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 6, ++ /* Tag Len */ 8, ++ /* Tag Value */ 0xFF,0xFE,0x8B,0xFE,0xD8,0x3F,0x5B,0x8B ++ }, ++ /* Tag 17 */ /* HCI Transport Layer Setting */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 11, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 17, ++ /* Tag Len */ 8, ++ /* Tag Value */ 0x82,0x01,0x0E,0x08,0x04,0x32,0x0A,0x00 ++ }, ++ /* Tag 35 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 58, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 35, ++ /* Tag Len */ 55, ++ /* Tag Value */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x58, 0x59, ++ 0x0E, 0x0E, 0x16, 0x16, 0x16, 0x1E, 0x26, 0x5F, 0x2F, 0x5F, ++ 0x0E, 0x0E, 0x16, 0x16, 0x16, 0x1E, 0x26, 0x5F, 0x2F, 0x5F, ++ 0x0C, 0x18, 0x14, 0x24, 0x40, 0x4C, 0x70, 0x80, 0x80, 0x80, ++ 0x0C, 0x18, 0x14, 0x24, 0x40, 0x4C, 0x70, 0x80, 0x80, 0x80, ++ 0x1B, 0x14, 0x01, 0x04, 0x48 ++ }, ++ /* Tag 36 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 15, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 36, ++ /* Tag Len */ 12, ++ /* Tag Value */ 0x0F,0x00,0x03,0x03,0x03,0x03,0x00,0x00,0x03,0x03,0x04,0x00 ++ }, ++ /* Tag 39 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 7, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 39, ++ /* Tag Len */ 4, ++ /* Tag Value */ 0x12,0x00,0x00,0x00 ++ }, ++ /* Tag 41 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 91, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 41, ++ /* Tag Len */ 88, ++ /* Tag Value */ 0x15, 0x00, 0x00, 0x00, 0xF6, 0x02, 0x00, 0x00, 0x76, 0x00, ++ 0x1E, 0x00, 0x29, 0x02, 0x1F, 0x00, 0x61, 0x00, 0x1A, 0x00, ++ 0x76, 0x00, 0x1E, 0x00, 0x7D, 0x00, 0x40, 0x00, 0x91, 0x00, ++ 0x06, 0x00, 0x92, 0x00, 0x03, 0x00, 0xA6, 0x01, 0x50, 0x00, ++ 0xAA, 0x01, 0x15, 0x00, 0xAB, 0x01, 0x0A, 0x00, 0xAC, 0x01, ++ 0x00, 0x00, 0xB0, 0x01, 0xC5, 0x00, 0xB3, 0x01, 0x03, 0x00, ++ 0xB4, 0x01, 0x13, 0x00, 0xB5, 0x01, 0x0C, 0x00, 0xC5, 0x01, ++ 0x0D, 0x00, 0xC6, 0x01, 0x10, 0x00, 0xCA, 0x01, 0x2B, 0x00, ++ 0xCB, 0x01, 0x5F, 0x00, 0xCC, 0x01, 0x48, 0x00 ++ }, ++ /* Tag 42 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 63, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 42, ++ /* Tag Len */ 60, ++ /* Tag Value */ 0xD7, 0xC0, 0x00, 0x00, 0x8F, 0x5C, 0x02, 0x00, 0x80, 0x47, ++ 0x60, 0x0C, 0x70, 0x4C, 0x00, 0x00, 0x00, 0x01, 0x1F, 0x01, ++ 0x42, 0x01, 0x69, 0x01, 0x95, 0x01, 0xC7, 0x01, 0xFE, 0x01, ++ 0x3D, 0x02, 0x83, 0x02, 0xD1, 0x02, 0x29, 0x03, 0x00, 0x0A, ++ 0x10, 0x00, 0x1F, 0x00, 0x3F, 0x00, 0x7F, 0x00, 0xFD, 0x00, ++ 0xF9, 0x01, 0xF1, 0x03, 0xDE, 0x07, 0x00, 0x00, 0x9A, 0x01 ++ }, ++ /* Tag 84 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 153, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 84, ++ /* Tag Len */ 150, ++ /* Tag Value */ 0x7C, 0x6A, 0x59, 0x47, 0x19, 0x36, 0x35, 0x25, 0x25, 0x28, ++ 0x2C, 0x2B, 0x2B, 0x28, 0x2C, 0x28, 0x29, 0x28, 0x29, 0x28, ++ 0x29, 0x29, 0x2C, 0x29, 0x2C, 0x29, 0x2C, 0x28, 0x29, 0x28, ++ 0x29, 0x28, 0x29, 0x2A, 0x00, 0x00, 0x2C, 0x2A, 0x2C, 0x18, ++ 0x98, 0x98, 0x98, 0x98, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, ++ 0x1E, 0x13, 0x1E, 0x1E, 0x1E, 0x1E, 0x13, 0x13, 0x11, 0x13, ++ 0x1E, 0x1E, 0x13, 0x12, 0x12, 0x12, 0x11, 0x12, 0x1F, 0x12, ++ 0x12, 0x12, 0x10, 0x0C, 0x18, 0x0D, 0x01, 0x01, 0x01, 0x01, ++ 0x01, 0x01, 0x01, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x0D, 0x0D, ++ 0x0E, 0x0D, 0x01, 0x01, 0x0D, 0x0D, 0x0D, 0x0D, 0x0F, 0x0D, ++ 0x10, 0x0D, 0x0D, 0x0D, 0x0D, 0x10, 0x05, 0x10, 0x03, 0x00, ++ 0x7E, 0x7B, 0x7B, 0x72, 0x71, 0x50, 0x50, 0x50, 0x00, 0x40, ++ 0x60, 0x60, 0x30, 0x08, 0x02, 0x0F, 0x00, 0x01, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x08, 0x16, 0x16, 0x08, 0x08, 0x00, ++ 0x00, 0x00, 0x1E, 0x34, 0x2B, 0x1B, 0x23, 0x2B, 0x15, 0x0D ++ }, ++ /* Tag 85 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 119, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 85, ++ /* Tag Len */ 116, ++ /* Tag Value */ 0x03, 0x00, 0x38, 0x00, 0x45, 0x77, 0x00, 0xE8, 0x00, 0x59, ++ 0x01, 0xCA, 0x01, 0x3B, 0x02, 0xAC, 0x02, 0x1D, 0x03, 0x8E, ++ 0x03, 0x00, 0x89, 0x01, 0x0E, 0x02, 0x5C, 0x02, 0xD7, 0x02, ++ 0xF8, 0x08, 0x01, 0x00, 0x1F, 0x00, 0x0A, 0x02, 0x55, 0x02, ++ 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x2A, 0xD7, 0x00, 0x00, ++ 0x00, 0x1E, 0xDE, 0x00, 0x00, 0x00, 0x14, 0x0F, 0x0A, 0x0F, ++ 0x0A, 0x0C, 0x0C, 0x0C, 0x0C, 0x04, 0x04, 0x04, 0x0C, 0x0C, ++ 0x0C, 0x0C, 0x06, 0x06, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, ++ 0x01, 0x00, 0x02, 0x02, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, ++ 0x06, 0x0F, 0x14, 0x05, 0x47, 0xCF, 0x77, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0xAC, 0x7C, 0xFF, 0x40, 0x00, 0x00, 0x00, ++ 0x12, 0x04, 0x04, 0x01, 0x04, 0x03 ++ }, ++ {TAG_END} ++ }; ++#elif (NVM_VERSION == ROME_1_0_6002) ++ unsigned char cmds[MAX_TAG_CMD][HCI_MAX_CMD_SIZE] = ++ { ++ /* Tag 2 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 9, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 2, ++ /* Tag Len */ 6, ++ /* Tag Value */ 0x77,0x78,0x23,0x01,0x56,0x22 /* BD Address */ ++ }, ++ /* Tag 6 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 11, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 6, ++ /* Tag Len */ 8, ++ /* Tag Value */ 0xFF,0xFE,0x8B,0xFE,0xD8,0x3F,0x5B,0x8B ++ }, ++ /* Tag 17 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 11, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 17, ++ /* Tag Len */ 8, ++ /* Tag Value */ 0x82,0x01,0x0E,0x08,0x04,0x32,0x0A,0x00 ++ }, ++ /* Tag 36 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 15, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 36, ++ /* Tag Len */ 12, ++ /* Tag Value */ 0x0F,0x00,0x03,0x03,0x03,0x03,0x00,0x00,0x03,0x03,0x04,0x00 ++ }, ++ ++ /* Tag 39 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 7, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 39, ++ /* Tag Len */ 4, ++ /* Tag Value */ 0x12,0x00,0x00,0x00 ++ }, ++ ++ /* Tag 41 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 199, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 41, ++ /* Tag Len */ 196, ++ /* Tag Value */ 0x30,0x00,0x00,0x00,0xD5,0x00,0x0E,0x00,0xD6,0x00,0x0E,0x00, ++ 0xD7,0x00,0x16,0x00,0xD8,0x00,0x16,0x00,0xD9,0x00,0x16,0x00, ++ 0xDA,0x00,0x1E,0x00,0xDB,0x00,0x26,0x00,0xDC,0x00,0x5F,0x00, ++ 0xDD,0x00,0x2F,0x00,0xDE,0x00,0x5F,0x00,0xE0,0x00,0x0E,0x00, ++ 0xE1,0x00,0x0E,0x00,0xE2,0x00,0x16,0x00,0xE3,0x00,0x16,0x00, ++ 0xE4,0x00,0x16,0x00,0xE5,0x00,0x1E,0x00,0xE6,0x00,0x26,0x00, ++ 0xE7,0x00,0x5F,0x00,0xE8,0x00,0x2F,0x00,0xE9,0x00,0x5F,0x00, ++ 0xEC,0x00,0x0C,0x00,0xED,0x00,0x08,0x00,0xEE,0x00,0x14,0x00, ++ 0xEF,0x00,0x24,0x00,0xF0,0x00,0x40,0x00,0xF1,0x00,0x4C,0x00, ++ 0xF2,0x00,0x70,0x00,0xF3,0x00,0x80,0x00,0xF4,0x00,0x80,0x00, ++ 0xF5,0x00,0x80,0x00,0xF8,0x00,0x0C,0x00,0xF9,0x00,0x18,0x00, ++ 0xFA,0x00,0x14,0x00,0xFB,0x00,0x24,0x00,0xFC,0x00,0x40,0x00, ++ 0xFD,0x00,0x4C,0x00,0xFE,0x00,0x70,0x00,0xFF,0x00,0x80,0x00, ++ 0x00,0x01,0x80,0x00,0x01,0x01,0x80,0x00,0x04,0x01,0x1B,0x00, ++ 0x05,0x01,0x14,0x00,0x06,0x01,0x01,0x00,0x07,0x01,0x04,0x00, ++ 0x08,0x01,0x00,0x00,0x09,0x01,0x00,0x00,0x0A,0x01,0x03,0x00, ++ 0x0B,0x01,0x03,0x00 ++ }, ++ ++ /* Tag 44 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 44, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 44, ++ /* Tag Len */ 41, ++ /* Tag Value */ 0x6F,0x0A,0x00,0x00,0x00,0x00,0x00,0x50,0xFF,0x10,0x02,0x02, ++ 0x01,0x00,0x14,0x01,0x06,0x28,0xA0,0x62,0x03,0x64,0x01,0x01, ++ 0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0xFF,0x10,0x02,0x01, ++ 0x00,0x14,0x01,0x02,0x03 ++ }, ++ {TAG_END} ++ }; ++#endif ++ ++ fprintf(stderr, "%s: Start sending NVM Tags (ver: 0x%x)\n", __FUNCTION__, (unsigned int) NVM_VERSION); ++ ++ for (i=0; (i < MAX_TAG_CMD) && (cmds[i][0] != TAG_END); i++) ++ { ++ /* Write BD Address */ ++ if(cmds[i][TAG_NUM_OFFSET] == TAG_NUM_2){ ++ memcpy(&cmds[i][TAG_BDADDR_OFFSET], vnd_local_bd_addr, 6); ++ fprintf(stderr, "BD Address: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", ++ cmds[i][TAG_BDADDR_OFFSET ], cmds[i][TAG_BDADDR_OFFSET + 1], ++ cmds[i][TAG_BDADDR_OFFSET + 2], cmds[i][TAG_BDADDR_OFFSET + 3], ++ cmds[i][TAG_BDADDR_OFFSET + 4], cmds[i][TAG_BDADDR_OFFSET + 5]); ++ } ++ size = cmds[i][3] + HCI_COMMAND_HDR_SIZE + 1; ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)&cmds[i][0], rsp, size); ++ if ( err != size) { ++ fprintf(stderr, "Failed to attach the patch payload to the Controller!\n"); ++ goto error; ++ } ++ ++ /* Read Command Complete Event - This is extra routine for ROME 1.0. From ROM 2.0, it should be removed. */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to get patch version(s)\n", __FUNCTION__); ++ goto error; ++ } ++ } ++ ++error: ++ return err; ++} ++ ++ ++ ++int rome_patch_ver_req(int fd) ++{ ++ int size, err = 0; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++ /* Frame the HCI CMD to be sent to the Controller */ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_VER_REQ_CMD, 0, ++ -1, EDL_PATCH_CMD_LEN); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if ( err != size) { ++ fprintf(stderr, "Failed to attach the patch payload to the Controller!\n"); ++ goto error; ++ } ++ ++ /* Read Command Complete Event - This is extra routine for ROME 1.0. From ROM 2.0, it should be removed. */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to get patch version(s)\n", __FUNCTION__); ++ goto error; ++ } ++error: ++ return err; ++ ++} ++ ++int rome_disable_sleep(int fd) ++{ ++ int size, err = 0; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ hci_command_hdr *cmd_hdr; ++ int flags; ++ ++ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); ++ ++ cmd_hdr = (void *) (cmd + 1); ++ cmd[0] = HCI_COMMAND_PKT; ++ cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, NVM_ACCESS_CODE); ++ cmd_hdr->plen = VSC_DISABLE_IBS_LEN; ++ cmd[4] = 0x01; ++ cmd[5] = 0x1B; ++ cmd[6] = 0x01; ++ cmd[7] = 0x00; ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_DISABLE_IBS_LEN); ++ /* Send the HCI command packet to UART for transmission */ ++ fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7]) ; ++ err = write(fd, cmd, size); ++ if (err != size) { ++ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); ++ goto error; ++ } ++ ++ /* Check for response from the Controller */ ++ if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { ++ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); ++ goto error; ++ } ++ ++ fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); ++ ++ /* Wait for command complete event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s\n", __FUNCTION__); ++error: ++ return err; ++ ++} ++ ++int rome_set_baudrate_req(int fd) ++{ ++ int size, err = 0; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ hci_command_hdr *cmd_hdr; ++ int flags; ++ ++ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); ++ ++ cmd_hdr = (void *) (cmd + 1); ++ cmd[0] = HCI_COMMAND_PKT; ++ cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF); ++ cmd_hdr->plen = VSC_SET_BAUDRATE_REQ_LEN; ++ cmd[4] = BAUDRATE_115200; ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN); ++ /* Send the HCI command packet to UART for transmission */ ++ fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ; ++ err = write(fd, cmd, size); ++ if (err != size) { ++ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); ++ goto error; ++ } ++ ++ /* Check for response from the Controller */ ++ if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { ++ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); ++ goto error; ++ } ++ ++ fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); ++ ++ /* Wait for command complete event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s\n", __FUNCTION__); ++error: ++ return err; ++ ++} ++ ++ ++int rome_hci_reset_req(int fd) ++{ ++ int size, err = 0; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ hci_command_hdr *cmd_hdr; ++ int flags; ++ ++ fprintf(stderr, "%s: HCI RESET \n", __FUNCTION__); ++ ++ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); ++ ++ cmd_hdr = (void *) (cmd + 1); ++ cmd[0] = HCI_COMMAND_PKT; ++ cmd_hdr->opcode = HCI_RESET; ++ cmd_hdr->plen = 0; ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE); ++ ++ /* Send the HCI command packet to UART for transmission */ ++ fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]); ++ err = write(fd, cmd, size); ++ if (err != size) { ++ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); ++ goto error; ++ } ++ ++ /* Wait for command complete event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); ++ goto error; ++ } ++ ++error: ++ return err; ++ ++} ++ ++ ++int qca_soc_init(int fd, char *bdaddr) ++{ ++ int err = -1; ++ int size; ++ ++ fprintf(stderr, " %s \n", __FUNCTION__); ++ vnd_userial.fd = fd; ++ /* Get Rome version information */ ++ if((err = rome_patch_ver_req(fd)) <0){ ++ fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err); ++ goto error; ++ } ++ ++ fprintf(stderr, "%s: Rome Version (0x%08x)\n", __FUNCTION__, rome_ver); ++ ++ switch (rome_ver){ ++ case ROME_VER_1_0: ++ { ++ /* Set and Download the RAMPATCH */ ++ fprintf(stderr, "%s: Setting Patch Header & Downloading Patches\n", __FUNCTION__); ++ err = rome_download_rampatch(fd); ++ if (err < 0) { ++ fprintf(stderr, "%s: DOWNLOAD RAMPATCH failed!\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s: DOWNLOAD RAMPTACH complete\n", __FUNCTION__); ++ ++ /* Attach the RAMPATCH */ ++ fprintf(stderr, "%s: Attaching the patches\n", __FUNCTION__); ++ err = rome_attach_rampatch(fd); ++ if (err < 0) { ++ fprintf(stderr, "%s: ATTACH RAMPATCH failed!\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s: ATTACH RAMPTACH complete\n", __FUNCTION__); ++ ++ /* Send Reset */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); ++ err = rome_rampatch_reset(fd); ++ if ( err < 0 ) { ++ fprintf(stderr, "Failed to RESET after RAMPATCH upgrade!\n"); ++ goto error; ++ } ++ ++ /* NVM download */ ++ fprintf(stderr, "%s: Downloading NVM\n", __FUNCTION__); ++ err = rome_1_0_nvm_tag_dnld(fd); ++ if ( err <0 ) { ++ fprintf(stderr, "Downloading NVM Failed !!\n"); ++ goto error; ++ } ++ ++ /* Change baud rate 115.2 kbps to 3Mbps*/ ++ err = rome_hci_reset_req(fd); ++ if ( err <0 ) { ++ fprintf(stderr, "HCI Reset Failed !!\n"); ++ goto error; ++ } ++ ++ fprintf(stderr, "HCI Reset is done\n"); ++ } ++ break; ++ case ROME_VER_1_1: ++ rampatch_file_path = ROME_RAMPATCH_TLV_PATH; ++ nvm_file_path = ROME_NVM_TLV_PATH; ++ goto download; ++ case ROME_VER_1_3: ++ rampatch_file_path = ROME_RAMPATCH_TLV_1_0_3_PATH; ++ nvm_file_path = ROME_NVM_TLV_1_0_3_PATH; ++ goto download; ++ case ROME_VER_2_1: ++ rampatch_file_path = ROME_RAMPATCH_TLV_2_0_1_PATH; ++ nvm_file_path = ROME_NVM_TLV_2_0_1_PATH; ++ goto download; ++ case ROME_VER_3_0: ++ case TUFELLO_VER_1_0: ++ rampatch_file_path = ROME_RAMPATCH_TLV_3_0_0_PATH; ++ nvm_file_path = ROME_NVM_TLV_3_0_0_PATH; ++ ++download: ++ /* Donwload TLV files (rampatch, NVM) */ ++ err = rome_download_tlv_file(fd); ++ if (err < 0) { ++ fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__); ++ ++ /* Change baud rate back to user requested */ ++ fprintf(stderr, "Changing baud rate back from 3M --> 115K\n"); ++ err = rome_set_baudrate_req(fd); ++ if (err < 0) { ++ fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s: Baud rate changed successfully \n", __FUNCTION__); ++ ++ fprintf(stderr, "%s: Disabling In Band Sleep functionality\n", __FUNCTION__); ++ err = rome_disable_sleep(fd); ++ if (err < 0) { ++ fprintf(stderr, "%s: Failed to disable IBS!\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s: IBS disabled successfully \n", __FUNCTION__); ++ ++ /* Perform HCI reset here*/ ++ err = rome_hci_reset_req(fd); ++ if ( err <0 ) { ++ fprintf(stderr, "HCI Reset Failed !!!\n"); ++ goto error; ++ } ++ fprintf(stderr, "HCI Reset is done\n"); ++ ++ break; ++ case ROME_VER_UNKNOWN: ++ default: ++ fprintf(stderr, "%s: Detected unknown ROME version\n", __FUNCTION__); ++ err = -1; ++ break; ++ } ++ ++error: ++ return err; ++} +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +new file mode 100644 +index 000000000000..aa59965643ec +--- /dev/null ++++ b/tools/hciattach_rome.h +@@ -0,0 +1,317 @@ ++/* ++ * Copyright 2012 The Android Open Source Project ++ * Copyright (c) 2013, The Linux Foundation. All rights reserved. ++ * Not a Contribution. ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++#ifndef HW_ROME_H ++#define HW_ROME_H ++ ++/****************************************************************************** ++** Constants & Macros ++******************************************************************************/ ++#define HCI_MAX_CMD_SIZE 260 ++#define HCI_MAX_EVENT_SIZE 260 ++#define PRINT_BUF_SIZE ((HCI_MAX_CMD_SIZE * 3) + 2) ++/* HCI Command/Event Opcode */ ++#define HCI_RESET 0x0C03 ++#define EVT_CMD_COMPLETE 0x0E ++/* HCI Packet types */ ++#define HCI_COMMAND_PKT 0x01 ++#define HCI_ACLDATA_PKT 0x02 ++#define HCI_SCODATA_PKT 0x03 ++#define HCI_EVENT_PKT 0x04 ++#define HCI_VENDOR_PKT 0xff ++#define cmd_opcode_pack(ogf, ocf) (unsigned short)((ocf & 0x03ff)|(ogf << 10)) ++unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; ++typedef enum { ++ USERIAL_OP_FLOW_ON, ++ USERIAL_OP_FLOW_OFF, ++ USERIAL_OP_NOP, ++} userial_vendor_ioctl_op_t; ++ ++ ++/* vendor serial control block */ ++typedef struct ++{ ++ int fd; /* fd to Bluetooth device */ ++ struct termios termios; /* serial terminal of BT port */ ++ char port_name[256]; ++} vnd_userial_cb_t; ++ ++/**** baud rates ****/ ++#define USERIAL_BAUD_300 0 ++#define USERIAL_BAUD_600 1 ++#define USERIAL_BAUD_1200 2 ++#define USERIAL_BAUD_2400 3 ++#define USERIAL_BAUD_9600 4 ++#define USERIAL_BAUD_19200 5 ++#define USERIAL_BAUD_57600 6 ++#define USERIAL_BAUD_115200 7 ++#define USERIAL_BAUD_230400 8 ++#define USERIAL_BAUD_460800 9 ++#define USERIAL_BAUD_921600 10 ++#define USERIAL_BAUD_1M 11 ++#define USERIAL_BAUD_1_5M 12 ++#define USERIAL_BAUD_2M 13 ++#define USERIAL_BAUD_3M 14 ++#define USERIAL_BAUD_4M 15 ++#define USERIAL_BAUD_AUTO 16 ++ ++#ifndef FALSE ++#define FALSE 0 ++#endif ++ ++#ifndef TRUE ++#define TRUE (!FALSE) ++#endif ++ ++#define HCI_CHG_BAUD_CMD_OCF 0x0C ++#define HCI_VENDOR_CMD_OGF 0x3F ++#define WRITE_BDADDR_CMD_LEN 14 ++#define WRITE_BAUD_CMD_LEN 6 ++#define MAX_CMD_LEN WRITE_BDADDR_CMD_LEN ++#define GET_VERSION_OCF 0x1E ++ ++#define PS_HDR_LEN 4 ++#define HCI_VENDOR_CMD_OGF 0x3F ++#define HCI_PS_CMD_OCF 0x0B ++ ++#define HCI_COMMAND_HDR_SIZE 3 ++#define EVT_CMD_COMPLETE_SIZE 3 ++#define EVT_CMD_STATUS 0x0F ++#define EVT_CMD_STATUS_SIZE 4 ++#define HCI_EVENT_HDR_SIZE 2 ++#define HCI_EV_SUCCESS 0x00 ++/* HCI Socket options */ ++#define HCI_DATA_DIR 1 ++#define HCI_FILTER 2 ++#define HCI_TIME_STAMP 3 ++ ++#define P_ID_OFFSET (0) ++#define HCI_CMD_IND (1) ++#define EVENTCODE_OFFSET (1) ++#define EVT_PLEN (2) ++#define PLEN (3) ++#define CMD_RSP_OFFSET (3) ++#define RSP_TYPE_OFFSET (4) ++#define BAUDRATE_RSP_STATUS_OFFSET (4) ++#define CMD_STATUS_OFFSET (5) ++#define P_ROME_VER_OFFSET (4) ++#define P_BUILD_VER_OFFSET (6) ++#define P_BASE_ADDR_OFFSET (8) ++#define P_ENTRY_ADDR_OFFSET (12) ++#define P_LEN_OFFSET (16) ++#define P_CRC_OFFSET (20) ++#define P_CONTROL_OFFSET (24) ++#define PATCH_HDR_LEN (28) ++#define MAX_DATA_PER_SEGMENT (239) ++#define VSEVENT_CODE (0xFF) ++#define HC_VS_MAX_CMD_EVENT (0xFF) ++#define PATCH_PROD_ID_OFFSET (5) ++#define PATCH_PATCH_VER_OFFSET (9) ++#define PATCH_ROM_BUILD_VER_OFFSET (11) ++#define PATCH_SOC_VER_OFFSET (13) ++#define MAX_SIZE_PER_TLV_SEGMENT (243) ++ ++/* VS Opcode */ ++#define HCI_PATCH_CMD_OCF (0) ++#define EDL_SET_BAUDRATE_CMD_OCF (0x48) ++ ++/* VS Commands */ ++#define VSC_SET_BAUDRATE_REQ_LEN (1) ++#define EDL_PATCH_CMD_LEN (1) ++#define EDL_PATCH_CMD_REQ_LEN (1) ++#define EDL_PATCH_DLD_REQ_CMD (0x01) ++#define EDL_PATCH_RST_REQ_CMD (0x05) ++#define EDL_PATCH_SET_REQ_CMD (0x16) ++#define EDL_PATCH_ATCH_REQ_CMD (0x17) ++#define EDL_PATCH_VER_REQ_CMD (0x19) ++#define EDL_PATCH_TLV_REQ_CMD (0x1E) ++#define VSC_DISABLE_IBS_LEN (0x04) ++ ++/* VS Event */ ++#define EDL_CMD_REQ_RES_EVT (0x00) ++#define EDL_CMD_EXE_STATUS_EVT (0x00) ++#define EDL_SET_BAUDRATE_RSP_EVT (0x92) ++#define EDL_PATCH_VER_RES_EVT (0x19) ++#define EDL_TVL_DNLD_RES_EVT (0x04) ++#define EDL_APP_VER_RES_EVT (0x02) ++ ++ ++/* Status Codes of HCI CMD execution*/ ++#define HCI_CMD_SUCCESS (0x0) ++#define PATCH_LEN_ERROR (0x1) ++#define PATCH_VER_ERROR (0x2) ++#define PATCH_CRC_ERROR (0x3) ++#define PATCH_NOT_FOUND (0x4) ++#define TLV_TYPE_ERROR (0x10) ++#define NVM_ACCESS_CODE (0x0B) ++#define BAUDRATE_CHANGE_SUCCESS (1) ++ ++/* TLV_TYPE */ ++#define TLV_TYPE_PATCH (1) ++#define TLV_TYPE_NVM (2) ++ ++/* NVM */ ++#define MAX_TAG_CMD 30 ++#define TAG_END 0xFF ++#define NVM_ACCESS_SET 0x01 ++#define TAG_NUM_OFFSET 5 ++#define TAG_NUM_2 2 ++#define TAG_BDADDR_OFFSET 7 ++ ++/* NVM Tags specifically used for ROME 1.0 */ ++#define ROME_1_0_100022_1 0x101000221 ++#define ROME_1_0_100019 0x101000190 ++#define ROME_1_0_6002 0x100600200 ++ ++/* Default NVM Version setting for ROME 1.0 */ ++#define NVM_VERSION ROME_1_0_100022_1 ++ ++ ++#define LSH(val, n) ((unsigned int)(val) << (n)) ++#define EXTRACT_BYTE(val, pos) (char) (((val) >> (8 * (pos))) & 0xFF) ++#define CALC_SEG_SIZE(len, max) ((plen) % (max))?((plen/max)+1) : ((plen) / (max)) ++ ++#define ROME_FW_PATH "/lib/firmware/rampatch.img" ++#define ROME_RAMPATCH_TLV_PATH "/lib/firmware/rampatch_tlv.img" ++#define ROME_NVM_TLV_PATH "/lib/firmware/nvm_tlv.bin" ++#define ROME_RAMPATCH_TLV_1_0_3_PATH "/lib/firmware/rampatch_tlv_1.3.tlv" ++#define ROME_NVM_TLV_1_0_3_PATH "/lib/firmware/nvm_tlv_1.3.bin" ++#define ROME_RAMPATCH_TLV_2_0_1_PATH "/lib/firmware/rampatch_tlv_2.1.tlv" ++#define ROME_NVM_TLV_2_0_1_PATH "/lib/firmware/nvm_tlv_2.1.bin" ++#define ROME_RAMPATCH_TLV_3_0_0_PATH "/lib/firmware/qca/rampatch_tlv_3.0.tlv" ++#define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin" ++ ++ ++/****************************************************************************** ++** Local type definitions ++******************************************************************************/ ++ ++typedef struct { ++ unsigned char ncmd; ++ unsigned short opcode; ++} __attribute__ ((packed)) evt_cmd_complete; ++ ++typedef struct { ++ unsigned char status; ++ unsigned char ncmd; ++ unsigned short opcode; ++} __attribute__ ((packed)) evt_cmd_status; ++ ++typedef struct { ++ unsigned short opcode; ++ unsigned char plen; ++} __attribute__ ((packed)) hci_command_hdr; ++ ++typedef struct { ++ unsigned char evt; ++ unsigned char plen; ++} __attribute__ ((packed)) hci_event_hdr; ++typedef struct { ++ unsigned short rom_version; ++ unsigned short build_version; ++} __attribute__ ((packed)) patch_version; ++ ++typedef struct { ++ unsigned int patch_id; ++ patch_version patch_ver; ++ unsigned int patch_base_addr; ++ unsigned int patch_entry_addr; ++ unsigned short patch_length; ++ int patch_crc; ++ unsigned short patch_ctrl; ++} __attribute__ ((packed)) patch_info; ++ ++typedef struct { ++ unsigned char sign_ver; ++ unsigned char sign_algorithm; ++ unsigned short reserved1; ++ unsigned short prod_id; ++ unsigned short build_ver; ++ unsigned short patch_ver; ++ unsigned short reserved2; ++ unsigned int patch_entry_addr; ++} __attribute__ ((packed)) tlv_patch_hdr; ++ ++typedef struct { ++ unsigned short tag_id; ++ unsigned short tag_len; ++ unsigned int tag_ptr; ++ unsigned int tag_ex_flag; ++} __attribute__ ((packed)) tlv_nvm_hdr; ++ ++typedef struct { ++ unsigned char tlv_type; ++ unsigned char tlv_length1; ++ unsigned char tlv_length2; ++ unsigned char tlv_length3; ++ unsigned int tlv_data_len; ++ unsigned int tlv_patch_data_len; ++ ++ union{ ++ tlv_patch_hdr patch; ++ tlv_nvm_hdr nvm; ++ }tlv; ++} __attribute__ ((packed)) tlv_patch_info; ++ ++enum{ ++ BAUDRATE_115200 = 0x00, ++ BAUDRATE_57600 = 0x01, ++ BAUDRATE_38400 = 0x02, ++ BAUDRATE_19200 = 0x03, ++ BAUDRATE_9600 = 0x04, ++ BAUDRATE_230400 = 0x05, ++ BAUDRATE_250000 = 0x06, ++ BAUDRATE_460800 = 0x07, ++ BAUDRATE_500000 = 0x08, ++ BAUDRATE_720000 = 0x09, ++ BAUDRATE_921600 = 0x0A, ++ BAUDRATE_1000000 = 0x0B, ++ BAUDRATE_1250000 = 0x0C, ++ BAUDRATE_2000000 = 0x0D, ++ BAUDRATE_3000000 = 0x0E, ++ BAUDRATE_4000000 = 0x0F, ++ BAUDRATE_1600000 = 0x10, ++ BAUDRATE_3200000 = 0x11, ++ BAUDRATE_3500000 = 0x12, ++ BAUDRATE_AUTO = 0xFE, ++ BAUDRATE_Reserved = 0xFF ++}; ++ ++enum{ ++ ROME_PATCH_VER_0100 = 0x0100, ++ ROME_PATCH_VER_0101 = 0x0101, ++ ROME_PATCH_VER_0200 = 0x0200, ++ ROME_PATCH_VER_0300 = 0x0300 ++ }; ++ ++enum{ ++ ROME_SOC_ID_00 = 0x00000000, ++ ROME_SOC_ID_11 = 0x00000011, ++ ROME_SOC_ID_13 = 0x00000013, ++ ROME_SOC_ID_22 = 0x00000022, ++}; ++ ++enum{ ++ ROME_VER_UNKNOWN = 0, ++ ROME_VER_1_0 = ((ROME_PATCH_VER_0100 << 16 ) | ROME_SOC_ID_00 ), ++ ROME_VER_1_1 = ((ROME_PATCH_VER_0101 << 16 ) | ROME_SOC_ID_00 ), ++ ROME_VER_1_3 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_00 ), ++ ROME_VER_2_1 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_11 ), ++ ROME_VER_3_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_22 ), ++ TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ) ++}; ++#endif /* HW_ROME_H */ + +From 333676e63694e137558e7a685d2fa1a50c499436 Mon Sep 17 00:00:00 2001 +From: Anantha Krishnan +Date: Thu, 11 Sep 2014 19:20:02 +0530 +Subject: [PATCH 02/19] bluetooth: Enable bluetooth low power mode + functionality + +During periods of inactivity the bluetooth controller and the +application processor will indicate each other to enter into +low power mode and signal each other when they have data to be +exchanged, thereby saving considerable amount of power. + +Change-Id: I9e0d579ac8a9d61a2ebde78b031f4101cb6bc443 +Signed-off-by: Rupesh Tatiya +--- + tools/hciattach.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/hciattach.c b/tools/hciattach.c +index 73811d4c4c2a..e3a915061440 100644 +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -1102,7 +1102,7 @@ struct uart_t uart[] = { + FLOW_CTL, DISABLE_PM, NULL, ath3k_ps, ath3k_pm }, + + /* QCA ROME */ +- { "qca", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, ++ { "qca", 0x0000, 0x0000, HCI_UART_IBS, 115200, 115200, + FLOW_CTL, DISABLE_PM, NULL, qca, NULL }, + + /* QUALCOMM BTS */ + +From 0518592a10bff2ac0b99e4081bd01154f2eeacb6 Mon Sep 17 00:00:00 2001 +From: Anantha Krishnan +Date: Thu, 11 Sep 2014 18:57:45 +0530 +Subject: [PATCH 03/19] bluetooth: Fix bug in firmware parsing mechanism + +Reorganize the RAMPATCH members to be present as part of the +RAMPATCH header structre instead of the main firmware structure + +Change-Id: If523e1bb20edcd52b7c6f623c07af492e6305bd0 +Signed-off-by: Rupesh Tatiya +--- + tools/hciattach_rome.c | 4 ++-- + tools/hciattach_rome.h | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index f31be43c09e4..122a0f4b89bc 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -851,8 +851,8 @@ int rome_get_tlv_file(char *file_path) + fprintf(stderr, "Length\t\t\t : %d bytes\n", (ptlv_header->tlv_length1) | + (ptlv_header->tlv_length2 << 8) | + (ptlv_header->tlv_length3 << 16)); +- fprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv_data_len); +- fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv_patch_data_len); ++ fprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv.patch.tlv_data_len); ++ fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len); + fprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver); + fprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm); + fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1); +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index aa59965643ec..07127f30a70a 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -236,6 +236,8 @@ typedef struct { + } __attribute__ ((packed)) patch_info; + + typedef struct { ++ unsigned int tlv_data_len; ++ unsigned int tlv_patch_data_len; + unsigned char sign_ver; + unsigned char sign_algorithm; + unsigned short reserved1; +@@ -258,8 +260,6 @@ typedef struct { + unsigned char tlv_length1; + unsigned char tlv_length2; + unsigned char tlv_length3; +- unsigned int tlv_data_len; +- unsigned int tlv_patch_data_len; + + union{ + tlv_patch_hdr patch; + +From 78f1ab9c20956f4e6f009d7bc2b94fe1d4474a08 Mon Sep 17 00:00:00 2001 +From: Anantha Krishnan +Date: Mon, 8 Sep 2014 15:11:02 +0530 +Subject: [PATCH 04/19] bluetooth: Configure BD Address + +Read the BD Address programmed by user from persist location. +If there is no user programmed BD address then use the default +BD address present in the firmware file. + +Change-Id: Id702d1476bae765dfd23f88542bfd5a8a1f26056 +Signed-off-by: Rupesh Tatiya +--- + tools/hciattach_rome.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++--- + tools/hciattach_rome.h | 7 +++++++ + 2 files changed, 60 insertions(+), 3 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 122a0f4b89bc..947e1abb96c4 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -809,6 +809,7 @@ int rome_get_tlv_file(char *file_path) + tlv_nvm_hdr *nvm_ptr; + unsigned char data_buf[PRINT_BUF_SIZE]={0,}; + unsigned char *nvm_byte_ptr; ++ unsigned char bdaddr[6]; + + fprintf(stderr, "File Open (%s)\n", file_path); + pFile = fopen ( file_path , "r" ); +@@ -886,9 +887,10 @@ int rome_get_tlv_file(char *file_path) + nvm_byte_ptr+=sizeof(tlv_nvm_hdr); + + /* Write BD Address */ +- if(nvm_ptr->tag_id == TAG_NUM_2){ +- memcpy(nvm_byte_ptr, vnd_local_bd_addr, 6); +- fprintf(stderr, "BD Address: %.02x:%.02x:%.02x:%.02x:%.02x:%.02x\n", ++ if(nvm_ptr->tag_id == TAG_NUM_2 && read_bd_address(&bdaddr) == 0) { ++ memcpy(nvm_byte_ptr, bdaddr, 6); ++ fprintf(stderr, "Overriding default BD ADDR with user" ++ " programmed BD Address: %02x:%02x:%02x:%02x:%02x:%02x\n", + *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), + *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); + } +@@ -1451,6 +1453,54 @@ error: + + } + ++int read_bd_address(unsigned char *bdaddr) ++{ ++ int fd = -1; ++ int readPtr = 0; ++ unsigned char data[BD_ADDR_LEN]; ++ ++ /* Open the persist file for reading device address*/ ++ fd = open("/etc/bluetooth/.bt_nv.bin", O_RDONLY); ++ if(fd < 0) ++ { ++ fprintf(stderr, "%s: Open failed: Programming default BD ADDR\n", __func__); ++ return -1; ++ } ++ ++ /* Read the NVM Header : fp will be advanced by readPtr number of bytes */ ++ readPtr = read(fd, data, PERSIST_HEADER_LEN); ++ if (readPtr > 0) ++ fprintf(stderr, "%s: Persist header data: %02x \t %02x \t %02x\n", __func__, ++ data[NVITEM], data[RDWR_PROT], data[NVITEM_SIZE]); ++ else { ++ fprintf(stderr, "%s: Read from persist memory failed : Programming default" ++ " BD ADDR\n"); ++ close(fd); ++ return -1; ++ } ++ ++ /* Check for BD ADDR length before programming */ ++ if(data[NVITEM_SIZE] != BD_ADDR_LEN) { ++ fprintf(stderr, "Invalid BD ADDR: Programming default BD ADDR!\n"); ++ close(fd); ++ return -1; ++ } ++ ++ /* Read the BD ADDR info */ ++ readPtr = read(fd, data, BD_ADDR_LEN); ++ if (readPtr > 0) ++ fprintf(stderr, "BD-ADDR: ==> %02x:%02x:%02x:%02x:%02x:%02x\n", data[0], ++ data[1], data[2], data[3], data[4], data[5]); ++ else { ++ fprintf(stderr, "%s: Read from persist memory failed : Programming default" ++ " BD ADDR\n"); ++ close(fd); ++ return -1; ++ } ++ memcpy(bdaddr, data, BD_ADDR_LEN); ++ close(fd); ++ return 0; ++} + + int qca_soc_init(int fd, char *bdaddr) + { +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 07127f30a70a..a4abe9f73080 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -34,6 +34,13 @@ + #define HCI_EVENT_PKT 0x04 + #define HCI_VENDOR_PKT 0xff + #define cmd_opcode_pack(ogf, ocf) (unsigned short)((ocf & 0x03ff)|(ogf << 10)) ++ ++#define NVITEM 0 ++#define RDWR_PROT 1 ++#define NVITEM_SIZE 2 ++#define PERSIST_HEADER_LEN 3 ++#define BD_ADDR_LEN 6 ++ + unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + typedef enum { + USERIAL_OP_FLOW_ON, + +From 7f148243e9d36427734de874f291911e1f3d60d0 Mon Sep 17 00:00:00 2001 +From: Anantha Krishnan +Date: Mon, 8 Sep 2014 14:33:24 +0530 +Subject: [PATCH 05/19] bluetooth: Remove unused functions in the firmware + download process + +rome_disable_sleep() function is not used anywhere in the code and +hence remove it. + +Change-Id: Iec1f9b1478850af3023ff297493693283a5338d7 +Signed-off-by: Rupesh Tatiya +--- + tools/hciattach_rome.c | 48 ------------------------------------------------ + 1 file changed, 48 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 947e1abb96c4..4fcbdf2ab82a 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1317,54 +1317,6 @@ error: + + } + +-int rome_disable_sleep(int fd) +-{ +- int size, err = 0; +- unsigned char cmd[HCI_MAX_CMD_SIZE]; +- unsigned char rsp[HCI_MAX_EVENT_SIZE]; +- hci_command_hdr *cmd_hdr; +- int flags; +- +- memset(cmd, 0x0, HCI_MAX_CMD_SIZE); +- +- cmd_hdr = (void *) (cmd + 1); +- cmd[0] = HCI_COMMAND_PKT; +- cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, NVM_ACCESS_CODE); +- cmd_hdr->plen = VSC_DISABLE_IBS_LEN; +- cmd[4] = 0x01; +- cmd[5] = 0x1B; +- cmd[6] = 0x01; +- cmd[7] = 0x00; +- +- /* Total length of the packet to be sent to the Controller */ +- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_DISABLE_IBS_LEN); +- /* Send the HCI command packet to UART for transmission */ +- fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7]) ; +- err = write(fd, cmd, size); +- if (err != size) { +- fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); +- goto error; +- } +- +- /* Check for response from the Controller */ +- if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { +- fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); +- goto error; +- } +- +- fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); +- +- /* Wait for command complete event */ +- err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); +- if ( err < 0) { +- fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); +- goto error; +- } +- fprintf(stderr, "%s\n", __FUNCTION__); +-error: +- return err; +- +-} + + int rome_set_baudrate_req(int fd) + { + +From 175fe3690522afc91f38933f821e4b00bd1a12c8 Mon Sep 17 00:00:00 2001 +From: Anantha Krishnan +Date: Mon, 8 Sep 2014 14:31:18 +0530 +Subject: [PATCH 06/19] bluetooth: Enable 3Mbps baud rate support + +Allow APPS PROC and BT Controller to operate at 3Mbps baud rate +for faster exchange of commands, events and data between the two + +Change-Id: I55651633027ea60a762b11abea84fe1abd6574a9 +Signed-off-by: Rupesh Tatiya +--- + tools/hciattach_rome.c | 63 ++++++++++++++++++++++++++++++++++++++------------ + 1 file changed, 48 insertions(+), 15 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 4fcbdf2ab82a..d0e2935b9997 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -166,6 +166,7 @@ int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data) + } + cfmakeraw(&ti); + ti.c_cflag |= CLOCAL; ++ ti.c_cflag |= CREAD; + + switch(op) + { +@@ -332,6 +333,8 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size) + { + int remain, r; + int count = 0; ++ fd_set infids; ++ struct timeval timeout; + + if (size <= 0) { + fprintf(stderr, "Invalid size arguement!\n"); +@@ -340,6 +343,16 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size) + + fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", __FUNCTION__); + ++ FD_ZERO (&infids); ++ FD_SET (fd, &infids); ++ timeout.tv_sec = 3; ++ timeout.tv_usec = 0; /* half second is a long time at 115.2 Kbps */ ++ ++ if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) ++ fprintf(stderr, "%s: Timing out on select for 3 secs.\n", __FUNCTION__); ++ else ++ fprintf(stderr, "%s: Data available in TTY Serial buffer\n", __FUNCTION__); ++ + /* The first byte identifies the packet type. For HCI event packets, it + * should be 0x04, so we read until we get to the 0x04. */ + /* It will keep reading until find 0x04 byte */ +@@ -1332,10 +1345,16 @@ int rome_set_baudrate_req(int fd) + cmd[0] = HCI_COMMAND_PKT; + cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF); + cmd_hdr->plen = VSC_SET_BAUDRATE_REQ_LEN; +- cmd[4] = BAUDRATE_115200; ++ cmd[4] = BAUDRATE_3000000; + + /* Total length of the packet to be sent to the Controller */ + size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN); ++ /* Flow off during baudrate change */ ++ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0) ++ { ++ fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err); ++ goto error; ++ } + /* Send the HCI command packet to UART for transmission */ + fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ; + err = write(fd, cmd, size); +@@ -1343,7 +1362,15 @@ int rome_set_baudrate_req(int fd) + fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); + goto error; + } ++ /* Change Local UART baudrate to high speed UART */ ++ userial_vendor_set_baud(USERIAL_BAUD_3M); + ++ /* Flow on after changing local uart baudrate */ ++ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0) ++ { ++ fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err); ++ return err; ++ } + /* Check for response from the Controller */ + if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { + fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); +@@ -1385,6 +1412,12 @@ int rome_hci_reset_req(int fd) + /* Total length of the packet to be sent to the Controller */ + size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE); + ++ /* Flow off during baudrate change */ ++ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0) ++ { ++ fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err); ++ goto error; ++ } + /* Send the HCI command packet to UART for transmission */ + fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]); + err = write(fd, cmd, size); +@@ -1393,6 +1426,15 @@ int rome_hci_reset_req(int fd) + goto error; + } + ++ /* Change Local UART baudrate to high speed UART */ ++ userial_vendor_set_baud(USERIAL_BAUD_3M); ++ ++ /* Flow on after changing local uart baudrate */ ++ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0) ++ { ++ fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err); ++ return err; ++ } + /* Wait for command complete event */ + err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); + if ( err < 0) { +@@ -1534,16 +1576,7 @@ int qca_soc_init(int fd, char *bdaddr) + nvm_file_path = ROME_NVM_TLV_3_0_0_PATH; + + download: +- /* Donwload TLV files (rampatch, NVM) */ +- err = rome_download_tlv_file(fd); +- if (err < 0) { +- fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__); +- goto error; +- } +- fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__); +- +- /* Change baud rate back to user requested */ +- fprintf(stderr, "Changing baud rate back from 3M --> 115K\n"); ++ /* Change baud rate 115.2 kbps to 3Mbps*/ + err = rome_set_baudrate_req(fd); + if (err < 0) { + fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); +@@ -1551,13 +1584,13 @@ download: + } + fprintf(stderr, "%s: Baud rate changed successfully \n", __FUNCTION__); + +- fprintf(stderr, "%s: Disabling In Band Sleep functionality\n", __FUNCTION__); +- err = rome_disable_sleep(fd); ++ /* Donwload TLV files (rampatch, NVM) */ ++ err = rome_download_tlv_file(fd); + if (err < 0) { +- fprintf(stderr, "%s: Failed to disable IBS!\n", __FUNCTION__); ++ fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__); + goto error; + } +- fprintf(stderr, "%s: IBS disabled successfully \n", __FUNCTION__); ++ fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__); + + /* Perform HCI reset here*/ + err = rome_hci_reset_req(fd); + +From 1911a9d5799d110a7d010e154b44e43c65e838ff Mon Sep 17 00:00:00 2001 +From: Anantha Krishnan +Date: Tue, 30 Sep 2014 12:13:00 +0530 +Subject: [PATCH 07/19] bluetooth: Check TTY buffer for data availability + before reading + +When operating at higher baud rates check the TTY buffer for +availability of data before proceeding to read. Call select() with +a 3 sec timeout value to check for the availablitiy of data. +select() will return once data is available in the TTY buffers +and will allow read() to fetch the data. If data is not available +in the TTY buffer until the timeout valueexpires, do not proceed +to read the data from the TTY buffers as there is none. + +Occasionally corrupt data is received on UART lines while we wait +for vendor specific event from Controller. Expected vendor specific +events are received after the corrupt data. But we do not retry +and exit and this causes firmware download failures. So, retry once +if we did not get HCI event. + +Change-Id: I3b672a7762403690f8b934ca216492f16285e8da +Signed-off-by: Rupesh Tatiya +--- + tools/hciattach.c | 20 ++++++++++++- + tools/hciattach_rome.c | 77 +++++++++++++++++++++++++++++++++++++++----------- + tools/hciattach_rome.h | 3 ++ + 3 files changed, 83 insertions(+), 17 deletions(-) + +diff --git a/tools/hciattach.c b/tools/hciattach.c +index e3a915061440..c3cf10843303 100644 +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -109,16 +109,34 @@ int read_hci_event(int fd, unsigned char* buf, int size) + { + int remain, r; + int count = 0; ++ fd_set infids; ++ struct timeval timeout; + + if (size <= 0) + return -1; + ++ FD_ZERO (&infids); ++ FD_SET (fd, &infids); ++ timeout.tv_sec = 3; ++ timeout.tv_usec = 0; ++ ++ /* Check whether data is available in TTY buffer before calling read() */ ++ if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) { ++ fprintf(stderr, "%s: Timing out on select for 3 secs.\n", __FUNCTION__); ++ return -1; ++ } ++ else ++ fprintf(stderr, "%s: Data(HCI-CMD-COMP-EVENT) available in TTY Serial buffer\n", __FUNCTION__); ++ + /* The first byte identifies the packet type. For HCI event packets, it + * should be 0x04, so we read until we get to the 0x04. */ + while (1) { + r = read(fd, buf, 1); +- if (r <= 0) ++ if (r <= 0) { ++ fprintf(stderr, "%s: read() failed with return value: %d\n", ++ __FUNCTION__, r); + return -1; ++ } + if (buf[0] == 0x04) + break; + } +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index d0e2935b9997..d2687b1ef01a 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -326,42 +326,87 @@ failed: + } + + ++int wait_for_data(int fd, int maxTimeOut) ++{ ++ fd_set infids; ++ struct timeval timeout; ++ ++ if (maxTimeOut <= 0) { ++ fprintf(stderr, "%s: Invalid timeout value specified", __func__); ++ return -EINVAL; ++ } ++ ++ FD_ZERO (&infids); ++ FD_SET (fd, &infids); ++ timeout.tv_sec = maxTimeOut; ++ timeout.tv_usec = 0; ++ ++ /* Check whether data is available in TTY buffer before calling read() */ ++ if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) { ++ fprintf(stderr, "%s: Timing out on select for %d secs.\n", __FUNCTION__, maxTimeOut); ++ return -1; ++ } ++ else ++ fprintf(stderr, "%s: HCI-VS-EVENT available in TTY Serial buffer\n", ++ __FUNCTION__); ++ ++ return 1; ++} ++ + /* + * Read an VS HCI event from the given file descriptor. + */ + int read_vs_hci_event(int fd, unsigned char* buf, int size) + { +- int remain, r; ++ int remain, r, retry = 0; + int count = 0; +- fd_set infids; +- struct timeval timeout; + + if (size <= 0) { + fprintf(stderr, "Invalid size arguement!\n"); + return -1; + } + +- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", __FUNCTION__); +- +- FD_ZERO (&infids); +- FD_SET (fd, &infids); +- timeout.tv_sec = 3; +- timeout.tv_usec = 0; /* half second is a long time at 115.2 Kbps */ ++ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", ++ __FUNCTION__); + +- if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) +- fprintf(stderr, "%s: Timing out on select for 3 secs.\n", __FUNCTION__); +- else +- fprintf(stderr, "%s: Data available in TTY Serial buffer\n", __FUNCTION__); ++ /* Check whether data is available in TTY buffer before calling read() */ ++ if (wait_for_data(fd, SELECT_TIMEOUT) < 1) ++ return -1; + + /* The first byte identifies the packet type. For HCI event packets, it + * should be 0x04, so we read until we get to the 0x04. */ + /* It will keep reading until find 0x04 byte */ + while (1) { ++ /* Read UART Buffer for HCI-DATA */ + r = read(fd, buf, 1); +- if (r <= 0) +- return -1; +- if (buf[0] == 0x04) ++ if (r <= 0) { ++ fprintf(stderr, "%s: read() failed. error: %d\n", ++ __FUNCTION__, r); ++ return -1; ++ } ++ ++ /* Check if received data is HCI-DATA or not. ++ * If not HCI-DATA, then retry reading the UART Buffer once. ++ * Sometimes there could be corruption on the UART lines and to ++ * avoid that retry once reading the UART Buffer for HCI-DATA. ++ */ ++ if (buf[0] == 0x04) { /* Recvd. HCI DATA */ ++ retry = 0; + break; ++ } ++ else if (retry < MAX_RETRY_CNT){ /* Retry mechanism */ ++ retry++; ++ fprintf(stderr, "%s: Not an HCI-VS-Event! buf[0]: %d", ++ __FUNCTION__, buf[0]); ++ if (wait_for_data(fd, SELECT_TIMEOUT) < 1) ++ return -1; ++ else /* Data available in UART Buffer: Continue to read */ ++ continue; ++ } ++ else { /* RETRY failed : Exiting with failure */ ++ fprintf(stderr, "%s: RETRY failed!", __FUNCTION__); ++ return -1; ++ } + } + count++; + +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index a4abe9f73080..3efb71995c45 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -179,6 +179,9 @@ typedef struct + #define TAG_NUM_2 2 + #define TAG_BDADDR_OFFSET 7 + ++#define MAX_RETRY_CNT 1 ++#define SELECT_TIMEOUT 3 ++ + /* NVM Tags specifically used for ROME 1.0 */ + #define ROME_1_0_100022_1 0x101000221 + #define ROME_1_0_100019 0x101000190 + +From 9d81b1dd643966ba6f2ffb3f7658a24cfcb37df4 Mon Sep 17 00:00:00 2001 +From: Anantha Krishnan +Date: Wed, 20 Aug 2014 12:13:19 +0530 +Subject: [PATCH 08/19] bluetooth : Add support for TUFEELO firmware download + +Add TUFELLO chip version to allow firmware download. + +Change-Id: Ie3760fa64e8345bf9a84b2f047fde0ac1003b393 +--- + tools/hciattach_rome.c | 5 ++++- + tools/hciattach_rome.h | 3 ++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index d2687b1ef01a..84dfc97b5140 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1616,9 +1616,12 @@ int qca_soc_init(int fd, char *bdaddr) + nvm_file_path = ROME_NVM_TLV_2_0_1_PATH; + goto download; + case ROME_VER_3_0: +- case TUFELLO_VER_1_0: + rampatch_file_path = ROME_RAMPATCH_TLV_3_0_0_PATH; + nvm_file_path = ROME_NVM_TLV_3_0_0_PATH; ++ goto download; ++ case TUFELLO_VER_1_0: ++ rampatch_file_path = TF_RAMPATCH_TLV_1_0_0_PATH; ++ nvm_file_path = TF_NVM_TLV_1_0_0_PATH; + + download: + /* Change baud rate 115.2 kbps to 3Mbps*/ +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 3efb71995c45..9d18c576fcae 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -204,7 +204,8 @@ typedef struct + #define ROME_NVM_TLV_2_0_1_PATH "/lib/firmware/nvm_tlv_2.1.bin" + #define ROME_RAMPATCH_TLV_3_0_0_PATH "/lib/firmware/qca/rampatch_tlv_3.0.tlv" + #define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin" +- ++#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/rampatch_tlv_tf_1.0.tlv" ++#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/nvm_tlv_tf_1.0.bin" + + /****************************************************************************** + ** Local type definitions + +From ac12a2a733ad6cc6eed8ccdd3462d1fe1969fc54 Mon Sep 17 00:00:00 2001 +From: Anantha Krishnan +Date: Mon, 8 Dec 2014 14:52:16 +0530 +Subject: [PATCH 09/19] bluetooth: Add support for ROME 3.2 SOC. + +Add firmware download support for ROME 3.2 version. As part +of this, the Bluetooth on time is optimized based on event +handling while downloading rampatch files.From ROME 3.2 onwards, +the VS and command complete events will be sent depending the flag +indication present in the header. HOST can wait for VS and command +complete events only if specified in the header info. This greatly +reduces the time spent by HOST in waiting for 2 events from the +Controller before downloading each segment of the RAMPATCH file + +Change-Id: I9c4227a7a529455f4d120b2c9d065f3ec6b439e9 +--- + tools/hciattach_rome.c | 104 ++++++++++++++++++++++++++++++++++++++++++------- + tools/hciattach_rome.h | 16 +++++++- + 2 files changed, 103 insertions(+), 17 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 84dfc97b5140..c6d528f118e1 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -62,9 +62,11 @@ unsigned char *pdata_buffer = NULL; + patch_info rampatch_patch_info; + int rome_ver = ROME_VER_UNKNOWN; + unsigned char gTlv_type; ++unsigned char gtlv_dwndcfg; + char *rampatch_file_path; + char *nvm_file_path; + vnd_userial_cb_t vnd_userial; ++unsigned char wait_vsc_evt = TRUE; + /****************************************************************************** + ** Extern variables + ******************************************************************************/ +@@ -455,14 +457,16 @@ int hci_send_vs_cmd(int fd, unsigned char *cmd, unsigned char *rsp, int size) + goto failed; + } + +- /* Check for response from the Controller */ +- if (read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE) < 0) { +- ret = -ETIMEDOUT; +- fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); +- goto failed; ++ if (wait_vsc_evt) { ++ /* Check for response from the Controller */ ++ if (read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE) < 0) { ++ ret = -ETIMEDOUT; ++ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); ++ goto failed; ++ } ++ fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); + } + +- fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); + failed: + return ret; + } +@@ -903,6 +907,7 @@ int rome_get_tlv_file(char *file_path) + + /* To handle different event between rampatch and NVM */ + gTlv_type = ptlv_header->tlv_type; ++ gtlv_dwndcfg = ptlv_header->tlv.patch.dwnd_cfg; + + if(ptlv_header->tlv_type == TLV_TYPE_PATCH){ + fprintf(stderr, "====================================================\n"); +@@ -914,6 +919,7 @@ int rome_get_tlv_file(char *file_path) + fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len); + fprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver); + fprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm); ++ fprintf(stderr, "Event Handling\t\t\t : 0x%x", ptlv_header->tlv.patch.dwnd_cfg); + fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1); + fprintf(stderr, "Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id); + fprintf(stderr, "Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver); +@@ -1023,19 +1029,83 @@ int rome_tlv_dnld_req(int fd, int tlv_size) + fprintf(stderr, "%s: TLV size: %d, Total Seg num: %d, remain size: %d\n", + __FUNCTION__,tlv_size, total_segment, remain_size); + +- for(i=0;i= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH ) +- && !remain_size && ((i+1) == total_segment))? FALSE: TRUE; ++ if (gTlv_type == TLV_TYPE_PATCH) { ++ /* Prior to Rome version 3.2(including inital few rampatch release of ++ * Rome 3.2), the event handling mechanism is ROME_SKIP_EVT_NONE. After ++ * few release of rampatch for Rome 3.2, the mechamism is changed to ++ * ROME_SKIP_EVT_VSE_CC. Rest of the mechanism is not used for now ++ */ ++ switch(gtlv_dwndcfg) ++ { ++ case ROME_SKIP_EVT_NONE: ++ wait_vsc_evt = TRUE; ++ wait_cc_evt = TRUE; ++ fprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_NONE", __func__); ++ break; ++ case ROME_SKIP_EVT_VSE_CC: ++ wait_vsc_evt = FALSE; ++ wait_cc_evt = FALSE; ++ fprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_VSE_CC", __func__); ++ break; ++ /* Not handled for now */ ++ case ROME_SKIP_EVT_VSE: ++ case ROME_SKIP_EVT_CC: ++ default: ++ fprintf(stderr, "%s: Unsupported Event handling: %d", __func__, gtlv_dwndcfg); ++ break; ++ } ++ } else { ++ wait_vsc_evt = TRUE; ++ wait_cc_evt = TRUE; ++ } ++ ++ for(i = 0; i < total_segment; i++) { ++ if((i+1) == total_segment) { ++ if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && ++ (gTlv_type == TLV_TYPE_PATCH)) { ++ /* If the Rome version is from 1.1 to 3.1 ++ * 1. No CCE for the last command segment but all other segment ++ * 2. All the command segments get VSE including the last one ++ */ ++ wait_cc_evt = !remain_size ? FALSE: TRUE; ++ } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { ++ /* If the Rome version is 3.2 ++ * 1. None of the command segments receive CCE ++ * 2. No command segments receive VSE except the last one ++ * 3. If gtlv_dwndcfg is ROME_SKIP_EVT_NONE then the logic is ++ * same as Rome 2.1, 2.2, 3.0 ++ */ ++ if (gtlv_dwndcfg == ROME_SKIP_EVT_NONE) { ++ wait_cc_evt = !remain_size ? FALSE: TRUE; ++ } else if (gtlv_dwndcfg == ROME_SKIP_EVT_VSE_CC) { ++ wait_vsc_evt = !remain_size ? TRUE: FALSE; ++ } ++ } ++ } ++ + if((err = rome_tlv_dnld_segment(fd, i, MAX_SIZE_PER_TLV_SEGMENT, wait_cc_evt )) < 0) + goto error; + } + +- /* In case remain data still remain, last rampatch segment command will not wait +- for command complete event here */ +- wait_cc_evt = ((rome_ver >= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH ) +- && remain_size )? FALSE:TRUE; ++ if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { ++ /* If the Rome version is from 1.1 to 3.1 ++ * 1. No CCE for the last command segment but all other segment ++ * 2. All the command segments get VSE including the last one ++ */ ++ wait_cc_evt = remain_size ? FALSE: TRUE; ++ } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { ++ /* If the Rome version is 3.2 ++ * 1. None of the command segments receive CCE ++ * 2. No command segments receive VSE except the last one ++ * 3. If gtlv_dwndcfg is ROME_SKIP_EVT_NONE then the logic is ++ * same as Rome 2.1, 2.2, 3.0 ++ */ ++ if (gtlv_dwndcfg == ROME_SKIP_EVT_NONE) { ++ wait_cc_evt = remain_size ? FALSE: TRUE; ++ } else if (gtlv_dwndcfg == ROME_SKIP_EVT_VSE_CC) { ++ wait_vsc_evt = remain_size ? TRUE: FALSE; ++ } ++ } + + if(remain_size) err =rome_tlv_dnld_segment(fd, i, remain_size, wait_cc_evt); + +@@ -1619,6 +1689,10 @@ int qca_soc_init(int fd, char *bdaddr) + rampatch_file_path = ROME_RAMPATCH_TLV_3_0_0_PATH; + nvm_file_path = ROME_NVM_TLV_3_0_0_PATH; + goto download; ++ case ROME_VER_3_2: ++ rampatch_file_path = ROME_RAMPATCH_TLV_3_0_2_PATH; ++ nvm_file_path = ROME_NVM_TLV_3_0_2_PATH; ++ goto download; + case TUFELLO_VER_1_0: + rampatch_file_path = TF_RAMPATCH_TLV_1_0_0_PATH; + nvm_file_path = TF_NVM_TLV_1_0_0_PATH; +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 9d18c576fcae..77e85e7e7b19 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -204,9 +204,17 @@ typedef struct + #define ROME_NVM_TLV_2_0_1_PATH "/lib/firmware/nvm_tlv_2.1.bin" + #define ROME_RAMPATCH_TLV_3_0_0_PATH "/lib/firmware/qca/rampatch_tlv_3.0.tlv" + #define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin" ++#define ROME_RAMPATCH_TLV_3_0_2_PATH "/lib/firmware/qca/rampatch_tlv_3.2.tlv" ++#define ROME_NVM_TLV_3_0_2_PATH "/lib/firmware/qca/nvm_tlv_3.2.bin" + #define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/rampatch_tlv_tf_1.0.tlv" + #define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/nvm_tlv_tf_1.0.bin" + ++/* This header value in rampatch file decides event handling mechanism in the HOST */ ++#define ROME_SKIP_EVT_NONE 0x00 ++#define ROME_SKIP_EVT_VSE 0x01 ++#define ROME_SKIP_EVT_CC 0x02 ++#define ROME_SKIP_EVT_VSE_CC 0x03 ++ + /****************************************************************************** + ** Local type definitions + ******************************************************************************/ +@@ -251,7 +259,8 @@ typedef struct { + unsigned int tlv_patch_data_len; + unsigned char sign_ver; + unsigned char sign_algorithm; +- unsigned short reserved1; ++ unsigned char dwnd_cfg; ++ unsigned char reserved1; + unsigned short prod_id; + unsigned short build_ver; + unsigned short patch_ver; +@@ -306,7 +315,8 @@ enum{ + ROME_PATCH_VER_0100 = 0x0100, + ROME_PATCH_VER_0101 = 0x0101, + ROME_PATCH_VER_0200 = 0x0200, +- ROME_PATCH_VER_0300 = 0x0300 ++ ROME_PATCH_VER_0300 = 0x0300, ++ ROME_PATCH_VER_0302 = 0x0302 + }; + + enum{ +@@ -314,6 +324,7 @@ enum{ + ROME_SOC_ID_11 = 0x00000011, + ROME_SOC_ID_13 = 0x00000013, + ROME_SOC_ID_22 = 0x00000022, ++ ROME_SOC_ID_44 = 0x00000044 + }; + + enum{ +@@ -323,6 +334,7 @@ enum{ + ROME_VER_1_3 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_00 ), + ROME_VER_2_1 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_11 ), + ROME_VER_3_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_22 ), ++ ROME_VER_3_2 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_44 ), + TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ) + }; + #endif /* HW_ROME_H */ + +From f7cc3b22522cfc66a7c4126630c6222f22be17f6 Mon Sep 17 00:00:00 2001 +From: Anantha Krishnan +Date: Thu, 4 Dec 2014 17:23:58 +0530 +Subject: [PATCH 10/19] bluetooth: Use correct TTY ioctl calls for flow control + operations + +BT firmware download application is using incorrect APIs for +performing flow off and flow on operations. As a result, the local +UART Controller is detecting breaks errors on the UART HW lines. + +Appliaction should use TIOCMGET and TIOCMSET ioctl()'s for flow +control operations instead of the tcsetattr() call. Also, the +application should set the value of "number of bits per character" +value to 8 and not as 5. + +Due to incorrect APIs used for flow control operation and wrong +value configured for CSIZE parameter, the local UART Controller +detected break errors on the UART HW lines. This caused the +firmware download operation to fail and resulted in BT ON failure. + +Change-Id: Id0ac1276609eceb528163860cc87267aaa50fede +--- + tools/hciattach_rome.c | 67 +++++++++++++++++++++++++++++++++----------------- + tools/hciattach_rome.h | 6 +++-- + 2 files changed, 49 insertions(+), 24 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index c6d528f118e1..1e689273b851 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1,6 +1,6 @@ + /* + * +- * Copyright (c) 2013, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. + * Not a Contribution. + * + * Copyright 2012 The Android Open Source Project +@@ -31,6 +31,7 @@ + + #define LOG_TAG "bt_vendor" + #include ++#include + #include + #include + #include +@@ -139,6 +140,16 @@ void userial_vendor_set_baud(unsigned char userial_baud) + unsigned int tcio_baud; + fprintf(stderr, "## userial_vendor_set_baud: %d\n", userial_baud); + ++ if (tcgetattr(vnd_userial.fd, &vnd_userial.termios) < 0) { ++ perror("Can't get port settings"); ++ return; ++ } ++ cfmakeraw(&vnd_userial.termios); ++ vnd_userial.termios.c_cflag |= CLOCAL; ++ vnd_userial.termios.c_cflag |= CREAD; ++ vnd_userial.termios.c_cflag |= CS8; ++ tcsetattr(vnd_userial.fd, TCSANOW, &vnd_userial.termios); ++ + userial_to_tcio_baud(userial_baud, &tcio_baud); + + cfsetospeed(&vnd_userial.termios, tcio_baud); +@@ -169,6 +180,7 @@ int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data) + cfmakeraw(&ti); + ti.c_cflag |= CLOCAL; + ti.c_cflag |= CREAD; ++ ti.c_cflag |= CS8; + + switch(op) + { +@@ -1445,6 +1457,29 @@ error: + + } + ++static void flow_control(int fd, int opt) ++{ ++ struct termios c_opt; ++ ++ ioctl(fd, TIOCMGET, &c_opt); ++ c_opt.c_cc[VTIME] = 0; /* inter-character timer unused */ ++ c_opt.c_cc[VMIN] = 0; /* blocking read until 8 chars received */ ++ c_opt.c_cflag &= ~CSIZE; ++ c_opt.c_cflag |= (CS8 | CLOCAL | CREAD); ++ if (MSM_ENABLE_FLOW_CTRL) ++ c_opt.c_cflag |= CRTSCTS; ++ else if (MSM_DISABLE_FLOW_CTRL) ++ c_opt.c_cflag |= ~CRTSCTS; ++ else { ++ fprintf(stderr, "%s: Incorrect option passed for TIOCMSET\n", __func__); ++ return; ++ } ++ c_opt.c_iflag = IGNPAR; ++ c_opt.c_oflag = 0; ++ c_opt.c_lflag = 0; ++ ioctl(fd, TIOCMSET, &c_opt); ++} ++ + + int rome_set_baudrate_req(int fd) + { +@@ -1464,12 +1499,10 @@ int rome_set_baudrate_req(int fd) + + /* Total length of the packet to be sent to the Controller */ + size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN); ++ + /* Flow off during baudrate change */ +- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0) +- { +- fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err); +- goto error; +- } ++ flow_control(fd, MSM_DISABLE_FLOW_CTRL); ++ + /* Send the HCI command packet to UART for transmission */ + fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ; + err = write(fd, cmd, size); +@@ -1481,11 +1514,8 @@ int rome_set_baudrate_req(int fd) + userial_vendor_set_baud(USERIAL_BAUD_3M); + + /* Flow on after changing local uart baudrate */ +- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0) +- { +- fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err); +- return err; +- } ++ flow_control(fd, MSM_ENABLE_FLOW_CTRL); ++ + /* Check for response from the Controller */ + if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { + fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); +@@ -1528,11 +1558,8 @@ int rome_hci_reset_req(int fd) + size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE); + + /* Flow off during baudrate change */ +- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0) +- { +- fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err); +- goto error; +- } ++ flow_control(fd, MSM_DISABLE_FLOW_CTRL); ++ + /* Send the HCI command packet to UART for transmission */ + fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]); + err = write(fd, cmd, size); +@@ -1545,11 +1572,8 @@ int rome_hci_reset_req(int fd) + userial_vendor_set_baud(USERIAL_BAUD_3M); + + /* Flow on after changing local uart baudrate */ +- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0) +- { +- fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err); +- return err; +- } ++ flow_control(fd, MSM_ENABLE_FLOW_CTRL); ++ + /* Wait for command complete event */ + err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); + if ( err < 0) { +@@ -1616,7 +1640,6 @@ int qca_soc_init(int fd, char *bdaddr) + int err = -1; + int size; + +- fprintf(stderr, " %s \n", __FUNCTION__); + vnd_userial.fd = fd; + /* Get Rome version information */ + if((err = rome_patch_ver_req(fd)) <0){ +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 77e85e7e7b19..ef3647e6a69b 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -1,7 +1,7 @@ + /* +- * Copyright 2012 The Android Open Source Project +- * Copyright (c) 2013, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. + * Not a Contribution. ++ * Copyright 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. +@@ -40,6 +40,8 @@ + #define NVITEM_SIZE 2 + #define PERSIST_HEADER_LEN 3 + #define BD_ADDR_LEN 6 ++#define MSM_ENABLE_FLOW_CTRL 16 ++#define MSM_DISABLE_FLOW_CTRL 17 + + unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + typedef enum { + +From bd7d1fce8de4639445563442a8448468d671fad2 Mon Sep 17 00:00:00 2001 +From: Anantha Krishnan +Date: Tue, 20 Jan 2015 12:43:20 +0530 +Subject: [PATCH 11/19] bluetooth: Add support for multi baud rate + +Currently BT operates only at 3M baud rate. Provide option +to configure the pre-defined baud rate values as supported by the +target platform. + +Change-Id: I4bbaf7db01ffb983c38dca7c4a4a56f579c678a8 +--- + tools/hciattach.c | 2 +- + tools/hciattach.h | 2 +- + tools/hciattach_rome.c | 109 ++++++++++++++++++++++++++++++++++++++++++------- + tools/hciattach_rome.h | 23 +++++++++++ + 4 files changed, 119 insertions(+), 17 deletions(-) + +diff --git a/tools/hciattach.c b/tools/hciattach.c +index c3cf10843303..dda639cabca3 100644 +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -286,7 +286,7 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti) + static int qca(int fd, struct uart_t *u, struct termios *ti) + { + fprintf(stderr,"qca\n"); +- return qca_soc_init(fd, u->bdaddr); ++ return qca_soc_init(fd, u->speed, u->bdaddr); + } + + static int qualcomm(int fd, struct uart_t *u, struct termios *ti) +diff --git a/tools/hciattach.h b/tools/hciattach.h +index 0656a845223c..49e59321fcac 100644 +--- a/tools/hciattach.h ++++ b/tools/hciattach.h +@@ -64,7 +64,7 @@ int ath3k_init(int fd, int speed, int init_speed, char *bdaddr, + struct termios *ti); + int ath3k_post(int fd, int pm); + int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr); +-int qca_soc_init(int fd, char *bdaddr); ++int qca_soc_init(int fd, int speed, char *bdaddr); + int intel_init(int fd, int init_speed, int *speed, struct termios *ti); + int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti, + const char *bdaddr); +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 1e689273b851..37974290ae0a 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1481,7 +1481,7 @@ static void flow_control(int fd, int opt) + } + + +-int rome_set_baudrate_req(int fd) ++int rome_set_baudrate_req(int fd, int local_baud_rate, int controller_baud_rate) + { + int size, err = 0; + unsigned char cmd[HCI_MAX_CMD_SIZE]; +@@ -1495,7 +1495,7 @@ int rome_set_baudrate_req(int fd) + cmd[0] = HCI_COMMAND_PKT; + cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF); + cmd_hdr->plen = VSC_SET_BAUDRATE_REQ_LEN; +- cmd[4] = BAUDRATE_3000000; ++ cmd[4] = controller_baud_rate; + + /* Total length of the packet to be sent to the Controller */ + size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN); +@@ -1511,7 +1511,7 @@ int rome_set_baudrate_req(int fd) + goto error; + } + /* Change Local UART baudrate to high speed UART */ +- userial_vendor_set_baud(USERIAL_BAUD_3M); ++ userial_vendor_set_baud(local_baud_rate); + + /* Flow on after changing local uart baudrate */ + flow_control(fd, MSM_ENABLE_FLOW_CTRL); +@@ -1537,7 +1537,7 @@ error: + } + + +-int rome_hci_reset_req(int fd) ++int rome_hci_reset_req(int fd, char baud) + { + int size, err = 0; + unsigned char cmd[HCI_MAX_CMD_SIZE]; +@@ -1569,7 +1569,7 @@ int rome_hci_reset_req(int fd) + } + + /* Change Local UART baudrate to high speed UART */ +- userial_vendor_set_baud(USERIAL_BAUD_3M); ++ userial_vendor_set_baud(baud); + + /* Flow on after changing local uart baudrate */ + flow_control(fd, MSM_ENABLE_FLOW_CTRL); +@@ -1635,10 +1635,69 @@ int read_bd_address(unsigned char *bdaddr) + return 0; + } + +-int qca_soc_init(int fd, char *bdaddr) ++int isSpeedValid(int speed, int *local_baud_rate, int *controller_baud_rate) ++{ ++ switch(speed) { ++ case 9600: ++ *local_baud_rate = USERIAL_BAUD_9600; ++ *controller_baud_rate = BAUDRATE_9600; ++ break; ++ case 19200: ++ *local_baud_rate = USERIAL_BAUD_19200; ++ *controller_baud_rate = BAUDRATE_19200; ++ break; ++ case 57600: ++ *local_baud_rate = USERIAL_BAUD_57600; ++ *controller_baud_rate = BAUDRATE_57600; ++ break; ++ case 115200: ++ *local_baud_rate = USERIAL_BAUD_115200; ++ *controller_baud_rate = BAUDRATE_115200; ++ break; ++ case 230400: ++ *local_baud_rate = USERIAL_BAUD_230400; ++ *controller_baud_rate = BAUDRATE_230400; ++ break; ++ case 460800: ++ *local_baud_rate = USERIAL_BAUD_460800; ++ *controller_baud_rate = BAUDRATE_460800; ++ break; ++ case 921600: ++ *local_baud_rate = USERIAL_BAUD_921600; ++ *controller_baud_rate = BAUDRATE_921600; ++ break; ++ case 1000000: ++ *local_baud_rate = USERIAL_BAUD_1M; ++ *controller_baud_rate = BAUDRATE_1000000; ++ break; ++ case 2000000: ++ *local_baud_rate = USERIAL_BAUD_2M; ++ *controller_baud_rate = BAUDRATE_2000000; ++ break; ++ case 3000000: ++ *local_baud_rate = USERIAL_BAUD_3M; ++ *controller_baud_rate = BAUDRATE_3000000; ++ break; ++ case 4000000: ++ *local_baud_rate = USERIAL_BAUD_4M; ++ *controller_baud_rate = BAUDRATE_4000000; ++ break; ++ case 300: ++ case 600: ++ case 1200: ++ case 2400: ++ default: ++ fprintf(stderr, "Invalid baud rate passed!\n"); ++ *local_baud_rate = *controller_baud_rate = -1; ++ break; ++ } ++ return -1; ++} ++ ++int qca_soc_init(int fd, int speed, char *bdaddr) + { + int err = -1; +- int size; ++ int size, local_baud_rate = 0, controller_baud_rate = 0; + + vnd_userial.fd = fd; + /* Get Rome version information */ +@@ -1687,7 +1746,7 @@ int qca_soc_init(int fd, char *bdaddr) + } + + /* Change baud rate 115.2 kbps to 3Mbps*/ +- err = rome_hci_reset_req(fd); ++ err = rome_hci_reset_req(fd, local_baud_rate); + if ( err <0 ) { + fprintf(stderr, "HCI Reset Failed !!\n"); + goto error; +@@ -1721,13 +1780,23 @@ int qca_soc_init(int fd, char *bdaddr) + nvm_file_path = TF_NVM_TLV_1_0_0_PATH; + + download: +- /* Change baud rate 115.2 kbps to 3Mbps*/ +- err = rome_set_baudrate_req(fd); +- if (err < 0) { +- fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); +- goto error; ++ /* Check if user requested for 115200 kbps */ ++ if (speed == 115200) { ++ local_baud_rate = USERIAL_BAUD_115200; ++ controller_baud_rate = BAUDRATE_115200; + } +- fprintf(stderr, "%s: Baud rate changed successfully \n", __FUNCTION__); ++ else { ++ /* Change only if baud rate requested is valid or not */ ++ isSpeedValid(speed, &local_baud_rate, &controller_baud_rate); ++ if (local_baud_rate < 0 || controller_baud_rate < 0) ++ goto error; ++ ++ err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate); ++ if (err < 0) { ++ fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); ++ goto error; ++ } ++ } + + /* Donwload TLV files (rampatch, NVM) */ + err = rome_download_tlv_file(fd); +@@ -1737,8 +1806,18 @@ download: + } + fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__); + ++ /* ++ * Overriding the baud rate value in NVM file with the user ++ * requested baud rate, since default baud rate in NVM file is 3M. ++ */ ++ err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate); ++ if (err < 0) { ++ fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); ++ goto error; ++ } ++ + /* Perform HCI reset here*/ +- err = rome_hci_reset_req(fd); ++ err = rome_hci_reset_req(fd, local_baud_rate); + if ( err <0 ) { + fprintf(stderr, "HCI Reset Failed !!!\n"); + goto error; +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index ef3647e6a69b..1500ddd3a79f 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -78,6 +78,29 @@ typedef struct + #define USERIAL_BAUD_4M 15 + #define USERIAL_BAUD_AUTO 16 + ++/* Vendor specific baud rate values */ ++#define UART_Baud_Rate_Baud_9600 4 ++#define UART_Baud_Rate_Baud_19200 3 ++#define UART_Baud_Rate_Baud_57600 1 ++#define UART_Baud_Rate_Baud_115200 0 ++#define UART_Baud_Rate_Baud_230400 5 ++#define UART_Baud_Rate_Baud_460800 7 ++#define UART_Baud_Rate_Baud_921600 10 ++#define UART_Baud_Rate_Baud_1000000 11 ++#define UART_Baud_Rate_Baud_2000000 13 ++#define UART_Baud_Rate_Baud_3000000 14 ++#define UART_Baud_Rate_Baud_4000000 15 ++ ++#define UART_Baud_Rate_Baud_250000 6 ++#define UART_Baud_Rate_Baud_500000 8 ++#define UART_Baud_Rate_Baud_720000 9 ++#define UART_Baud_Rate_Baud_125000 12 ++#define UART_Baud_Rate_Baud_1600000 16 ++#define UART_Baud_Rate_Baud_3200000 17 ++#define UART_Baud_Rate_Baud_3500000 18 ++ ++ ++ + #ifndef FALSE + #define FALSE 0 + #endif + +From 7dc9c5e316aa9a22899259ce296136b2e257735d Mon Sep 17 00:00:00 2001 +From: Kamal Negi +Date: Tue, 30 Dec 2014 19:15:08 +0530 +Subject: [PATCH 12/19] Override PCM Settings by reading configuration file + +Configure the PCM role as master or slave depending upon +the platform's support. This configuration is provided +in the config file which is read during the firmware +download process and the default PCM configuration is +overwritten with this value. + +Change-Id: If0eae58b4cd32d75b3bcb669bc73dca67652473c +Signed-off-by: Kamal Negi +--- + tools/hciattach_rome.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++--- + tools/hciattach_rome.h | 8 ++++++ + 2 files changed, 71 insertions(+), 4 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 37974290ae0a..99866e23e99e 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1,6 +1,6 @@ + /* + * +- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. + * Not a Contribution. + * + * Copyright 2012 The Android Open Source Project +@@ -873,6 +873,44 @@ error: + return err; + } + ++int get_value_from_config(char *file_path,char *param) ++{ ++ FILE *pfile = NULL; ++ char *line = NULL; ++ char *pch = NULL; ++ char param_str[20]; ++ int bytes_read = 0, position; ++ int ret = -1; ++ ++ if (!file_path || !param) { ++ fprintf(stderr,"Invalid arguments\n"); ++ return -EINVAL; ++ } ++ ++ pfile = fopen(file_path, "r" ); ++ if (!pfile) { ++ fprintf(stderr, "Failed to open %s\n", file_path); ++ return ret; ++ } ++ ++ while (getline(&line, &bytes_read, pfile) > 0 ) { ++ if (line[0] != '#' && line[0] != '\n') { ++ pch = memchr(line, '=', strlen(line)); ++ if (pch != NULL) { ++ position = pch - line; ++ strncpy(param_str, line, position); ++ if (strncmp(param_str, param, position) == 0) { ++ ret = atoi(pch + 1); ++ break; ++ } ++ } ++ } ++ } ++ free(line); ++ fclose(pfile); ++ return ret; ++} ++ + int rome_get_tlv_file(char *file_path) + { + FILE * pFile; +@@ -884,7 +922,7 @@ int rome_get_tlv_file(char *file_path) + unsigned char data_buf[PRINT_BUF_SIZE]={0,}; + unsigned char *nvm_byte_ptr; + unsigned char bdaddr[6]; +- ++ unsigned short pcm_value; + fprintf(stderr, "File Open (%s)\n", file_path); + pFile = fopen ( file_path , "r" ); + if (pFile==NULL) {; +@@ -970,9 +1008,30 @@ int rome_get_tlv_file(char *file_path) + *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), + *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); + } ++ /* Read from file and check what PCM Configuration is required: ++ * Master = 0 /Slave = 1 */ ++ /* Override PCM configuration */ ++ if (nvm_ptr->tag_id == TAG_NUM_44) { ++ if ((pcm_value = ++ get_value_from_config(PCM_CONFIG_FILE_PATH, "PCM")) >= 0) { ++ ++ if (pcm_value == PCM_SLAVE) { ++ nvm_byte_ptr[PCM_MS_OFFSET_1] |= ++ (1 << PCM_ROLE_BIT_OFFSET); ++ nvm_byte_ptr[PCM_MS_OFFSET_2] |= ++ (1 << PCM_ROLE_BIT_OFFSET); ++ } else if (pcm_value == PCM_MASTER) { ++ nvm_byte_ptr[PCM_MS_OFFSET_1] &= ++ (~(1 << PCM_ROLE_BIT_OFFSET)); ++ nvm_byte_ptr[PCM_MS_OFFSET_2] &= ++ (~(1 << PCM_ROLE_BIT_OFFSET)); ++ } ++ } ++ } + +- for(i =0;(itag_len && (i*3 + 2) tag_len && (i*3 + 2) < PRINT_BUF_SIZE);i++) ++ snprintf((char *) data_buf, PRINT_BUF_SIZE, "%s%.02x ", ++ (char *)data_buf, *(nvm_byte_ptr + i)); + + fprintf(stderr, "TAG Data\t\t\t : %s\n", data_buf); + +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 1500ddd3a79f..f591c10e4f2b 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -202,8 +202,15 @@ typedef struct + #define NVM_ACCESS_SET 0x01 + #define TAG_NUM_OFFSET 5 + #define TAG_NUM_2 2 ++#define TAG_NUM_44 44 + #define TAG_BDADDR_OFFSET 7 + ++#define PCM_MS_OFFSET_1 9 ++#define PCM_MS_OFFSET_2 33 ++ ++#define PCM_SLAVE 1 ++#define PCM_MASTER 0 ++#define PCM_ROLE_BIT_OFFSET 4 + #define MAX_RETRY_CNT 1 + #define SELECT_TIMEOUT 3 + +@@ -240,6 +247,7 @@ typedef struct + #define ROME_SKIP_EVT_CC 0x02 + #define ROME_SKIP_EVT_VSE_CC 0x03 + ++#define PCM_CONFIG_FILE_PATH "/etc/bluetooth/pcm.conf" + /****************************************************************************** + ** Local type definitions + ******************************************************************************/ + +From 9eb8220969598d63be3b918b49b6258387629bf3 Mon Sep 17 00:00:00 2001 +From: Rupesh Tatiya +Date: Thu, 29 Jan 2015 15:36:27 +0530 +Subject: [PATCH 13/19] Add support for Tufello 1.1 SOC + +Enable mechanism to download firmware for Tufello 1.1 SOC. +Also, use correct firmware file path for Tufello 1.0. + +Change-Id: I915e48023e45de9e2550336a3de9a07f2b788189 +Signed-off-by: Rupesh Tatiya +--- + tools/hciattach_rome.c | 29 ++++++++++++++++++----------- + tools/hciattach_rome.h | 10 +++++++--- + 2 files changed, 25 insertions(+), 14 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 99866e23e99e..fee36f904e04 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -621,7 +621,7 @@ int rome_edl_set_patch_request(int fd) + -1, PATCH_HDR_LEN + 1); + + /* Total length of the packet to be sent to the Controller */ +- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); + + /* Send HCI Command packet to Controller */ + err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); +@@ -670,7 +670,7 @@ int rome_edl_patch_download_request(int fd) + index, MAX_DATA_PER_SEGMENT); + + /* Total length of the packet to be sent to the Controller */ +- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); + + /* Initialize the RSP packet everytime to 0 */ + memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); +@@ -707,7 +707,7 @@ int rome_edl_patch_download_request(int fd) + memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); + + /* Total length of the packet to be sent to the Controller */ +- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); + + /* Send HCI Command packet to Controller */ + err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); +@@ -824,7 +824,7 @@ int rome_attach_rampatch(int fd) + -1, EDL_PATCH_CMD_LEN); + + /* Total length of the packet to be sent to the Controller */ +- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); + + /* Send HCI Command packet to Controller */ + err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); +@@ -854,7 +854,7 @@ int rome_rampatch_reset(int fd) + -1, EDL_PATCH_CMD_LEN); + + /* Total length of the packet to be sent to the Controller */ +- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); + + /* Send HCI Command packet to Controller */ + err = write(fd, cmd, size); +@@ -1058,7 +1058,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc + unsigned char cmd[HCI_MAX_CMD_SIZE]; + unsigned char rsp[HCI_MAX_EVENT_SIZE]; + +- fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d\n", __FUNCTION__, index, seg_size); ++ fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d wait_cc_evt = 0x%x\n", __FUNCTION__, index, seg_size, wait_cc_evt); + + /* Frame the HCI CMD PKT to be sent to Controller*/ + frame_hci_cmd_pkt(cmd, EDL_PATCH_TLV_REQ_CMD, 0, index, seg_size); +@@ -1092,6 +1092,7 @@ int rome_tlv_dnld_req(int fd, int tlv_size) + { + int total_segment, remain_size, i, err = -1; + unsigned char wait_cc_evt; ++ unsigned int rom = rome_ver >> 16; + + total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT; + remain_size = (tlv_size < MAX_SIZE_PER_TLV_SEGMENT)?\ +@@ -1132,14 +1133,15 @@ int rome_tlv_dnld_req(int fd, int tlv_size) + + for(i = 0; i < total_segment; i++) { + if((i+1) == total_segment) { +- if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && ++ if ((rom >= ROME_PATCH_VER_0100) && (rom < ROME_PATCH_VER_0302) && + (gTlv_type == TLV_TYPE_PATCH)) { + /* If the Rome version is from 1.1 to 3.1 + * 1. No CCE for the last command segment but all other segment + * 2. All the command segments get VSE including the last one + */ + wait_cc_evt = !remain_size ? FALSE: TRUE; +- } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { ++ } else if ((rom == ROME_PATCH_VER_0302) && ++ (gTlv_type == TLV_TYPE_PATCH)) { + /* If the Rome version is 3.2 + * 1. None of the command segments receive CCE + * 2. No command segments receive VSE except the last one +@@ -1158,13 +1160,14 @@ int rome_tlv_dnld_req(int fd, int tlv_size) + goto error; + } + +- if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { ++ if ((rom >= ROME_PATCH_VER_0100) && (rom < ROME_PATCH_VER_0302) && ++ (gTlv_type == TLV_TYPE_PATCH)) { + /* If the Rome version is from 1.1 to 3.1 + * 1. No CCE for the last command segment but all other segment + * 2. All the command segments get VSE including the last one + */ + wait_cc_evt = remain_size ? FALSE: TRUE; +- } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { ++ } else if ((rom == ROME_PATCH_VER_0302) && (gTlv_type == TLV_TYPE_PATCH)) { + /* If the Rome version is 3.2 + * 1. None of the command segments receive CCE + * 2. No command segments receive VSE except the last one +@@ -1837,6 +1840,10 @@ int qca_soc_init(int fd, int speed, char *bdaddr) + case TUFELLO_VER_1_0: + rampatch_file_path = TF_RAMPATCH_TLV_1_0_0_PATH; + nvm_file_path = TF_NVM_TLV_1_0_0_PATH; ++ goto download; ++ case TUFELLO_VER_1_1: ++ rampatch_file_path = TF_RAMPATCH_TLV_1_0_1_PATH; ++ nvm_file_path = TF_NVM_TLV_1_0_1_PATH; + + download: + /* Check if user requested for 115200 kbps */ +@@ -1881,7 +1888,7 @@ download: + fprintf(stderr, "HCI Reset Failed !!!\n"); + goto error; + } +- fprintf(stderr, "HCI Reset is done\n"); ++ fprintf(stderr, "HCI Reset is done\n"); + + break; + case ROME_VER_UNKNOWN: +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index f591c10e4f2b..95d5f1e8a5c2 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -238,8 +238,10 @@ typedef struct + #define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin" + #define ROME_RAMPATCH_TLV_3_0_2_PATH "/lib/firmware/qca/rampatch_tlv_3.2.tlv" + #define ROME_NVM_TLV_3_0_2_PATH "/lib/firmware/qca/nvm_tlv_3.2.bin" +-#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/rampatch_tlv_tf_1.0.tlv" +-#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/nvm_tlv_tf_1.0.bin" ++#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/qca/rampatch_tlv_tf_1.0.tlv" ++#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/qca/nvm_tlv_tf_1.0.bin" ++#define TF_RAMPATCH_TLV_1_0_1_PATH "/lib/firmware/qca/rampatch_tlv_tf_1.1.tlv" ++#define TF_NVM_TLV_1_0_1_PATH "/lib/firmware/qca/nvm_tlv_tf_1.1.bin" + + /* This header value in rampatch file decides event handling mechanism in the HOST */ + #define ROME_SKIP_EVT_NONE 0x00 +@@ -357,6 +359,7 @@ enum{ + ROME_SOC_ID_11 = 0x00000011, + ROME_SOC_ID_13 = 0x00000013, + ROME_SOC_ID_22 = 0x00000022, ++ ROME_SOC_ID_23 = 0x00000023, + ROME_SOC_ID_44 = 0x00000044 + }; + +@@ -368,6 +371,7 @@ enum{ + ROME_VER_2_1 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_11 ), + ROME_VER_3_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_22 ), + ROME_VER_3_2 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_44 ), +- TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ) ++ TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ), ++ TUFELLO_VER_1_1 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_23 ) + }; + #endif /* HW_ROME_H */ + +From f55d710cf43d008e42ce06ead49dc0dfbf97d3a1 Mon Sep 17 00:00:00 2001 +From: Anantha Krishnan +Date: Wed, 4 Feb 2015 12:29:07 +0530 +Subject: [PATCH 14/19] bluetooth: Vote UART CLK ON prior to firmware download + process + +Before starting the firmware download process, vote UART CLK ON +to avoid triggering the dynamic suspend of UART driver. Post +firmware download and in error scenarios vote UART CLK OFF. + +As per design, the UART driver enters into dynamic suspend if +there are no activity on the UART lines for 100ms. Depending upon +the rampatch size, the BT Controller takes time to apply the +downloaded rampatch segments and in sending the vendor specific +event. If the BT Controller takes > 100ms time in sending the +vendor specific event, the UART driver enters into suspend state. + +As a result, UART driver fails to process the last vendor specific +event sent by the BT Controller. The VSE sent by BT Controller +wakes up the UART driver, but the data is not processed causing +firmware download failures. + +Hence, vote UART CLK ON prior to firmware download process and +vote UART CLK OFF post firmware download proess and in error +scenarios. + +Change-Id: I447ded33ad1cfaa020b491effce368fbfe41f894 +--- + tools/hciattach_rome.c | 13 +++++++++++++ + tools/hciattach_rome.h | 2 ++ + 2 files changed, 15 insertions(+) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index fee36f904e04..574ceac6c750 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1762,6 +1762,14 @@ int qca_soc_init(int fd, int speed, char *bdaddr) + int size, local_baud_rate = 0, controller_baud_rate = 0; + + vnd_userial.fd = fd; ++ ++ /* Vote for UART CLK prior to FW download */ ++ err = ioctl(fd, USERIAL_OP_CLK_ON); ++ if (err < 0) { ++ fprintf(stderr, "%s: Failed to vote UART CLK ON\n", __func__); ++ return -1; ++ } ++ + /* Get Rome version information */ + if((err = rome_patch_ver_req(fd)) <0){ + fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err); +@@ -1899,5 +1907,10 @@ download: + } + + error: ++ /* Vote UART CLK OFF post to FW download */ ++ err = ioctl(fd, USERIAL_OP_CLK_OFF); ++ if (err < 0) ++ fprintf(stderr, "%s: Failed to vote UART CLK OFF!!!\n", __func__); ++ + return err; + } +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 95d5f1e8a5c2..20264f9978d9 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -42,6 +42,8 @@ + #define BD_ADDR_LEN 6 + #define MSM_ENABLE_FLOW_CTRL 16 + #define MSM_DISABLE_FLOW_CTRL 17 ++#define USERIAL_OP_CLK_ON 0x5441 ++#define USERIAL_OP_CLK_OFF 0x5442 + + unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + typedef enum { + +From b09f8b12c937ec58df0581b2d95493e036c86432 Mon Sep 17 00:00:00 2001 +From: Kamal Negi +Date: Thu, 30 Apr 2015 15:53:06 +0530 +Subject: [PATCH 15/19] Override IBS settings by reading configuration file + +Configure the IBS value in Firmware by reading the +configuration file.This configuration value is +provided in the config file which is read during +the firmware download process and the default +configuration value is overwritten with this value. + +Change-Id: I47992a573b3137ac9bfb80538727981f56b328c4 +Signed-off-by: Kamal Negi +--- + tools/hciattach_rome.c | 42 +++++++++++++++++++++++++++++------------- + tools/hciattach_rome.h | 24 ++++++++++++++++-------- + 2 files changed, 45 insertions(+), 21 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 574ceac6c750..6a3f33867c12 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -922,7 +922,8 @@ int rome_get_tlv_file(char *file_path) + unsigned char data_buf[PRINT_BUF_SIZE]={0,}; + unsigned char *nvm_byte_ptr; + unsigned char bdaddr[6]; +- unsigned short pcm_value; ++ unsigned short pcm_value, ibs_value; ++ + fprintf(stderr, "File Open (%s)\n", file_path); + pFile = fopen ( file_path , "r" ); + if (pFile==NULL) {; +@@ -1008,23 +1009,38 @@ int rome_get_tlv_file(char *file_path) + *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), + *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); + } ++ ++ if (nvm_ptr->tag_id == TAG_NUM_17) { ++ if ((ibs_value = ++ get_value_from_config(FW_CONFIG_FILE_PATH, "IBS")) >= 0) { ++ if (ibs_value == FWCONF_IBS_DISABLE) { ++ nvm_byte_ptr[FWCONF_IBS_VAL_OFFSET] &= ++ (~(FWCONF_IBS_ENABLE << ++ FWCONF_IBS_VAL_BIT)); ++ } else if (ibs_value == FWCONF_IBS_ENABLE) { ++ nvm_byte_ptr[FWCONF_IBS_VAL_OFFSET] |= ++ (FWCONF_IBS_ENABLE << ++ FWCONF_IBS_VAL_BIT); ++ } ++ } ++ } + /* Read from file and check what PCM Configuration is required: + * Master = 0 /Slave = 1 */ + /* Override PCM configuration */ + if (nvm_ptr->tag_id == TAG_NUM_44) { + if ((pcm_value = +- get_value_from_config(PCM_CONFIG_FILE_PATH, "PCM")) >= 0) { +- +- if (pcm_value == PCM_SLAVE) { +- nvm_byte_ptr[PCM_MS_OFFSET_1] |= +- (1 << PCM_ROLE_BIT_OFFSET); +- nvm_byte_ptr[PCM_MS_OFFSET_2] |= +- (1 << PCM_ROLE_BIT_OFFSET); +- } else if (pcm_value == PCM_MASTER) { +- nvm_byte_ptr[PCM_MS_OFFSET_1] &= +- (~(1 << PCM_ROLE_BIT_OFFSET)); +- nvm_byte_ptr[PCM_MS_OFFSET_2] &= +- (~(1 << PCM_ROLE_BIT_OFFSET)); ++ get_value_from_config(FW_CONFIG_FILE_PATH, "PCM")) >= 0) { ++ ++ if (pcm_value == FWCONF_PCM_SLAVE) { ++ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_1] |= ++ (1 << FWCONF_PCM_ROLE_BIT_OFFSET); ++ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_2] |= ++ (1 << FWCONF_PCM_ROLE_BIT_OFFSET); ++ } else if (pcm_value == FWCONF_PCM_MASTER) { ++ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_1] &= ++ (~(1 << FWCONF_PCM_ROLE_BIT_OFFSET)); ++ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_2] &= ++ (~(1 << FWCONF_PCM_ROLE_BIT_OFFSET)); + } + } + } +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 20264f9978d9..8eaeeed8bc96 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -203,16 +203,24 @@ typedef struct + #define TAG_END 0xFF + #define NVM_ACCESS_SET 0x01 + #define TAG_NUM_OFFSET 5 +-#define TAG_NUM_2 2 +-#define TAG_NUM_44 44 ++#define TAG_NUM_2 2 ++#define TAG_NUM_17 (17) ++#define TAG_NUM_44 44 + #define TAG_BDADDR_OFFSET 7 + +-#define PCM_MS_OFFSET_1 9 +-#define PCM_MS_OFFSET_2 33 ++/* FW PCM Configuration */ ++#define FWCONF_PCM_MS_OFFSET_1 9 ++#define FWCONF_PCM_MS_OFFSET_2 33 ++#define FWCONF_PCM_SLAVE 1 ++#define FWCONF_PCM_MASTER 0 ++#define FWCONF_PCM_ROLE_BIT_OFFSET 4 ++ ++/* FW IBS Configuration */ ++#define FWCONF_IBS_DISABLE (0) ++#define FWCONF_IBS_ENABLE (1) ++#define FWCONF_IBS_VAL_BIT (7) ++#define FWCONF_IBS_VAL_OFFSET (0) + +-#define PCM_SLAVE 1 +-#define PCM_MASTER 0 +-#define PCM_ROLE_BIT_OFFSET 4 + #define MAX_RETRY_CNT 1 + #define SELECT_TIMEOUT 3 + +@@ -251,7 +259,7 @@ typedef struct + #define ROME_SKIP_EVT_CC 0x02 + #define ROME_SKIP_EVT_VSE_CC 0x03 + +-#define PCM_CONFIG_FILE_PATH "/etc/bluetooth/pcm.conf" ++#define FW_CONFIG_FILE_PATH "/etc/bluetooth/firmware.conf" + /****************************************************************************** + ** Local type definitions + ******************************************************************************/ + +From b307659dc988054c1fef32c131417cfab2b74c3e Mon Sep 17 00:00:00 2001 +From: Dibyendu Roy +Date: Fri, 22 May 2015 18:57:05 +0530 +Subject: [PATCH 16/19] bluetooth: Fix flow control operation + +Flow off operation was not actually happening at the UART line level, +since the argument passed was not being used correctly. As a result, +sometimes command complete and VS event were sent by BT SOC even +before the local UART Controller could change its baud rate to the +newer one(3 Mbps). This led to VS event being processed +incorrectly which in turn causes baud rate change to fail. + +CRs-Fixed: 844730 +Change-Id: I06d8c4ed7807aa47dd5498642c7a23c9189a1cff +Signed-off-by: Dibyendu Roy +--- + tools/hciattach_rome.c | 6 +++--- + tools/hciattach_rome.h | 4 ++-- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 6a3f33867c12..0d7014f1d2f6 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1544,10 +1544,10 @@ static void flow_control(int fd, int opt) + c_opt.c_cc[VMIN] = 0; /* blocking read until 8 chars received */ + c_opt.c_cflag &= ~CSIZE; + c_opt.c_cflag |= (CS8 | CLOCAL | CREAD); +- if (MSM_ENABLE_FLOW_CTRL) ++ if (opt == MSM_ENABLE_FLOW_CTRL) + c_opt.c_cflag |= CRTSCTS; +- else if (MSM_DISABLE_FLOW_CTRL) +- c_opt.c_cflag |= ~CRTSCTS; ++ else if (opt == MSM_DISABLE_FLOW_CTRL) ++ c_opt.c_cflag &= ~CRTSCTS; + else { + fprintf(stderr, "%s: Incorrect option passed for TIOCMSET\n", __func__); + return; +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 8eaeeed8bc96..3fdaf208e522 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -40,8 +40,8 @@ + #define NVITEM_SIZE 2 + #define PERSIST_HEADER_LEN 3 + #define BD_ADDR_LEN 6 +-#define MSM_ENABLE_FLOW_CTRL 16 +-#define MSM_DISABLE_FLOW_CTRL 17 ++#define MSM_DISABLE_FLOW_CTRL 0 ++#define MSM_ENABLE_FLOW_CTRL 1 + #define USERIAL_OP_CLK_ON 0x5441 + #define USERIAL_OP_CLK_OFF 0x5442 + + +From bec6be1174e250c60b48b51933ab6f80a27a093e Mon Sep 17 00:00:00 2001 +From: Dibyendu Roy +Date: Thu, 11 Jun 2015 12:07:43 +0530 +Subject: [PATCH 17/19] Adding MDM specific code under _PLATFORM_MDM_ + +This patch is added to comment out the commit +84cc0e12983b5761c67789ef93fd6fb164c7314d in x86 as +dynamic suspend feature is not available in x86. However, +this code shall be active for MDM platform due to +dynamic suspend feature. + +Change-Id: I998f0521b4a5f9744412db40f2c2d3bff2ac3d11 +--- + tools/hciattach_rome.c | 5 ++++- + tools/hciattach_rome.h | 3 +++ + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 0d7014f1d2f6..1891de24e21a 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1779,13 +1779,14 @@ int qca_soc_init(int fd, int speed, char *bdaddr) + + vnd_userial.fd = fd; + ++#ifdef _PLATFORM_MDM_ + /* Vote for UART CLK prior to FW download */ + err = ioctl(fd, USERIAL_OP_CLK_ON); + if (err < 0) { + fprintf(stderr, "%s: Failed to vote UART CLK ON\n", __func__); + return -1; + } +- ++#endif + /* Get Rome version information */ + if((err = rome_patch_ver_req(fd)) <0){ + fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err); +@@ -1923,10 +1924,12 @@ download: + } + + error: ++#ifdef _PLATFORM_MDM_ + /* Vote UART CLK OFF post to FW download */ + err = ioctl(fd, USERIAL_OP_CLK_OFF); + if (err < 0) + fprintf(stderr, "%s: Failed to vote UART CLK OFF!!!\n", __func__); ++#endif + + return err; + } +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 3fdaf208e522..89f7db3bef86 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -42,8 +42,11 @@ + #define BD_ADDR_LEN 6 + #define MSM_DISABLE_FLOW_CTRL 0 + #define MSM_ENABLE_FLOW_CTRL 1 ++ ++#ifdef _PLATFORM_MDM_ + #define USERIAL_OP_CLK_ON 0x5441 + #define USERIAL_OP_CLK_OFF 0x5442 ++#endif + + unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + typedef enum { + +From 5ab2a193c11eaa8a68a0e060a560a5bd2ee2459c Mon Sep 17 00:00:00 2001 +From: Dibyendu Roy +Date: Mon, 6 Jul 2015 13:30:53 +0530 +Subject: [PATCH 18/19] Bluetooth: Fix static analysis issues + +Change-Id: Ida91f012544c39a8aaa6e7db23f1d5b68d3bec08 +--- + tools/hciattach_rome.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 1891de24e21a..59bdc16e4e8f 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -933,7 +933,13 @@ int rome_get_tlv_file(char *file_path) + + /* Get File Size */ + fseek (pFile , 0 , SEEK_END); +- fileSize = ftell (pFile); ++ ++ if((fileSize = ftell(pFile)) < 0) { ++ fprintf(stderr, "%s: fail to get current file position\n", file_path); ++ fclose (pFile); ++ return -1; ++ } ++ + rewind (pFile); + + pdata_buffer = (unsigned char*) malloc (sizeof(char)*fileSize); +@@ -1107,7 +1113,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc + int rome_tlv_dnld_req(int fd, int tlv_size) + { + int total_segment, remain_size, i, err = -1; +- unsigned char wait_cc_evt; ++ unsigned char wait_cc_evt = FALSE; + unsigned int rom = rome_ver >> 16; + + total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT; + +From ca52faad6e23bee353e3315f136efb43d1e9d143 Mon Sep 17 00:00:00 2001 +From: Kamal Negi +Date: Fri, 8 May 2015 15:01:02 +0530 +Subject: [PATCH 19/19] Handle NULL Pointer derefrencing in AVRCP Target role + +Check NULL pointer to AVRCP controller role initialized or not. +If remote device don't support the AVRCP target role, then HOST dont +initialize AVRCP controller role and directly dereference the controller +role and segfault happens. + +Change-Id: Ibbb9452f17a576c3a79a53ea72e0211982752144 +Signed-off-by: Kamal Negi +--- + profiles/audio/avrcp.c | 27 ++++++++++++++++++++++----- + 1 file changed, 22 insertions(+), 5 deletions(-) + +diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c +index c100149acf42..d8cb0ed96a1f 100644 +--- a/profiles/audio/avrcp.c ++++ b/profiles/audio/avrcp.c +@@ -2082,13 +2082,19 @@ static gboolean avrcp_get_play_status_rsp(struct avctp *conn, uint8_t code, + void *user_data) + { + struct avrcp *session = user_data; +- struct avrcp_player *player = session->controller->player; +- struct media_player *mp = player->user_data; ++ struct avrcp_player *player; ++ struct media_player *mp; + struct avrcp_header *pdu = (void *) operands; + uint32_t duration; + uint32_t position; + uint8_t status; + ++ if (!session || !session->controller) ++ return FALSE; ++ ++ player = session->controller->player; ++ mp = player->user_data; ++ + if (pdu == NULL || code == AVC_CTYPE_REJECTED || + ntohs(pdu->params_len) != 9) + return FALSE; +@@ -2146,12 +2152,18 @@ static gboolean avrcp_player_value_rsp(struct avctp *conn, uint8_t code, + void *user_data) + { + struct avrcp *session = user_data; +- struct avrcp_player *player = session->controller->player; +- struct media_player *mp = player->user_data; ++ struct avrcp_player *player; ++ struct media_player *mp; + struct avrcp_header *pdu = (void *) operands; + uint8_t count; + int i; + ++ if (!session || !session->controller) ++ return FALSE; ++ ++ player = session->controller->player; ++ mp = player->user_data; ++ + if (pdu == NULL) { + media_player_set_setting(mp, "Error", "Timeout"); + return FALSE; +@@ -2303,10 +2315,15 @@ static gboolean avrcp_get_element_attributes_rsp(struct avctp *conn, + void *user_data) + { + struct avrcp *session = user_data; +- struct avrcp_player *player = session->controller->player; ++ struct avrcp_player *player; + struct avrcp_header *pdu = (void *) operands; + uint8_t count; + ++ if (!session || !session->controller) ++ return FALSE; ++ ++ player = session->controller->player; ++ + if (code == AVC_CTYPE_REJECTED) + return FALSE; + diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0022-hciattach_rome-Respect-the-user-indication-for-noflo.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0013-hciattach_rome-Respect-the-user-indication-for-noflo.patch similarity index 100% rename from meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0022-hciattach_rome-Respect-the-user-indication-for-noflo.patch rename to meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0013-hciattach_rome-Respect-the-user-indication-for-noflo.patch diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0023-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0014-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch similarity index 100% rename from meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0023-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch rename to meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0014-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0024-hciattach-Add-verbosity-option.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0015-hciattach-Add-verbosity-option.patch similarity index 100% rename from meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0024-hciattach-Add-verbosity-option.patch rename to meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/0015-hciattach-Add-verbosity-option.patch diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6qpsbc/bluetooth-init b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6qpsbc/bluetooth-init new file mode 100644 index 000000000..1a9741841 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6qpsbc/bluetooth-init @@ -0,0 +1,87 @@ +#!/bin/sh +#=============================================================================== +# +# Copyright (C) 2012-2017 by Digi International Inc. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. +# +# +# !Description: Initialize bluetooth hardware +# +#=============================================================================== + +# Bluetooth power GPIO +BT_EN_QCA_GPIO_NR="244" + +# set_gpio_value +set_gpio_value() { + local SG_GPIONR="${1}" + local SG_GPIOVAL="${2}" + local SG_GPIOPATH="/sys/class/gpio/gpio${SG_GPIONR}" + + [ -d "${SG_GPIOPATH}" ] || printf "%s" "${SG_GPIONR}" > /sys/class/gpio/export + printf out > "${SG_GPIOPATH}/direction" && sleep .2 + printf "${SG_GPIOVAL}" > "${SG_GPIOPATH}/value" && sleep .2 + [ -d "${SG_GPIOPATH}" ] && printf "%s" "${SG_GPIONR}" > /sys/class/gpio/unexport +} + +# powercycle_gpio +powercycle_gpio() { + set_gpio_value "${1}" 0 + set_gpio_value "${1}" 1 +} + +error() { + echo ${1} + exit 1 +} + +bluetooth_init() { + # Get MAC address from the device tree. Use a default value if it has not been set. + BT_MACADDR="$(hexdump -ve '1/1 "%02X" ":"' /proc/device-tree/bluetooth/mac-address 2>/dev/null | sed 's/:$//g')" + if [ -z "${BT_MACADDR}" ] || [ "${BT_MACADDR}" = "00:00:00:00:00:00" ]; then + BT_MACADDR="00:04:F3:FF:FF:BB" + fi + + # Start the Bluetooth driver and bring up the interface + HCIATTACH_LOG="/var/log/hciattach.log" + killproc hciattach + powercycle_gpio "${BT_EN_QCA_GPIO_NR}" + if ! hciattach ttyBt qca ${BT_RATE:-3000000} -t30 ${BT_FLOW:-flow} unused ${BT_MACADDR} >${HCIATTACH_LOG} 2>&1; then + BT_ERROR="FAIL (hciattach)" + fi +} + +# Source function library +. /etc/init.d/functions + +case "$1" in + start) + if [ -d "/proc/device-tree/bluetooth" ]; then + echo -n "Starting bluetooth hardware: " + bluetooth_init + echo "${BT_ERROR:-done.}" + fi + ;; + stop) + if [ -d "/sys/class/bluetooth/hci0" ]; then + echo -n "Stopping bluetooth hardware: " + killproc hciattach + # Power down bluetooth + set_gpio_value "${BT_EN_QCA_GPIO_NR}" 0 + echo "done." + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6qpsbc/main.conf b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6qpsbc/main.conf new file mode 100644 index 000000000..332d38fad --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6qpsbc/main.conf @@ -0,0 +1,12 @@ +[General] + +# Default adapter name +# Defaults to 'BlueZ X.YZ' +Name = cc6qp + +[Policy] + +# AutoEnable defines option to enable all controllers when they are found. +# This includes adapters present on start as well as adapters that are plugged +# in later on. Defaults to 'false'. +AutoEnable=true diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6/bluetooth-init b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6sbc/bluetooth-init similarity index 100% rename from meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6/bluetooth-init rename to meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6sbc/bluetooth-init diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6/main.conf b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6sbc/main.conf similarity index 100% rename from meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6/main.conf rename to meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6sbc/main.conf diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0003-bluetooth-Add-bluetooth-support-for-QCA6174-chip.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0003-bluetooth-Add-bluetooth-support-for-QCA6174-chip.patch deleted file mode 100644 index 1537e2bbb..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0003-bluetooth-Add-bluetooth-support-for-QCA6174-chip.patch +++ /dev/null @@ -1,2068 +0,0 @@ -From: Anantha Krishnan -Date: Tue, 19 Aug 2014 20:23:01 +0530 -Subject: [PATCH] bluetooth : Add bluetooth support for QCA6174 chip. - -Register the QCA6174 initialization routine with hciattach for -downloading firmware patches to the bluetooth controller. -Add optional support 'f' to control installation of line -discipline driver. Invoke hciattach from command line and -download the firmware patches: - hciattach /dev/ttyHS0 qca 3000000 -t120 flow -f0 - -Change-Id: I87f2927d7096904071a02d73d3afef0dc34db414 -Signed-off-by: Rupesh Tatiya ---- - Makefile.tools | 3 +- - tools/hciattach.c | 25 +- - tools/hciattach.h | 8 +- - tools/hciattach_rome.c | 1578 ++++++++++++++++++++++++++++++++++++++++++++++++ - tools/hciattach_rome.h | 317 ++++++++++ - 5 files changed, 1926 insertions(+), 5 deletions(-) - create mode 100644 tools/hciattach_rome.c - create mode 100644 tools/hciattach_rome.h - -diff --git a/Makefile.tools b/Makefile.tools -index 0d5f1431e013..8f087c597490 100644 ---- a/Makefile.tools -+++ b/Makefile.tools -@@ -164,7 +164,8 @@ tools_hciattach_SOURCES = tools/hciattach.c tools/hciattach.h \ - tools/hciattach_ath3k.c \ - tools/hciattach_qualcomm.c \ - tools/hciattach_intel.c \ -- tools/hciattach_bcm43xx.c -+ tools/hciattach_bcm43xx.c \ -+ tools/hciattach_rome.c tools/hciattach_rome.h - tools_hciattach_LDADD = lib/libbluetooth-internal.la - - tools_hciconfig_SOURCES = tools/hciconfig.c tools/csr.h tools/csr.c -diff --git a/tools/hciattach.c b/tools/hciattach.c -index fad176c9b804..73811d4c4c2a 100644 ---- a/tools/hciattach.c -+++ b/tools/hciattach.c -@@ -69,6 +69,8 @@ struct uart_t { - #define ENABLE_PM 1 - #define DISABLE_PM 0 - -+int line_disp = 1; -+ - static volatile sig_atomic_t __io_canceled = 0; - - static void sig_hup(int sig) -@@ -263,6 +265,12 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti) - return ath3k_post(fd, u->pm); - } - -+static int qca(int fd, struct uart_t *u, struct termios *ti) -+{ -+ fprintf(stderr,"qca\n"); -+ return qca_soc_init(fd, u->bdaddr); -+} -+ - static int qualcomm(int fd, struct uart_t *u, struct termios *ti) - { - return qualcomm_init(fd, u->speed, ti, u->bdaddr); -@@ -1093,6 +1101,10 @@ struct uart_t uart[] = { - { "ath3k", 0x0000, 0x0000, HCI_UART_ATH3K, 115200, 115200, - FLOW_CTL, DISABLE_PM, NULL, ath3k_ps, ath3k_pm }, - -+ /* QCA ROME */ -+ { "qca", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, -+ FLOW_CTL, DISABLE_PM, NULL, qca, NULL }, -+ - /* QUALCOMM BTS */ - { "qualcomm", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, - FLOW_CTL, DISABLE_PM, NULL, qualcomm, NULL }, -@@ -1195,6 +1207,7 @@ static int init_uart(char *dev, struct uart_t *u, int send_break, int raw) - goto fail; - } - -+if (line_disp) { - /* Set TTY to N_HCI line discipline */ - i = N_HCI; - if (ioctl(fd, TIOCSETD, &i) < 0) { -@@ -1211,6 +1224,7 @@ static int init_uart(char *dev, struct uart_t *u, int send_break, int raw) - perror("Can't set device"); - goto fail; - } -+} - - if (u->post && u->post(fd, u, &ti) < 0) - goto fail; -@@ -1249,7 +1263,7 @@ int main(int argc, char *argv[]) - printpid = 0; - raw = 0; - -- while ((opt=getopt(argc, argv, "bnpt:s:lr")) != EOF) { -+ while ((opt=getopt(argc, argv, "bnpt:s:lrf:")) != EOF) { - switch(opt) { - case 'b': - send_break = 1; -@@ -1282,6 +1296,11 @@ int main(int argc, char *argv[]) - raw = 1; - break; - -+ case 'f': -+ line_disp = atoi(optarg); -+ fprintf(stderr, "Line_disp val : %d\n", line_disp); -+ break; -+ - default: - usage(); - exit(1); -@@ -1350,6 +1369,7 @@ int main(int argc, char *argv[]) - case 5: - u->bdaddr = argv[optind]; - break; -+ - } - } - -@@ -1426,12 +1446,15 @@ int main(int argc, char *argv[]) - break; - } - -+if (line_disp) { - /* Restore TTY line discipline */ -+ fprintf(stderr, "Restoring the Line Discipline driver\n"); - ld = N_TTY; - if (ioctl(n, TIOCSETD, &ld) < 0) { - perror("Can't restore line discipline"); - exit(1); - } -+} - - return 0; - } -diff --git a/tools/hciattach.h b/tools/hciattach.h -index 4279a3361749..0656a845223c 100644 ---- a/tools/hciattach.h -+++ b/tools/hciattach.h -@@ -39,9 +39,10 @@ - #define HCI_UART_H4DS 3 - #define HCI_UART_LL 4 - #define HCI_UART_ATH3K 5 --#define HCI_UART_INTEL 6 --#define HCI_UART_BCM 7 --#define HCI_UART_QCA 8 -+#define HCI_UART_IBS 6 -+#define HCI_UART_INTEL 7 -+#define HCI_UART_BCM 8 -+#define HCI_UART_QCA 9 - - #define HCI_UART_RAW_DEVICE 0 - #define HCI_UART_RESET_ON_INIT 1 -@@ -63,6 +64,7 @@ int ath3k_init(int fd, int speed, int init_speed, char *bdaddr, - struct termios *ti); - int ath3k_post(int fd, int pm); - int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr); -+int qca_soc_init(int fd, char *bdaddr); - int intel_init(int fd, int init_speed, int *speed, struct termios *ti); - int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti, - const char *bdaddr); -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -new file mode 100644 -index 000000000000..f31be43c09e4 ---- /dev/null -+++ b/tools/hciattach_rome.c -@@ -0,0 +1,1578 @@ -+/* -+ * -+ * Copyright (c) 2013, The Linux Foundation. All rights reserved. -+ * Not a Contribution. -+ * -+ * Copyright 2012 The Android Open Source Project -+ * -+ * Licensed under the Apache License, Version 2.0 (the "License"); you -+ * may not use this file except in compliance with the License. You may -+ * obtain a copy of the License at -+ * -+ * http://www.apache.org/licenses/LICENSE-2.0 -+ * -+ * Unless required by applicable law or agreed to in writing, software -+ * distributed under the License is distributed on an "AS IS" BASIS, -+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -+ * implied. See the License for the specific language governing -+ * permissions and limitations under the License. -+ * -+ */ -+ -+/****************************************************************************** -+ * -+ * Filename: hciattach_rome.c -+ * -+ * Description: Contains controller-specific functions, like -+ * firmware patch download -+ * low power mode operations -+ * -+ ******************************************************************************/ -+ -+#define LOG_TAG "bt_vendor" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "hciattach_rome.h" -+#include "hciattach.h" -+ -+#ifdef __cplusplus -+} -+#endif -+ -+ -+/****************************************************************************** -+** Variables -+******************************************************************************/ -+FILE *file; -+unsigned char *phdr_buffer; -+unsigned char *pdata_buffer = NULL; -+patch_info rampatch_patch_info; -+int rome_ver = ROME_VER_UNKNOWN; -+unsigned char gTlv_type; -+char *rampatch_file_path; -+char *nvm_file_path; -+vnd_userial_cb_t vnd_userial; -+/****************************************************************************** -+** Extern variables -+******************************************************************************/ -+//extern unsigned char vnd_local_bd_addr[6]; -+ -+/***************************************************************************** -+** Functions -+*****************************************************************************/ -+ -+/******************************************************************************* -+** -+** Function userial_to_tcio_baud -+** -+** Description helper function converts USERIAL baud rates into TCIO -+** conforming baud rates -+** -+** Returns TRUE/FALSE -+** -+*******************************************************************************/ -+unsigned char userial_to_tcio_baud(unsigned char cfg_baud, unsigned int *baud) -+{ -+ if (cfg_baud == USERIAL_BAUD_115200) -+ *baud = B115200; -+ else if (cfg_baud == USERIAL_BAUD_4M) -+ *baud = B4000000; -+ else if (cfg_baud == USERIAL_BAUD_3M) -+ *baud = B3000000; -+ else if (cfg_baud == USERIAL_BAUD_2M) -+ *baud = B2000000; -+ else if (cfg_baud == USERIAL_BAUD_1M) -+ *baud = B1000000; -+ else if (cfg_baud == USERIAL_BAUD_921600) -+ *baud = B921600; -+ else if (cfg_baud == USERIAL_BAUD_460800) -+ *baud = B460800; -+ else if (cfg_baud == USERIAL_BAUD_230400) -+ *baud = B230400; -+ else if (cfg_baud == USERIAL_BAUD_57600) -+ *baud = B57600; -+ else if (cfg_baud == USERIAL_BAUD_19200) -+ *baud = B19200; -+ else if (cfg_baud == USERIAL_BAUD_9600) -+ *baud = B9600; -+ else if (cfg_baud == USERIAL_BAUD_1200) -+ *baud = B1200; -+ else if (cfg_baud == USERIAL_BAUD_600) -+ *baud = B600; -+ else -+ { -+ fprintf(stderr, "userial vendor open: unsupported baud idx %i\n", cfg_baud); -+ *baud = B115200; -+ return FALSE; -+ } -+ -+ return TRUE; -+} -+ -+ -+/******************************************************************************* -+** -+** Function userial_vendor_set_baud -+** -+** Description Set new baud rate -+** -+** Returns None -+** -+*******************************************************************************/ -+void userial_vendor_set_baud(unsigned char userial_baud) -+{ -+ unsigned int tcio_baud; -+ fprintf(stderr, "## userial_vendor_set_baud: %d\n", userial_baud); -+ -+ userial_to_tcio_baud(userial_baud, &tcio_baud); -+ -+ cfsetospeed(&vnd_userial.termios, tcio_baud); -+ cfsetispeed(&vnd_userial.termios, tcio_baud); -+ tcsetattr(vnd_userial.fd, TCSADRAIN, &vnd_userial.termios); /* don't change speed until last write done */ -+ -+} -+ -+ -+/******************************************************************************* -+** -+** Function userial_vendor_ioctl -+** -+** Description ioctl inteface -+** -+** Returns None -+** -+*******************************************************************************/ -+int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data) -+{ -+ int err = -1; -+ struct termios ti; -+ -+ if (tcgetattr(fd, &ti) < 0) { -+ perror("Can't get port settings"); -+ return -1; -+ } -+ cfmakeraw(&ti); -+ ti.c_cflag |= CLOCAL; -+ -+ switch(op) -+ { -+#if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) -+ case USERIAL_OP_ASSERT_BT_WAKE: -+ VNDUSERIALDBG("## userial_vendor_ioctl: Asserting BT_Wake ##"); -+ err = ioctl(fd, USERIAL_IOCTL_BT_WAKE_ASSERT, NULL); -+ break; -+ -+ case USERIAL_OP_DEASSERT_BT_WAKE: -+ VNDUSERIALDBG("## userial_vendor_ioctl: De-asserting BT_Wake ##"); -+ err = ioctl(fd, USERIAL_IOCTL_BT_WAKE_DEASSERT, NULL); -+ break; -+ -+ case USERIAL_OP_GET_BT_WAKE_STATE: -+ err = ioctl(fd, USERIAL_IOCTL_BT_WAKE_GET_ST, p_data); -+ break; -+#endif // (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) -+ case USERIAL_OP_FLOW_ON: -+ fprintf(stderr, "## userial_vendor_ioctl: UART Flow On\n "); -+ ti.c_cflag |= CRTSCTS; -+ -+ if (err = tcsetattr(fd, TCSANOW, &ti) < 0) { -+ perror("Can't set port settings"); -+ return -1; -+ } -+ -+ break; -+ -+ case USERIAL_OP_FLOW_OFF: -+ fprintf(stderr, "## userial_vendor_ioctl: UART Flow Off\n "); -+ ti.c_cflag &= ~CRTSCTS; -+ if (err = tcsetattr(fd, TCSANOW, &ti) < 0) { -+ fprintf(stderr, "Can't set port settings"); -+ return -1; -+ } -+ break; -+ -+ default: -+ break; -+ } -+ -+ return err; -+} -+ -+ -+int get_vs_hci_event(unsigned char *rsp) -+{ -+ int err = 0, soc_id =0; -+ unsigned char paramlen = 0; -+ -+ if( (rsp[EVENTCODE_OFFSET] == VSEVENT_CODE) || (rsp[EVENTCODE_OFFSET] == EVT_CMD_COMPLETE)) -+ fprintf(stderr, "%s: Received HCI-Vendor Specific event\n", __FUNCTION__); -+ else { -+ fprintf(stderr, "%s: Failed to receive HCI-Vendor Specific event\n", __FUNCTION__); -+ err = -EIO; -+ goto failed; -+ } -+ -+ fprintf(stderr, "%s: Parameter Length: 0x%x\n", __FUNCTION__, paramlen = rsp[EVT_PLEN]); -+ fprintf(stderr, "%s: Command response: 0x%x\n", __FUNCTION__, rsp[CMD_RSP_OFFSET]); -+ fprintf(stderr, "%s: Response type : 0x%x\n", __FUNCTION__, rsp[RSP_TYPE_OFFSET]); -+ -+ /* Check the status of the operation */ -+ switch ( rsp[CMD_RSP_OFFSET] ) -+ { -+ case EDL_CMD_REQ_RES_EVT: -+ fprintf(stderr, "%s: Command Request Response\n", __FUNCTION__); -+ switch(rsp[RSP_TYPE_OFFSET]) -+ { -+ case EDL_PATCH_VER_RES_EVT: -+ case EDL_APP_VER_RES_EVT: -+ fprintf(stderr, "\t Current Product ID\t\t: 0x%08x\n", -+ (unsigned int)(rsp[PATCH_PROD_ID_OFFSET +3] << 24 | -+ rsp[PATCH_PROD_ID_OFFSET+2] << 16 | -+ rsp[PATCH_PROD_ID_OFFSET+1] << 8 | -+ rsp[PATCH_PROD_ID_OFFSET] )); -+ -+ /* Patch Version indicates FW patch version */ -+ fprintf(stderr, "\t Current Patch Version\t\t: 0x%04x\n", -+ (unsigned short)(rsp[PATCH_PATCH_VER_OFFSET + 1] << 8 | -+ rsp[PATCH_PATCH_VER_OFFSET] )); -+ -+ /* ROM Build Version indicates ROM build version like 1.0/1.1/2.0 */ -+ fprintf(stderr, "\t Current ROM Build Version\t: 0x%04x\n", rome_ver = -+ (int)(rsp[PATCH_ROM_BUILD_VER_OFFSET + 1] << 8 | -+ rsp[PATCH_ROM_BUILD_VER_OFFSET] )); -+ -+ /* In case rome 1.0/1.1, there is no SOC ID version available */ -+ if (paramlen - 10) -+ { -+ fprintf(stderr, "\t Current SOC Version\t\t: 0x%08x\n", soc_id = -+ (unsigned int)(rsp[PATCH_SOC_VER_OFFSET +3] << 24 | -+ rsp[PATCH_SOC_VER_OFFSET+2] << 16 | -+ rsp[PATCH_SOC_VER_OFFSET+1] << 8 | -+ rsp[PATCH_SOC_VER_OFFSET] )); -+ } -+ -+ /* Rome Chipset Version can be decided by Patch version and SOC version, -+ Upper 2 bytes will be used for Patch version and Lower 2 bytes will be -+ used for SOC as combination for BT host driver */ -+ rome_ver = (rome_ver << 16) | (soc_id & 0x0000ffff); -+ break; -+ case EDL_TVL_DNLD_RES_EVT: -+ case EDL_CMD_EXE_STATUS_EVT: -+ switch (err = rsp[CMD_STATUS_OFFSET]) -+ { -+ case HCI_CMD_SUCCESS: -+ fprintf(stderr, "%s: Download Packet successfully!\n", __FUNCTION__); -+ break; -+ case PATCH_LEN_ERROR: -+ fprintf(stderr, "%s: Invalid patch length argument passed for EDL PATCH " -+ "SET REQ cmd\n", __FUNCTION__); -+ break; -+ case PATCH_VER_ERROR: -+ fprintf(stderr, "%s: Invalid patch version argument passed for EDL PATCH " -+ "SET REQ cmd\n", __FUNCTION__); -+ break; -+ case PATCH_CRC_ERROR: -+ fprintf(stderr, "%s: CRC check of patch failed!!!\n", __FUNCTION__); -+ break; -+ case PATCH_NOT_FOUND: -+ fprintf(stderr, "%s: Invalid patch data!!!\n", __FUNCTION__); -+ break; -+ case TLV_TYPE_ERROR: -+ fprintf(stderr, "%s: TLV Type Error !!!\n", __FUNCTION__); -+ break; -+ default: -+ fprintf(stderr, "%s: Undefined error (0x%x)", __FUNCTION__, err); -+ break; -+ } -+ break; -+ } -+ break; -+ -+ case NVM_ACCESS_CODE: -+ fprintf(stderr, "%s: NVM Access Code!!!\n", __FUNCTION__); -+ err = HCI_CMD_SUCCESS; -+ break; -+ case EDL_SET_BAUDRATE_RSP_EVT: -+ /* Rome 1.1 has bug with the response, so it should ignore it. */ -+ if (rsp[BAUDRATE_RSP_STATUS_OFFSET] != BAUDRATE_CHANGE_SUCCESS) -+ { -+ fprintf(stderr, "%s: Set Baudrate request failed - 0x%x\n", __FUNCTION__, -+ rsp[CMD_STATUS_OFFSET]); -+ err = -1; -+ } -+ break; -+ default: -+ fprintf(stderr, "%s: Not a valid status!!!\n", __FUNCTION__); -+ err = -1; -+ break; -+ } -+ -+failed: -+ return err; -+} -+ -+ -+/* -+ * Read an VS HCI event from the given file descriptor. -+ */ -+int read_vs_hci_event(int fd, unsigned char* buf, int size) -+{ -+ int remain, r; -+ int count = 0; -+ -+ if (size <= 0) { -+ fprintf(stderr, "Invalid size arguement!\n"); -+ return -1; -+ } -+ -+ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", __FUNCTION__); -+ -+ /* The first byte identifies the packet type. For HCI event packets, it -+ * should be 0x04, so we read until we get to the 0x04. */ -+ /* It will keep reading until find 0x04 byte */ -+ while (1) { -+ r = read(fd, buf, 1); -+ if (r <= 0) -+ return -1; -+ if (buf[0] == 0x04) -+ break; -+ } -+ count++; -+ -+ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[0] - 0x%x\n", __FUNCTION__, buf[0]); -+ /* The next two bytes are the event code and parameter total length. */ -+ while (count < 3) { -+ r = read(fd, buf + count, 3 - count); -+ if ((r <= 0) || (buf[1] != 0xFF )) { -+ fprintf(stderr, "It is not VS event !!\n"); -+ return -1; -+ } -+ count += r; -+ } -+ -+ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[1] - 0x%x\n", __FUNCTION__, buf[1]); -+ /* Now we read the parameters. */ -+ if (buf[2] < (size - 3)) -+ remain = buf[2]; -+ else -+ remain = size - 3; -+ -+ while ((count - 3) < remain) { -+ r = read(fd, buf + count, remain - (count - 3)); -+ if (r <= 0) -+ return -1; -+ count += r; -+ } -+ -+ /* Check if the set patch command is successful or not */ -+ if(get_vs_hci_event(buf) != HCI_CMD_SUCCESS) -+ return -1; -+ -+ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, count - 0x%x\n", __FUNCTION__, count); -+ return count; -+} -+ -+ -+int hci_send_vs_cmd(int fd, unsigned char *cmd, unsigned char *rsp, int size) -+{ -+ int ret = 0; -+ -+ /* Send the HCI command packet to UART for transmission */ -+ ret = write(fd, cmd, size); -+ if (ret != size) { -+ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, ret); -+ goto failed; -+ } -+ -+ /* Check for response from the Controller */ -+ if (read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE) < 0) { -+ ret = -ETIMEDOUT; -+ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); -+ goto failed; -+ } -+ -+ fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); -+failed: -+ return ret; -+} -+ -+void frame_hci_cmd_pkt( -+ unsigned char *cmd, -+ int edl_cmd, unsigned int p_base_addr, -+ int segtNo, int size -+ ) -+{ -+ int offset = 0; -+ hci_command_hdr *cmd_hdr; -+ -+ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); -+ -+ cmd_hdr = (void *) (cmd + 1); -+ -+ cmd[0] = HCI_COMMAND_PKT; -+ cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, HCI_PATCH_CMD_OCF); -+ cmd_hdr->plen = size; -+ cmd[4] = edl_cmd; -+ -+ switch (edl_cmd) -+ { -+ case EDL_PATCH_SET_REQ_CMD: -+ /* Copy the patch header info as CMD params */ -+ memcpy(&cmd[5], phdr_buffer, PATCH_HDR_LEN); -+ fprintf(stderr, "%s: Sending EDL_PATCH_SET_REQ_CMD\n", __FUNCTION__); -+ fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", -+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); -+ break; -+ case EDL_PATCH_DLD_REQ_CMD: -+ offset = ((segtNo - 1) * MAX_DATA_PER_SEGMENT); -+ p_base_addr += offset; -+ cmd_hdr->plen = (size + 6); -+ cmd[5] = (size + 4); -+ cmd[6] = EXTRACT_BYTE(p_base_addr, 0); -+ cmd[7] = EXTRACT_BYTE(p_base_addr, 1); -+ cmd[8] = EXTRACT_BYTE(p_base_addr, 2); -+ cmd[9] = EXTRACT_BYTE(p_base_addr, 3); -+ memcpy(&cmd[10], (pdata_buffer + offset), size); -+ -+ fprintf(stderr, "%s: Sending EDL_PATCH_DLD_REQ_CMD: size: %d bytes\n", -+ __FUNCTION__, size); -+ fprintf(stderr, "HCI-CMD %d:\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t" -+ "0x%x\t0x%x\t0x%x\t\n", segtNo, cmd[0], cmd[1], cmd[2], -+ cmd[3], cmd[4], cmd[5], cmd[6], cmd[7], cmd[8], cmd[9]); -+ break; -+ case EDL_PATCH_ATCH_REQ_CMD: -+ fprintf(stderr, "%s: Sending EDL_PATCH_ATTACH_REQ_CMD\n", __FUNCTION__); -+ fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", -+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); -+ break; -+ case EDL_PATCH_RST_REQ_CMD: -+ fprintf(stderr, "%s: Sending EDL_PATCH_RESET_REQ_CMD\n", __FUNCTION__); -+ fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", -+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); -+ break; -+ case EDL_PATCH_VER_REQ_CMD: -+ fprintf(stderr, "%s: Sending EDL_PATCH_VER_REQ_CMD\n", __FUNCTION__); -+ fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", -+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); -+ break; -+ case EDL_PATCH_TLV_REQ_CMD: -+ fprintf(stderr, "%s: Sending EDL_PATCH_TLV_REQ_CMD\n", __FUNCTION__); -+ /* Parameter Total Length */ -+ cmd[3] = size +2; -+ -+ /* TLV Segment Length */ -+ cmd[5] = size; -+ fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", -+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5]); -+ offset = (segtNo * MAX_SIZE_PER_TLV_SEGMENT); -+ memcpy(&cmd[6], (pdata_buffer + offset), size); -+ break; -+ default: -+ fprintf(stderr, "%s: Unknown EDL CMD !!!\n", __FUNCTION__); -+ } -+} -+ -+void rome_extract_patch_header_info(unsigned char *buf) -+{ -+ int index; -+ -+ /* Extract patch id */ -+ for (index = 0; index < 4; index++) -+ rampatch_patch_info.patch_id |= -+ (LSH(buf[index + P_ID_OFFSET], (index * 8))); -+ -+ /* Extract (ROM and BUILD) version information */ -+ for (index = 0; index < 2; index++) -+ rampatch_patch_info.patch_ver.rom_version |= -+ (LSH(buf[index + P_ROME_VER_OFFSET], (index * 8))); -+ -+ for (index = 0; index < 2; index++) -+ rampatch_patch_info.patch_ver.build_version |= -+ (LSH(buf[index + P_BUILD_VER_OFFSET], (index * 8))); -+ -+ /* Extract patch base and entry addresses */ -+ for (index = 0; index < 4; index++) -+ rampatch_patch_info.patch_base_addr |= -+ (LSH(buf[index + P_BASE_ADDR_OFFSET], (index * 8))); -+ -+ /* Patch BASE & ENTRY addresses are same */ -+ rampatch_patch_info.patch_entry_addr = rampatch_patch_info.patch_base_addr; -+ -+ /* Extract total length of the patch payload */ -+ for (index = 0; index < 4; index++) -+ rampatch_patch_info.patch_length |= -+ (LSH(buf[index + P_LEN_OFFSET], (index * 8))); -+ -+ /* Extract the CRC checksum of the patch payload */ -+ for (index = 0; index < 4; index++) -+ rampatch_patch_info.patch_crc |= -+ (LSH(buf[index + P_CRC_OFFSET], (index * 8))); -+ -+ /* Extract patch control value */ -+ for (index = 0; index < 4; index++) -+ rampatch_patch_info.patch_ctrl |= -+ (LSH(buf[index + P_CONTROL_OFFSET], (index * 8))); -+ -+ fprintf(stderr, "PATCH_ID\t : 0x%x\n", rampatch_patch_info.patch_id); -+ fprintf(stderr, "ROM_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.rom_version); -+ fprintf(stderr, "BUILD_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.build_version); -+ fprintf(stderr, "PATCH_LENGTH\t : 0x%x\n", rampatch_patch_info.patch_length); -+ fprintf(stderr, "PATCH_CRC\t : 0x%x\n", rampatch_patch_info.patch_crc); -+ fprintf(stderr, "PATCH_CONTROL\t : 0x%x\n", rampatch_patch_info.patch_ctrl); -+ fprintf(stderr, "PATCH_BASE_ADDR\t : 0x%x\n", rampatch_patch_info.patch_base_addr); -+ -+} -+ -+int rome_edl_set_patch_request(int fd) -+{ -+ int size, err; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ -+ /* Frame the HCI CMD to be sent to the Controller */ -+ frame_hci_cmd_pkt(cmd, EDL_PATCH_SET_REQ_CMD, 0, -+ -1, PATCH_HDR_LEN + 1); -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); -+ -+ /* Send HCI Command packet to Controller */ -+ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); -+ if ( err != size) { -+ fprintf(stderr, "Failed to set the patch info to the Controller!\n"); -+ goto error; -+ } -+ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if ( err < 0) { -+ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); -+ goto error; -+ } -+ fprintf(stderr, "%s: Successfully set patch info on the Controller\n", __FUNCTION__); -+error: -+ return err; -+} -+ -+int rome_edl_patch_download_request(int fd) -+{ -+ int no_of_patch_segment; -+ int index = 1, err = 0, size = 0; -+ unsigned int p_base_addr; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ -+ no_of_patch_segment = (rampatch_patch_info.patch_length / -+ MAX_DATA_PER_SEGMENT); -+ fprintf(stderr, "%s: %d patch segments to be d'loaded from patch base addr: 0x%x\n", -+ __FUNCTION__, no_of_patch_segment, -+ rampatch_patch_info.patch_base_addr); -+ -+ /* Initialize the patch base address from the one read from bin file */ -+ p_base_addr = rampatch_patch_info.patch_base_addr; -+ -+ /* -+ * Depending upon size of the patch payload, download the patches in -+ * segments with a max. size of 239 bytes -+ */ -+ for (index = 1; index <= no_of_patch_segment; index++) { -+ -+ fprintf(stderr, "%s: Downloading patch segment: %d\n", __FUNCTION__, index); -+ -+ /* Frame the HCI CMD PKT to be sent to Controller*/ -+ frame_hci_cmd_pkt(cmd, EDL_PATCH_DLD_REQ_CMD, p_base_addr, -+ index, MAX_DATA_PER_SEGMENT); -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); -+ -+ /* Initialize the RSP packet everytime to 0 */ -+ memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); -+ -+ /* Send HCI Command packet to Controller */ -+ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); -+ if ( err != size) { -+ fprintf(stderr, "Failed to send the patch payload to the Controller!\n"); -+ goto error; -+ } -+ -+ /* Read Command Complete Event */ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if ( err < 0) { -+ fprintf(stderr, "%s: Failed to downlaod patch segment: %d!\n", -+ __FUNCTION__, index); -+ goto error; -+ } -+ fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", -+ __FUNCTION__, index); -+ } -+ -+ /* Check if any pending patch data to be sent */ -+ size = (rampatch_patch_info.patch_length < MAX_DATA_PER_SEGMENT) ? -+ rampatch_patch_info.patch_length : -+ (rampatch_patch_info.patch_length % MAX_DATA_PER_SEGMENT); -+ -+ if (size) -+ { -+ /* Frame the HCI CMD PKT to be sent to Controller*/ -+ frame_hci_cmd_pkt(cmd, EDL_PATCH_DLD_REQ_CMD, p_base_addr, index, size); -+ -+ /* Initialize the RSP packet everytime to 0 */ -+ memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); -+ -+ /* Send HCI Command packet to Controller */ -+ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); -+ if ( err != size) { -+ fprintf(stderr, "Failed to send the patch payload to the Controller!\n"); -+ goto error; -+ } -+ -+ /* Read Command Complete Event */ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if ( err < 0) { -+ fprintf(stderr, "%s: Failed to downlaod patch segment: %d!\n", -+ __FUNCTION__, index); -+ goto error; -+ } -+ -+ fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", -+ __FUNCTION__, index); -+ } -+ -+error: -+ return err; -+} -+ -+static int rome_download_rampatch(int fd) -+{ -+ int c, size, index, ret = -1; -+ -+ fprintf(stderr, "%s:\n", __FUNCTION__); -+ -+ /* Get handle to the RAMPATCH binary file */ -+ fprintf(stderr, "%s: Getting handle to the RAMPATCH binary file from %s\n", __FUNCTION__, ROME_FW_PATH); -+ file = fopen(ROME_FW_PATH, "r"); -+ if (file == NULL) { -+ fprintf(stderr, "%s: Failed to get handle to the RAMPATCH bin file!\n", -+ __FUNCTION__); -+ return -ENFILE; -+ } -+ -+ /* Allocate memory for the patch headder info */ -+ fprintf(stderr, "%s: Allocating memory for the patch header\n", __FUNCTION__); -+ phdr_buffer = (unsigned char *) malloc(PATCH_HDR_LEN + 1); -+ if (phdr_buffer == NULL) { -+ fprintf(stderr, "%s: Failed to allocate memory for patch header\n", -+ __FUNCTION__); -+ goto phdr_alloc_failed; -+ } -+ for (index = 0; index < PATCH_HDR_LEN + 1; index++) -+ phdr_buffer[index] = 0x0; -+ -+ /* Read 28 bytes of patch header information */ -+ fprintf(stderr, "%s: Reading patch header info\n", __FUNCTION__); -+ index = 0; -+ do { -+ c = fgetc (file); -+ phdr_buffer[index++] = (unsigned char)c; -+ } while (index != PATCH_HDR_LEN); -+ -+ /* Save the patch header info into local structure */ -+ fprintf(stderr, "%s: Saving patch hdr. info\n", __FUNCTION__); -+ rome_extract_patch_header_info((unsigned char *)phdr_buffer); -+ -+ /* Set the patch header info onto the Controller */ -+ ret = rome_edl_set_patch_request(fd); -+ if (ret < 0) { -+ fprintf(stderr, "%s: Error setting the patchheader info!\n", __FUNCTION__); -+ goto pdata_alloc_failed; -+ } -+ -+ /* Allocate memory for the patch payload */ -+ fprintf(stderr, "%s: Allocating memory for patch payload\n", __FUNCTION__); -+ size = rampatch_patch_info.patch_length; -+ pdata_buffer = (unsigned char *) malloc(size+1); -+ if (pdata_buffer == NULL) { -+ fprintf(stderr, "%s: Failed to allocate memory for patch payload\n", -+ __FUNCTION__); -+ goto pdata_alloc_failed; -+ } -+ for (index = 0; index < size+1; index++) -+ pdata_buffer[index] = 0x0; -+ -+ /* Read the patch data from Rampatch binary image */ -+ fprintf(stderr, "%s: Reading patch payload from RAMPATCH file\n", __FUNCTION__); -+ index = 0; -+ do { -+ c = fgetc (file); -+ pdata_buffer[index++] = (unsigned char)c; -+ } while (c != EOF); -+ -+ /* Downloading patches in segments to controller */ -+ ret = rome_edl_patch_download_request(fd); -+ if (ret < 0) { -+ fprintf(stderr, "%s: Error downloading patch segments!\n", __FUNCTION__); -+ goto cleanup; -+ } -+cleanup: -+ free(pdata_buffer); -+pdata_alloc_failed: -+ free(phdr_buffer); -+phdr_alloc_failed: -+ fclose(file); -+ -+ return ret; -+} -+ -+int rome_attach_rampatch(int fd) -+{ -+ int size, err; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ -+ /* Frame the HCI CMD to be sent to the Controller */ -+ frame_hci_cmd_pkt(cmd, EDL_PATCH_ATCH_REQ_CMD, 0, -+ -1, EDL_PATCH_CMD_LEN); -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); -+ -+ /* Send HCI Command packet to Controller */ -+ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); -+ if ( err != size) { -+ fprintf(stderr, "Failed to attach the patch payload to the Controller!\n"); -+ goto error; -+ } -+ -+ /* Read Command Complete Event */ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if ( err < 0) { -+ fprintf(stderr, "%s: Failed to attach the patch segment(s)\n", __FUNCTION__); -+ goto error; -+ } -+error: -+ return err; -+} -+ -+int rome_rampatch_reset(int fd) -+{ -+ int size, err = 0; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ struct timespec tm = { 0, 100*1000*1000 }; /* 100 ms */ -+ -+ /* Frame the HCI CMD to be sent to the Controller */ -+ frame_hci_cmd_pkt(cmd, EDL_PATCH_RST_REQ_CMD, 0, -+ -1, EDL_PATCH_CMD_LEN); -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); -+ -+ /* Send HCI Command packet to Controller */ -+ err = write(fd, cmd, size); -+ if (err != size) { -+ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); -+ goto error; -+ } -+ -+ /* -+ * Controller doesn't sends any response for the patch reset -+ * command. HOST has to wait for 100ms before proceeding. -+ */ -+ nanosleep(&tm, NULL); -+ -+error: -+ return err; -+} -+ -+int rome_get_tlv_file(char *file_path) -+{ -+ FILE * pFile; -+ long fileSize; -+ int readSize, nvm_length, nvm_index, i; -+ unsigned short nvm_tag_len; -+ tlv_patch_info *ptlv_header; -+ tlv_nvm_hdr *nvm_ptr; -+ unsigned char data_buf[PRINT_BUF_SIZE]={0,}; -+ unsigned char *nvm_byte_ptr; -+ -+ fprintf(stderr, "File Open (%s)\n", file_path); -+ pFile = fopen ( file_path , "r" ); -+ if (pFile==NULL) {; -+ fprintf(stderr, "%s File Open Fail\n", file_path); -+ return -1; -+ } -+ -+ /* Get File Size */ -+ fseek (pFile , 0 , SEEK_END); -+ fileSize = ftell (pFile); -+ rewind (pFile); -+ -+ pdata_buffer = (unsigned char*) malloc (sizeof(char)*fileSize); -+ if (pdata_buffer == NULL) { -+ fprintf(stderr, "Allocated Memory failed\n"); -+ fclose (pFile); -+ return -1; -+ } -+ -+ /* Copy file into allocated buffer */ -+ readSize = fread (pdata_buffer,1,fileSize,pFile); -+ -+ /* File Close */ -+ fclose (pFile); -+ -+ if (readSize != fileSize) { -+ fprintf(stderr, "Read file size(%d) not matched with actual file size (%ld bytes)\n",readSize,fileSize); -+ return -1; -+ } -+ -+ ptlv_header = (tlv_patch_info *) pdata_buffer; -+ -+ /* To handle different event between rampatch and NVM */ -+ gTlv_type = ptlv_header->tlv_type; -+ -+ if(ptlv_header->tlv_type == TLV_TYPE_PATCH){ -+ fprintf(stderr, "====================================================\n"); -+ fprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type); -+ fprintf(stderr, "Length\t\t\t : %d bytes\n", (ptlv_header->tlv_length1) | -+ (ptlv_header->tlv_length2 << 8) | -+ (ptlv_header->tlv_length3 << 16)); -+ fprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv_data_len); -+ fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv_patch_data_len); -+ fprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver); -+ fprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm); -+ fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1); -+ fprintf(stderr, "Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id); -+ fprintf(stderr, "Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver); -+ fprintf(stderr, "Patch Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.patch_ver); -+ fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved2); -+ fprintf(stderr, "Patch Entry Address\t\t : 0x%x\n", (ptlv_header->tlv.patch.patch_entry_addr)); -+ fprintf(stderr, "====================================================\n"); -+ -+ } else if(ptlv_header->tlv_type == TLV_TYPE_NVM) { -+ fprintf(stderr, "====================================================\n"); -+ fprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type); -+ fprintf(stderr, "Length\t\t\t : %d bytes\n", nvm_length = (ptlv_header->tlv_length1) | -+ (ptlv_header->tlv_length2 << 8) | -+ (ptlv_header->tlv_length3 << 16)); -+ -+ if(nvm_length <= 0) -+ return readSize; -+ -+ for(nvm_byte_ptr=(unsigned char *)(nvm_ptr = &(ptlv_header->tlv.nvm)), nvm_index=0; -+ nvm_index < nvm_length ; nvm_ptr = (tlv_nvm_hdr *) nvm_byte_ptr) -+ { -+ fprintf(stderr, "TAG ID\t\t\t : %d\n", nvm_ptr->tag_id); -+ fprintf(stderr, "TAG Length\t\t\t : %d\n", nvm_tag_len = nvm_ptr->tag_len); -+ fprintf(stderr, "TAG Pointer\t\t\t : %d\n", nvm_ptr->tag_ptr); -+ fprintf(stderr, "TAG Extended Flag\t\t : %d\n", nvm_ptr->tag_ex_flag); -+ -+ /* Increase nvm_index to NVM data */ -+ nvm_index+=sizeof(tlv_nvm_hdr); -+ nvm_byte_ptr+=sizeof(tlv_nvm_hdr); -+ -+ /* Write BD Address */ -+ if(nvm_ptr->tag_id == TAG_NUM_2){ -+ memcpy(nvm_byte_ptr, vnd_local_bd_addr, 6); -+ fprintf(stderr, "BD Address: %.02x:%.02x:%.02x:%.02x:%.02x:%.02x\n", -+ *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), -+ *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); -+ } -+ -+ for(i =0;(itag_len && (i*3 + 2) tag_len; -+ nvm_byte_ptr +=nvm_ptr->tag_len; -+ } -+ -+ fprintf(stderr, "====================================================\n"); -+ -+ } else { -+ fprintf(stderr, "TLV Header type is unknown (%d) \n", ptlv_header->tlv_type); -+ } -+ -+ return readSize; -+} -+ -+int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc_evt) -+{ -+ int size=0, err = -1; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ -+ fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d\n", __FUNCTION__, index, seg_size); -+ -+ /* Frame the HCI CMD PKT to be sent to Controller*/ -+ frame_hci_cmd_pkt(cmd, EDL_PATCH_TLV_REQ_CMD, 0, index, seg_size); -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); -+ -+ /* Initialize the RSP packet everytime to 0 */ -+ memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); -+ -+ /* Send HCI Command packet to Controller */ -+ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); -+ if ( err != size) { -+ fprintf(stderr, "Failed to send the patch payload to the Controller! 0x%x\n", err); -+ return err; -+ } -+ -+ if(wait_cc_evt) { -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if ( err < 0) { -+ fprintf(stderr, "%s: Failed to downlaod patch segment: %d!\n", __FUNCTION__, index); -+ return err; -+ } -+ } -+ -+ fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", __FUNCTION__, index); -+ return err; -+} -+ -+int rome_tlv_dnld_req(int fd, int tlv_size) -+{ -+ int total_segment, remain_size, i, err = -1; -+ unsigned char wait_cc_evt; -+ -+ total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT; -+ remain_size = (tlv_size < MAX_SIZE_PER_TLV_SEGMENT)?\ -+ tlv_size: (tlv_size%MAX_SIZE_PER_TLV_SEGMENT); -+ -+ fprintf(stderr, "%s: TLV size: %d, Total Seg num: %d, remain size: %d\n", -+ __FUNCTION__,tlv_size, total_segment, remain_size); -+ -+ for(i=0;i= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH ) -+ && !remain_size && ((i+1) == total_segment))? FALSE: TRUE; -+ if((err = rome_tlv_dnld_segment(fd, i, MAX_SIZE_PER_TLV_SEGMENT, wait_cc_evt )) < 0) -+ goto error; -+ } -+ -+ /* In case remain data still remain, last rampatch segment command will not wait -+ for command complete event here */ -+ wait_cc_evt = ((rome_ver >= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH ) -+ && remain_size )? FALSE:TRUE; -+ -+ if(remain_size) err =rome_tlv_dnld_segment(fd, i, remain_size, wait_cc_evt); -+ -+error: -+ return err; -+} -+ -+int rome_download_tlv_file(int fd) -+{ -+ int tlv_size, err = -1; -+ -+ /* Rampatch TLV file Downloading */ -+ pdata_buffer = NULL; -+ -+ if((tlv_size = rome_get_tlv_file(rampatch_file_path)) < 0) -+ goto error; -+ -+ if((err =rome_tlv_dnld_req(fd, tlv_size)) <0 ) -+ goto error; -+ -+ if (pdata_buffer != NULL){ -+ free (pdata_buffer); -+ pdata_buffer = NULL; -+ } -+ -+ /* NVM TLV file Downloading */ -+ if((tlv_size = rome_get_tlv_file(nvm_file_path)) < 0) -+ goto error; -+ -+ if((err =rome_tlv_dnld_req(fd, tlv_size)) <0 ) -+ goto error; -+ -+error: -+ if (pdata_buffer != NULL) -+ free (pdata_buffer); -+ -+ return err; -+} -+ -+int rome_1_0_nvm_tag_dnld(int fd) -+{ -+ int i, size, err = 0; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ -+#if (NVM_VERSION >= ROME_1_0_100019) -+ unsigned char cmds[MAX_TAG_CMD][HCI_MAX_CMD_SIZE] = -+ { -+ /* Tag 2 */ /* BD Address */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 9, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 2, -+ /* Tag Len */ 6, -+ /* Tag Value */ 0x77,0x78,0x23,0x01,0x56,0x22 -+ }, -+ /* Tag 6 */ /* Bluetooth Support Features */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 11, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 6, -+ /* Tag Len */ 8, -+ /* Tag Value */ 0xFF,0xFE,0x8B,0xFE,0xD8,0x3F,0x5B,0x8B -+ }, -+ /* Tag 17 */ /* HCI Transport Layer Setting */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 11, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 17, -+ /* Tag Len */ 8, -+ /* Tag Value */ 0x82,0x01,0x0E,0x08,0x04,0x32,0x0A,0x00 -+ }, -+ /* Tag 35 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 58, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 35, -+ /* Tag Len */ 55, -+ /* Tag Value */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x58, 0x59, -+ 0x0E, 0x0E, 0x16, 0x16, 0x16, 0x1E, 0x26, 0x5F, 0x2F, 0x5F, -+ 0x0E, 0x0E, 0x16, 0x16, 0x16, 0x1E, 0x26, 0x5F, 0x2F, 0x5F, -+ 0x0C, 0x18, 0x14, 0x24, 0x40, 0x4C, 0x70, 0x80, 0x80, 0x80, -+ 0x0C, 0x18, 0x14, 0x24, 0x40, 0x4C, 0x70, 0x80, 0x80, 0x80, -+ 0x1B, 0x14, 0x01, 0x04, 0x48 -+ }, -+ /* Tag 36 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 15, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 36, -+ /* Tag Len */ 12, -+ /* Tag Value */ 0x0F,0x00,0x03,0x03,0x03,0x03,0x00,0x00,0x03,0x03,0x04,0x00 -+ }, -+ /* Tag 39 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 7, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 39, -+ /* Tag Len */ 4, -+ /* Tag Value */ 0x12,0x00,0x00,0x00 -+ }, -+ /* Tag 41 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 91, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 41, -+ /* Tag Len */ 88, -+ /* Tag Value */ 0x15, 0x00, 0x00, 0x00, 0xF6, 0x02, 0x00, 0x00, 0x76, 0x00, -+ 0x1E, 0x00, 0x29, 0x02, 0x1F, 0x00, 0x61, 0x00, 0x1A, 0x00, -+ 0x76, 0x00, 0x1E, 0x00, 0x7D, 0x00, 0x40, 0x00, 0x91, 0x00, -+ 0x06, 0x00, 0x92, 0x00, 0x03, 0x00, 0xA6, 0x01, 0x50, 0x00, -+ 0xAA, 0x01, 0x15, 0x00, 0xAB, 0x01, 0x0A, 0x00, 0xAC, 0x01, -+ 0x00, 0x00, 0xB0, 0x01, 0xC5, 0x00, 0xB3, 0x01, 0x03, 0x00, -+ 0xB4, 0x01, 0x13, 0x00, 0xB5, 0x01, 0x0C, 0x00, 0xC5, 0x01, -+ 0x0D, 0x00, 0xC6, 0x01, 0x10, 0x00, 0xCA, 0x01, 0x2B, 0x00, -+ 0xCB, 0x01, 0x5F, 0x00, 0xCC, 0x01, 0x48, 0x00 -+ }, -+ /* Tag 42 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 63, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 42, -+ /* Tag Len */ 60, -+ /* Tag Value */ 0xD7, 0xC0, 0x00, 0x00, 0x8F, 0x5C, 0x02, 0x00, 0x80, 0x47, -+ 0x60, 0x0C, 0x70, 0x4C, 0x00, 0x00, 0x00, 0x01, 0x1F, 0x01, -+ 0x42, 0x01, 0x69, 0x01, 0x95, 0x01, 0xC7, 0x01, 0xFE, 0x01, -+ 0x3D, 0x02, 0x83, 0x02, 0xD1, 0x02, 0x29, 0x03, 0x00, 0x0A, -+ 0x10, 0x00, 0x1F, 0x00, 0x3F, 0x00, 0x7F, 0x00, 0xFD, 0x00, -+ 0xF9, 0x01, 0xF1, 0x03, 0xDE, 0x07, 0x00, 0x00, 0x9A, 0x01 -+ }, -+ /* Tag 84 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 153, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 84, -+ /* Tag Len */ 150, -+ /* Tag Value */ 0x7C, 0x6A, 0x59, 0x47, 0x19, 0x36, 0x35, 0x25, 0x25, 0x28, -+ 0x2C, 0x2B, 0x2B, 0x28, 0x2C, 0x28, 0x29, 0x28, 0x29, 0x28, -+ 0x29, 0x29, 0x2C, 0x29, 0x2C, 0x29, 0x2C, 0x28, 0x29, 0x28, -+ 0x29, 0x28, 0x29, 0x2A, 0x00, 0x00, 0x2C, 0x2A, 0x2C, 0x18, -+ 0x98, 0x98, 0x98, 0x98, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, -+ 0x1E, 0x13, 0x1E, 0x1E, 0x1E, 0x1E, 0x13, 0x13, 0x11, 0x13, -+ 0x1E, 0x1E, 0x13, 0x12, 0x12, 0x12, 0x11, 0x12, 0x1F, 0x12, -+ 0x12, 0x12, 0x10, 0x0C, 0x18, 0x0D, 0x01, 0x01, 0x01, 0x01, -+ 0x01, 0x01, 0x01, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x0D, 0x0D, -+ 0x0E, 0x0D, 0x01, 0x01, 0x0D, 0x0D, 0x0D, 0x0D, 0x0F, 0x0D, -+ 0x10, 0x0D, 0x0D, 0x0D, 0x0D, 0x10, 0x05, 0x10, 0x03, 0x00, -+ 0x7E, 0x7B, 0x7B, 0x72, 0x71, 0x50, 0x50, 0x50, 0x00, 0x40, -+ 0x60, 0x60, 0x30, 0x08, 0x02, 0x0F, 0x00, 0x01, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x16, 0x16, 0x08, 0x08, 0x00, -+ 0x00, 0x00, 0x1E, 0x34, 0x2B, 0x1B, 0x23, 0x2B, 0x15, 0x0D -+ }, -+ /* Tag 85 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 119, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 85, -+ /* Tag Len */ 116, -+ /* Tag Value */ 0x03, 0x00, 0x38, 0x00, 0x45, 0x77, 0x00, 0xE8, 0x00, 0x59, -+ 0x01, 0xCA, 0x01, 0x3B, 0x02, 0xAC, 0x02, 0x1D, 0x03, 0x8E, -+ 0x03, 0x00, 0x89, 0x01, 0x0E, 0x02, 0x5C, 0x02, 0xD7, 0x02, -+ 0xF8, 0x08, 0x01, 0x00, 0x1F, 0x00, 0x0A, 0x02, 0x55, 0x02, -+ 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x2A, 0xD7, 0x00, 0x00, -+ 0x00, 0x1E, 0xDE, 0x00, 0x00, 0x00, 0x14, 0x0F, 0x0A, 0x0F, -+ 0x0A, 0x0C, 0x0C, 0x0C, 0x0C, 0x04, 0x04, 0x04, 0x0C, 0x0C, -+ 0x0C, 0x0C, 0x06, 0x06, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, -+ 0x01, 0x00, 0x02, 0x02, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, -+ 0x06, 0x0F, 0x14, 0x05, 0x47, 0xCF, 0x77, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0xAC, 0x7C, 0xFF, 0x40, 0x00, 0x00, 0x00, -+ 0x12, 0x04, 0x04, 0x01, 0x04, 0x03 -+ }, -+ {TAG_END} -+ }; -+#elif (NVM_VERSION == ROME_1_0_6002) -+ unsigned char cmds[MAX_TAG_CMD][HCI_MAX_CMD_SIZE] = -+ { -+ /* Tag 2 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 9, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 2, -+ /* Tag Len */ 6, -+ /* Tag Value */ 0x77,0x78,0x23,0x01,0x56,0x22 /* BD Address */ -+ }, -+ /* Tag 6 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 11, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 6, -+ /* Tag Len */ 8, -+ /* Tag Value */ 0xFF,0xFE,0x8B,0xFE,0xD8,0x3F,0x5B,0x8B -+ }, -+ /* Tag 17 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 11, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 17, -+ /* Tag Len */ 8, -+ /* Tag Value */ 0x82,0x01,0x0E,0x08,0x04,0x32,0x0A,0x00 -+ }, -+ /* Tag 36 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 15, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 36, -+ /* Tag Len */ 12, -+ /* Tag Value */ 0x0F,0x00,0x03,0x03,0x03,0x03,0x00,0x00,0x03,0x03,0x04,0x00 -+ }, -+ -+ /* Tag 39 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 7, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 39, -+ /* Tag Len */ 4, -+ /* Tag Value */ 0x12,0x00,0x00,0x00 -+ }, -+ -+ /* Tag 41 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 199, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 41, -+ /* Tag Len */ 196, -+ /* Tag Value */ 0x30,0x00,0x00,0x00,0xD5,0x00,0x0E,0x00,0xD6,0x00,0x0E,0x00, -+ 0xD7,0x00,0x16,0x00,0xD8,0x00,0x16,0x00,0xD9,0x00,0x16,0x00, -+ 0xDA,0x00,0x1E,0x00,0xDB,0x00,0x26,0x00,0xDC,0x00,0x5F,0x00, -+ 0xDD,0x00,0x2F,0x00,0xDE,0x00,0x5F,0x00,0xE0,0x00,0x0E,0x00, -+ 0xE1,0x00,0x0E,0x00,0xE2,0x00,0x16,0x00,0xE3,0x00,0x16,0x00, -+ 0xE4,0x00,0x16,0x00,0xE5,0x00,0x1E,0x00,0xE6,0x00,0x26,0x00, -+ 0xE7,0x00,0x5F,0x00,0xE8,0x00,0x2F,0x00,0xE9,0x00,0x5F,0x00, -+ 0xEC,0x00,0x0C,0x00,0xED,0x00,0x08,0x00,0xEE,0x00,0x14,0x00, -+ 0xEF,0x00,0x24,0x00,0xF0,0x00,0x40,0x00,0xF1,0x00,0x4C,0x00, -+ 0xF2,0x00,0x70,0x00,0xF3,0x00,0x80,0x00,0xF4,0x00,0x80,0x00, -+ 0xF5,0x00,0x80,0x00,0xF8,0x00,0x0C,0x00,0xF9,0x00,0x18,0x00, -+ 0xFA,0x00,0x14,0x00,0xFB,0x00,0x24,0x00,0xFC,0x00,0x40,0x00, -+ 0xFD,0x00,0x4C,0x00,0xFE,0x00,0x70,0x00,0xFF,0x00,0x80,0x00, -+ 0x00,0x01,0x80,0x00,0x01,0x01,0x80,0x00,0x04,0x01,0x1B,0x00, -+ 0x05,0x01,0x14,0x00,0x06,0x01,0x01,0x00,0x07,0x01,0x04,0x00, -+ 0x08,0x01,0x00,0x00,0x09,0x01,0x00,0x00,0x0A,0x01,0x03,0x00, -+ 0x0B,0x01,0x03,0x00 -+ }, -+ -+ /* Tag 44 */ -+ { /* Packet Type */HCI_COMMAND_PKT, -+ /* Opcode */ 0x0b,0xfc, -+ /* Total Len */ 44, -+ /* NVM CMD */ NVM_ACCESS_SET, -+ /* Tag Num */ 44, -+ /* Tag Len */ 41, -+ /* Tag Value */ 0x6F,0x0A,0x00,0x00,0x00,0x00,0x00,0x50,0xFF,0x10,0x02,0x02, -+ 0x01,0x00,0x14,0x01,0x06,0x28,0xA0,0x62,0x03,0x64,0x01,0x01, -+ 0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0xFF,0x10,0x02,0x01, -+ 0x00,0x14,0x01,0x02,0x03 -+ }, -+ {TAG_END} -+ }; -+#endif -+ -+ fprintf(stderr, "%s: Start sending NVM Tags (ver: 0x%x)\n", __FUNCTION__, (unsigned int) NVM_VERSION); -+ -+ for (i=0; (i < MAX_TAG_CMD) && (cmds[i][0] != TAG_END); i++) -+ { -+ /* Write BD Address */ -+ if(cmds[i][TAG_NUM_OFFSET] == TAG_NUM_2){ -+ memcpy(&cmds[i][TAG_BDADDR_OFFSET], vnd_local_bd_addr, 6); -+ fprintf(stderr, "BD Address: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", -+ cmds[i][TAG_BDADDR_OFFSET ], cmds[i][TAG_BDADDR_OFFSET + 1], -+ cmds[i][TAG_BDADDR_OFFSET + 2], cmds[i][TAG_BDADDR_OFFSET + 3], -+ cmds[i][TAG_BDADDR_OFFSET + 4], cmds[i][TAG_BDADDR_OFFSET + 5]); -+ } -+ size = cmds[i][3] + HCI_COMMAND_HDR_SIZE + 1; -+ /* Send HCI Command packet to Controller */ -+ err = hci_send_vs_cmd(fd, (unsigned char *)&cmds[i][0], rsp, size); -+ if ( err != size) { -+ fprintf(stderr, "Failed to attach the patch payload to the Controller!\n"); -+ goto error; -+ } -+ -+ /* Read Command Complete Event - This is extra routine for ROME 1.0. From ROM 2.0, it should be removed. */ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if ( err < 0) { -+ fprintf(stderr, "%s: Failed to get patch version(s)\n", __FUNCTION__); -+ goto error; -+ } -+ } -+ -+error: -+ return err; -+} -+ -+ -+ -+int rome_patch_ver_req(int fd) -+{ -+ int size, err = 0; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ -+ /* Frame the HCI CMD to be sent to the Controller */ -+ frame_hci_cmd_pkt(cmd, EDL_PATCH_VER_REQ_CMD, 0, -+ -1, EDL_PATCH_CMD_LEN); -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); -+ -+ /* Send HCI Command packet to Controller */ -+ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); -+ if ( err != size) { -+ fprintf(stderr, "Failed to attach the patch payload to the Controller!\n"); -+ goto error; -+ } -+ -+ /* Read Command Complete Event - This is extra routine for ROME 1.0. From ROM 2.0, it should be removed. */ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if ( err < 0) { -+ fprintf(stderr, "%s: Failed to get patch version(s)\n", __FUNCTION__); -+ goto error; -+ } -+error: -+ return err; -+ -+} -+ -+int rome_disable_sleep(int fd) -+{ -+ int size, err = 0; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ hci_command_hdr *cmd_hdr; -+ int flags; -+ -+ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); -+ -+ cmd_hdr = (void *) (cmd + 1); -+ cmd[0] = HCI_COMMAND_PKT; -+ cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, NVM_ACCESS_CODE); -+ cmd_hdr->plen = VSC_DISABLE_IBS_LEN; -+ cmd[4] = 0x01; -+ cmd[5] = 0x1B; -+ cmd[6] = 0x01; -+ cmd[7] = 0x00; -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_DISABLE_IBS_LEN); -+ /* Send the HCI command packet to UART for transmission */ -+ fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7]) ; -+ err = write(fd, cmd, size); -+ if (err != size) { -+ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); -+ goto error; -+ } -+ -+ /* Check for response from the Controller */ -+ if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { -+ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); -+ goto error; -+ } -+ -+ fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); -+ -+ /* Wait for command complete event */ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if ( err < 0) { -+ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); -+ goto error; -+ } -+ fprintf(stderr, "%s\n", __FUNCTION__); -+error: -+ return err; -+ -+} -+ -+int rome_set_baudrate_req(int fd) -+{ -+ int size, err = 0; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ hci_command_hdr *cmd_hdr; -+ int flags; -+ -+ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); -+ -+ cmd_hdr = (void *) (cmd + 1); -+ cmd[0] = HCI_COMMAND_PKT; -+ cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF); -+ cmd_hdr->plen = VSC_SET_BAUDRATE_REQ_LEN; -+ cmd[4] = BAUDRATE_115200; -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN); -+ /* Send the HCI command packet to UART for transmission */ -+ fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ; -+ err = write(fd, cmd, size); -+ if (err != size) { -+ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); -+ goto error; -+ } -+ -+ /* Check for response from the Controller */ -+ if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { -+ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); -+ goto error; -+ } -+ -+ fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); -+ -+ /* Wait for command complete event */ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if ( err < 0) { -+ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); -+ goto error; -+ } -+ fprintf(stderr, "%s\n", __FUNCTION__); -+error: -+ return err; -+ -+} -+ -+ -+int rome_hci_reset_req(int fd) -+{ -+ int size, err = 0; -+ unsigned char cmd[HCI_MAX_CMD_SIZE]; -+ unsigned char rsp[HCI_MAX_EVENT_SIZE]; -+ hci_command_hdr *cmd_hdr; -+ int flags; -+ -+ fprintf(stderr, "%s: HCI RESET \n", __FUNCTION__); -+ -+ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); -+ -+ cmd_hdr = (void *) (cmd + 1); -+ cmd[0] = HCI_COMMAND_PKT; -+ cmd_hdr->opcode = HCI_RESET; -+ cmd_hdr->plen = 0; -+ -+ /* Total length of the packet to be sent to the Controller */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE); -+ -+ /* Send the HCI command packet to UART for transmission */ -+ fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]); -+ err = write(fd, cmd, size); -+ if (err != size) { -+ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); -+ goto error; -+ } -+ -+ /* Wait for command complete event */ -+ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -+ if ( err < 0) { -+ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); -+ goto error; -+ } -+ -+error: -+ return err; -+ -+} -+ -+ -+int qca_soc_init(int fd, char *bdaddr) -+{ -+ int err = -1; -+ int size; -+ -+ fprintf(stderr, " %s \n", __FUNCTION__); -+ vnd_userial.fd = fd; -+ /* Get Rome version information */ -+ if((err = rome_patch_ver_req(fd)) <0){ -+ fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err); -+ goto error; -+ } -+ -+ fprintf(stderr, "%s: Rome Version (0x%08x)\n", __FUNCTION__, rome_ver); -+ -+ switch (rome_ver){ -+ case ROME_VER_1_0: -+ { -+ /* Set and Download the RAMPATCH */ -+ fprintf(stderr, "%s: Setting Patch Header & Downloading Patches\n", __FUNCTION__); -+ err = rome_download_rampatch(fd); -+ if (err < 0) { -+ fprintf(stderr, "%s: DOWNLOAD RAMPATCH failed!\n", __FUNCTION__); -+ goto error; -+ } -+ fprintf(stderr, "%s: DOWNLOAD RAMPTACH complete\n", __FUNCTION__); -+ -+ /* Attach the RAMPATCH */ -+ fprintf(stderr, "%s: Attaching the patches\n", __FUNCTION__); -+ err = rome_attach_rampatch(fd); -+ if (err < 0) { -+ fprintf(stderr, "%s: ATTACH RAMPATCH failed!\n", __FUNCTION__); -+ goto error; -+ } -+ fprintf(stderr, "%s: ATTACH RAMPTACH complete\n", __FUNCTION__); -+ -+ /* Send Reset */ -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); -+ err = rome_rampatch_reset(fd); -+ if ( err < 0 ) { -+ fprintf(stderr, "Failed to RESET after RAMPATCH upgrade!\n"); -+ goto error; -+ } -+ -+ /* NVM download */ -+ fprintf(stderr, "%s: Downloading NVM\n", __FUNCTION__); -+ err = rome_1_0_nvm_tag_dnld(fd); -+ if ( err <0 ) { -+ fprintf(stderr, "Downloading NVM Failed !!\n"); -+ goto error; -+ } -+ -+ /* Change baud rate 115.2 kbps to 3Mbps*/ -+ err = rome_hci_reset_req(fd); -+ if ( err <0 ) { -+ fprintf(stderr, "HCI Reset Failed !!\n"); -+ goto error; -+ } -+ -+ fprintf(stderr, "HCI Reset is done\n"); -+ } -+ break; -+ case ROME_VER_1_1: -+ rampatch_file_path = ROME_RAMPATCH_TLV_PATH; -+ nvm_file_path = ROME_NVM_TLV_PATH; -+ goto download; -+ case ROME_VER_1_3: -+ rampatch_file_path = ROME_RAMPATCH_TLV_1_0_3_PATH; -+ nvm_file_path = ROME_NVM_TLV_1_0_3_PATH; -+ goto download; -+ case ROME_VER_2_1: -+ rampatch_file_path = ROME_RAMPATCH_TLV_2_0_1_PATH; -+ nvm_file_path = ROME_NVM_TLV_2_0_1_PATH; -+ goto download; -+ case ROME_VER_3_0: -+ case TUFELLO_VER_1_0: -+ rampatch_file_path = ROME_RAMPATCH_TLV_3_0_0_PATH; -+ nvm_file_path = ROME_NVM_TLV_3_0_0_PATH; -+ -+download: -+ /* Donwload TLV files (rampatch, NVM) */ -+ err = rome_download_tlv_file(fd); -+ if (err < 0) { -+ fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__); -+ goto error; -+ } -+ fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__); -+ -+ /* Change baud rate back to user requested */ -+ fprintf(stderr, "Changing baud rate back from 3M --> 115K\n"); -+ err = rome_set_baudrate_req(fd); -+ if (err < 0) { -+ fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); -+ goto error; -+ } -+ fprintf(stderr, "%s: Baud rate changed successfully \n", __FUNCTION__); -+ -+ fprintf(stderr, "%s: Disabling In Band Sleep functionality\n", __FUNCTION__); -+ err = rome_disable_sleep(fd); -+ if (err < 0) { -+ fprintf(stderr, "%s: Failed to disable IBS!\n", __FUNCTION__); -+ goto error; -+ } -+ fprintf(stderr, "%s: IBS disabled successfully \n", __FUNCTION__); -+ -+ /* Perform HCI reset here*/ -+ err = rome_hci_reset_req(fd); -+ if ( err <0 ) { -+ fprintf(stderr, "HCI Reset Failed !!!\n"); -+ goto error; -+ } -+ fprintf(stderr, "HCI Reset is done\n"); -+ -+ break; -+ case ROME_VER_UNKNOWN: -+ default: -+ fprintf(stderr, "%s: Detected unknown ROME version\n", __FUNCTION__); -+ err = -1; -+ break; -+ } -+ -+error: -+ return err; -+} -diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h -new file mode 100644 -index 000000000000..aa59965643ec ---- /dev/null -+++ b/tools/hciattach_rome.h -@@ -0,0 +1,317 @@ -+/* -+ * Copyright 2012 The Android Open Source Project -+ * Copyright (c) 2013, The Linux Foundation. All rights reserved. -+ * Not a Contribution. -+ * -+ * Licensed under the Apache License, Version 2.0 (the "License"); -+ * you may not use this file except in compliance with the License. -+ * You may obtain a copy of the License at -+ * -+ * http://www.apache.org/licenses/LICENSE-2.0 -+ * -+ * Unless required by applicable law or agreed to in writing, software -+ * distributed under the License is distributed on an "AS IS" BASIS, -+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ * See the License for the specific language governing permissions and -+ * limitations under the License. -+ */ -+#ifndef HW_ROME_H -+#define HW_ROME_H -+ -+/****************************************************************************** -+** Constants & Macros -+******************************************************************************/ -+#define HCI_MAX_CMD_SIZE 260 -+#define HCI_MAX_EVENT_SIZE 260 -+#define PRINT_BUF_SIZE ((HCI_MAX_CMD_SIZE * 3) + 2) -+/* HCI Command/Event Opcode */ -+#define HCI_RESET 0x0C03 -+#define EVT_CMD_COMPLETE 0x0E -+/* HCI Packet types */ -+#define HCI_COMMAND_PKT 0x01 -+#define HCI_ACLDATA_PKT 0x02 -+#define HCI_SCODATA_PKT 0x03 -+#define HCI_EVENT_PKT 0x04 -+#define HCI_VENDOR_PKT 0xff -+#define cmd_opcode_pack(ogf, ocf) (unsigned short)((ocf & 0x03ff)|(ogf << 10)) -+unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -+typedef enum { -+ USERIAL_OP_FLOW_ON, -+ USERIAL_OP_FLOW_OFF, -+ USERIAL_OP_NOP, -+} userial_vendor_ioctl_op_t; -+ -+ -+/* vendor serial control block */ -+typedef struct -+{ -+ int fd; /* fd to Bluetooth device */ -+ struct termios termios; /* serial terminal of BT port */ -+ char port_name[256]; -+} vnd_userial_cb_t; -+ -+/**** baud rates ****/ -+#define USERIAL_BAUD_300 0 -+#define USERIAL_BAUD_600 1 -+#define USERIAL_BAUD_1200 2 -+#define USERIAL_BAUD_2400 3 -+#define USERIAL_BAUD_9600 4 -+#define USERIAL_BAUD_19200 5 -+#define USERIAL_BAUD_57600 6 -+#define USERIAL_BAUD_115200 7 -+#define USERIAL_BAUD_230400 8 -+#define USERIAL_BAUD_460800 9 -+#define USERIAL_BAUD_921600 10 -+#define USERIAL_BAUD_1M 11 -+#define USERIAL_BAUD_1_5M 12 -+#define USERIAL_BAUD_2M 13 -+#define USERIAL_BAUD_3M 14 -+#define USERIAL_BAUD_4M 15 -+#define USERIAL_BAUD_AUTO 16 -+ -+#ifndef FALSE -+#define FALSE 0 -+#endif -+ -+#ifndef TRUE -+#define TRUE (!FALSE) -+#endif -+ -+#define HCI_CHG_BAUD_CMD_OCF 0x0C -+#define HCI_VENDOR_CMD_OGF 0x3F -+#define WRITE_BDADDR_CMD_LEN 14 -+#define WRITE_BAUD_CMD_LEN 6 -+#define MAX_CMD_LEN WRITE_BDADDR_CMD_LEN -+#define GET_VERSION_OCF 0x1E -+ -+#define PS_HDR_LEN 4 -+#define HCI_VENDOR_CMD_OGF 0x3F -+#define HCI_PS_CMD_OCF 0x0B -+ -+#define HCI_COMMAND_HDR_SIZE 3 -+#define EVT_CMD_COMPLETE_SIZE 3 -+#define EVT_CMD_STATUS 0x0F -+#define EVT_CMD_STATUS_SIZE 4 -+#define HCI_EVENT_HDR_SIZE 2 -+#define HCI_EV_SUCCESS 0x00 -+/* HCI Socket options */ -+#define HCI_DATA_DIR 1 -+#define HCI_FILTER 2 -+#define HCI_TIME_STAMP 3 -+ -+#define P_ID_OFFSET (0) -+#define HCI_CMD_IND (1) -+#define EVENTCODE_OFFSET (1) -+#define EVT_PLEN (2) -+#define PLEN (3) -+#define CMD_RSP_OFFSET (3) -+#define RSP_TYPE_OFFSET (4) -+#define BAUDRATE_RSP_STATUS_OFFSET (4) -+#define CMD_STATUS_OFFSET (5) -+#define P_ROME_VER_OFFSET (4) -+#define P_BUILD_VER_OFFSET (6) -+#define P_BASE_ADDR_OFFSET (8) -+#define P_ENTRY_ADDR_OFFSET (12) -+#define P_LEN_OFFSET (16) -+#define P_CRC_OFFSET (20) -+#define P_CONTROL_OFFSET (24) -+#define PATCH_HDR_LEN (28) -+#define MAX_DATA_PER_SEGMENT (239) -+#define VSEVENT_CODE (0xFF) -+#define HC_VS_MAX_CMD_EVENT (0xFF) -+#define PATCH_PROD_ID_OFFSET (5) -+#define PATCH_PATCH_VER_OFFSET (9) -+#define PATCH_ROM_BUILD_VER_OFFSET (11) -+#define PATCH_SOC_VER_OFFSET (13) -+#define MAX_SIZE_PER_TLV_SEGMENT (243) -+ -+/* VS Opcode */ -+#define HCI_PATCH_CMD_OCF (0) -+#define EDL_SET_BAUDRATE_CMD_OCF (0x48) -+ -+/* VS Commands */ -+#define VSC_SET_BAUDRATE_REQ_LEN (1) -+#define EDL_PATCH_CMD_LEN (1) -+#define EDL_PATCH_CMD_REQ_LEN (1) -+#define EDL_PATCH_DLD_REQ_CMD (0x01) -+#define EDL_PATCH_RST_REQ_CMD (0x05) -+#define EDL_PATCH_SET_REQ_CMD (0x16) -+#define EDL_PATCH_ATCH_REQ_CMD (0x17) -+#define EDL_PATCH_VER_REQ_CMD (0x19) -+#define EDL_PATCH_TLV_REQ_CMD (0x1E) -+#define VSC_DISABLE_IBS_LEN (0x04) -+ -+/* VS Event */ -+#define EDL_CMD_REQ_RES_EVT (0x00) -+#define EDL_CMD_EXE_STATUS_EVT (0x00) -+#define EDL_SET_BAUDRATE_RSP_EVT (0x92) -+#define EDL_PATCH_VER_RES_EVT (0x19) -+#define EDL_TVL_DNLD_RES_EVT (0x04) -+#define EDL_APP_VER_RES_EVT (0x02) -+ -+ -+/* Status Codes of HCI CMD execution*/ -+#define HCI_CMD_SUCCESS (0x0) -+#define PATCH_LEN_ERROR (0x1) -+#define PATCH_VER_ERROR (0x2) -+#define PATCH_CRC_ERROR (0x3) -+#define PATCH_NOT_FOUND (0x4) -+#define TLV_TYPE_ERROR (0x10) -+#define NVM_ACCESS_CODE (0x0B) -+#define BAUDRATE_CHANGE_SUCCESS (1) -+ -+/* TLV_TYPE */ -+#define TLV_TYPE_PATCH (1) -+#define TLV_TYPE_NVM (2) -+ -+/* NVM */ -+#define MAX_TAG_CMD 30 -+#define TAG_END 0xFF -+#define NVM_ACCESS_SET 0x01 -+#define TAG_NUM_OFFSET 5 -+#define TAG_NUM_2 2 -+#define TAG_BDADDR_OFFSET 7 -+ -+/* NVM Tags specifically used for ROME 1.0 */ -+#define ROME_1_0_100022_1 0x101000221 -+#define ROME_1_0_100019 0x101000190 -+#define ROME_1_0_6002 0x100600200 -+ -+/* Default NVM Version setting for ROME 1.0 */ -+#define NVM_VERSION ROME_1_0_100022_1 -+ -+ -+#define LSH(val, n) ((unsigned int)(val) << (n)) -+#define EXTRACT_BYTE(val, pos) (char) (((val) >> (8 * (pos))) & 0xFF) -+#define CALC_SEG_SIZE(len, max) ((plen) % (max))?((plen/max)+1) : ((plen) / (max)) -+ -+#define ROME_FW_PATH "/lib/firmware/rampatch.img" -+#define ROME_RAMPATCH_TLV_PATH "/lib/firmware/rampatch_tlv.img" -+#define ROME_NVM_TLV_PATH "/lib/firmware/nvm_tlv.bin" -+#define ROME_RAMPATCH_TLV_1_0_3_PATH "/lib/firmware/rampatch_tlv_1.3.tlv" -+#define ROME_NVM_TLV_1_0_3_PATH "/lib/firmware/nvm_tlv_1.3.bin" -+#define ROME_RAMPATCH_TLV_2_0_1_PATH "/lib/firmware/rampatch_tlv_2.1.tlv" -+#define ROME_NVM_TLV_2_0_1_PATH "/lib/firmware/nvm_tlv_2.1.bin" -+#define ROME_RAMPATCH_TLV_3_0_0_PATH "/lib/firmware/qca/rampatch_tlv_3.0.tlv" -+#define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin" -+ -+ -+/****************************************************************************** -+** Local type definitions -+******************************************************************************/ -+ -+typedef struct { -+ unsigned char ncmd; -+ unsigned short opcode; -+} __attribute__ ((packed)) evt_cmd_complete; -+ -+typedef struct { -+ unsigned char status; -+ unsigned char ncmd; -+ unsigned short opcode; -+} __attribute__ ((packed)) evt_cmd_status; -+ -+typedef struct { -+ unsigned short opcode; -+ unsigned char plen; -+} __attribute__ ((packed)) hci_command_hdr; -+ -+typedef struct { -+ unsigned char evt; -+ unsigned char plen; -+} __attribute__ ((packed)) hci_event_hdr; -+typedef struct { -+ unsigned short rom_version; -+ unsigned short build_version; -+} __attribute__ ((packed)) patch_version; -+ -+typedef struct { -+ unsigned int patch_id; -+ patch_version patch_ver; -+ unsigned int patch_base_addr; -+ unsigned int patch_entry_addr; -+ unsigned short patch_length; -+ int patch_crc; -+ unsigned short patch_ctrl; -+} __attribute__ ((packed)) patch_info; -+ -+typedef struct { -+ unsigned char sign_ver; -+ unsigned char sign_algorithm; -+ unsigned short reserved1; -+ unsigned short prod_id; -+ unsigned short build_ver; -+ unsigned short patch_ver; -+ unsigned short reserved2; -+ unsigned int patch_entry_addr; -+} __attribute__ ((packed)) tlv_patch_hdr; -+ -+typedef struct { -+ unsigned short tag_id; -+ unsigned short tag_len; -+ unsigned int tag_ptr; -+ unsigned int tag_ex_flag; -+} __attribute__ ((packed)) tlv_nvm_hdr; -+ -+typedef struct { -+ unsigned char tlv_type; -+ unsigned char tlv_length1; -+ unsigned char tlv_length2; -+ unsigned char tlv_length3; -+ unsigned int tlv_data_len; -+ unsigned int tlv_patch_data_len; -+ -+ union{ -+ tlv_patch_hdr patch; -+ tlv_nvm_hdr nvm; -+ }tlv; -+} __attribute__ ((packed)) tlv_patch_info; -+ -+enum{ -+ BAUDRATE_115200 = 0x00, -+ BAUDRATE_57600 = 0x01, -+ BAUDRATE_38400 = 0x02, -+ BAUDRATE_19200 = 0x03, -+ BAUDRATE_9600 = 0x04, -+ BAUDRATE_230400 = 0x05, -+ BAUDRATE_250000 = 0x06, -+ BAUDRATE_460800 = 0x07, -+ BAUDRATE_500000 = 0x08, -+ BAUDRATE_720000 = 0x09, -+ BAUDRATE_921600 = 0x0A, -+ BAUDRATE_1000000 = 0x0B, -+ BAUDRATE_1250000 = 0x0C, -+ BAUDRATE_2000000 = 0x0D, -+ BAUDRATE_3000000 = 0x0E, -+ BAUDRATE_4000000 = 0x0F, -+ BAUDRATE_1600000 = 0x10, -+ BAUDRATE_3200000 = 0x11, -+ BAUDRATE_3500000 = 0x12, -+ BAUDRATE_AUTO = 0xFE, -+ BAUDRATE_Reserved = 0xFF -+}; -+ -+enum{ -+ ROME_PATCH_VER_0100 = 0x0100, -+ ROME_PATCH_VER_0101 = 0x0101, -+ ROME_PATCH_VER_0200 = 0x0200, -+ ROME_PATCH_VER_0300 = 0x0300 -+ }; -+ -+enum{ -+ ROME_SOC_ID_00 = 0x00000000, -+ ROME_SOC_ID_11 = 0x00000011, -+ ROME_SOC_ID_13 = 0x00000013, -+ ROME_SOC_ID_22 = 0x00000022, -+}; -+ -+enum{ -+ ROME_VER_UNKNOWN = 0, -+ ROME_VER_1_0 = ((ROME_PATCH_VER_0100 << 16 ) | ROME_SOC_ID_00 ), -+ ROME_VER_1_1 = ((ROME_PATCH_VER_0101 << 16 ) | ROME_SOC_ID_00 ), -+ ROME_VER_1_3 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_00 ), -+ ROME_VER_2_1 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_11 ), -+ ROME_VER_3_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_22 ), -+ TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ) -+}; -+#endif /* HW_ROME_H */ diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0004-bluetooth-Enable-bluetooth-low-power-mode-functional.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0004-bluetooth-Enable-bluetooth-low-power-mode-functional.patch deleted file mode 100644 index 8ba83ae56..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0004-bluetooth-Enable-bluetooth-low-power-mode-functional.patch +++ /dev/null @@ -1,28 +0,0 @@ -From: Anantha Krishnan -Date: Thu, 11 Sep 2014 19:20:02 +0530 -Subject: [PATCH] bluetooth: Enable bluetooth low power mode functionality - -During periods of inactivity the bluetooth controller and the -application processor will indicate each other to enter into -low power mode and signal each other when they have data to be -exchanged, thereby saving considerable amount of power. - -Change-Id: I9e0d579ac8a9d61a2ebde78b031f4101cb6bc443 -Signed-off-by: Rupesh Tatiya ---- - tools/hciattach.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tools/hciattach.c b/tools/hciattach.c -index 73811d4c4c2a..e3a915061440 100644 ---- a/tools/hciattach.c -+++ b/tools/hciattach.c -@@ -1102,7 +1102,7 @@ struct uart_t uart[] = { - FLOW_CTL, DISABLE_PM, NULL, ath3k_ps, ath3k_pm }, - - /* QCA ROME */ -- { "qca", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, -+ { "qca", 0x0000, 0x0000, HCI_UART_IBS, 115200, 115200, - FLOW_CTL, DISABLE_PM, NULL, qca, NULL }, - - /* QUALCOMM BTS */ diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0005-bluetooth-Fix-bug-in-firmware-parsing-mechanism.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0005-bluetooth-Fix-bug-in-firmware-parsing-mechanism.patch deleted file mode 100644 index 21b57dde3..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0005-bluetooth-Fix-bug-in-firmware-parsing-mechanism.patch +++ /dev/null @@ -1,51 +0,0 @@ -From: Anantha Krishnan -Date: Thu, 11 Sep 2014 18:57:45 +0530 -Subject: [PATCH] bluetooth: Fix bug in firmware parsing mechanism - -Reorganize the RAMPATCH members to be present as part of the -RAMPATCH header structre instead of the main firmware structure - -Change-Id: If523e1bb20edcd52b7c6f623c07af492e6305bd0 -Signed-off-by: Rupesh Tatiya ---- - tools/hciattach_rome.c | 4 ++-- - tools/hciattach_rome.h | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index f31be43c09e4..122a0f4b89bc 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -851,8 +851,8 @@ int rome_get_tlv_file(char *file_path) - fprintf(stderr, "Length\t\t\t : %d bytes\n", (ptlv_header->tlv_length1) | - (ptlv_header->tlv_length2 << 8) | - (ptlv_header->tlv_length3 << 16)); -- fprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv_data_len); -- fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv_patch_data_len); -+ fprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv.patch.tlv_data_len); -+ fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len); - fprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver); - fprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm); - fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1); -diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h -index aa59965643ec..07127f30a70a 100644 ---- a/tools/hciattach_rome.h -+++ b/tools/hciattach_rome.h -@@ -236,6 +236,8 @@ typedef struct { - } __attribute__ ((packed)) patch_info; - - typedef struct { -+ unsigned int tlv_data_len; -+ unsigned int tlv_patch_data_len; - unsigned char sign_ver; - unsigned char sign_algorithm; - unsigned short reserved1; -@@ -258,8 +260,6 @@ typedef struct { - unsigned char tlv_length1; - unsigned char tlv_length2; - unsigned char tlv_length3; -- unsigned int tlv_data_len; -- unsigned int tlv_patch_data_len; - - union{ - tlv_patch_hdr patch; diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0006-bluetooth-Configure-BD-Address.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0006-bluetooth-Configure-BD-Address.patch deleted file mode 100644 index d39d8d0a0..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0006-bluetooth-Configure-BD-Address.patch +++ /dev/null @@ -1,114 +0,0 @@ -From: Anantha Krishnan -Date: Mon, 8 Sep 2014 15:11:02 +0530 -Subject: [PATCH] bluetooth: Configure BD Address - -Read the BD Address programmed by user from persist location. -If there is no user programmed BD address then use the default -BD address present in the firmware file. - -Change-Id: Id702d1476bae765dfd23f88542bfd5a8a1f26056 -Signed-off-by: Rupesh Tatiya ---- - tools/hciattach_rome.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++--- - tools/hciattach_rome.h | 7 +++++++ - 2 files changed, 60 insertions(+), 3 deletions(-) - -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index 122a0f4b89bc..947e1abb96c4 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -809,6 +809,7 @@ int rome_get_tlv_file(char *file_path) - tlv_nvm_hdr *nvm_ptr; - unsigned char data_buf[PRINT_BUF_SIZE]={0,}; - unsigned char *nvm_byte_ptr; -+ unsigned char bdaddr[6]; - - fprintf(stderr, "File Open (%s)\n", file_path); - pFile = fopen ( file_path , "r" ); -@@ -886,9 +887,10 @@ int rome_get_tlv_file(char *file_path) - nvm_byte_ptr+=sizeof(tlv_nvm_hdr); - - /* Write BD Address */ -- if(nvm_ptr->tag_id == TAG_NUM_2){ -- memcpy(nvm_byte_ptr, vnd_local_bd_addr, 6); -- fprintf(stderr, "BD Address: %.02x:%.02x:%.02x:%.02x:%.02x:%.02x\n", -+ if(nvm_ptr->tag_id == TAG_NUM_2 && read_bd_address(&bdaddr) == 0) { -+ memcpy(nvm_byte_ptr, bdaddr, 6); -+ fprintf(stderr, "Overriding default BD ADDR with user" -+ " programmed BD Address: %02x:%02x:%02x:%02x:%02x:%02x\n", - *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), - *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); - } -@@ -1451,6 +1453,54 @@ error: - - } - -+int read_bd_address(unsigned char *bdaddr) -+{ -+ int fd = -1; -+ int readPtr = 0; -+ unsigned char data[BD_ADDR_LEN]; -+ -+ /* Open the persist file for reading device address*/ -+ fd = open("/etc/bluetooth/.bt_nv.bin", O_RDONLY); -+ if(fd < 0) -+ { -+ fprintf(stderr, "%s: Open failed: Programming default BD ADDR\n", __func__); -+ return -1; -+ } -+ -+ /* Read the NVM Header : fp will be advanced by readPtr number of bytes */ -+ readPtr = read(fd, data, PERSIST_HEADER_LEN); -+ if (readPtr > 0) -+ fprintf(stderr, "%s: Persist header data: %02x \t %02x \t %02x\n", __func__, -+ data[NVITEM], data[RDWR_PROT], data[NVITEM_SIZE]); -+ else { -+ fprintf(stderr, "%s: Read from persist memory failed : Programming default" -+ " BD ADDR\n"); -+ close(fd); -+ return -1; -+ } -+ -+ /* Check for BD ADDR length before programming */ -+ if(data[NVITEM_SIZE] != BD_ADDR_LEN) { -+ fprintf(stderr, "Invalid BD ADDR: Programming default BD ADDR!\n"); -+ close(fd); -+ return -1; -+ } -+ -+ /* Read the BD ADDR info */ -+ readPtr = read(fd, data, BD_ADDR_LEN); -+ if (readPtr > 0) -+ fprintf(stderr, "BD-ADDR: ==> %02x:%02x:%02x:%02x:%02x:%02x\n", data[0], -+ data[1], data[2], data[3], data[4], data[5]); -+ else { -+ fprintf(stderr, "%s: Read from persist memory failed : Programming default" -+ " BD ADDR\n"); -+ close(fd); -+ return -1; -+ } -+ memcpy(bdaddr, data, BD_ADDR_LEN); -+ close(fd); -+ return 0; -+} - - int qca_soc_init(int fd, char *bdaddr) - { -diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h -index 07127f30a70a..a4abe9f73080 100644 ---- a/tools/hciattach_rome.h -+++ b/tools/hciattach_rome.h -@@ -34,6 +34,13 @@ - #define HCI_EVENT_PKT 0x04 - #define HCI_VENDOR_PKT 0xff - #define cmd_opcode_pack(ogf, ocf) (unsigned short)((ocf & 0x03ff)|(ogf << 10)) -+ -+#define NVITEM 0 -+#define RDWR_PROT 1 -+#define NVITEM_SIZE 2 -+#define PERSIST_HEADER_LEN 3 -+#define BD_ADDR_LEN 6 -+ - unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - typedef enum { - USERIAL_OP_FLOW_ON, diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0007-bluetooth-Remove-unused-functions-in-the-firmware-do.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0007-bluetooth-Remove-unused-functions-in-the-firmware-do.patch deleted file mode 100644 index 604efb2e4..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0007-bluetooth-Remove-unused-functions-in-the-firmware-do.patch +++ /dev/null @@ -1,73 +0,0 @@ -From: Anantha Krishnan -Date: Mon, 8 Sep 2014 14:33:24 +0530 -Subject: [PATCH] bluetooth: Remove unused functions in the firmware download - process - -rome_disable_sleep() function is not used anywhere in the code and -hence remove it. - -Change-Id: Iec1f9b1478850af3023ff297493693283a5338d7 -Signed-off-by: Rupesh Tatiya ---- - tools/hciattach_rome.c | 48 ------------------------------------------------ - 1 file changed, 48 deletions(-) - -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index 947e1abb96c4..4fcbdf2ab82a 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -1317,54 +1317,6 @@ error: - - } - --int rome_disable_sleep(int fd) --{ -- int size, err = 0; -- unsigned char cmd[HCI_MAX_CMD_SIZE]; -- unsigned char rsp[HCI_MAX_EVENT_SIZE]; -- hci_command_hdr *cmd_hdr; -- int flags; -- -- memset(cmd, 0x0, HCI_MAX_CMD_SIZE); -- -- cmd_hdr = (void *) (cmd + 1); -- cmd[0] = HCI_COMMAND_PKT; -- cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, NVM_ACCESS_CODE); -- cmd_hdr->plen = VSC_DISABLE_IBS_LEN; -- cmd[4] = 0x01; -- cmd[5] = 0x1B; -- cmd[6] = 0x01; -- cmd[7] = 0x00; -- -- /* Total length of the packet to be sent to the Controller */ -- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_DISABLE_IBS_LEN); -- /* Send the HCI command packet to UART for transmission */ -- fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7]) ; -- err = write(fd, cmd, size); -- if (err != size) { -- fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); -- goto error; -- } -- -- /* Check for response from the Controller */ -- if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { -- fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); -- goto error; -- } -- -- fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); -- -- /* Wait for command complete event */ -- err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); -- if ( err < 0) { -- fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); -- goto error; -- } -- fprintf(stderr, "%s\n", __FUNCTION__); --error: -- return err; -- --} - - int rome_set_baudrate_req(int fd) - { diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0008-bluetooth-Enable-3Mbps-baud-rate-support.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0008-bluetooth-Enable-3Mbps-baud-rate-support.patch deleted file mode 100644 index a4f15ead0..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0008-bluetooth-Enable-3Mbps-baud-rate-support.patch +++ /dev/null @@ -1,150 +0,0 @@ -From: Anantha Krishnan -Date: Mon, 8 Sep 2014 14:31:18 +0530 -Subject: [PATCH] bluetooth: Enable 3Mbps baud rate support - -Allow APPS PROC and BT Controller to operate at 3Mbps baud rate -for faster exchange of commands, events and data between the two - -Change-Id: I55651633027ea60a762b11abea84fe1abd6574a9 -Signed-off-by: Rupesh Tatiya ---- - tools/hciattach_rome.c | 63 ++++++++++++++++++++++++++++++++++++++------------ - 1 file changed, 48 insertions(+), 15 deletions(-) - -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index 4fcbdf2ab82a..d0e2935b9997 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -166,6 +166,7 @@ int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data) - } - cfmakeraw(&ti); - ti.c_cflag |= CLOCAL; -+ ti.c_cflag |= CREAD; - - switch(op) - { -@@ -332,6 +333,8 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size) - { - int remain, r; - int count = 0; -+ fd_set infids; -+ struct timeval timeout; - - if (size <= 0) { - fprintf(stderr, "Invalid size arguement!\n"); -@@ -340,6 +343,16 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size) - - fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", __FUNCTION__); - -+ FD_ZERO (&infids); -+ FD_SET (fd, &infids); -+ timeout.tv_sec = 3; -+ timeout.tv_usec = 0; /* half second is a long time at 115.2 Kbps */ -+ -+ if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) -+ fprintf(stderr, "%s: Timing out on select for 3 secs.\n", __FUNCTION__); -+ else -+ fprintf(stderr, "%s: Data available in TTY Serial buffer\n", __FUNCTION__); -+ - /* The first byte identifies the packet type. For HCI event packets, it - * should be 0x04, so we read until we get to the 0x04. */ - /* It will keep reading until find 0x04 byte */ -@@ -1332,10 +1345,16 @@ int rome_set_baudrate_req(int fd) - cmd[0] = HCI_COMMAND_PKT; - cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF); - cmd_hdr->plen = VSC_SET_BAUDRATE_REQ_LEN; -- cmd[4] = BAUDRATE_115200; -+ cmd[4] = BAUDRATE_3000000; - - /* Total length of the packet to be sent to the Controller */ - size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN); -+ /* Flow off during baudrate change */ -+ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0) -+ { -+ fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err); -+ goto error; -+ } - /* Send the HCI command packet to UART for transmission */ - fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ; - err = write(fd, cmd, size); -@@ -1343,7 +1362,15 @@ int rome_set_baudrate_req(int fd) - fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); - goto error; - } -+ /* Change Local UART baudrate to high speed UART */ -+ userial_vendor_set_baud(USERIAL_BAUD_3M); - -+ /* Flow on after changing local uart baudrate */ -+ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0) -+ { -+ fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err); -+ return err; -+ } - /* Check for response from the Controller */ - if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { - fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); -@@ -1385,6 +1412,12 @@ int rome_hci_reset_req(int fd) - /* Total length of the packet to be sent to the Controller */ - size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE); - -+ /* Flow off during baudrate change */ -+ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0) -+ { -+ fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err); -+ goto error; -+ } - /* Send the HCI command packet to UART for transmission */ - fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]); - err = write(fd, cmd, size); -@@ -1393,6 +1426,15 @@ int rome_hci_reset_req(int fd) - goto error; - } - -+ /* Change Local UART baudrate to high speed UART */ -+ userial_vendor_set_baud(USERIAL_BAUD_3M); -+ -+ /* Flow on after changing local uart baudrate */ -+ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0) -+ { -+ fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err); -+ return err; -+ } - /* Wait for command complete event */ - err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); - if ( err < 0) { -@@ -1534,16 +1576,7 @@ int qca_soc_init(int fd, char *bdaddr) - nvm_file_path = ROME_NVM_TLV_3_0_0_PATH; - - download: -- /* Donwload TLV files (rampatch, NVM) */ -- err = rome_download_tlv_file(fd); -- if (err < 0) { -- fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__); -- goto error; -- } -- fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__); -- -- /* Change baud rate back to user requested */ -- fprintf(stderr, "Changing baud rate back from 3M --> 115K\n"); -+ /* Change baud rate 115.2 kbps to 3Mbps*/ - err = rome_set_baudrate_req(fd); - if (err < 0) { - fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); -@@ -1551,13 +1584,13 @@ download: - } - fprintf(stderr, "%s: Baud rate changed successfully \n", __FUNCTION__); - -- fprintf(stderr, "%s: Disabling In Band Sleep functionality\n", __FUNCTION__); -- err = rome_disable_sleep(fd); -+ /* Donwload TLV files (rampatch, NVM) */ -+ err = rome_download_tlv_file(fd); - if (err < 0) { -- fprintf(stderr, "%s: Failed to disable IBS!\n", __FUNCTION__); -+ fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__); - goto error; - } -- fprintf(stderr, "%s: IBS disabled successfully \n", __FUNCTION__); -+ fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__); - - /* Perform HCI reset here*/ - err = rome_hci_reset_req(fd); diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0009-bluetooth-Check-TTY-buffer-for-data-availability-bef.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0009-bluetooth-Check-TTY-buffer-for-data-availability-bef.patch deleted file mode 100644 index 6e276d517..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0009-bluetooth-Check-TTY-buffer-for-data-availability-bef.patch +++ /dev/null @@ -1,189 +0,0 @@ -From: Anantha Krishnan -Date: Tue, 30 Sep 2014 12:13:00 +0530 -Subject: [PATCH] bluetooth: Check TTY buffer for data availability before - reading - -When operating at higher baud rates check the TTY buffer for -availability of data before proceeding to read. Call select() with -a 3 sec timeout value to check for the availablitiy of data. -select() will return once data is available in the TTY buffers -and will allow read() to fetch the data. If data is not available -in the TTY buffer until the timeout valueexpires, do not proceed -to read the data from the TTY buffers as there is none. - -Occasionally corrupt data is received on UART lines while we wait -for vendor specific event from Controller. Expected vendor specific -events are received after the corrupt data. But we do not retry -and exit and this causes firmware download failures. So, retry once -if we did not get HCI event. - -Change-Id: I3b672a7762403690f8b934ca216492f16285e8da -Signed-off-by: Rupesh Tatiya ---- - tools/hciattach.c | 20 ++++++++++++- - tools/hciattach_rome.c | 77 +++++++++++++++++++++++++++++++++++++++----------- - tools/hciattach_rome.h | 3 ++ - 3 files changed, 83 insertions(+), 17 deletions(-) - -diff --git a/tools/hciattach.c b/tools/hciattach.c -index e3a915061440..c3cf10843303 100644 ---- a/tools/hciattach.c -+++ b/tools/hciattach.c -@@ -109,16 +109,34 @@ int read_hci_event(int fd, unsigned char* buf, int size) - { - int remain, r; - int count = 0; -+ fd_set infids; -+ struct timeval timeout; - - if (size <= 0) - return -1; - -+ FD_ZERO (&infids); -+ FD_SET (fd, &infids); -+ timeout.tv_sec = 3; -+ timeout.tv_usec = 0; -+ -+ /* Check whether data is available in TTY buffer before calling read() */ -+ if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) { -+ fprintf(stderr, "%s: Timing out on select for 3 secs.\n", __FUNCTION__); -+ return -1; -+ } -+ else -+ fprintf(stderr, "%s: Data(HCI-CMD-COMP-EVENT) available in TTY Serial buffer\n", __FUNCTION__); -+ - /* The first byte identifies the packet type. For HCI event packets, it - * should be 0x04, so we read until we get to the 0x04. */ - while (1) { - r = read(fd, buf, 1); -- if (r <= 0) -+ if (r <= 0) { -+ fprintf(stderr, "%s: read() failed with return value: %d\n", -+ __FUNCTION__, r); - return -1; -+ } - if (buf[0] == 0x04) - break; - } -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index d0e2935b9997..d2687b1ef01a 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -326,42 +326,87 @@ failed: - } - - -+int wait_for_data(int fd, int maxTimeOut) -+{ -+ fd_set infids; -+ struct timeval timeout; -+ -+ if (maxTimeOut <= 0) { -+ fprintf(stderr, "%s: Invalid timeout value specified", __func__); -+ return -EINVAL; -+ } -+ -+ FD_ZERO (&infids); -+ FD_SET (fd, &infids); -+ timeout.tv_sec = maxTimeOut; -+ timeout.tv_usec = 0; -+ -+ /* Check whether data is available in TTY buffer before calling read() */ -+ if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) { -+ fprintf(stderr, "%s: Timing out on select for %d secs.\n", __FUNCTION__, maxTimeOut); -+ return -1; -+ } -+ else -+ fprintf(stderr, "%s: HCI-VS-EVENT available in TTY Serial buffer\n", -+ __FUNCTION__); -+ -+ return 1; -+} -+ - /* - * Read an VS HCI event from the given file descriptor. - */ - int read_vs_hci_event(int fd, unsigned char* buf, int size) - { -- int remain, r; -+ int remain, r, retry = 0; - int count = 0; -- fd_set infids; -- struct timeval timeout; - - if (size <= 0) { - fprintf(stderr, "Invalid size arguement!\n"); - return -1; - } - -- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", __FUNCTION__); -- -- FD_ZERO (&infids); -- FD_SET (fd, &infids); -- timeout.tv_sec = 3; -- timeout.tv_usec = 0; /* half second is a long time at 115.2 Kbps */ -+ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", -+ __FUNCTION__); - -- if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) -- fprintf(stderr, "%s: Timing out on select for 3 secs.\n", __FUNCTION__); -- else -- fprintf(stderr, "%s: Data available in TTY Serial buffer\n", __FUNCTION__); -+ /* Check whether data is available in TTY buffer before calling read() */ -+ if (wait_for_data(fd, SELECT_TIMEOUT) < 1) -+ return -1; - - /* The first byte identifies the packet type. For HCI event packets, it - * should be 0x04, so we read until we get to the 0x04. */ - /* It will keep reading until find 0x04 byte */ - while (1) { -+ /* Read UART Buffer for HCI-DATA */ - r = read(fd, buf, 1); -- if (r <= 0) -- return -1; -- if (buf[0] == 0x04) -+ if (r <= 0) { -+ fprintf(stderr, "%s: read() failed. error: %d\n", -+ __FUNCTION__, r); -+ return -1; -+ } -+ -+ /* Check if received data is HCI-DATA or not. -+ * If not HCI-DATA, then retry reading the UART Buffer once. -+ * Sometimes there could be corruption on the UART lines and to -+ * avoid that retry once reading the UART Buffer for HCI-DATA. -+ */ -+ if (buf[0] == 0x04) { /* Recvd. HCI DATA */ -+ retry = 0; - break; -+ } -+ else if (retry < MAX_RETRY_CNT){ /* Retry mechanism */ -+ retry++; -+ fprintf(stderr, "%s: Not an HCI-VS-Event! buf[0]: %d", -+ __FUNCTION__, buf[0]); -+ if (wait_for_data(fd, SELECT_TIMEOUT) < 1) -+ return -1; -+ else /* Data available in UART Buffer: Continue to read */ -+ continue; -+ } -+ else { /* RETRY failed : Exiting with failure */ -+ fprintf(stderr, "%s: RETRY failed!", __FUNCTION__); -+ return -1; -+ } - } - count++; - -diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h -index a4abe9f73080..3efb71995c45 100644 ---- a/tools/hciattach_rome.h -+++ b/tools/hciattach_rome.h -@@ -179,6 +179,9 @@ typedef struct - #define TAG_NUM_2 2 - #define TAG_BDADDR_OFFSET 7 - -+#define MAX_RETRY_CNT 1 -+#define SELECT_TIMEOUT 3 -+ - /* NVM Tags specifically used for ROME 1.0 */ - #define ROME_1_0_100022_1 0x101000221 - #define ROME_1_0_100019 0x101000190 diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0010-bluetooth-Add-support-for-TUFEELO-firmware-download.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0010-bluetooth-Add-support-for-TUFEELO-firmware-download.patch deleted file mode 100644 index e8f2f8dcc..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0010-bluetooth-Add-support-for-TUFEELO-firmware-download.patch +++ /dev/null @@ -1,44 +0,0 @@ -From: Anantha Krishnan -Date: Wed, 20 Aug 2014 12:13:19 +0530 -Subject: [PATCH] bluetooth : Add support for TUFEELO firmware download - -Add TUFELLO chip version to allow firmware download. - -Change-Id: Ie3760fa64e8345bf9a84b2f047fde0ac1003b393 ---- - tools/hciattach_rome.c | 5 ++++- - tools/hciattach_rome.h | 3 ++- - 2 files changed, 6 insertions(+), 2 deletions(-) - -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index d2687b1ef01a..84dfc97b5140 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -1616,9 +1616,12 @@ int qca_soc_init(int fd, char *bdaddr) - nvm_file_path = ROME_NVM_TLV_2_0_1_PATH; - goto download; - case ROME_VER_3_0: -- case TUFELLO_VER_1_0: - rampatch_file_path = ROME_RAMPATCH_TLV_3_0_0_PATH; - nvm_file_path = ROME_NVM_TLV_3_0_0_PATH; -+ goto download; -+ case TUFELLO_VER_1_0: -+ rampatch_file_path = TF_RAMPATCH_TLV_1_0_0_PATH; -+ nvm_file_path = TF_NVM_TLV_1_0_0_PATH; - - download: - /* Change baud rate 115.2 kbps to 3Mbps*/ -diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h -index 3efb71995c45..9d18c576fcae 100644 ---- a/tools/hciattach_rome.h -+++ b/tools/hciattach_rome.h -@@ -204,7 +204,8 @@ typedef struct - #define ROME_NVM_TLV_2_0_1_PATH "/lib/firmware/nvm_tlv_2.1.bin" - #define ROME_RAMPATCH_TLV_3_0_0_PATH "/lib/firmware/qca/rampatch_tlv_3.0.tlv" - #define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin" -- -+#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/rampatch_tlv_tf_1.0.tlv" -+#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/nvm_tlv_tf_1.0.bin" - - /****************************************************************************** - ** Local type definitions diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0011-bluetooth-Add-support-for-ROME-3.2-SOC.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0011-bluetooth-Add-support-for-ROME-3.2-SOC.patch deleted file mode 100644 index 5cc72bde2..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0011-bluetooth-Add-support-for-ROME-3.2-SOC.patch +++ /dev/null @@ -1,236 +0,0 @@ -From: Anantha Krishnan -Date: Mon, 8 Dec 2014 14:52:16 +0530 -Subject: [PATCH] bluetooth: Add support for ROME 3.2 SOC. - -Add firmware download support for ROME 3.2 version. As part -of this, the Bluetooth on time is optimized based on event -handling while downloading rampatch files.From ROME 3.2 onwards, -the VS and command complete events will be sent depending the flag -indication present in the header. HOST can wait for VS and command -complete events only if specified in the header info. This greatly -reduces the time spent by HOST in waiting for 2 events from the -Controller before downloading each segment of the RAMPATCH file - -Change-Id: I9c4227a7a529455f4d120b2c9d065f3ec6b439e9 ---- - tools/hciattach_rome.c | 104 ++++++++++++++++++++++++++++++++++++++++++------- - tools/hciattach_rome.h | 16 +++++++- - 2 files changed, 103 insertions(+), 17 deletions(-) - -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index 84dfc97b5140..c6d528f118e1 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -62,9 +62,11 @@ unsigned char *pdata_buffer = NULL; - patch_info rampatch_patch_info; - int rome_ver = ROME_VER_UNKNOWN; - unsigned char gTlv_type; -+unsigned char gtlv_dwndcfg; - char *rampatch_file_path; - char *nvm_file_path; - vnd_userial_cb_t vnd_userial; -+unsigned char wait_vsc_evt = TRUE; - /****************************************************************************** - ** Extern variables - ******************************************************************************/ -@@ -455,14 +457,16 @@ int hci_send_vs_cmd(int fd, unsigned char *cmd, unsigned char *rsp, int size) - goto failed; - } - -- /* Check for response from the Controller */ -- if (read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE) < 0) { -- ret = -ETIMEDOUT; -- fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); -- goto failed; -+ if (wait_vsc_evt) { -+ /* Check for response from the Controller */ -+ if (read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE) < 0) { -+ ret = -ETIMEDOUT; -+ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); -+ goto failed; -+ } -+ fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); - } - -- fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); - failed: - return ret; - } -@@ -903,6 +907,7 @@ int rome_get_tlv_file(char *file_path) - - /* To handle different event between rampatch and NVM */ - gTlv_type = ptlv_header->tlv_type; -+ gtlv_dwndcfg = ptlv_header->tlv.patch.dwnd_cfg; - - if(ptlv_header->tlv_type == TLV_TYPE_PATCH){ - fprintf(stderr, "====================================================\n"); -@@ -914,6 +919,7 @@ int rome_get_tlv_file(char *file_path) - fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len); - fprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver); - fprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm); -+ fprintf(stderr, "Event Handling\t\t\t : 0x%x", ptlv_header->tlv.patch.dwnd_cfg); - fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1); - fprintf(stderr, "Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id); - fprintf(stderr, "Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver); -@@ -1023,19 +1029,83 @@ int rome_tlv_dnld_req(int fd, int tlv_size) - fprintf(stderr, "%s: TLV size: %d, Total Seg num: %d, remain size: %d\n", - __FUNCTION__,tlv_size, total_segment, remain_size); - -- for(i=0;i= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH ) -- && !remain_size && ((i+1) == total_segment))? FALSE: TRUE; -+ if (gTlv_type == TLV_TYPE_PATCH) { -+ /* Prior to Rome version 3.2(including inital few rampatch release of -+ * Rome 3.2), the event handling mechanism is ROME_SKIP_EVT_NONE. After -+ * few release of rampatch for Rome 3.2, the mechamism is changed to -+ * ROME_SKIP_EVT_VSE_CC. Rest of the mechanism is not used for now -+ */ -+ switch(gtlv_dwndcfg) -+ { -+ case ROME_SKIP_EVT_NONE: -+ wait_vsc_evt = TRUE; -+ wait_cc_evt = TRUE; -+ fprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_NONE", __func__); -+ break; -+ case ROME_SKIP_EVT_VSE_CC: -+ wait_vsc_evt = FALSE; -+ wait_cc_evt = FALSE; -+ fprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_VSE_CC", __func__); -+ break; -+ /* Not handled for now */ -+ case ROME_SKIP_EVT_VSE: -+ case ROME_SKIP_EVT_CC: -+ default: -+ fprintf(stderr, "%s: Unsupported Event handling: %d", __func__, gtlv_dwndcfg); -+ break; -+ } -+ } else { -+ wait_vsc_evt = TRUE; -+ wait_cc_evt = TRUE; -+ } -+ -+ for(i = 0; i < total_segment; i++) { -+ if((i+1) == total_segment) { -+ if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && -+ (gTlv_type == TLV_TYPE_PATCH)) { -+ /* If the Rome version is from 1.1 to 3.1 -+ * 1. No CCE for the last command segment but all other segment -+ * 2. All the command segments get VSE including the last one -+ */ -+ wait_cc_evt = !remain_size ? FALSE: TRUE; -+ } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { -+ /* If the Rome version is 3.2 -+ * 1. None of the command segments receive CCE -+ * 2. No command segments receive VSE except the last one -+ * 3. If gtlv_dwndcfg is ROME_SKIP_EVT_NONE then the logic is -+ * same as Rome 2.1, 2.2, 3.0 -+ */ -+ if (gtlv_dwndcfg == ROME_SKIP_EVT_NONE) { -+ wait_cc_evt = !remain_size ? FALSE: TRUE; -+ } else if (gtlv_dwndcfg == ROME_SKIP_EVT_VSE_CC) { -+ wait_vsc_evt = !remain_size ? TRUE: FALSE; -+ } -+ } -+ } -+ - if((err = rome_tlv_dnld_segment(fd, i, MAX_SIZE_PER_TLV_SEGMENT, wait_cc_evt )) < 0) - goto error; - } - -- /* In case remain data still remain, last rampatch segment command will not wait -- for command complete event here */ -- wait_cc_evt = ((rome_ver >= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH ) -- && remain_size )? FALSE:TRUE; -+ if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { -+ /* If the Rome version is from 1.1 to 3.1 -+ * 1. No CCE for the last command segment but all other segment -+ * 2. All the command segments get VSE including the last one -+ */ -+ wait_cc_evt = remain_size ? FALSE: TRUE; -+ } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { -+ /* If the Rome version is 3.2 -+ * 1. None of the command segments receive CCE -+ * 2. No command segments receive VSE except the last one -+ * 3. If gtlv_dwndcfg is ROME_SKIP_EVT_NONE then the logic is -+ * same as Rome 2.1, 2.2, 3.0 -+ */ -+ if (gtlv_dwndcfg == ROME_SKIP_EVT_NONE) { -+ wait_cc_evt = remain_size ? FALSE: TRUE; -+ } else if (gtlv_dwndcfg == ROME_SKIP_EVT_VSE_CC) { -+ wait_vsc_evt = remain_size ? TRUE: FALSE; -+ } -+ } - - if(remain_size) err =rome_tlv_dnld_segment(fd, i, remain_size, wait_cc_evt); - -@@ -1619,6 +1689,10 @@ int qca_soc_init(int fd, char *bdaddr) - rampatch_file_path = ROME_RAMPATCH_TLV_3_0_0_PATH; - nvm_file_path = ROME_NVM_TLV_3_0_0_PATH; - goto download; -+ case ROME_VER_3_2: -+ rampatch_file_path = ROME_RAMPATCH_TLV_3_0_2_PATH; -+ nvm_file_path = ROME_NVM_TLV_3_0_2_PATH; -+ goto download; - case TUFELLO_VER_1_0: - rampatch_file_path = TF_RAMPATCH_TLV_1_0_0_PATH; - nvm_file_path = TF_NVM_TLV_1_0_0_PATH; -diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h -index 9d18c576fcae..77e85e7e7b19 100644 ---- a/tools/hciattach_rome.h -+++ b/tools/hciattach_rome.h -@@ -204,9 +204,17 @@ typedef struct - #define ROME_NVM_TLV_2_0_1_PATH "/lib/firmware/nvm_tlv_2.1.bin" - #define ROME_RAMPATCH_TLV_3_0_0_PATH "/lib/firmware/qca/rampatch_tlv_3.0.tlv" - #define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin" -+#define ROME_RAMPATCH_TLV_3_0_2_PATH "/lib/firmware/qca/rampatch_tlv_3.2.tlv" -+#define ROME_NVM_TLV_3_0_2_PATH "/lib/firmware/qca/nvm_tlv_3.2.bin" - #define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/rampatch_tlv_tf_1.0.tlv" - #define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/nvm_tlv_tf_1.0.bin" - -+/* This header value in rampatch file decides event handling mechanism in the HOST */ -+#define ROME_SKIP_EVT_NONE 0x00 -+#define ROME_SKIP_EVT_VSE 0x01 -+#define ROME_SKIP_EVT_CC 0x02 -+#define ROME_SKIP_EVT_VSE_CC 0x03 -+ - /****************************************************************************** - ** Local type definitions - ******************************************************************************/ -@@ -251,7 +259,8 @@ typedef struct { - unsigned int tlv_patch_data_len; - unsigned char sign_ver; - unsigned char sign_algorithm; -- unsigned short reserved1; -+ unsigned char dwnd_cfg; -+ unsigned char reserved1; - unsigned short prod_id; - unsigned short build_ver; - unsigned short patch_ver; -@@ -306,7 +315,8 @@ enum{ - ROME_PATCH_VER_0100 = 0x0100, - ROME_PATCH_VER_0101 = 0x0101, - ROME_PATCH_VER_0200 = 0x0200, -- ROME_PATCH_VER_0300 = 0x0300 -+ ROME_PATCH_VER_0300 = 0x0300, -+ ROME_PATCH_VER_0302 = 0x0302 - }; - - enum{ -@@ -314,6 +324,7 @@ enum{ - ROME_SOC_ID_11 = 0x00000011, - ROME_SOC_ID_13 = 0x00000013, - ROME_SOC_ID_22 = 0x00000022, -+ ROME_SOC_ID_44 = 0x00000044 - }; - - enum{ -@@ -323,6 +334,7 @@ enum{ - ROME_VER_1_3 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_00 ), - ROME_VER_2_1 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_11 ), - ROME_VER_3_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_22 ), -+ ROME_VER_3_2 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_44 ), - TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ) - }; - #endif /* HW_ROME_H */ diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0012-bluetooth-Use-correct-TTY-ioctl-calls-for-flow-contr.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0012-bluetooth-Use-correct-TTY-ioctl-calls-for-flow-contr.patch deleted file mode 100644 index b48e915e2..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0012-bluetooth-Use-correct-TTY-ioctl-calls-for-flow-contr.patch +++ /dev/null @@ -1,189 +0,0 @@ -From: Anantha Krishnan -Date: Thu, 4 Dec 2014 17:23:58 +0530 -Subject: [PATCH] bluetooth: Use correct TTY ioctl calls for flow control - operations - -BT firmware download application is using incorrect APIs for -performing flow off and flow on operations. As a result, the local -UART Controller is detecting breaks errors on the UART HW lines. - -Appliaction should use TIOCMGET and TIOCMSET ioctl()'s for flow -control operations instead of the tcsetattr() call. Also, the -application should set the value of "number of bits per character" -value to 8 and not as 5. - -Due to incorrect APIs used for flow control operation and wrong -value configured for CSIZE parameter, the local UART Controller -detected break errors on the UART HW lines. This caused the -firmware download operation to fail and resulted in BT ON failure. - -Change-Id: Id0ac1276609eceb528163860cc87267aaa50fede ---- - tools/hciattach_rome.c | 67 +++++++++++++++++++++++++++++++++----------------- - tools/hciattach_rome.h | 6 +++-- - 2 files changed, 49 insertions(+), 24 deletions(-) - -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index c6d528f118e1..1e689273b851 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -1,6 +1,6 @@ - /* - * -- * Copyright (c) 2013, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. - * Not a Contribution. - * - * Copyright 2012 The Android Open Source Project -@@ -31,6 +31,7 @@ - - #define LOG_TAG "bt_vendor" - #include -+#include - #include - #include - #include -@@ -139,6 +140,16 @@ void userial_vendor_set_baud(unsigned char userial_baud) - unsigned int tcio_baud; - fprintf(stderr, "## userial_vendor_set_baud: %d\n", userial_baud); - -+ if (tcgetattr(vnd_userial.fd, &vnd_userial.termios) < 0) { -+ perror("Can't get port settings"); -+ return; -+ } -+ cfmakeraw(&vnd_userial.termios); -+ vnd_userial.termios.c_cflag |= CLOCAL; -+ vnd_userial.termios.c_cflag |= CREAD; -+ vnd_userial.termios.c_cflag |= CS8; -+ tcsetattr(vnd_userial.fd, TCSANOW, &vnd_userial.termios); -+ - userial_to_tcio_baud(userial_baud, &tcio_baud); - - cfsetospeed(&vnd_userial.termios, tcio_baud); -@@ -169,6 +180,7 @@ int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data) - cfmakeraw(&ti); - ti.c_cflag |= CLOCAL; - ti.c_cflag |= CREAD; -+ ti.c_cflag |= CS8; - - switch(op) - { -@@ -1445,6 +1457,29 @@ error: - - } - -+static void flow_control(int fd, int opt) -+{ -+ struct termios c_opt; -+ -+ ioctl(fd, TIOCMGET, &c_opt); -+ c_opt.c_cc[VTIME] = 0; /* inter-character timer unused */ -+ c_opt.c_cc[VMIN] = 0; /* blocking read until 8 chars received */ -+ c_opt.c_cflag &= ~CSIZE; -+ c_opt.c_cflag |= (CS8 | CLOCAL | CREAD); -+ if (MSM_ENABLE_FLOW_CTRL) -+ c_opt.c_cflag |= CRTSCTS; -+ else if (MSM_DISABLE_FLOW_CTRL) -+ c_opt.c_cflag |= ~CRTSCTS; -+ else { -+ fprintf(stderr, "%s: Incorrect option passed for TIOCMSET\n", __func__); -+ return; -+ } -+ c_opt.c_iflag = IGNPAR; -+ c_opt.c_oflag = 0; -+ c_opt.c_lflag = 0; -+ ioctl(fd, TIOCMSET, &c_opt); -+} -+ - - int rome_set_baudrate_req(int fd) - { -@@ -1464,12 +1499,10 @@ int rome_set_baudrate_req(int fd) - - /* Total length of the packet to be sent to the Controller */ - size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN); -+ - /* Flow off during baudrate change */ -- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0) -- { -- fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err); -- goto error; -- } -+ flow_control(fd, MSM_DISABLE_FLOW_CTRL); -+ - /* Send the HCI command packet to UART for transmission */ - fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ; - err = write(fd, cmd, size); -@@ -1481,11 +1514,8 @@ int rome_set_baudrate_req(int fd) - userial_vendor_set_baud(USERIAL_BAUD_3M); - - /* Flow on after changing local uart baudrate */ -- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0) -- { -- fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err); -- return err; -- } -+ flow_control(fd, MSM_ENABLE_FLOW_CTRL); -+ - /* Check for response from the Controller */ - if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { - fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); -@@ -1528,11 +1558,8 @@ int rome_hci_reset_req(int fd) - size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE); - - /* Flow off during baudrate change */ -- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0) -- { -- fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err); -- goto error; -- } -+ flow_control(fd, MSM_DISABLE_FLOW_CTRL); -+ - /* Send the HCI command packet to UART for transmission */ - fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]); - err = write(fd, cmd, size); -@@ -1545,11 +1572,8 @@ int rome_hci_reset_req(int fd) - userial_vendor_set_baud(USERIAL_BAUD_3M); - - /* Flow on after changing local uart baudrate */ -- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0) -- { -- fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err); -- return err; -- } -+ flow_control(fd, MSM_ENABLE_FLOW_CTRL); -+ - /* Wait for command complete event */ - err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); - if ( err < 0) { -@@ -1616,7 +1640,6 @@ int qca_soc_init(int fd, char *bdaddr) - int err = -1; - int size; - -- fprintf(stderr, " %s \n", __FUNCTION__); - vnd_userial.fd = fd; - /* Get Rome version information */ - if((err = rome_patch_ver_req(fd)) <0){ -diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h -index 77e85e7e7b19..ef3647e6a69b 100644 ---- a/tools/hciattach_rome.h -+++ b/tools/hciattach_rome.h -@@ -1,7 +1,7 @@ - /* -- * Copyright 2012 The Android Open Source Project -- * Copyright (c) 2013, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. - * Not a Contribution. -+ * Copyright 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. -@@ -40,6 +40,8 @@ - #define NVITEM_SIZE 2 - #define PERSIST_HEADER_LEN 3 - #define BD_ADDR_LEN 6 -+#define MSM_ENABLE_FLOW_CTRL 16 -+#define MSM_DISABLE_FLOW_CTRL 17 - - unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - typedef enum { diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0013-bluetooth-Add-support-for-multi-baud-rate.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0013-bluetooth-Add-support-for-multi-baud-rate.patch deleted file mode 100644 index 8b19376ba..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0013-bluetooth-Add-support-for-multi-baud-rate.patch +++ /dev/null @@ -1,256 +0,0 @@ -From: Anantha Krishnan -Date: Tue, 20 Jan 2015 12:43:20 +0530 -Subject: [PATCH] bluetooth: Add support for multi baud rate - -Currently BT operates only at 3M baud rate. Provide option -to configure the pre-defined baud rate values as supported by the -target platform. - -Change-Id: I4bbaf7db01ffb983c38dca7c4a4a56f579c678a8 ---- - tools/hciattach.c | 2 +- - tools/hciattach.h | 2 +- - tools/hciattach_rome.c | 109 ++++++++++++++++++++++++++++++++++++++++++------- - tools/hciattach_rome.h | 23 +++++++++++ - 4 files changed, 119 insertions(+), 17 deletions(-) - -diff --git a/tools/hciattach.c b/tools/hciattach.c -index c3cf10843303..dda639cabca3 100644 ---- a/tools/hciattach.c -+++ b/tools/hciattach.c -@@ -286,7 +286,7 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti) - static int qca(int fd, struct uart_t *u, struct termios *ti) - { - fprintf(stderr,"qca\n"); -- return qca_soc_init(fd, u->bdaddr); -+ return qca_soc_init(fd, u->speed, u->bdaddr); - } - - static int qualcomm(int fd, struct uart_t *u, struct termios *ti) -diff --git a/tools/hciattach.h b/tools/hciattach.h -index 0656a845223c..49e59321fcac 100644 ---- a/tools/hciattach.h -+++ b/tools/hciattach.h -@@ -64,7 +64,7 @@ int ath3k_init(int fd, int speed, int init_speed, char *bdaddr, - struct termios *ti); - int ath3k_post(int fd, int pm); - int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr); --int qca_soc_init(int fd, char *bdaddr); -+int qca_soc_init(int fd, int speed, char *bdaddr); - int intel_init(int fd, int init_speed, int *speed, struct termios *ti); - int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti, - const char *bdaddr); -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index 1e689273b851..37974290ae0a 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -1481,7 +1481,7 @@ static void flow_control(int fd, int opt) - } - - --int rome_set_baudrate_req(int fd) -+int rome_set_baudrate_req(int fd, int local_baud_rate, int controller_baud_rate) - { - int size, err = 0; - unsigned char cmd[HCI_MAX_CMD_SIZE]; -@@ -1495,7 +1495,7 @@ int rome_set_baudrate_req(int fd) - cmd[0] = HCI_COMMAND_PKT; - cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF); - cmd_hdr->plen = VSC_SET_BAUDRATE_REQ_LEN; -- cmd[4] = BAUDRATE_3000000; -+ cmd[4] = controller_baud_rate; - - /* Total length of the packet to be sent to the Controller */ - size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN); -@@ -1511,7 +1511,7 @@ int rome_set_baudrate_req(int fd) - goto error; - } - /* Change Local UART baudrate to high speed UART */ -- userial_vendor_set_baud(USERIAL_BAUD_3M); -+ userial_vendor_set_baud(local_baud_rate); - - /* Flow on after changing local uart baudrate */ - flow_control(fd, MSM_ENABLE_FLOW_CTRL); -@@ -1537,7 +1537,7 @@ error: - } - - --int rome_hci_reset_req(int fd) -+int rome_hci_reset_req(int fd, char baud) - { - int size, err = 0; - unsigned char cmd[HCI_MAX_CMD_SIZE]; -@@ -1569,7 +1569,7 @@ int rome_hci_reset_req(int fd) - } - - /* Change Local UART baudrate to high speed UART */ -- userial_vendor_set_baud(USERIAL_BAUD_3M); -+ userial_vendor_set_baud(baud); - - /* Flow on after changing local uart baudrate */ - flow_control(fd, MSM_ENABLE_FLOW_CTRL); -@@ -1635,10 +1635,69 @@ int read_bd_address(unsigned char *bdaddr) - return 0; - } - --int qca_soc_init(int fd, char *bdaddr) -+int isSpeedValid(int speed, int *local_baud_rate, int *controller_baud_rate) -+{ -+ switch(speed) { -+ case 9600: -+ *local_baud_rate = USERIAL_BAUD_9600; -+ *controller_baud_rate = BAUDRATE_9600; -+ break; -+ case 19200: -+ *local_baud_rate = USERIAL_BAUD_19200; -+ *controller_baud_rate = BAUDRATE_19200; -+ break; -+ case 57600: -+ *local_baud_rate = USERIAL_BAUD_57600; -+ *controller_baud_rate = BAUDRATE_57600; -+ break; -+ case 115200: -+ *local_baud_rate = USERIAL_BAUD_115200; -+ *controller_baud_rate = BAUDRATE_115200; -+ break; -+ case 230400: -+ *local_baud_rate = USERIAL_BAUD_230400; -+ *controller_baud_rate = BAUDRATE_230400; -+ break; -+ case 460800: -+ *local_baud_rate = USERIAL_BAUD_460800; -+ *controller_baud_rate = BAUDRATE_460800; -+ break; -+ case 921600: -+ *local_baud_rate = USERIAL_BAUD_921600; -+ *controller_baud_rate = BAUDRATE_921600; -+ break; -+ case 1000000: -+ *local_baud_rate = USERIAL_BAUD_1M; -+ *controller_baud_rate = BAUDRATE_1000000; -+ break; -+ case 2000000: -+ *local_baud_rate = USERIAL_BAUD_2M; -+ *controller_baud_rate = BAUDRATE_2000000; -+ break; -+ case 3000000: -+ *local_baud_rate = USERIAL_BAUD_3M; -+ *controller_baud_rate = BAUDRATE_3000000; -+ break; -+ case 4000000: -+ *local_baud_rate = USERIAL_BAUD_4M; -+ *controller_baud_rate = BAUDRATE_4000000; -+ break; -+ case 300: -+ case 600: -+ case 1200: -+ case 2400: -+ default: -+ fprintf(stderr, "Invalid baud rate passed!\n"); -+ *local_baud_rate = *controller_baud_rate = -1; -+ break; -+ } -+ return -1; -+} -+ -+int qca_soc_init(int fd, int speed, char *bdaddr) - { - int err = -1; -- int size; -+ int size, local_baud_rate = 0, controller_baud_rate = 0; - - vnd_userial.fd = fd; - /* Get Rome version information */ -@@ -1687,7 +1746,7 @@ int qca_soc_init(int fd, char *bdaddr) - } - - /* Change baud rate 115.2 kbps to 3Mbps*/ -- err = rome_hci_reset_req(fd); -+ err = rome_hci_reset_req(fd, local_baud_rate); - if ( err <0 ) { - fprintf(stderr, "HCI Reset Failed !!\n"); - goto error; -@@ -1721,13 +1780,23 @@ int qca_soc_init(int fd, char *bdaddr) - nvm_file_path = TF_NVM_TLV_1_0_0_PATH; - - download: -- /* Change baud rate 115.2 kbps to 3Mbps*/ -- err = rome_set_baudrate_req(fd); -- if (err < 0) { -- fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); -- goto error; -+ /* Check if user requested for 115200 kbps */ -+ if (speed == 115200) { -+ local_baud_rate = USERIAL_BAUD_115200; -+ controller_baud_rate = BAUDRATE_115200; - } -- fprintf(stderr, "%s: Baud rate changed successfully \n", __FUNCTION__); -+ else { -+ /* Change only if baud rate requested is valid or not */ -+ isSpeedValid(speed, &local_baud_rate, &controller_baud_rate); -+ if (local_baud_rate < 0 || controller_baud_rate < 0) -+ goto error; -+ -+ err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate); -+ if (err < 0) { -+ fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); -+ goto error; -+ } -+ } - - /* Donwload TLV files (rampatch, NVM) */ - err = rome_download_tlv_file(fd); -@@ -1737,8 +1806,18 @@ download: - } - fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__); - -+ /* -+ * Overriding the baud rate value in NVM file with the user -+ * requested baud rate, since default baud rate in NVM file is 3M. -+ */ -+ err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate); -+ if (err < 0) { -+ fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); -+ goto error; -+ } -+ - /* Perform HCI reset here*/ -- err = rome_hci_reset_req(fd); -+ err = rome_hci_reset_req(fd, local_baud_rate); - if ( err <0 ) { - fprintf(stderr, "HCI Reset Failed !!!\n"); - goto error; -diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h -index ef3647e6a69b..1500ddd3a79f 100644 ---- a/tools/hciattach_rome.h -+++ b/tools/hciattach_rome.h -@@ -78,6 +78,29 @@ typedef struct - #define USERIAL_BAUD_4M 15 - #define USERIAL_BAUD_AUTO 16 - -+/* Vendor specific baud rate values */ -+#define UART_Baud_Rate_Baud_9600 4 -+#define UART_Baud_Rate_Baud_19200 3 -+#define UART_Baud_Rate_Baud_57600 1 -+#define UART_Baud_Rate_Baud_115200 0 -+#define UART_Baud_Rate_Baud_230400 5 -+#define UART_Baud_Rate_Baud_460800 7 -+#define UART_Baud_Rate_Baud_921600 10 -+#define UART_Baud_Rate_Baud_1000000 11 -+#define UART_Baud_Rate_Baud_2000000 13 -+#define UART_Baud_Rate_Baud_3000000 14 -+#define UART_Baud_Rate_Baud_4000000 15 -+ -+#define UART_Baud_Rate_Baud_250000 6 -+#define UART_Baud_Rate_Baud_500000 8 -+#define UART_Baud_Rate_Baud_720000 9 -+#define UART_Baud_Rate_Baud_125000 12 -+#define UART_Baud_Rate_Baud_1600000 16 -+#define UART_Baud_Rate_Baud_3200000 17 -+#define UART_Baud_Rate_Baud_3500000 18 -+ -+ -+ - #ifndef FALSE - #define FALSE 0 - #endif diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0014-Override-PCM-Settings-by-reading-configuration-file.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0014-Override-PCM-Settings-by-reading-configuration-file.patch deleted file mode 100644 index c86dee8e7..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0014-Override-PCM-Settings-by-reading-configuration-file.patch +++ /dev/null @@ -1,144 +0,0 @@ -From: Kamal Negi -Date: Tue, 30 Dec 2014 19:15:08 +0530 -Subject: [PATCH] Override PCM Settings by reading configuration file - -Configure the PCM role as master or slave depending upon -the platform's support. This configuration is provided -in the config file which is read during the firmware -download process and the default PCM configuration is -overwritten with this value. - -Change-Id: If0eae58b4cd32d75b3bcb669bc73dca67652473c -Signed-off-by: Kamal Negi ---- - tools/hciattach_rome.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++--- - tools/hciattach_rome.h | 8 ++++++ - 2 files changed, 71 insertions(+), 4 deletions(-) - -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index 37974290ae0a..99866e23e99e 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -1,6 +1,6 @@ - /* - * -- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. - * Not a Contribution. - * - * Copyright 2012 The Android Open Source Project -@@ -873,6 +873,44 @@ error: - return err; - } - -+int get_value_from_config(char *file_path,char *param) -+{ -+ FILE *pfile = NULL; -+ char *line = NULL; -+ char *pch = NULL; -+ char param_str[20]; -+ int bytes_read = 0, position; -+ int ret = -1; -+ -+ if (!file_path || !param) { -+ fprintf(stderr,"Invalid arguments\n"); -+ return -EINVAL; -+ } -+ -+ pfile = fopen(file_path, "r" ); -+ if (!pfile) { -+ fprintf(stderr, "Failed to open %s\n", file_path); -+ return ret; -+ } -+ -+ while (getline(&line, &bytes_read, pfile) > 0 ) { -+ if (line[0] != '#' && line[0] != '\n') { -+ pch = memchr(line, '=', strlen(line)); -+ if (pch != NULL) { -+ position = pch - line; -+ strncpy(param_str, line, position); -+ if (strncmp(param_str, param, position) == 0) { -+ ret = atoi(pch + 1); -+ break; -+ } -+ } -+ } -+ } -+ free(line); -+ fclose(pfile); -+ return ret; -+} -+ - int rome_get_tlv_file(char *file_path) - { - FILE * pFile; -@@ -884,7 +922,7 @@ int rome_get_tlv_file(char *file_path) - unsigned char data_buf[PRINT_BUF_SIZE]={0,}; - unsigned char *nvm_byte_ptr; - unsigned char bdaddr[6]; -- -+ unsigned short pcm_value; - fprintf(stderr, "File Open (%s)\n", file_path); - pFile = fopen ( file_path , "r" ); - if (pFile==NULL) {; -@@ -970,9 +1008,30 @@ int rome_get_tlv_file(char *file_path) - *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), - *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); - } -+ /* Read from file and check what PCM Configuration is required: -+ * Master = 0 /Slave = 1 */ -+ /* Override PCM configuration */ -+ if (nvm_ptr->tag_id == TAG_NUM_44) { -+ if ((pcm_value = -+ get_value_from_config(PCM_CONFIG_FILE_PATH, "PCM")) >= 0) { -+ -+ if (pcm_value == PCM_SLAVE) { -+ nvm_byte_ptr[PCM_MS_OFFSET_1] |= -+ (1 << PCM_ROLE_BIT_OFFSET); -+ nvm_byte_ptr[PCM_MS_OFFSET_2] |= -+ (1 << PCM_ROLE_BIT_OFFSET); -+ } else if (pcm_value == PCM_MASTER) { -+ nvm_byte_ptr[PCM_MS_OFFSET_1] &= -+ (~(1 << PCM_ROLE_BIT_OFFSET)); -+ nvm_byte_ptr[PCM_MS_OFFSET_2] &= -+ (~(1 << PCM_ROLE_BIT_OFFSET)); -+ } -+ } -+ } - -- for(i =0;(itag_len && (i*3 + 2) tag_len && (i*3 + 2) < PRINT_BUF_SIZE);i++) -+ snprintf((char *) data_buf, PRINT_BUF_SIZE, "%s%.02x ", -+ (char *)data_buf, *(nvm_byte_ptr + i)); - - fprintf(stderr, "TAG Data\t\t\t : %s\n", data_buf); - -diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h -index 1500ddd3a79f..f591c10e4f2b 100644 ---- a/tools/hciattach_rome.h -+++ b/tools/hciattach_rome.h -@@ -202,8 +202,15 @@ typedef struct - #define NVM_ACCESS_SET 0x01 - #define TAG_NUM_OFFSET 5 - #define TAG_NUM_2 2 -+#define TAG_NUM_44 44 - #define TAG_BDADDR_OFFSET 7 - -+#define PCM_MS_OFFSET_1 9 -+#define PCM_MS_OFFSET_2 33 -+ -+#define PCM_SLAVE 1 -+#define PCM_MASTER 0 -+#define PCM_ROLE_BIT_OFFSET 4 - #define MAX_RETRY_CNT 1 - #define SELECT_TIMEOUT 3 - -@@ -240,6 +247,7 @@ typedef struct - #define ROME_SKIP_EVT_CC 0x02 - #define ROME_SKIP_EVT_VSE_CC 0x03 - -+#define PCM_CONFIG_FILE_PATH "/etc/bluetooth/pcm.conf" - /****************************************************************************** - ** Local type definitions - ******************************************************************************/ diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0015-Add-support-for-Tufello-1.1-SOC.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0015-Add-support-for-Tufello-1.1-SOC.patch deleted file mode 100644 index f47a9d47e..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0015-Add-support-for-Tufello-1.1-SOC.patch +++ /dev/null @@ -1,169 +0,0 @@ -From: Rupesh Tatiya -Date: Thu, 29 Jan 2015 15:36:27 +0530 -Subject: [PATCH] Add support for Tufello 1.1 SOC - -Enable mechanism to download firmware for Tufello 1.1 SOC. -Also, use correct firmware file path for Tufello 1.0. - -Change-Id: I915e48023e45de9e2550336a3de9a07f2b788189 -Signed-off-by: Rupesh Tatiya ---- - tools/hciattach_rome.c | 29 ++++++++++++++++++----------- - tools/hciattach_rome.h | 10 +++++++--- - 2 files changed, 25 insertions(+), 14 deletions(-) - -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index 99866e23e99e..fee36f904e04 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -621,7 +621,7 @@ int rome_edl_set_patch_request(int fd) - -1, PATCH_HDR_LEN + 1); - - /* Total length of the packet to be sent to the Controller */ -- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); - - /* Send HCI Command packet to Controller */ - err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); -@@ -670,7 +670,7 @@ int rome_edl_patch_download_request(int fd) - index, MAX_DATA_PER_SEGMENT); - - /* Total length of the packet to be sent to the Controller */ -- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); - - /* Initialize the RSP packet everytime to 0 */ - memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); -@@ -707,7 +707,7 @@ int rome_edl_patch_download_request(int fd) - memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); - - /* Total length of the packet to be sent to the Controller */ -- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); - - /* Send HCI Command packet to Controller */ - err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); -@@ -824,7 +824,7 @@ int rome_attach_rampatch(int fd) - -1, EDL_PATCH_CMD_LEN); - - /* Total length of the packet to be sent to the Controller */ -- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); - - /* Send HCI Command packet to Controller */ - err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); -@@ -854,7 +854,7 @@ int rome_rampatch_reset(int fd) - -1, EDL_PATCH_CMD_LEN); - - /* Total length of the packet to be sent to the Controller */ -- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); -+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); - - /* Send HCI Command packet to Controller */ - err = write(fd, cmd, size); -@@ -1058,7 +1058,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc - unsigned char cmd[HCI_MAX_CMD_SIZE]; - unsigned char rsp[HCI_MAX_EVENT_SIZE]; - -- fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d\n", __FUNCTION__, index, seg_size); -+ fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d wait_cc_evt = 0x%x\n", __FUNCTION__, index, seg_size, wait_cc_evt); - - /* Frame the HCI CMD PKT to be sent to Controller*/ - frame_hci_cmd_pkt(cmd, EDL_PATCH_TLV_REQ_CMD, 0, index, seg_size); -@@ -1092,6 +1092,7 @@ int rome_tlv_dnld_req(int fd, int tlv_size) - { - int total_segment, remain_size, i, err = -1; - unsigned char wait_cc_evt; -+ unsigned int rom = rome_ver >> 16; - - total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT; - remain_size = (tlv_size < MAX_SIZE_PER_TLV_SEGMENT)?\ -@@ -1132,14 +1133,15 @@ int rome_tlv_dnld_req(int fd, int tlv_size) - - for(i = 0; i < total_segment; i++) { - if((i+1) == total_segment) { -- if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && -+ if ((rom >= ROME_PATCH_VER_0100) && (rom < ROME_PATCH_VER_0302) && - (gTlv_type == TLV_TYPE_PATCH)) { - /* If the Rome version is from 1.1 to 3.1 - * 1. No CCE for the last command segment but all other segment - * 2. All the command segments get VSE including the last one - */ - wait_cc_evt = !remain_size ? FALSE: TRUE; -- } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { -+ } else if ((rom == ROME_PATCH_VER_0302) && -+ (gTlv_type == TLV_TYPE_PATCH)) { - /* If the Rome version is 3.2 - * 1. None of the command segments receive CCE - * 2. No command segments receive VSE except the last one -@@ -1158,13 +1160,14 @@ int rome_tlv_dnld_req(int fd, int tlv_size) - goto error; - } - -- if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { -+ if ((rom >= ROME_PATCH_VER_0100) && (rom < ROME_PATCH_VER_0302) && -+ (gTlv_type == TLV_TYPE_PATCH)) { - /* If the Rome version is from 1.1 to 3.1 - * 1. No CCE for the last command segment but all other segment - * 2. All the command segments get VSE including the last one - */ - wait_cc_evt = remain_size ? FALSE: TRUE; -- } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { -+ } else if ((rom == ROME_PATCH_VER_0302) && (gTlv_type == TLV_TYPE_PATCH)) { - /* If the Rome version is 3.2 - * 1. None of the command segments receive CCE - * 2. No command segments receive VSE except the last one -@@ -1837,6 +1840,10 @@ int qca_soc_init(int fd, int speed, char *bdaddr) - case TUFELLO_VER_1_0: - rampatch_file_path = TF_RAMPATCH_TLV_1_0_0_PATH; - nvm_file_path = TF_NVM_TLV_1_0_0_PATH; -+ goto download; -+ case TUFELLO_VER_1_1: -+ rampatch_file_path = TF_RAMPATCH_TLV_1_0_1_PATH; -+ nvm_file_path = TF_NVM_TLV_1_0_1_PATH; - - download: - /* Check if user requested for 115200 kbps */ -@@ -1881,7 +1888,7 @@ download: - fprintf(stderr, "HCI Reset Failed !!!\n"); - goto error; - } -- fprintf(stderr, "HCI Reset is done\n"); -+ fprintf(stderr, "HCI Reset is done\n"); - - break; - case ROME_VER_UNKNOWN: -diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h -index f591c10e4f2b..95d5f1e8a5c2 100644 ---- a/tools/hciattach_rome.h -+++ b/tools/hciattach_rome.h -@@ -238,8 +238,10 @@ typedef struct - #define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin" - #define ROME_RAMPATCH_TLV_3_0_2_PATH "/lib/firmware/qca/rampatch_tlv_3.2.tlv" - #define ROME_NVM_TLV_3_0_2_PATH "/lib/firmware/qca/nvm_tlv_3.2.bin" --#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/rampatch_tlv_tf_1.0.tlv" --#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/nvm_tlv_tf_1.0.bin" -+#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/qca/rampatch_tlv_tf_1.0.tlv" -+#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/qca/nvm_tlv_tf_1.0.bin" -+#define TF_RAMPATCH_TLV_1_0_1_PATH "/lib/firmware/qca/rampatch_tlv_tf_1.1.tlv" -+#define TF_NVM_TLV_1_0_1_PATH "/lib/firmware/qca/nvm_tlv_tf_1.1.bin" - - /* This header value in rampatch file decides event handling mechanism in the HOST */ - #define ROME_SKIP_EVT_NONE 0x00 -@@ -357,6 +359,7 @@ enum{ - ROME_SOC_ID_11 = 0x00000011, - ROME_SOC_ID_13 = 0x00000013, - ROME_SOC_ID_22 = 0x00000022, -+ ROME_SOC_ID_23 = 0x00000023, - ROME_SOC_ID_44 = 0x00000044 - }; - -@@ -368,6 +371,7 @@ enum{ - ROME_VER_2_1 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_11 ), - ROME_VER_3_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_22 ), - ROME_VER_3_2 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_44 ), -- TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ) -+ TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ), -+ TUFELLO_VER_1_1 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_23 ) - }; - #endif /* HW_ROME_H */ diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0016-bluetooth-Vote-UART-CLK-ON-prior-to-firmware-downloa.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0016-bluetooth-Vote-UART-CLK-ON-prior-to-firmware-downloa.patch deleted file mode 100644 index ffb182062..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0016-bluetooth-Vote-UART-CLK-ON-prior-to-firmware-downloa.patch +++ /dev/null @@ -1,74 +0,0 @@ -From: Anantha Krishnan -Date: Wed, 4 Feb 2015 12:29:07 +0530 -Subject: [PATCH] bluetooth: Vote UART CLK ON prior to firmware download - process - -Before starting the firmware download process, vote UART CLK ON -to avoid triggering the dynamic suspend of UART driver. Post -firmware download and in error scenarios vote UART CLK OFF. - -As per design, the UART driver enters into dynamic suspend if -there are no activity on the UART lines for 100ms. Depending upon -the rampatch size, the BT Controller takes time to apply the -downloaded rampatch segments and in sending the vendor specific -event. If the BT Controller takes > 100ms time in sending the -vendor specific event, the UART driver enters into suspend state. - -As a result, UART driver fails to process the last vendor specific -event sent by the BT Controller. The VSE sent by BT Controller -wakes up the UART driver, but the data is not processed causing -firmware download failures. - -Hence, vote UART CLK ON prior to firmware download process and -vote UART CLK OFF post firmware download proess and in error -scenarios. - -Change-Id: I447ded33ad1cfaa020b491effce368fbfe41f894 ---- - tools/hciattach_rome.c | 13 +++++++++++++ - tools/hciattach_rome.h | 2 ++ - 2 files changed, 15 insertions(+) - -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index fee36f904e04..574ceac6c750 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -1762,6 +1762,14 @@ int qca_soc_init(int fd, int speed, char *bdaddr) - int size, local_baud_rate = 0, controller_baud_rate = 0; - - vnd_userial.fd = fd; -+ -+ /* Vote for UART CLK prior to FW download */ -+ err = ioctl(fd, USERIAL_OP_CLK_ON); -+ if (err < 0) { -+ fprintf(stderr, "%s: Failed to vote UART CLK ON\n", __func__); -+ return -1; -+ } -+ - /* Get Rome version information */ - if((err = rome_patch_ver_req(fd)) <0){ - fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err); -@@ -1899,5 +1907,10 @@ download: - } - - error: -+ /* Vote UART CLK OFF post to FW download */ -+ err = ioctl(fd, USERIAL_OP_CLK_OFF); -+ if (err < 0) -+ fprintf(stderr, "%s: Failed to vote UART CLK OFF!!!\n", __func__); -+ - return err; - } -diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h -index 95d5f1e8a5c2..20264f9978d9 100644 ---- a/tools/hciattach_rome.h -+++ b/tools/hciattach_rome.h -@@ -42,6 +42,8 @@ - #define BD_ADDR_LEN 6 - #define MSM_ENABLE_FLOW_CTRL 16 - #define MSM_DISABLE_FLOW_CTRL 17 -+#define USERIAL_OP_CLK_ON 0x5441 -+#define USERIAL_OP_CLK_OFF 0x5442 - - unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - typedef enum { diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0017-Override-IBS-settings-by-reading-configuration-file.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0017-Override-IBS-settings-by-reading-configuration-file.patch deleted file mode 100644 index 0a1e865ba..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0017-Override-IBS-settings-by-reading-configuration-file.patch +++ /dev/null @@ -1,127 +0,0 @@ -From: Kamal Negi -Date: Thu, 30 Apr 2015 15:53:06 +0530 -Subject: [PATCH] Override IBS settings by reading configuration file - -Configure the IBS value in Firmware by reading the -configuration file.This configuration value is -provided in the config file which is read during -the firmware download process and the default -configuration value is overwritten with this value. - -Change-Id: I47992a573b3137ac9bfb80538727981f56b328c4 -Signed-off-by: Kamal Negi ---- - tools/hciattach_rome.c | 42 +++++++++++++++++++++++++++++------------- - tools/hciattach_rome.h | 24 ++++++++++++++++-------- - 2 files changed, 45 insertions(+), 21 deletions(-) - -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index 574ceac6c750..6a3f33867c12 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -922,7 +922,8 @@ int rome_get_tlv_file(char *file_path) - unsigned char data_buf[PRINT_BUF_SIZE]={0,}; - unsigned char *nvm_byte_ptr; - unsigned char bdaddr[6]; -- unsigned short pcm_value; -+ unsigned short pcm_value, ibs_value; -+ - fprintf(stderr, "File Open (%s)\n", file_path); - pFile = fopen ( file_path , "r" ); - if (pFile==NULL) {; -@@ -1008,23 +1009,38 @@ int rome_get_tlv_file(char *file_path) - *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), - *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); - } -+ -+ if (nvm_ptr->tag_id == TAG_NUM_17) { -+ if ((ibs_value = -+ get_value_from_config(FW_CONFIG_FILE_PATH, "IBS")) >= 0) { -+ if (ibs_value == FWCONF_IBS_DISABLE) { -+ nvm_byte_ptr[FWCONF_IBS_VAL_OFFSET] &= -+ (~(FWCONF_IBS_ENABLE << -+ FWCONF_IBS_VAL_BIT)); -+ } else if (ibs_value == FWCONF_IBS_ENABLE) { -+ nvm_byte_ptr[FWCONF_IBS_VAL_OFFSET] |= -+ (FWCONF_IBS_ENABLE << -+ FWCONF_IBS_VAL_BIT); -+ } -+ } -+ } - /* Read from file and check what PCM Configuration is required: - * Master = 0 /Slave = 1 */ - /* Override PCM configuration */ - if (nvm_ptr->tag_id == TAG_NUM_44) { - if ((pcm_value = -- get_value_from_config(PCM_CONFIG_FILE_PATH, "PCM")) >= 0) { -- -- if (pcm_value == PCM_SLAVE) { -- nvm_byte_ptr[PCM_MS_OFFSET_1] |= -- (1 << PCM_ROLE_BIT_OFFSET); -- nvm_byte_ptr[PCM_MS_OFFSET_2] |= -- (1 << PCM_ROLE_BIT_OFFSET); -- } else if (pcm_value == PCM_MASTER) { -- nvm_byte_ptr[PCM_MS_OFFSET_1] &= -- (~(1 << PCM_ROLE_BIT_OFFSET)); -- nvm_byte_ptr[PCM_MS_OFFSET_2] &= -- (~(1 << PCM_ROLE_BIT_OFFSET)); -+ get_value_from_config(FW_CONFIG_FILE_PATH, "PCM")) >= 0) { -+ -+ if (pcm_value == FWCONF_PCM_SLAVE) { -+ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_1] |= -+ (1 << FWCONF_PCM_ROLE_BIT_OFFSET); -+ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_2] |= -+ (1 << FWCONF_PCM_ROLE_BIT_OFFSET); -+ } else if (pcm_value == FWCONF_PCM_MASTER) { -+ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_1] &= -+ (~(1 << FWCONF_PCM_ROLE_BIT_OFFSET)); -+ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_2] &= -+ (~(1 << FWCONF_PCM_ROLE_BIT_OFFSET)); - } - } - } -diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h -index 20264f9978d9..8eaeeed8bc96 100644 ---- a/tools/hciattach_rome.h -+++ b/tools/hciattach_rome.h -@@ -203,16 +203,24 @@ typedef struct - #define TAG_END 0xFF - #define NVM_ACCESS_SET 0x01 - #define TAG_NUM_OFFSET 5 --#define TAG_NUM_2 2 --#define TAG_NUM_44 44 -+#define TAG_NUM_2 2 -+#define TAG_NUM_17 (17) -+#define TAG_NUM_44 44 - #define TAG_BDADDR_OFFSET 7 - --#define PCM_MS_OFFSET_1 9 --#define PCM_MS_OFFSET_2 33 -+/* FW PCM Configuration */ -+#define FWCONF_PCM_MS_OFFSET_1 9 -+#define FWCONF_PCM_MS_OFFSET_2 33 -+#define FWCONF_PCM_SLAVE 1 -+#define FWCONF_PCM_MASTER 0 -+#define FWCONF_PCM_ROLE_BIT_OFFSET 4 -+ -+/* FW IBS Configuration */ -+#define FWCONF_IBS_DISABLE (0) -+#define FWCONF_IBS_ENABLE (1) -+#define FWCONF_IBS_VAL_BIT (7) -+#define FWCONF_IBS_VAL_OFFSET (0) - --#define PCM_SLAVE 1 --#define PCM_MASTER 0 --#define PCM_ROLE_BIT_OFFSET 4 - #define MAX_RETRY_CNT 1 - #define SELECT_TIMEOUT 3 - -@@ -251,7 +259,7 @@ typedef struct - #define ROME_SKIP_EVT_CC 0x02 - #define ROME_SKIP_EVT_VSE_CC 0x03 - --#define PCM_CONFIG_FILE_PATH "/etc/bluetooth/pcm.conf" -+#define FW_CONFIG_FILE_PATH "/etc/bluetooth/firmware.conf" - /****************************************************************************** - ** Local type definitions - ******************************************************************************/ diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0018-Handle-NULL-Pointer-derefrencing-in-AVRCP-Target-rol.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0018-Handle-NULL-Pointer-derefrencing-in-AVRCP-Target-rol.patch deleted file mode 100644 index 003364c2c..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0018-Handle-NULL-Pointer-derefrencing-in-AVRCP-Target-rol.patch +++ /dev/null @@ -1,79 +0,0 @@ -From: Kamal Negi -Date: Fri, 8 May 2015 15:01:02 +0530 -Subject: [PATCH] Handle NULL Pointer derefrencing in AVRCP Target role - -Check NULL pointer to AVRCP controller role initialized or not. -If remote device don't support the AVRCP target role, then HOST dont -initialize AVRCP controller role and directly dereference the controller -role and segfault happens. - -Change-Id: Ibbb9452f17a576c3a79a53ea72e0211982752144 -Signed-off-by: Kamal Negi ---- - profiles/audio/avrcp.c | 27 ++++++++++++++++++++++----- - 1 file changed, 22 insertions(+), 5 deletions(-) - -diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c -index c100149acf42..d8cb0ed96a1f 100644 ---- a/profiles/audio/avrcp.c -+++ b/profiles/audio/avrcp.c -@@ -2082,13 +2082,19 @@ static gboolean avrcp_get_play_status_rsp(struct avctp *conn, uint8_t code, - void *user_data) - { - struct avrcp *session = user_data; -- struct avrcp_player *player = session->controller->player; -- struct media_player *mp = player->user_data; -+ struct avrcp_player *player; -+ struct media_player *mp; - struct avrcp_header *pdu = (void *) operands; - uint32_t duration; - uint32_t position; - uint8_t status; - -+ if (!session || !session->controller) -+ return FALSE; -+ -+ player = session->controller->player; -+ mp = player->user_data; -+ - if (pdu == NULL || code == AVC_CTYPE_REJECTED || - ntohs(pdu->params_len) != 9) - return FALSE; -@@ -2146,12 +2152,18 @@ static gboolean avrcp_player_value_rsp(struct avctp *conn, uint8_t code, - void *user_data) - { - struct avrcp *session = user_data; -- struct avrcp_player *player = session->controller->player; -- struct media_player *mp = player->user_data; -+ struct avrcp_player *player; -+ struct media_player *mp; - struct avrcp_header *pdu = (void *) operands; - uint8_t count; - int i; - -+ if (!session || !session->controller) -+ return FALSE; -+ -+ player = session->controller->player; -+ mp = player->user_data; -+ - if (pdu == NULL) { - media_player_set_setting(mp, "Error", "Timeout"); - return FALSE; -@@ -2303,10 +2315,15 @@ static gboolean avrcp_get_element_attributes_rsp(struct avctp *conn, - void *user_data) - { - struct avrcp *session = user_data; -- struct avrcp_player *player = session->controller->player; -+ struct avrcp_player *player; - struct avrcp_header *pdu = (void *) operands; - uint8_t count; - -+ if (!session || !session->controller) -+ return FALSE; -+ -+ player = session->controller->player; -+ - if (code == AVC_CTYPE_REJECTED) - return FALSE; - diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0019-bluetooth-Fix-flow-control-operation.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0019-bluetooth-Fix-flow-control-operation.patch deleted file mode 100644 index ce05c2928..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0019-bluetooth-Fix-flow-control-operation.patch +++ /dev/null @@ -1,52 +0,0 @@ -From: Dibyendu Roy -Date: Fri, 22 May 2015 18:57:05 +0530 -Subject: [PATCH] bluetooth: Fix flow control operation - -Flow off operation was not actually happening at the UART line level, -since the argument passed was not being used correctly. As a result, -sometimes command complete and VS event were sent by BT SOC even -before the local UART Controller could change its baud rate to the -newer one(3 Mbps). This led to VS event being processed -incorrectly which in turn causes baud rate change to fail. - -CRs-Fixed: 844730 -Change-Id: I06d8c4ed7807aa47dd5498642c7a23c9189a1cff -Signed-off-by: Dibyendu Roy ---- - tools/hciattach_rome.c | 6 +++--- - tools/hciattach_rome.h | 4 ++-- - 2 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index 6a3f33867c12..0d7014f1d2f6 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -1544,10 +1544,10 @@ static void flow_control(int fd, int opt) - c_opt.c_cc[VMIN] = 0; /* blocking read until 8 chars received */ - c_opt.c_cflag &= ~CSIZE; - c_opt.c_cflag |= (CS8 | CLOCAL | CREAD); -- if (MSM_ENABLE_FLOW_CTRL) -+ if (opt == MSM_ENABLE_FLOW_CTRL) - c_opt.c_cflag |= CRTSCTS; -- else if (MSM_DISABLE_FLOW_CTRL) -- c_opt.c_cflag |= ~CRTSCTS; -+ else if (opt == MSM_DISABLE_FLOW_CTRL) -+ c_opt.c_cflag &= ~CRTSCTS; - else { - fprintf(stderr, "%s: Incorrect option passed for TIOCMSET\n", __func__); - return; -diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h -index 8eaeeed8bc96..3fdaf208e522 100644 ---- a/tools/hciattach_rome.h -+++ b/tools/hciattach_rome.h -@@ -40,8 +40,8 @@ - #define NVITEM_SIZE 2 - #define PERSIST_HEADER_LEN 3 - #define BD_ADDR_LEN 6 --#define MSM_ENABLE_FLOW_CTRL 16 --#define MSM_DISABLE_FLOW_CTRL 17 -+#define MSM_DISABLE_FLOW_CTRL 0 -+#define MSM_ENABLE_FLOW_CTRL 1 - #define USERIAL_OP_CLK_ON 0x5441 - #define USERIAL_OP_CLK_OFF 0x5442 - diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0020-Adding-MDM-specific-code-under-_PLATFORM_MDM_.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0020-Adding-MDM-specific-code-under-_PLATFORM_MDM_.patch deleted file mode 100644 index c2987d399..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0020-Adding-MDM-specific-code-under-_PLATFORM_MDM_.patch +++ /dev/null @@ -1,65 +0,0 @@ -From: Dibyendu Roy -Date: Thu, 11 Jun 2015 12:07:43 +0530 -Subject: [PATCH] Adding MDM specific code under _PLATFORM_MDM_ - -This patch is added to comment out the commit -84cc0e12983b5761c67789ef93fd6fb164c7314d in x86 as -dynamic suspend feature is not available in x86. However, -this code shall be active for MDM platform due to -dynamic suspend feature. - -Change-Id: I998f0521b4a5f9744412db40f2c2d3bff2ac3d11 ---- - tools/hciattach_rome.c | 5 ++++- - tools/hciattach_rome.h | 3 +++ - 2 files changed, 7 insertions(+), 1 deletion(-) - -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index 0d7014f1d2f6..1891de24e21a 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -1779,13 +1779,14 @@ int qca_soc_init(int fd, int speed, char *bdaddr) - - vnd_userial.fd = fd; - -+#ifdef _PLATFORM_MDM_ - /* Vote for UART CLK prior to FW download */ - err = ioctl(fd, USERIAL_OP_CLK_ON); - if (err < 0) { - fprintf(stderr, "%s: Failed to vote UART CLK ON\n", __func__); - return -1; - } -- -+#endif - /* Get Rome version information */ - if((err = rome_patch_ver_req(fd)) <0){ - fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err); -@@ -1923,10 +1924,12 @@ download: - } - - error: -+#ifdef _PLATFORM_MDM_ - /* Vote UART CLK OFF post to FW download */ - err = ioctl(fd, USERIAL_OP_CLK_OFF); - if (err < 0) - fprintf(stderr, "%s: Failed to vote UART CLK OFF!!!\n", __func__); -+#endif - - return err; - } -diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h -index 3fdaf208e522..89f7db3bef86 100644 ---- a/tools/hciattach_rome.h -+++ b/tools/hciattach_rome.h -@@ -42,8 +42,11 @@ - #define BD_ADDR_LEN 6 - #define MSM_DISABLE_FLOW_CTRL 0 - #define MSM_ENABLE_FLOW_CTRL 1 -+ -+#ifdef _PLATFORM_MDM_ - #define USERIAL_OP_CLK_ON 0x5441 - #define USERIAL_OP_CLK_OFF 0x5442 -+#endif - - unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - typedef enum { diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0021-Bluetooth-Fix-static-analysis-issues.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0021-Bluetooth-Fix-static-analysis-issues.patch deleted file mode 100644 index 97a865291..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0021-Bluetooth-Fix-static-analysis-issues.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Dibyendu Roy -Date: Mon, 6 Jul 2015 13:30:53 +0530 -Subject: [PATCH] Bluetooth: Fix static analysis issues - -Change-Id: Ida91f012544c39a8aaa6e7db23f1d5b68d3bec08 ---- - tools/hciattach_rome.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c -index 1891de24e21a..59bdc16e4e8f 100644 ---- a/tools/hciattach_rome.c -+++ b/tools/hciattach_rome.c -@@ -933,7 +933,13 @@ int rome_get_tlv_file(char *file_path) - - /* Get File Size */ - fseek (pFile , 0 , SEEK_END); -- fileSize = ftell (pFile); -+ -+ if((fileSize = ftell(pFile)) < 0) { -+ fprintf(stderr, "%s: fail to get current file position\n", file_path); -+ fclose (pFile); -+ return -1; -+ } -+ - rewind (pFile); - - pdata_buffer = (unsigned char*) malloc (sizeof(char)*fileSize); -@@ -1107,7 +1113,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc - int rome_tlv_dnld_req(int fd, int tlv_size) - { - int total_segment, remain_size, i, err = -1; -- unsigned char wait_cc_evt; -+ unsigned char wait_cc_evt = FALSE; - unsigned int rom = rome_ver >> 16; - - total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT; diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5_5.41.bbappend b/meta-digi-dey/recipes-connectivity/bluez/bluez5_5.41.bbappend index 7e54c309c..2c7439747 100644 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5_5.41.bbappend +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5_5.41.bbappend @@ -7,34 +7,27 @@ SRC_URI += " \ file://main.conf \ file://0001-hcitool-do-not-show-unsupported-refresh-option.patch \ file://0002-hcitool-increase-the-shown-connection-limit-to-20.patch \ - file://0025-port-test-discovery-to-python3.patch \ + file://0003-port-test-discovery-to-python3.patch \ + file://0004-example-gatt-server-update-example-to-master-version.patch \ + file://0005-core-Prefer-BR-EDR-over-LE-if-it-set-in-advertisemen.patch \ + file://0006-core-device-Fix-not-connecting-services-properly.patch \ + file://0007-core-device-Fix-marking-auto-connect-flag.patch \ + file://0008-core-device-Prefer-bonded-bearers-when-connecting.patch \ + file://0009-input-hog-Use-.accept-and-.disconnect-instead-of-att.patch \ + file://0010-src-device-Free-bonding-while-failed-to-pair-device.patch \ + file://0011-core-Fix-BR-EDR-pairing-for-dual-mode-devices.patch \ " -SRC_URI_append_ccimx6ul = " \ - file://0003-bluetooth-Add-bluetooth-support-for-QCA6174-chip.patch \ - file://0004-bluetooth-Enable-bluetooth-low-power-mode-functional.patch \ - file://0005-bluetooth-Fix-bug-in-firmware-parsing-mechanism.patch \ - file://0006-bluetooth-Configure-BD-Address.patch \ - file://0007-bluetooth-Remove-unused-functions-in-the-firmware-do.patch \ - file://0008-bluetooth-Enable-3Mbps-baud-rate-support.patch \ - file://0009-bluetooth-Check-TTY-buffer-for-data-availability-bef.patch \ - file://0010-bluetooth-Add-support-for-TUFEELO-firmware-download.patch \ - file://0011-bluetooth-Add-support-for-ROME-3.2-SOC.patch \ - file://0012-bluetooth-Use-correct-TTY-ioctl-calls-for-flow-contr.patch \ - file://0013-bluetooth-Add-support-for-multi-baud-rate.patch \ - file://0014-Override-PCM-Settings-by-reading-configuration-file.patch \ - file://0015-Add-support-for-Tufello-1.1-SOC.patch \ - file://0016-bluetooth-Vote-UART-CLK-ON-prior-to-firmware-downloa.patch \ - file://0017-Override-IBS-settings-by-reading-configuration-file.patch \ - file://0018-Handle-NULL-Pointer-derefrencing-in-AVRCP-Target-rol.patch \ - file://0019-bluetooth-Fix-flow-control-operation.patch \ - file://0020-Adding-MDM-specific-code-under-_PLATFORM_MDM_.patch \ - file://0021-Bluetooth-Fix-static-analysis-issues.patch \ - file://0022-hciattach_rome-Respect-the-user-indication-for-noflo.patch \ - file://0023-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch \ - file://0024-hciattach-Add-verbosity-option.patch \ +QCA6564_COMMON_PATCHES = " \ + file://0012-QCA_bluetooth_chip_support.patch \ + file://0013-hciattach_rome-Respect-the-user-indication-for-noflo.patch \ + file://0014-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch \ + file://0015-hciattach-Add-verbosity-option.patch \ " +SRC_URI_append_ccimx6ul = " ${QCA6564_COMMON_PATCHES}" +SRC_URI_append_ccimx6qpsbc = " ${QCA6564_COMMON_PATCHES}" + inherit update-rc.d PACKAGECONFIG_append = " experimental" @@ -43,6 +36,9 @@ do_install_append() { install -d ${D}${sysconfdir}/init.d/ install -m 0755 ${WORKDIR}/bluetooth-init ${D}${sysconfdir}/init.d/bluetooth-init install -m 0644 ${WORKDIR}/main.conf ${D}${sysconfdir}/bluetooth/ + if [ -n "${@bb.utils.contains('PACKAGECONFIG', 'experimental', 'experimental', '', d)}" ]; then + sed -i '/^SSD_OPTIONS/a SSD_OPTIONS="${SSD_OPTIONS} --experimental"' ${D}${INIT_D_DIR}/bluetooth + fi } PACKAGES =+ "${PN}-init" diff --git a/meta-digi-dey/recipes-connectivity/btfilter/btfilter-v3.4p4-b3.4.0.158/0001-enable-libnl3.patch b/meta-digi-dey/recipes-connectivity/btfilter/btfilter-v3.4p4-b3.4.0.158/0001-enable-libnl3.patch deleted file mode 100644 index 1cd5ac29c..000000000 --- a/meta-digi-dey/recipes-connectivity/btfilter/btfilter-v3.4p4-b3.4.0.158/0001-enable-libnl3.patch +++ /dev/null @@ -1,74 +0,0 @@ -From: Javier Viguera -Date: Thu, 31 Jan 2013 11:23:37 +0100 -Subject: [PATCH] enable-libnl3 - -Signed-off-by: Javier Viguera ---- - Makefile | 7 ++++++- - nl80211_utils.c | 4 ++-- - nl80211_utils.h | 2 +- - 3 files changed, 9 insertions(+), 4 deletions(-) - -diff --git a/Makefile b/Makefile -index 115ad33..6c21413 100644 ---- a/Makefile -+++ b/Makefile -@@ -56,17 +56,22 @@ LIBS= -ldbus-1 -lpthread -lrt -lbluetooth - - NL1FOUND := $(shell $(PKG_CONFIG) --atleast-version=1 libnl-1 && echo Y) - NL2FOUND := $(shell $(PKG_CONFIG) --atleast-version=2 libnl-2.0 && echo Y) -+NL3FOUND := $(shell $(PKG_CONFIG) --atleast-version=3 libnl-3.0 && echo Y) - - ifeq ($(NL1FOUND),Y) -+CFLAGS += -DCONFIG_LIBNL1 - NLLIBNAME = libnl-1 - endif - - ifeq ($(NL2FOUND),Y) --CFLAGS += -DCONFIG_LIBNL20 - LIBS += -lnl-genl - NLLIBNAME = libnl-2.0 - endif - -+ifeq ($(NL3FOUND),Y) -+NLLIBNAME = libnl-3.0 -+endif -+ - #ifeq ($(NLLIBNAME),) - #$(error Cannot find development files for any supported version of libnl) - #endif -diff --git a/nl80211_utils.c b/nl80211_utils.c -index 4689044..2957f2e 100644 ---- a/nl80211_utils.c -+++ b/nl80211_utils.c -@@ -9,7 +9,7 @@ - #include - #include "nl80211_utils.h" - --#ifndef CONFIG_LIBNL20 -+#ifdef CONFIG_LIBNL1 - /* libnl 2.0 compatibility code */ - - static inline int __genl_ctrl_alloc_cache(struct nl_sock *h, struct nl_cache **cache) -@@ -24,7 +24,7 @@ static inline int __genl_ctrl_alloc_cache(struct nl_sock *h, struct nl_cache **c - #define nl_socket_alloc nl_handle_alloc - #define nl_socket_free nl_handle_destroy - --#endif /* CONFIG_LIBNL20 */ -+#endif /* CONFIG_LIBNL1 */ - - int iw_debug = 0; - -diff --git a/nl80211_utils.h b/nl80211_utils.h -index 6a0dbd7..6bbeb2c 100644 ---- a/nl80211_utils.h -+++ b/nl80211_utils.h -@@ -11,7 +11,7 @@ - #include - #include - --#ifndef CONFIG_LIBNL20 -+#ifdef CONFIG_LIBNL1 - #define nl_sock nl_handle - #endif - diff --git a/meta-digi-dey/recipes-connectivity/btfilter/btfilter-v3.4p4-b3.4.0.158/0002-cross-compile.patch b/meta-digi-dey/recipes-connectivity/btfilter/btfilter-v3.4p4-b3.4.0.158/0002-cross-compile.patch deleted file mode 100644 index 98b1a3aac..000000000 --- a/meta-digi-dey/recipes-connectivity/btfilter/btfilter-v3.4p4-b3.4.0.158/0002-cross-compile.patch +++ /dev/null @@ -1,85 +0,0 @@ -From: Javier Viguera -Date: Tue, 16 Apr 2013 18:46:31 +0200 -Subject: [PATCH] cross-compile - -Signed-off-by: Javier Viguera ---- - Makefile | 43 +++++++++++++++++++++++++++---------------- - 1 file changed, 27 insertions(+), 16 deletions(-) - -diff --git a/Makefile b/Makefile -index 6c21413..91659dd 100644 ---- a/Makefile -+++ b/Makefile -@@ -25,13 +25,13 @@ SBINDIR ?= $(PREFIX)/sbin - MANDIR ?= $(PREFIX)/share/man - - PKG_CONFIG ?= pkg-config --ifdef V210 --CC= $(ATH_CROSS_COMPILE_TYPE)gcc --LD= $(ATH_CROSS_COMPILE_TYPE)ld --else --CC= $(ATH_CROSSS_COMPILE_TYPE)gcc --LD= $(ATH_CROSSS_COMPILE_TYPE)ld --endif -+# ifdef V210 -+# CC= $(ATH_CROSS_COMPILE_TYPE)gcc -+# LD= $(ATH_CROSS_COMPILE_TYPE)ld -+# else -+# CC= $(ATH_CROSSS_COMPILE_TYPE)gcc -+# LD= $(ATH_CROSSS_COMPILE_TYPE)ld -+# endif - SOURCES=abtfilt_main.c \ - abtfilt_wlan.c \ - abtfilt_core.c \ -@@ -40,19 +40,19 @@ SOURCES=abtfilt_main.c \ - nl80211_utils.c\ - btfilter_core.c - --INCLUDES= -Iinclude \ -+override INCLUDES += -Iinclude \ - -Ios/linux/include \ -- -Icommon/include \ -- -I$(V210_DIR)/usr/include/dbus-1.0/ \ -- -I$(V210_DIR)/usr/lib/dbus-1.0/include \ -- -I$(V210_DIR)/usr/local/include/dbus-1.0 \ -- -I$(V210_DIR)/usr/local/lib/dbus-1.0/include \ -- -I$(V210_DIR)/usr/include/bluetooth \ -- -I$(V210_DIR)/usr/local/include/bluetooth \ -+ -Icommon/include -+# -I$(V210_DIR)/usr/include/dbus-1.0/ \ -+# -I$(V210_DIR)/usr/lib/dbus-1.0/include \ -+# -I$(V210_DIR)/usr/local/include/dbus-1.0 \ -+# -I$(V210_DIR)/usr/local/lib/dbus-1.0/include \ -+# -I$(V210_DIR)/usr/include/bluetooth \ -+# -I$(V210_DIR)/usr/local/include/bluetooth \ - - CFLAGS= -Wall -g -DABF_DEBUG - #LIBS= -ldbus-1 -lpthread -lbtfilt -lrt -lbluetooth --LIBS= -ldbus-1 -lpthread -lrt -lbluetooth -+# LIBS= -ldbus-1 -lpthread -lrt -lbluetooth - - NL1FOUND := $(shell $(PKG_CONFIG) --atleast-version=1 libnl-1 && echo Y) - NL2FOUND := $(shell $(PKG_CONFIG) --atleast-version=2 libnl-2.0 && echo Y) -@@ -79,6 +79,13 @@ endif - LIBS += $(shell $(PKG_CONFIG) --libs $(NLLIBNAME)) - CFLAGS += $(shell $(PKG_CONFIG) --cflags $(NLLIBNAME)) - -+# dbus -+LIBS += $(shell $(PKG_CONFIG) --libs --static dbus-1) -+CFLAGS += $(shell $(PKG_CONFIG) --cflags dbus-1) -+ -+# BlueZ -+LIBS += $(shell $(PKG_CONFIG) --libs bluez) -+CFLAGS += $(shell $(PKG_CONFIG) --cflags bluez) - - ifdef BOARD_HAS_ATH_WLAN_AR6004 - CFLAGS += -DMULTI_WLAN_CHAN_SUPPORT -@@ -124,3 +131,7 @@ all: $(OBJECTS) - - clean: - rm -f $(FILTERAPP) $(OBJECTS) -+ -+install: -+ mkdir -p $(DESTDIR)$(SBINDIR) -+ install -m 0755 $(FILTERAPP) $(DESTDIR)$(SBINDIR) diff --git a/meta-digi-dey/recipes-connectivity/btfilter/btfilter-v3.4p4-b3.4.0.158/0003-abtfilt_wan-Rewrite-the-netlink-listener.patch b/meta-digi-dey/recipes-connectivity/btfilter/btfilter-v3.4p4-b3.4.0.158/0003-abtfilt_wan-Rewrite-the-netlink-listener.patch deleted file mode 100644 index 955fe6df7..000000000 --- a/meta-digi-dey/recipes-connectivity/btfilter/btfilter-v3.4p4-b3.4.0.158/0003-abtfilt_wan-Rewrite-the-netlink-listener.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 641f02fe3638d291a0ef53c076bda7e68e2f7d28 Mon Sep 17 00:00:00 2001 -From: Alex Gonzalez -Date: Tue, 26 Aug 2014 16:57:14 +0200 -Subject: [PATCH] abtfilt_wan: Rewrite the netlink listener. - -Not sure how old this code is but it is not working properly any more. - -Not only it incorrectly detects the netlink messages as corrupted, but it -also assumes an RTM_DELLINK will be issued for the link down event which -is not correct. - -I have updated the code trying to touch as little things as possible. - -Signed-off-by: Alex Gonzalez ---- - abtfilt_wlan.c | 87 +++++++++++++++++++++++++++++++++++++--------------------- - 1 file changed, 56 insertions(+), 31 deletions(-) - -diff --git a/abtfilt_wlan.c b/abtfilt_wlan.c -index b1966cef7ef2..64dffde37f19 100644 ---- a/abtfilt_wlan.c -+++ b/abtfilt_wlan.c -@@ -232,6 +232,59 @@ Abf_WlanDispatchIO(ATHBT_FILTER_INFO *pInfo, unsigned long int req, - return A_OK; - } - -+static void -+print_link(struct ifinfomsg *ifi, int len, int up) -+{ -+ struct rtattr *attrib; -+ -+ for(attrib = IFLA_RTA(ifi); RTA_OK(attrib, len); -+ attrib = RTA_NEXT(attrib, len)) { -+ switch(attrib->rta_type) { -+ case IFLA_IFNAME: -+ A_DEBUG("[%d:%s] Link %s\n", ifi->ifi_index, -+ (char *)RTA_DATA(attrib), up ? "UP" : "DOWN"); -+ break; -+ default: -+ break; -+ } -+ } -+} -+ -+static void -+parse_message(ATH_BT_FILTER_INSTANCE *pInstance, int len, char *buf) -+{ -+ struct nlmsghdr *msg_ptr; -+ struct ifinfomsg *ifi; -+ int len1; -+ -+ for(msg_ptr = (struct nlmsghdr *)buf; NLMSG_OK(msg_ptr, len); -+ msg_ptr = NLMSG_NEXT(msg_ptr, len)) { -+ /* Finish reading */ -+ if(msg_ptr->nlmsg_type == NLMSG_DONE) -+ break; -+ -+ /* Message is some kind of error */ -+ if(msg_ptr->nlmsg_type == NLMSG_ERROR) { -+ A_ERR("Message is an error.\n"); -+ break; -+ } -+ -+ if(msg_ptr->nlmsg_type == RTM_NEWLINK) { -+ ifi = NLMSG_DATA(msg_ptr); -+ len1 = msg_ptr->nlmsg_len - NLMSG_LENGTH(sizeof(*ifi)); -+ if(ifi->ifi_flags & IFF_RUNNING){ -+ print_link(ifi, len1, 1); -+ NewLinkEvent(pInstance, msg_ptr, len1); -+ } -+ else { -+ print_link(ifi, len1, 0); -+ DelLinkEvent(pInstance, msg_ptr, len1); -+ } -+ break; -+ } -+ } -+} -+ - /* Internal functions */ - static void * - WlanEventThread(void *arg) -@@ -322,41 +375,13 @@ WlanEventThread(void *arg) - } while (left == -1 && errno == EINTR); - - if (left < 0) { -- A_ERR("[%s] recvfrom(netlink)\n", __FUNCTION__); -+ A_ERR("[%s] recvfrom(netlink) error %d\n", __FUNCTION__, -+ left); - continue; - // break; - } - -- h = (struct nlmsghdr *) buf; -- while (left >= (int)sizeof(*h)) { -- int len, plen; -- -- len = h->nlmsg_len; -- plen = len - sizeof(*h); -- if (len > left || plen < 0) { -- A_ERR("[%s] malformed netlink message\n", __FUNCTION__); -- continue; -- } -- -- //A_DEBUG("RTM Message Type: %s\n", -- // ((h->nlmsg_type == RTM_NEWLINK) ? -- // "RTM_NEWLINK" : ((h->nlmsg_type == RTM_DELLINK) ? -- // "RTM_DELLINK" : "RTM_OTHER"))); -- switch (h->nlmsg_type) { -- case RTM_NEWLINK: -- NewLinkEvent(pInstance, h, plen); -- break; -- case RTM_DELLINK: -- DelLinkEvent(pInstance, h, plen); -- break; -- default: -- break; -- } -- -- len = NLMSG_ALIGN(len); -- left -= len; -- h = (struct nlmsghdr *) ((char *) h + len); -- } -+ parse_message(pInstance, left, buf); - } - } - diff --git a/meta-digi-dey/recipes-connectivity/btfilter/btfilter-v3.4p4-b3.4.0.158/0004-add-fgnu89-flag-for-gcc5.patch b/meta-digi-dey/recipes-connectivity/btfilter/btfilter-v3.4p4-b3.4.0.158/0004-add-fgnu89-flag-for-gcc5.patch deleted file mode 100644 index ee131ad1b..000000000 --- a/meta-digi-dey/recipes-connectivity/btfilter/btfilter-v3.4p4-b3.4.0.158/0004-add-fgnu89-flag-for-gcc5.patch +++ /dev/null @@ -1,29 +0,0 @@ -From d631ddd830cfacf610a562b52fc953b14dff7962 Mon Sep 17 00:00:00 2001 -From: Isaac Hermida -Date: Fri, 6 Nov 2015 17:46:33 +0100 -Subject: [PATCH] add -fgnu89-inline flag for gcc5 - -The problem is the change of the default C standard from gnu89 to gnu11 - which changes the semantics of 'inline'. The issue is described in the - Porting guide at https://gcc.gnu.org/gcc-5/porting_to.html. - ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index 91659ddb788c..1e2e1d6b0584 100644 ---- a/Makefile -+++ b/Makefile -@@ -50,7 +50,7 @@ override INCLUDES += -Iinclude \ - # -I$(V210_DIR)/usr/include/bluetooth \ - # -I$(V210_DIR)/usr/local/include/bluetooth \ - --CFLAGS= -Wall -g -DABF_DEBUG -+CFLAGS= -Wall -g -DABF_DEBUG -fgnu89-inline - #LIBS= -ldbus-1 -lpthread -lbtfilt -lrt -lbluetooth - # LIBS= -ldbus-1 -lpthread -lrt -lbluetooth - --- -1.9.1 - diff --git a/meta-digi-dey/recipes-connectivity/btfilter/btfilter-v3.4p4-b3.4.0.158/btfilter-init b/meta-digi-dey/recipes-connectivity/btfilter/btfilter-v3.4p4-b3.4.0.158/btfilter-init deleted file mode 100755 index 530a125ce..000000000 --- a/meta-digi-dey/recipes-connectivity/btfilter/btfilter-v3.4p4-b3.4.0.158/btfilter-init +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -#=============================================================================== -# -# btfilter -# -# Copyright (C) 2015 by Digi International Inc. -# All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 as published by -# the Free Software Foundation. -# -# -# !Description: Configure Bluetooth -# -#=============================================================================== - -set -e - -if [ "${1}" != "start" ]; then - exit 0 -fi - -SCRIPTNAME="$(basename "${0}")" - -# Check if this hardware does support Bluetooth -if [ -d "/proc/device-tree/bluetooth" ]; then - echo "Starting btfilter service." - if ! abtfilt -b -x -s -w wlan0 1>/dev/null; then - echo "${SCRIPTNAME}: FAILED (abtfilt)" - exit - fi -fi diff --git a/meta-digi-dey/recipes-connectivity/btfilter/btfilter_v3.4p4-b3.4.0.158.bb b/meta-digi-dey/recipes-connectivity/btfilter/btfilter_v3.4p4-b3.4.0.158.bb deleted file mode 100644 index a381020d2..000000000 --- a/meta-digi-dey/recipes-connectivity/btfilter/btfilter_v3.4p4-b3.4.0.158.bb +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2013 Digi International. - -SUMMARY = "Atheros BT/wlan coexistance daemon" -SECTION = "network" -LICENSE = "ISC" -LIC_FILES_CHKSUM = "file://Makefile;beginline=1;endline=14;md5=8f6614b37751445a5f6a9bdc69be26b3" - -inherit bluetooth -inherit update-rc.d - -DEPENDS = "${BLUEZ} dbus libnl" - -SRC_URI = " \ - ${DIGI_PKG_SRC}/${PN}-${PV}.tar.bz2 \ - file://0001-enable-libnl3.patch \ - file://0002-cross-compile.patch \ - file://0003-abtfilt_wan-Rewrite-the-netlink-listener.patch \ - file://0004-add-fgnu89-flag-for-gcc5.patch \ - file://btfilter-init \ -" - -SRC_URI[md5sum] = "06a26d3a368c33b508d660ea84d476ee" -SRC_URI[sha256sum] = "b1af73003b622189b66d51911d429d6d205ac9227ec8278c8572ca0c68c7d5f3" - -EXTRA_OEMAKE = "INCLUDES=-I${STAGING_INCDIR}/bluetooth" - -do_install() { - install -d ${D}${bindir} ${D}${sysconfdir}/init.d/ - install -m 0755 abtfilt ${D}${bindir} - install -m 0755 ${WORKDIR}/btfilter-init ${D}${sysconfdir}/init.d/btfilter -} - -INITSCRIPT_NAME = "btfilter" -INITSCRIPT_PARAMS = "start 11 5 ." diff --git a/meta-digi-dey/recipes-connectivity/hostapd/hostapd/hostapd_wlan0.conf b/meta-digi-dey/recipes-connectivity/hostapd/hostapd/hostapd_wlan0.conf index 570643ccd..73aaa58c4 100644 --- a/meta-digi-dey/recipes-connectivity/hostapd/hostapd/hostapd_wlan0.conf +++ b/meta-digi-dey/recipes-connectivity/hostapd/hostapd/hostapd_wlan0.conf @@ -4,7 +4,7 @@ interface=wlan0 driver=nl80211 # WPA2-AES encryption -ssid=ap-wlan0-wpa2aes_a +ssid=ap-wlan0-##MAC## auth_algs=1 wpa=2 wpa_key_mgmt=WPA-PSK diff --git a/meta-digi-dey/recipes-connectivity/hostapd/hostapd/ccimx6ul/hostapd_wlan1.conf b/meta-digi-dey/recipes-connectivity/hostapd/hostapd/hostapd_wlan1.conf similarity index 91% rename from meta-digi-dey/recipes-connectivity/hostapd/hostapd/ccimx6ul/hostapd_wlan1.conf rename to meta-digi-dey/recipes-connectivity/hostapd/hostapd/hostapd_wlan1.conf index 3d2e87d0d..a5ee3b926 100644 --- a/meta-digi-dey/recipes-connectivity/hostapd/hostapd/ccimx6ul/hostapd_wlan1.conf +++ b/meta-digi-dey/recipes-connectivity/hostapd/hostapd/hostapd_wlan1.conf @@ -4,7 +4,7 @@ interface=wlan1 driver=nl80211 # WPA2-AES encryption -ssid=ap-wlan1-wpa2aes_a +ssid=ap-wlan1-##MAC## auth_algs=1 wpa=2 wpa_key_mgmt=WPA-PSK diff --git a/meta-digi-dey/recipes-connectivity/hostapd/hostapd_%.bbappend b/meta-digi-dey/recipes-connectivity/hostapd/hostapd_%.bbappend index 4134c7993..6f31b13df 100644 --- a/meta-digi-dey/recipes-connectivity/hostapd/hostapd_%.bbappend +++ b/meta-digi-dey/recipes-connectivity/hostapd/hostapd_%.bbappend @@ -4,6 +4,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" SRC_URI_append = " file://hostapd_wlan0.conf" SRC_URI_append_ccimx6ul = " file://hostapd_wlan1.conf" +SRC_URI_append_ccimx6qpsbc = " file://hostapd_wlan1.conf" do_install_append() { # Remove the default hostapd.conf @@ -17,5 +18,35 @@ do_install_append_ccimx6ul() { install -m 0644 ${WORKDIR}/hostapd_wlan1.conf ${D}${sysconfdir} } +do_install_append_ccimx6qpsbc() { + # Install custom hostapd_IFACE.conf file + install -m 0644 ${WORKDIR}/hostapd_wlan1.conf ${D}${sysconfdir} +} + +pkg_postinst_${PN}() { + # Append the last two bytes of the wlan0 MAC address to the SSID of the + # hostAP configuration files + # (execute on first boot) + if [ -n "$D" ]; then + exit 1 + fi + + # Get the last two bytes of the wlan0 MAC address + MAC="$(cut -d ':' -f5,6 /sys/class/net/wlan0/address | tr -d ':')" + + # If wlan0 is not available, use a random value with no hexadecimal characters + if [ -z "${MAC}" ]; then + MAC="$(cat /dev/urandom | tr -dc 'G-Z' | fold -w 4 | head -n 1)" + fi + + find "${sysconfdir}" -type f -name 'hostapd_wlan?.conf' -exec \ + sed -i -e "s,##MAC##,${MAC},g" {} \; + + # Create the symlinks in the different runlevels + if type update-rc.d >/dev/null 2>/dev/null; then + update-rc.d ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} + fi +} + # Do not autostart hostapd daemon, it will conflict with wpa-supplicant. INITSCRIPT_PARAMS = "remove" diff --git a/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/78-mm-digi-xbee-cellular.rules b/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/ccimx6/78-mm-digi-xbee-cellular.rules similarity index 73% rename from meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/78-mm-digi-xbee-cellular.rules rename to meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/ccimx6/78-mm-digi-xbee-cellular.rules index e3ddda0ec..9f999dd1c 100644 --- a/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/78-mm-digi-xbee-cellular.rules +++ b/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/ccimx6/78-mm-digi-xbee-cellular.rules @@ -3,11 +3,9 @@ ACTION!="add|change|move", GOTO="mm_digi_xbee_cellular_modem_end" # By default, ModemManager expects a default baudrate of 57600bps. Different # baudrates may be used by setting the ID_MM_TTY_BAUDRATE udev tag. -# ConnectCore 6 SBC +# ModemManager documentation states that the best practice is to use the DEVPATH +# this way rather than other rules such as KERNEL, so be careful when modifying DEVPATH=="/devices/soc0/soc.0/2100000.aips-bus/21f4000.serial/tty/ttymxc4", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1", ENV{ID_MM_PHYSDEV_UID}="Digi XBee Cellular" DEVPATH=="/devices/soc0/soc/2100000.aips-bus/21f4000.serial/tty/ttymxc4", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1", ENV{ID_MM_PHYSDEV_UID}="Digi XBee Cellular" -# ConnectCore 6UL SBC Pro -DEVPATH=="/devices/platform/soc/2100000.aips-bus/21e8000.serial/tty/ttymxc1", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1", ENV{ID_MM_PHYSDEV_UID}="Digi XBee Cellular" - LABEL="mm_digi_xbee_cellular_modem_end" diff --git a/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/ccimx6ul/78-mm-digi-xbee-cellular.rules b/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/ccimx6ul/78-mm-digi-xbee-cellular.rules new file mode 100644 index 000000000..31fbcc68e --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager/ccimx6ul/78-mm-digi-xbee-cellular.rules @@ -0,0 +1,11 @@ +ACTION!="add|change|move", GOTO="mm_digi_xbee_cellular_modem_end" + +# By default, ModemManager expects a default baudrate of 57600bps. Different +# baudrates may be used by setting the ID_MM_TTY_BAUDRATE udev tag. + +# ModemManager documentation states that the best practice is to use the DEVPATH +# this way rather than other rules such as KERNEL, so be careful when modifying +DEVPATH=="/devices/platform/soc/2100000.aips-bus/21e8000.serial/tty/ttymxc1", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1", ENV{ID_MM_PHYSDEV_UID}="Digi XBee Cellular" +DEVPATH=="/devices/soc0/soc/2100000.aips-bus/21e8000.serial/tty/ttymxc1", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1", ENV{ID_MM_PHYSDEV_UID}="Digi XBee Cellular" + +LABEL="mm_digi_xbee_cellular_modem_end" diff --git a/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager_%.bbappend b/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager_%.bbappend index b1d763aea..1fe0adcf9 100644 --- a/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager_%.bbappend +++ b/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager_%.bbappend @@ -16,3 +16,5 @@ do_install_append() { install -d ${D}${nonarch_base_libdir}/udev/rules.d install -m 0644 ${WORKDIR}/78-mm-digi-xbee-cellular.rules ${D}${nonarch_base_libdir}/udev/rules.d/ } + +PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager_git.bb b/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager_git.bb index 623a8db0a..d83e76b6d 100644 --- a/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager_git.bb +++ b/meta-digi-dey/recipes-connectivity/modemmanager/modemmanager_git.bb @@ -8,7 +8,7 @@ LIC_FILES_CHKSUM = " \ file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c \ " -DEPENDS = "dbus-glib glib-2.0 intltool-native libgudev" +DEPENDS = "glib-2.0 intltool-native libgudev" PV = "1.7.0+git${SRCPV}" diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/0001-networkmanager-trigger-dispatcher-on-per-device-conn.patch b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/0001-networkmanager-trigger-dispatcher-on-per-device-conn.patch new file mode 100644 index 000000000..dd383515a --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/0001-networkmanager-trigger-dispatcher-on-per-device-conn.patch @@ -0,0 +1,129 @@ +From: Javier Viguera +Date: Thu, 9 Nov 2017 11:49:14 +0100 +Subject: [PATCH] networkmanager: trigger dispatcher on per-device connectivity + loss + +This creates a new dispatcher action DEVICE_CONNECTIVITY_CHANGE, that +gets triggered whenever one interface fails in the upstream connectivity +check, regardless of the system having connectivity through a different +interface. + +Signed-off-by: Javier Viguera +--- + shared/nm-dispatcher-api.h | 1 + + src/devices/nm-device.c | 3 +++ + src/nm-dispatcher.c | 40 +++++++++++++++++++++++++++++++++++++++- + src/nm-dispatcher.h | 9 ++++++++- + 4 files changed, 51 insertions(+), 2 deletions(-) + +diff --git a/shared/nm-dispatcher-api.h b/shared/nm-dispatcher-api.h +index b1f28e71d4c3..e83835b03057 100644 +--- a/shared/nm-dispatcher-api.h ++++ b/shared/nm-dispatcher-api.h +@@ -50,6 +50,7 @@ + #define NMD_ACTION_DHCP4_CHANGE "dhcp4-change" + #define NMD_ACTION_DHCP6_CHANGE "dhcp6-change" + #define NMD_ACTION_CONNECTIVITY_CHANGE "connectivity-change" ++#define NMD_ACTION_DEVICE_CONNECTIVITY_CHANGE "device-connectivity-change" + + typedef enum { + DISPATCH_RESULT_UNKNOWN = 0, +diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c +index fbf315ed3bc8..503c4689b035 100644 +--- a/src/devices/nm-device.c ++++ b/src/devices/nm-device.c +@@ -1824,6 +1824,9 @@ update_connectivity_state (NMDevice *self, NMConnectivityState state) + nm_connectivity_state_to_string (priv->connectivity_state), + nm_connectivity_state_to_string (state)); + #endif ++ if (priv->connectivity_state == NM_CONNECTIVITY_FULL) ++ nm_dispatcher_call_device_connectivity(state, self, NULL, NULL, NULL); ++ + priv->connectivity_state = state; + _notify (self, PROP_CONNECTIVITY); + +diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c +index 0d482e0cad9d..8e3f95c0b819 100644 +--- a/src/nm-dispatcher.c ++++ b/src/nm-dispatcher.c +@@ -453,7 +453,8 @@ static const char *action_table[] = { + [NM_DISPATCHER_ACTION_VPN_DOWN] = NMD_ACTION_VPN_DOWN, + [NM_DISPATCHER_ACTION_DHCP4_CHANGE] = NMD_ACTION_DHCP4_CHANGE, + [NM_DISPATCHER_ACTION_DHCP6_CHANGE] = NMD_ACTION_DHCP6_CHANGE, +- [NM_DISPATCHER_ACTION_CONNECTIVITY_CHANGE] = NMD_ACTION_CONNECTIVITY_CHANGE ++ [NM_DISPATCHER_ACTION_CONNECTIVITY_CHANGE] = NMD_ACTION_CONNECTIVITY_CHANGE, ++ [NM_DISPATCHER_ACTION_DEVICE_CONNECTIVITY_CHANGE] = NMD_ACTION_DEVICE_CONNECTIVITY_CHANGE + }; + + static const char * +@@ -903,6 +904,43 @@ nm_dispatcher_call_connectivity (NMConnectivityState connectivity_state, + callback, user_data, out_call_id); + } + ++/** ++ * nm_dispatcher_call_device_connectivity(): ++ * @connectivity_state: the #NMConnectivityState value ++ * @device: the #NMDevice the action applies to ++ * @callback: a caller-supplied callback to execute when done ++ * @user_data: caller-supplied pointer passed to @callback ++ * @out_call_id: on success, a call identifier which can be passed to ++ * nm_dispatcher_call_cancel() ++ * ++ * This method does not block the caller. ++ * ++ * Returns: %TRUE if the action was dispatched, %FALSE on failure ++ */ ++gboolean ++nm_dispatcher_call_device_connectivity(NMConnectivityState connectivity_state, ++ NMDevice *device, ++ NMDispatcherFunc callback, ++ gpointer user_data, guint *out_call_id) ++{ ++ NMActRequest *act_request; ++ ++ nm_assert(NM_IS_DEVICE(device)); ++ ++ act_request = nm_device_get_act_request(device); ++ if (!act_request) ++ return FALSE; ++ ++ nm_assert(NM_IN_SET(nm_active_connection_get_device(NM_ACTIVE_CONNECTION(act_request)), NULL, device)); ++ return _dispatcher_call(NM_DISPATCHER_ACTION_DEVICE_CONNECTIVITY_CHANGE, FALSE, device, ++ nm_act_request_get_settings_connection(act_request), ++ nm_act_request_get_applied_connection(act_request), ++ nm_active_connection_get_activation_type(NM_ACTIVE_CONNECTION(act_request)) == NM_ACTIVATION_TYPE_EXTERNAL, ++ connectivity_state, ++ NULL, NULL, NULL, NULL, ++ callback, user_data, out_call_id); ++} ++ + void + nm_dispatcher_call_cancel (guint call_id) + { +diff --git a/src/nm-dispatcher.h b/src/nm-dispatcher.h +index 4448e8173fa7..9902a77ba683 100644 +--- a/src/nm-dispatcher.h ++++ b/src/nm-dispatcher.h +@@ -36,7 +36,8 @@ typedef enum { + NM_DISPATCHER_ACTION_VPN_DOWN, + NM_DISPATCHER_ACTION_DHCP4_CHANGE, + NM_DISPATCHER_ACTION_DHCP6_CHANGE, +- NM_DISPATCHER_ACTION_CONNECTIVITY_CHANGE ++ NM_DISPATCHER_ACTION_CONNECTIVITY_CHANGE, ++ NM_DISPATCHER_ACTION_DEVICE_CONNECTIVITY_CHANGE + } NMDispatcherAction; + + typedef void (*NMDispatcherFunc) (guint call_id, gpointer user_data); +@@ -82,6 +83,12 @@ gboolean nm_dispatcher_call_connectivity (NMConnectivityState state, + gpointer user_data, + guint *out_call_id); + ++gboolean nm_dispatcher_call_device_connectivity(NMConnectivityState ++ connectivity_state, ++ NMDevice *device, ++ NMDispatcherFunc callback, ++ gpointer user_data, ++ guint *out_call_id); + + void nm_dispatcher_call_cancel (guint call_id); + diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/NetworkManager.conf b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/NetworkManager.conf index 10810a323..ad683c98e 100644 --- a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/NetworkManager.conf +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/NetworkManager.conf @@ -1,6 +1,7 @@ [main] plugins=ifupdown,keyfile no-auto-default=type:ethernet +dns=dnsmasq rc-manager=file [ifupdown] diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_%.bbappend b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_%.bbappend index f744aa2d4..461cc0f5c 100644 --- a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_%.bbappend +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_%.bbappend @@ -3,6 +3,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" SRC_URI += " \ + file://0001-networkmanager-trigger-dispatcher-on-per-device-conn.patch \ file://NetworkManager.conf \ file://networkmanager-init \ file://nm.cellular \ @@ -22,7 +23,7 @@ EXTRA_OECONF += "--enable-polkit=disabled" PACKAGECONFIG_remove = "consolekit" # Adjust other compile time options to save space -PACKAGECONFIG_remove = "dnsmasq netconfig nss" +PACKAGECONFIG_remove = "netconfig nss" PACKAGECONFIG_append = " concheck gnutls modemmanager ppp" # diff --git a/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-wireless.bb b/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-wireless.bb index e4f27eb3e..f2d6bf9a7 100644 --- a/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-wireless.bb +++ b/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-wireless.bb @@ -1,5 +1,5 @@ # -# Copyright (C) 2012 Digi International. +# Copyright (C) 2012-2017 Digi International. # SUMMARY = "Wireless packagegroup for DEY image" @@ -16,3 +16,4 @@ RDEPENDS_${PN} = "\ " RDEPENDS_${PN}_append_ccimx6ul = " hostapd" +RDEPENDS_${PN}_append_ccimx6qpsbc = " hostapd" diff --git a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx6qpsbc/wpa_supplicant.conf-sane b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx6qpsbc/wpa_supplicant.conf-sane new file mode 100644 index 000000000..c58546a06 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx6qpsbc/wpa_supplicant.conf-sane @@ -0,0 +1,18 @@ +ctrl_interface=/var/run/wpa_supplicant +ctrl_interface_group=0 +fast_reauth=1 +update_config=1 + +ap_scan=1 + +# Static scheduled scan interval time in seconds +# +# The wpa-supplicant dynamically adjusts the scheduled scan time interval. On +# occassions, fixing the interval time is helpful, for example on DFS channels. +#sched_scan_interval=2 + +network={ + scan_ssid=1 + ssid="" + key_mgmt=NONE +} diff --git a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx6qpsbc/wpa_supplicant_p2p.conf b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx6qpsbc/wpa_supplicant_p2p.conf new file mode 100644 index 000000000..c6d16f32d --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx6qpsbc/wpa_supplicant_p2p.conf @@ -0,0 +1,8 @@ +ctrl_interface=/var/run/wpa_supplicant +update_config=1 +device_name=ccimx6qp-p2p +manufacturer=QCA +model_name=McK +device_type=1-0050F204-1 +config_methods=display keypad push_button +persistent_reconnect=1 diff --git a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx6sbc/wpa_supplicant_p2p.conf b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx6sbc/wpa_supplicant_p2p.conf new file mode 100644 index 000000000..c1146257f --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx6sbc/wpa_supplicant_p2p.conf @@ -0,0 +1,6 @@ +ctrl_interface=/var/run/wpa_supplicant +ctrl_interface_group=0 +device_name=ccimx6-p2p +device_type=10-0050F204-5 +config_methods=virtual_push_button keypad display pin +persistent_reconnect=1 diff --git a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant_%.bbappend b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant_%.bbappend index bee53d088..7a80ba361 100644 --- a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant_%.bbappend +++ b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant_%.bbappend @@ -4,10 +4,12 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" PACKAGECONFIG ?= "openssl" -SRC_URI += "file://0001-wpa_supplicant-enable-control-socket-interface-when-.patch" -SRC_URI_append_ccimx6ul = " file://wpa_supplicant_p2p.conf" +SRC_URI += " \ + file://0001-wpa_supplicant-enable-control-socket-interface-when-.patch \ + file://wpa_supplicant_p2p.conf \ +" -do_install_append_ccimx6ul() { +do_install_append() { install -m 600 ${WORKDIR}/wpa_supplicant_p2p.conf ${D}${sysconfdir}/wpa_supplicant_p2p.conf } diff --git a/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6qpsbc/suspend b/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6qpsbc/suspend new file mode 100755 index 000000000..28a9f68ca --- /dev/null +++ b/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6qpsbc/suspend @@ -0,0 +1,121 @@ +#!/bin/sh +#=============================================================================== +# +# suspend +# +# Copyright (C) 2017 by Digi International Inc. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. +# +# +# !Description: suspend system to RAM +# +#=============================================================================== + +scriptname="$(basename ${0})" +syspower="/sys/power/state" +lockfile="/var/lock/${scriptname}.lock" +lockfd="9" + +BT_INIT="/etc/init.d/bluetooth-init" +BT_DAEMON="/etc/init.d/bluetooth" + +usage() { + printf "\nSuspend system to RAM memory\n" + printf "\nUsage: ${scriptname} [OPTIONS]\n + -h Show this help + \n" +} + +suspend_interfaces() { + # Suspend wireless interfaces + if [ -d "/proc/device-tree/wireless" ]; then + for i in $(sed -ne 's,^\(wlan[0-9]\)=.*,\1,g;T;p' /var/run/ifstate | sort -r); do + ifdown "${i}" && RESUME_IFACES="${RESUME_IFACES:+${RESUME_IFACES} }${i}" + done + + # Get a list of the wireless interfaces managed by NetworkManager + # and set them to unmanaged before suspend. + for i in $(nmcli -t -f DEVICE,TYPE,STATE dev | grep :wifi: | grep -v unmanaged | cut -d':' -f1); do + nmcli dev set "${i}" managed no && NM_MANAGED_IFACES="${NM_MANAGED_IFACES:+${NM_MANAGED_IFACES} }${i}" + done + + grep -qs '^wlan' /proc/modules && rmmod wlan + fi + + # Suspend bluetooth interface + if [ -d "/proc/device-tree/bluetooth" ]; then + hciconfig hci0 2>&1 | grep -qs UP && up_bt_on_resume="1" + ${BT_DAEMON} stop >/dev/null + ${BT_INIT} stop >/dev/null + fi +} + +resume_interfaces() { + # Resume wireless interfaces + if [ -d "/proc/device-tree/wireless" ]; then + # Trigger wireless module loading event, and wait until the interface exists + udevadm trigger --action=add --attr-match="modalias=sdio:c00v0271d050A" + timeout -t 5 sh -c "while [ ! -d /sys/class/net/wlan0 ]; do sleep .2; done" 2>/dev/null + + # Set interfaces managed by NetworkManager back as managed + for i in $(echo ${NM_MANAGED_IFACES} | tr ' ' '\n' | sort); do + nmcli dev set "${i}" managed yes + done + + # Bring up the interfaces that were bring down on suspend + for i in $(echo ${RESUME_IFACES} | tr ' ' '\n' | sort); do + grep -qs "^${i}" /var/run/ifstate || ifup "${i}" + done + fi + + # Resume bluetooth interface + if [ -d "/proc/device-tree/bluetooth" ]; then + if [ -n "${up_bt_on_resume}" ]; then + ${BT_INIT} start >/dev/null + ${BT_DAEMON} start >/dev/null + fi + fi +} + +enter_critical_section() { + # Create lock file + eval "exec ${lockfd}>${lockfile}" + + # Acquire the lock in non blocking mode. Otherwise, additional calls + # to the script will be queued and the system will endlessly go in + # and out of suspend to ram + flock -n "${lockfd}" || exit 0 +} + +exit_critical_section() { + # Release the lock + flock -u "${lockfd}" +} + +while getopts "h" c; do + case "${c}" in + h) usage; exit;; + esac +done + +if [ -f "${syspower}" ]; then + # Avoid running multiple instances of this script in parallel + enter_critical_section + + # Pre-suspend actions + suspend_interfaces + + # Suspend the device + printf "mem" > ${syspower} + + # Post-resume actions + resume_interfaces + + exit_critical_section +else + printf "\n[ERROR] File ${syspower} not found\n\n" +fi diff --git a/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6/suspend b/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6sbc/suspend similarity index 85% rename from meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6/suspend rename to meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6sbc/suspend index 140645eea..44f9548e6 100755 --- a/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6/suspend +++ b/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6sbc/suspend @@ -36,6 +36,13 @@ suspend_interfaces() { for i in $(sed -ne 's,^\(wlan[0-9]\)=.*,\1,g;T;p' /var/run/ifstate | sort -r); do ifdown "${i}" && RESUME_IFACES="${RESUME_IFACES:+${RESUME_IFACES} }${i}" done + + # Get a list of the wireless interfaces managed by NetworkManager + # and set them to unmanaged before suspend. + for i in $(nmcli -t -f DEVICE,TYPE,STATE dev | grep :wifi: | grep -v unmanaged | cut -d':' -f1); do + nmcli dev set "${i}" managed no && NM_MANAGED_IFACES="${NM_MANAGED_IFACES:+${NM_MANAGED_IFACES} }${i}" + done + grep -qs '^ath6kl_sdio' /proc/modules && rmmod ath6kl_sdio ath6kl_core fi @@ -54,6 +61,11 @@ resume_interfaces() { udevadm trigger --action=add --attr-match="modalias=sdio:c00v0271d0301" timeout -t 5 sh -c "while [ ! -d /sys/class/net/wlan0 ]; do sleep .2; done" 2>/dev/null + # Set interfaces managed by NetworkManager back as managed + for i in $(echo ${NM_MANAGED_IFACES} | tr ' ' '\n' | sort); do + nmcli dev set "${i}" managed yes + done + # Bring up the interfaces that were bring down on suspend for i in $(echo ${RESUME_IFACES} | tr ' ' '\n' | sort); do grep -qs "^${i}" /var/run/ifstate || ifup "${i}" diff --git a/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6ul/suspend b/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6ul/suspend index a74f24d35..f2ee3cb22 100755 --- a/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6ul/suspend +++ b/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6ul/suspend @@ -36,6 +36,13 @@ suspend_interfaces() { for i in $(sed -ne 's,^\(wlan[0-9]\)=.*,\1,g;T;p' /var/run/ifstate | sort -r); do ifdown "${i}" && RESUME_IFACES="${RESUME_IFACES:+${RESUME_IFACES} }${i}" done + + # Get a list of the wireless interfaces managed by NetworkManager + # and set them to unmanaged before suspend. + for i in $(nmcli -t -f DEVICE,TYPE,STATE dev | grep :wifi: | grep -v unmanaged | cut -d':' -f1); do + nmcli dev set "${i}" managed no && NM_MANAGED_IFACES="${NM_MANAGED_IFACES:+${NM_MANAGED_IFACES} }${i}" + done + grep -qs '^wlan' /proc/modules && rmmod wlan fi @@ -54,6 +61,11 @@ resume_interfaces() { udevadm trigger --action=add --attr-match="modalias=sdio:c00v0271d050A" timeout -t 5 sh -c "while [ ! -d /sys/class/net/wlan0 ]; do sleep .2; done" 2>/dev/null + # Set interfaces managed by NetworkManager back as managed + for i in $(echo ${NM_MANAGED_IFACES} | tr ' ' '\n' | sort); do + nmcli dev set "${i}" managed yes + done + # Bring up the interfaces that were bring down on suspend for i in $(echo ${RESUME_IFACES} | tr ' ' '\n' | sort); do grep -qs "^${i}" /var/run/ifstate || ifup "${i}" diff --git a/meta-digi-dey/recipes-core/images/core-image-base.bbappend b/meta-digi-dey/recipes-core/images/core-image-base.bbappend index 4263517ac..2e7b4d5de 100644 --- a/meta-digi-dey/recipes-core/images/core-image-base.bbappend +++ b/meta-digi-dey/recipes-core/images/core-image-base.bbappend @@ -4,6 +4,7 @@ IMAGE_FEATURES += " \ dey-network \ + eclipse-debug \ package-management \ ssh-server-dropbear \ ${@bb.utils.contains('MACHINE_FEATURES', 'accel-video', 'dey-gstreamer', '', d)} \ diff --git a/meta-digi-dey/recipes-core/images/dey-image-qt.bb b/meta-digi-dey/recipes-core/images/dey-image-qt.bb index 6cd4e2956..bb935e61d 100644 --- a/meta-digi-dey/recipes-core/images/dey-image-qt.bb +++ b/meta-digi-dey/recipes-core/images/dey-image-qt.bb @@ -17,6 +17,7 @@ IMAGE_INSTALL = " \ IMAGE_FEATURES += " \ dey-network \ dey-qt \ + eclipse-debug \ package-management \ ssh-server-dropbear \ ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11-base x11-sato', '', d)} \ diff --git a/meta-digi-dey/recipes-core/images/dey-image-recovery-initramfs.bb b/meta-digi-dey/recipes-core/images/dey-image-recovery-initramfs.bb index bd484673d..1d5ad31a2 100644 --- a/meta-digi-dey/recipes-core/images/dey-image-recovery-initramfs.bb +++ b/meta-digi-dey/recipes-core/images/dey-image-recovery-initramfs.bb @@ -5,7 +5,6 @@ LICENSE = "MIT" PACKAGE_INSTALL = " \ busybox \ - parted \ psplash \ recovery-initramfs \ swupdate \ diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6qpsbc/interfaces.br0.example b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6qpsbc/interfaces.br0.example new file mode 100644 index 000000000..60e05fe52 --- /dev/null +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6qpsbc/interfaces.br0.example @@ -0,0 +1,7 @@ + +## Example bridge between eth0 and wlan1 +#auto br0 +#iface br0 inet static +# bridge_ports eth0 wlan1 +# address 192.168.42.50 +# netmask 255.255.255.0 diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6qpsbc/interfaces.wlan1.dhcp b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6qpsbc/interfaces.wlan1.dhcp new file mode 100644 index 000000000..245b973f0 --- /dev/null +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6qpsbc/interfaces.wlan1.dhcp @@ -0,0 +1,6 @@ + +auto wlan1 +iface wlan1 inet dhcp + udhcpc_opts -S -b >/dev/null & + post-up /etc/init.d/hostapd start + pre-down /etc/init.d/hostapd stop diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6qpsbc/interfaces.wlan1.static b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6qpsbc/interfaces.wlan1.static new file mode 100644 index 000000000..664542efe --- /dev/null +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6qpsbc/interfaces.wlan1.static @@ -0,0 +1,9 @@ + +auto wlan1 +iface wlan1 inet static + address ##WLAN1_STATIC_IP## + netmask ##WLAN1_STATIC_NETMASK## + gateway ##WLAN1_STATIC_GATEWAY## + dns-nameservers ##WLAN1_STATIC_DNS## + post-up /etc/init.d/hostapd start + pre-down /etc/init.d/hostapd stop diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6qpsbc/virtwlans.sh b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6qpsbc/virtwlans.sh new file mode 100644 index 000000000..a3eb3dc7b --- /dev/null +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6qpsbc/virtwlans.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Copyright (c) 2017, Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +# This will create a second wireless network device +if [ -s "/proc/device-tree/wireless/mac-address1" ] && + [ -s "/proc/device-tree/wireless/mac-address2" ] && + [ -s "/proc/device-tree/wireless/mac-address3" ]; then + : +else + echo "[WARN] Using default MAC addresses for virtual interfaces, please program them referring to the Digi U-Boot Documentation" +fi + +if [ ! -d "/sys/class/net/wlan1" ]; then + # This will create a second wireless network device + iw dev wlan0 interface add wlan1 type __ap +fi diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6/interfaces.br0.example b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6sbc/interfaces.br0.example similarity index 100% rename from meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6/interfaces.br0.example rename to meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6sbc/interfaces.br0.example diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6ul/virtwlans.sh b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6ul/virtwlans.sh index 304c09fc5..a3eb3dc7b 100644 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6ul/virtwlans.sh +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx6ul/virtwlans.sh @@ -26,5 +26,5 @@ fi if [ ! -d "/sys/class/net/wlan1" ]; then # This will create a second wireless network device - iw dev wlan0 interface add wlan1 type managed + iw dev wlan0 interface add wlan1 type __ap fi diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend index 388399008..97e1dccf4 100644 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend @@ -11,6 +11,12 @@ SRC_URI_append = " \ file://resolv \ " +SRC_URI_append_ccimx6qpsbc = "\ + file://interfaces.wlan1.static \ + file://interfaces.wlan1.dhcp \ + file://virtwlans.sh \ +" + SRC_URI_append_ccimx6ul = "\ file://interfaces.wlan1.static \ file://interfaces.wlan1.dhcp \ @@ -49,6 +55,28 @@ do_install_append_ccimx6sbc() { cat ${WORKDIR}/interfaces.br0.example >> ${D}${sysconfdir}/network/interfaces } +do_install_append_ccimx6qpsbc() { + install -d ${D}${base_bindir} + install -m 0755 ${WORKDIR}/virtwlans.sh ${D}${base_bindir} + if [ -n "${HAVE_WIFI}" ]; then + cat ${WORKDIR}/interfaces.wlan1.${WLAN1_MODE} >> ${D}${sysconfdir}/network/interfaces + fi + + # Remove config entries if corresponding variable is not defined + [ -z "${WLAN1_STATIC_DNS}" ] && sed -i -e "/##WLAN1_STATIC_DNS##/d" ${D}${sysconfdir}/network/interfaces + [ -z "${WLAN1_STATIC_GATEWAY}" ] && sed -i -e "/##WLAN1_STATIC_GATEWAY##/d" ${D}${sysconfdir}/network/interfaces + [ -z "${WLAN1_STATIC_IP}" ] && sed -i -e "/##WLAN1_STATIC_IP##/d" ${D}${sysconfdir}/network/interfaces + [ -z "${WLAN1_STATIC_NETMASK}" ] && sed -i -e "/##WLAN1_STATIC_NETMASK##/d" ${D}${sysconfdir}/network/interfaces + + # Replace interface parameters + sed -i -e "s,##WLAN1_STATIC_IP##,${WLAN1_STATIC_IP},g" ${D}${sysconfdir}/network/interfaces + sed -i -e "s,##WLAN1_STATIC_NETMASK##,${WLAN1_STATIC_NETMASK},g" ${D}${sysconfdir}/network/interfaces + sed -i -e "s,##WLAN1_STATIC_GATEWAY##,${WLAN1_STATIC_GATEWAY},g" ${D}${sysconfdir}/network/interfaces + sed -i -e "s,##WLAN1_STATIC_DNS##,${WLAN1_STATIC_DNS},g" ${D}${sysconfdir}/network/interfaces + + cat ${WORKDIR}/interfaces.br0.example >> ${D}${sysconfdir}/network/interfaces +} + do_install_append_ccimx6ul() { install -d ${D}${base_bindir} install -m 0755 ${WORKDIR}/virtwlans.sh ${D}${base_bindir} diff --git a/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb b/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb index 2a4613cc1..ff26058ea 100644 --- a/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb +++ b/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb @@ -37,6 +37,7 @@ RDEPENDS_${PN} = "\ ${@bb.utils.contains("MACHINE_FEATURES", "rtc", "busybox-hwclock", "", d)} \ ${@bb.utils.contains("MACHINE_FEATURES", "touchscreen", "${VIRTUAL-RUNTIME_touchscreen}", "",d)} \ init-ifupdown \ + libdigiapix \ modutils-initscripts \ netbase \ networkmanager \ diff --git a/meta-digi-dey/recipes-core/recovery/recovery-initramfs.bb b/meta-digi-dey/recipes-core/recovery/recovery-initramfs.bb index fb88dba95..16103d2af 100644 --- a/meta-digi-dey/recipes-core/recovery/recovery-initramfs.bb +++ b/meta-digi-dey/recipes-core/recovery/recovery-initramfs.bb @@ -53,7 +53,9 @@ PACKAGES = "${PN}" FILES_${PN} = "/" -RDEPENDS_${PN}_append_ccimx6 = " \ +RDEPENDS_${PN}_append_ccimx6sbc = " \ cryptsetup \ rng-tools \ " + +RDEPENDS_${PN}_append_ccimx6qpsbc = " cryptsetup" diff --git a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/automount_block.sh b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/automount_block.sh index 1d3466b4b..e437f0b6d 100644 --- a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/automount_block.sh +++ b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/automount_block.sh @@ -23,12 +23,12 @@ PARTITION="$(echo "${MDEV}" | sed -n -e '/^mmc/{s,^[^p]\+p\([0-9]\+\)$,\1,g;T;p} # This will detect if the block device has a update partition is_update_device() { - parted -s "/dev/${DEVICE}" print | grep -qs update + fdisk -l "/dev/${DEVICE}" | grep -qs update } # This will verify that the requested partition is the update partition is_update_partition() { - parted -s "/dev/${DEVICE}" print | sed -ne "s,^[^0-9]*\([0-9]\+\).*\.*,\1,g;T;p" | grep -qs "${PARTITION}" + fdisk -l "/dev/${DEVICE}" | sed -ne "s,^[^0-9]*\([0-9]\+\).*\.*,\1,g;T;p" | grep -qs "${PARTITION}" } if is_update_device; then diff --git a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init index 5f70a0e3d..a59cb846c 100644 --- a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init +++ b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init @@ -230,7 +230,7 @@ format_ubi_volume() { #------------------------------------------------------------------------------ format_emmc_block() { # Find partition block number. - local partition_block="/dev/mmcblk0p$(parted -s /dev/mmcblk0 print | sed -ne "s,^[^0-9]*\([0-9]\+\).*\<${1}\>.*,\1,g;T;p")" + local partition_block="/dev/mmcblk0p$(fdisk -l /dev/mmcblk0 | sed -ne "s,^[^0-9]*\([0-9]\+\).*\<${1}\>.*,\1,g;T;p")" if [ -b "${partition_block}" ]; then # Umount in case partition is mounted, ignore errors. if grep -qs "${partition_block}" /proc/mounts; then @@ -349,6 +349,19 @@ set_encryption_flag() { fi } +#------------------------------------------------------------------------------ +# Function - get_kernel_version +# +# Obtain the kernel version and return it in number format +# +# @return - kernel version +#------------------------------------------------------------------------------ +get_kernel_version() { + major="$(uname -r | cut -d'.' -f1)" + minor="$(uname -r | cut -d'.' -f2)" + echo $(((major << 8) + minor)) +} + # Main #------------------------------------------------------------------------------ # Setup the environment. @@ -381,8 +394,9 @@ mkdir -p /var/lock # Set kernel console loglevel. sysctl -q -w kernel.printk=4 -if [ "$(is_nand)" = "no" ]; then - # Launch 'rngd' to feed random data to kernel entropy pool +# Launch 'rngd' to feed random data to kernel entropy pool +# for kernels previous to v3.17 +if [ "$(get_kernel_version)" -lt "$(((3 << 8) + 17))" ]; then mkdir -p /var/run && rngd fi @@ -458,7 +472,7 @@ if [ -n "${encryption_key_bool}" ]; then # Format partition. if [ "$(is_nand)" = "no" ]; then psplash_message "Formatting rootfs partition..." - rootfs_block="/dev/mmcblk0p$(parted -s /dev/mmcblk0 print | sed -ne "s,^[^0-9]*\([0-9]\+\).*\.*,\1,g;T;p")" + rootfs_block="/dev/mmcblk0p$(fdisk -l /dev/mmcblk0 | sed -ne "s,^[^0-9]*\([0-9]\+\).*\.*,\1,g;T;p")" trustfence-tool --format ${rootfs_block} cryptroot fi psplash_progress "100" diff --git a/meta-digi-dey/recipes-core/trustfence/trustfence-initramfs.bb b/meta-digi-dey/recipes-core/trustfence/trustfence-initramfs.bb index 0d6d77ef4..5f9cb418c 100644 --- a/meta-digi-dey/recipes-core/trustfence/trustfence-initramfs.bb +++ b/meta-digi-dey/recipes-core/trustfence/trustfence-initramfs.bb @@ -27,11 +27,13 @@ RDEPENDS_${PN} = " \ u-boot-fw-utils \ " -RDEPENDS_${PN}_append_ccimx6 = " \ +RDEPENDS_${PN}_append_ccimx6sbc = " \ cryptsetup \ rng-tools \ " +RDEPENDS_${PN}_append_ccimx6qpsbc = " cryptsetup" + RDEPENDS_${PN}_append_ccimx6ul = " \ mtd-utils-ubifs \ " diff --git a/meta-digi-dey/recipes-core/trustfence/trustfence-initramfs/ccimx6sbc/trustfence-initramfs-init b/meta-digi-dey/recipes-core/trustfence/trustfence-initramfs/ccimx6/trustfence-initramfs-init similarity index 74% rename from meta-digi-dey/recipes-core/trustfence/trustfence-initramfs/ccimx6sbc/trustfence-initramfs-init rename to meta-digi-dey/recipes-core/trustfence/trustfence-initramfs/ccimx6/trustfence-initramfs-init index d1d352671..d8eb73c0b 100644 --- a/meta-digi-dey/recipes-core/trustfence/trustfence-initramfs/ccimx6sbc/trustfence-initramfs-init +++ b/meta-digi-dey/recipes-core/trustfence/trustfence-initramfs/ccimx6/trustfence-initramfs-init @@ -24,6 +24,22 @@ error() { sync && poweroff -f } +#------------------------------------------------------------------------------ +# Function - get_kernel_version +# +# Obtain the kernel version and return it in number format +# +# @return - kernel version +#------------------------------------------------------------------------------ +get_kernel_version() { + major="$(uname -r | cut -d'.' -f1)" + minor="$(uname -r | cut -d'.' -f2)" + echo $(((major << 8) + minor)) +} + +# Main +#------------------------------------------------------------------------------ +# Setup the environment. export PATH=/bin:/sbin:/usr/bin:/usr/sbin mkdir -p /proc /sys /dev @@ -36,7 +52,10 @@ LOGLEVEL="$(sysctl -n kernel.printk)" sysctl -q -w kernel.printk=4 # Launch 'rngd' to feed random data to kernel entropy pool -mkdir -p /var/run && rngd +# for kernels previous to v3.17 +if [ "$(get_kernel_version)" -lt "$(((3 << 8) + 17))" ]; then + mkdir -p /var/run && rngd +fi for arg in $(cat /proc/cmdline); do case "${arg}" in @@ -76,7 +95,9 @@ mount ${FSTYPE:+-t ${FSTYPE}} ${root} /newroot # - restore previous kernel console loglevel # - umount virtual filesystems # -pkill -9 rngd +if [ "$(get_kernel_version)" -lt "$(((3 << 8) + 17))" ]; then + pkill -9 rngd +fi [ -n "${LOGLEVEL}" ] && sysctl -q -w kernel.printk="${LOGLEVEL}" mount --move /dev /newroot/dev umount /sys /proc diff --git a/meta-digi-dey/recipes-devtools/tcf-agent/tcf-agent/0001-Makefile.inc-fix-ranlib.patch b/meta-digi-dey/recipes-devtools/tcf-agent/tcf-agent/0001-Makefile.inc-fix-ranlib.patch new file mode 100644 index 000000000..bfacb21eb --- /dev/null +++ b/meta-digi-dey/recipes-devtools/tcf-agent/tcf-agent/0001-Makefile.inc-fix-ranlib.patch @@ -0,0 +1,25 @@ +From: Javier Viguera +Date: Thu, 16 Nov 2017 17:57:07 +0100 +Subject: [PATCH 1/3] Makefile.inc: fix ranlib + +Upstream-Status: Inappropriate [poky-specific fix] + +Signed-off-by: Javier Viguera +--- + agent/Makefile.inc | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/agent/Makefile.inc b/agent/Makefile.inc +index 8304cfecc14a..cdf8536dbf9b 100644 +--- a/agent/Makefile.inc ++++ b/agent/Makefile.inc +@@ -88,6 +88,9 @@ ifeq ($(OPSYS),GNU/Linux) + else + OPTS += -DUSE_uuid_generate=0 + endif ++ ifneq ($(RANLIB),) ++ RANLIB += $@ ++ endif + OPTS += -DENABLE_arch_$(shell uname -m) + endif + diff --git a/meta-digi-dey/recipes-devtools/tcf-agent/tcf-agent/0002-tcf-agent-obey-LDFLAGS.patch b/meta-digi-dey/recipes-devtools/tcf-agent/tcf-agent/0002-tcf-agent-obey-LDFLAGS.patch new file mode 100644 index 000000000..b130bfa8e --- /dev/null +++ b/meta-digi-dey/recipes-devtools/tcf-agent/tcf-agent/0002-tcf-agent-obey-LDFLAGS.patch @@ -0,0 +1,22 @@ +From: Abdur Rehman +Date: Wed, 26 Aug 2015 19:18:11 +0500 +Subject: [PATCH 2/3] tcf-agent: obey LDFLAGS + +Signed-off-by: Abdur Rehman +--- + agent/Makefile.inc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/agent/Makefile.inc b/agent/Makefile.inc +index cdf8536dbf9b..70f4710dcacd 100644 +--- a/agent/Makefile.inc ++++ b/agent/Makefile.inc +@@ -114,7 +114,7 @@ NO_LINK_F ?= -c + # Linker definition and flags + + LINK ?= $(CC) +-LINK_FLAGS ?= $(CFLAGS) ++LINK_FLAGS ?= $(LDFLAGS) $(CFLAGS) + LINK_OUT_F ?= $(OUT_OBJ_F) + + # Archiver definition and flags diff --git a/meta-digi-dey/recipes-devtools/tcf-agent/tcf-agent/0003-canonicalize_file_name-is-specific-to-glibc.patch b/meta-digi-dey/recipes-devtools/tcf-agent/tcf-agent/0003-canonicalize_file_name-is-specific-to-glibc.patch new file mode 100644 index 000000000..1b94cdfd5 --- /dev/null +++ b/meta-digi-dey/recipes-devtools/tcf-agent/tcf-agent/0003-canonicalize_file_name-is-specific-to-glibc.patch @@ -0,0 +1,40 @@ +From: Khem Raj +Date: Thu, 7 Jan 2016 22:37:48 +0000 +Subject: [PATCH 3/3] canonicalize_file_name is specific to glibc + +When on Linux and not using glibc then we need to define +canonicalize_file_name() API, therefore add a check for finding out if +its not glibc + +Signed-off-by: Khem Raj +--- + agent/tcf/framework/mdep.c | 2 +- + agent/tcf/framework/mdep.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/agent/tcf/framework/mdep.c b/agent/tcf/framework/mdep.c +index cf5771e5f016..ccdea09b8817 100644 +--- a/agent/tcf/framework/mdep.c ++++ b/agent/tcf/framework/mdep.c +@@ -1086,7 +1086,7 @@ char * canonicalize_file_name(const char * path) { + return strdup(res); + } + +-#elif defined(__UCLIBC__) ++#elif defined(__UCLIBC__) || !defined(__GLIBC__) + + char * canonicalize_file_name(const char * path) { + return realpath(path, NULL); +diff --git a/agent/tcf/framework/mdep.h b/agent/tcf/framework/mdep.h +index fec94d787224..52c41256cd92 100644 +--- a/agent/tcf/framework/mdep.h ++++ b/agent/tcf/framework/mdep.h +@@ -288,7 +288,7 @@ extern int loc_clock_gettime(int, struct timespec *); + + #define O_BINARY 0 + +-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(__sun__) ++#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(__sun__) || !defined(__GLIBC__) + # define O_LARGEFILE 0 + extern char ** environ; + extern char * canonicalize_file_name(const char * path); diff --git a/meta-digi-dey/recipes-devtools/tcf-agent/tcf-agent_git.bbappend b/meta-digi-dey/recipes-devtools/tcf-agent/tcf-agent_git.bbappend new file mode 100644 index 000000000..822d2337a --- /dev/null +++ b/meta-digi-dey/recipes-devtools/tcf-agent/tcf-agent_git.bbappend @@ -0,0 +1,19 @@ +# Copyright (C) 2017 Digi International Inc. + +FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" + +SRCREV = "5ec928ddf62b0ad936efacf2b2d8fb87cca112ac" +PV = "1.5+git${SRCPV}" + +SRC_URI = " \ + git://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent;branch=1.5_oxygen_bugfix \ + file://0001-Makefile.inc-fix-ranlib.patch;striplevel=2 \ + file://0002-tcf-agent-obey-LDFLAGS.patch;striplevel=2 \ + file://0003-canonicalize_file_name-is-specific-to-glibc.patch;striplevel=2 \ + file://tcf-agent.init \ + file://tcf-agent.service \ +" + +# tcf-agent falls back to '/bin/sh' if 'bash' is not available, so don't +# depend on bash at runtime. +RDEPENDS_${PN}_remove = "bash" diff --git a/meta-digi-dey/recipes-digi/cryptoauthlib/cryptoauthlib_git.bb b/meta-digi-dey/recipes-digi/cryptoauthlib/cryptoauthlib_git.bb index b837549f7..2db3ee8cb 100644 --- a/meta-digi-dey/recipes-digi/cryptoauthlib/cryptoauthlib_git.bb +++ b/meta-digi-dey/recipes-digi/cryptoauthlib/cryptoauthlib_git.bb @@ -8,16 +8,18 @@ LIC_FILES_CHKSUM = "file://lib/atca_cfgs.h;beginline=8;endline=40;md5=073d05cb7a SRCBRANCH = "dey-2.2/maint" SRCREV = "${AUTOREV}" -GIT_URI ?= "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${DIGI_MTK_GIT}linux/atmel-cryptoauth-openssl-engine.git;protocol=ssh', '${DIGI_GITHUB_GIT}/cryptoauth-openssl-engine.git', d)}" +GIT_URI ?= "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${DIGI_MTK_GIT}linux/atmel-cryptoauth-openssl-engine.git;protocol=ssh', '${DIGI_GITHUB_GIT}/atmel-cryptoauth-openssl-engine.git', d)}" SRC_URI = "${GIT_URI};branch=${SRCBRANCH}" S = "${WORKDIR}/git/engine_atecc/cryptoauthlib" I2C_BUS = "" +I2C_BUS_ccimx6qpsbc = "1" I2C_BUS_ccimx6ul = "0" I2C_SPEED = "" +I2C_SPEED_ccimx6qpsbc = "100000" I2C_SPEED_ccimx6ul = "100000" CFLAGS += "-DATCA_HAL_I2C_BUS=${I2C_BUS} -DATCA_HAL_I2C_SPEED=${I2C_SPEED}" @@ -27,4 +29,4 @@ do_install() { } PACKAGE_ARCH = "${MACHINE_ARCH}" -COMPATIBLE_MACHINE = "(ccimx6ul)" +COMPATIBLE_MACHINE = "(ccimx6qpsbc|ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/awsiotsdk-demo_git.bb b/meta-digi-dey/recipes-digi/dey-examples/awsiotsdk-demo_git.bb index 107243991..80d2c068d 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/awsiotsdk-demo_git.bb +++ b/meta-digi-dey/recipes-digi/dey-examples/awsiotsdk-demo_git.bb @@ -12,6 +12,7 @@ AWS_USER_LED ?= "" AWS_USER_LED_ccimx6ulstarter ?= "75" AWS_USER_LED_ccimx6ulsbc ?= "488" AWS_USER_LED_ccimx6sbc ?= "34" +AWS_USER_LED_ccimx6qpsbc ?= "34" SRCBRANCH = "dey-2.2/maint" SRCREV = "${AUTOREV}" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-bt.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-bt.bb index ed1a49ad6..6b467525e 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-bt.bb +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-bt.bb @@ -1,4 +1,4 @@ -# Copyright (C) 2013,2017 Digi International. +# Copyright (C) 2013-2017, Digi International Inc. SUMMARY = "DEY examples: application to transfer data over bluetooth" SECTION = "examples" @@ -22,4 +22,4 @@ do_install() { install -m 0755 bt_test ${D}${bindir} } -COMPATIBLE_MACHINE = "(ccardimx28|ccimx6$|ccimx6ul)" +COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-btconfig.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-btconfig.bb index f05173b94..f533b8237 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-btconfig.bb +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-btconfig.bb @@ -1,4 +1,4 @@ -# Copyright (C) 2013,2017 Digi International. +# Copyright (C) 2013-2017, Digi International Inc. SUMMARY = "DEY examples: application to perform low level bluetooth" SECTION = "examples" @@ -22,4 +22,4 @@ do_install() { install -m 0755 btconfig ${D}${bindir} } -COMPATIBLE_MACHINE = "(ccardimx28|ccimx6$|ccimx6ul)" +COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-can.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-can.bb index a0cd3eecd..fa793a6c4 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-can.bb +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-can.bb @@ -1,4 +1,4 @@ -# Copyright (C) 2013,2017 Digi International. +# Copyright (C) 2013-2017, Digi International Inc. SUMMARY = "DEY examples: CAN bus test application" SECTION = "examples" @@ -18,4 +18,4 @@ do_install() { install -m 0755 can_test ${D}${bindir} } -COMPATIBLE_MACHINE = "(ccardimx28|ccimx6$|ccimx6ul)" +COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-cryptochip.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-cryptochip.bb index 00b24ac1f..5988605f6 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-cryptochip.bb +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-cryptochip.bb @@ -24,5 +24,5 @@ do_install() { } PACKAGE_ARCH = "${MACHINE_ARCH}" -COMPATIBLE_MACHINE = "(ccimx6ul)" +COMPATIBLE_MACHINE = "(ccimx6qpsbc|ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-digiapix.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-digiapix.bb new file mode 100644 index 000000000..32ae4e863 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-digiapix.bb @@ -0,0 +1,34 @@ +# Copyright (C) 2017, Digi International Inc. + +SUMMARY = "DEY Digi APIX examples" +SECTION = "examples" +LICENSE = "ISC" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/ISC;md5=f3b90e78ea0cffb20bf5cca7947a896d" + +DEPENDS = "libdigiapix" + +SRCBRANCH = "master" +SRCREV = "${AUTOREV}" + +LIBDIGIAPIX_STASH = "${DIGI_MTK_GIT}dey/dey-examples.git;protocol=ssh" +LIBDIGIAPIX_GITHUB = "${DIGI_GITHUB_GIT}/dey-examples.git;protocol=git" + +LIBDIGIAPIX_GIT_URI ?= "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${LIBDIGIAPIX_STASH}', '${LIBDIGIAPIX_GITHUB}', d)}" + +SRC_URI = "${LIBDIGIAPIX_GIT_URI};branch=${SRCBRANCH}" + +S = "${WORKDIR}/git" + +inherit pkgconfig + +EXTRA_OEMAKE += "-f libdigiapix-examples.mk" + +do_compile() { + oe_runmake +} + +do_install() { + oe_runmake DESTDIR=${D} install +} + +COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-hdp.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-hdp.bb index e5642292f..ab52fd51d 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-hdp.bb +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-hdp.bb @@ -1,4 +1,4 @@ -# Copyright (C) 2013 Digi International. +# Copyright (C) 2013-2017, Digi International Inc. SUMMARY = "DEY examples: bluetooth health profile test application" SECTION = "examples" @@ -16,4 +16,4 @@ do_install() { RDEPENDS_${PN} = "python3 python3-argparse python3-crypt python3-dbus python3-pygobject" -COMPATIBLE_MACHINE = "(ccardimx28|ccimx6$|ccimx6ul)" +COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-spidev.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-spidev.bb index 1f2ef985b..1acfd89ed 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-spidev.bb +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-spidev.bb @@ -1,4 +1,4 @@ -# Copyright (C) 2013,2017 Digi International. +# Copyright (C) 2013-2017, Digi International Inc. SUMMARY = "DEY examples: SPI device driver test application" SECTION = "examples" @@ -9,17 +9,6 @@ SRC_URI = "file://spidev_test" S = "${WORKDIR}/spidev_test" -python do_warning_spidev() { - pass -} - -# Warn the user in case we cannot enable spidev in the device tree -python do_warning_spidev_ccardimx28() { - if d.getVar('HAVE_GUI', True): - bb.warn("SPIDEV conflicts with touchscreen so it was not enabled in the device tree") -} -addtask warning_spidev before do_compile - do_compile() { ${CC} -O2 -Wall ${LDFLAGS} spidev_test.c -o spidev_test } diff --git a/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/99-digiapix.rules b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/99-digiapix.rules new file mode 100644 index 000000000..04ec742bb --- /dev/null +++ b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/99-digiapix.rules @@ -0,0 +1,22 @@ +# libdigiapix: configure interfaces so they can be used by group 'digiapix' + +SUBSYSTEM=="i2c-dev", GROUP="digiapix", MODE="0660" +SUBSYSTEM=="spidev", GROUP="digiapix", MODE="0660" + +# +# Use two different rules for GPIO's. +# +# 1. The first rule (gpiochip0) allows to configure the GROUP and MODE of +# the 'export' and 'unexport' files. This is basically executed once on +# boot and it's needed so a normal user (with group 'digiapix') +# is able to export/unexport gpios. +# +# 2. The second rule configures the GROUP and MODE of the sysfs files that +# are created whenever a 'gpio' is exported. +# +# This way we filter out multiple gpiochipX events that we don't want to attend +# +SUBSYSTEM=="gpio", KERNEL=="gpiochip0", ACTION=="add", RUN="/etc/udev/scripts/digiapix.sh" +SUBSYSTEM=="gpio", KERNEL!="gpiochip*", ACTION=="add", RUN="/etc/udev/scripts/digiapix.sh" + +SUBSYSTEM=="pwm", ACTION=="add", RUN="/etc/udev/scripts/digiapix.sh" diff --git a/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx6qpsbc/board.conf b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx6qpsbc/board.conf new file mode 100644 index 000000000..31d0afd0b --- /dev/null +++ b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx6qpsbc/board.conf @@ -0,0 +1,36 @@ +[board] +model = Digi International ConnectCore 6 QuadPlus Single Board Computer. + +[GPIO] + +# USER LED (RED) - GPIO02_IO02 +USER_LED = 34 + +# USER LED (ORANGE) - GPIO02_IO03 +USER_LED_2 = 35 + +# USER LED (GREEN) - GPIO02_IO04 +USER_LED_3 = 36 + +# USER BUTTON - GPIO02_IO05 +USER_BUTTON = 37 + +[I2C] + +# I2C-3 on I2C board connector. +DEFAULT_I2C_BUS = 2 + +[SPI] + +# SPI-1 on SPI board connector. +DEFAULT_SPI = 0,0 + +[PWM] + +# PWM1 on LCD board connector (pin 10). +DEFAULT_PWM = 0,0 + +[ADC] + +# ADC1 on GPIO connector (pin 1). +DEFAULT_ADC = 0,1 diff --git a/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx6sbc/board.conf b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx6sbc/board.conf new file mode 100644 index 000000000..5d726f2e9 --- /dev/null +++ b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx6sbc/board.conf @@ -0,0 +1,36 @@ +[board] +model = Digi International ConnectCore 6 Single Board Computer. + +[GPIO] + +# USER LED (RED) - GPIO02_IO02 +USER_LED = 34 + +# USER LED (ORANGE) - GPIO02_IO03 +USER_LED_2 = 35 + +# USER LED (GREEN) - GPIO02_IO04 +USER_LED_3 = 36 + +# USER BUTTON - GPIO02_IO05 +USER_BUTTON = 37 + +[I2C] + +# I2C-3 on I2C board connector. +DEFAULT_I2C_BUS = 2 + +[SPI] + +# SPI-1 on SPI board connector. +DEFAULT_SPI = 0,0 + +[PWM] + +# PWM1 on LCD board connector (pin 10). +DEFAULT_PWM = 0,0 + +[ADC] + +# ADC1 on GPIO connector (pin 1). +DEFAULT_ADC = 0,1 diff --git a/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx6ulsbc/board.conf b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx6ulsbc/board.conf new file mode 100644 index 000000000..f311343c6 --- /dev/null +++ b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx6ulsbc/board.conf @@ -0,0 +1,30 @@ +[board] +model = Digi International ConnectCore 6UL SBC. + +[GPIO] + +# USER LED - I/O Expander IO23 +USER_LED = 488 + +# USER BUTTON - MCA_IO1 +USER_BUTTON = 505 + +[I2C] + +# I2C-1 on I2C board connector. +DEFAULT_I2C_BUS = 0 + +[SPI] + +# SPI-1 on SPI board connector. +DEFAULT_SPI = 0,0 + +[PWM] + +# PWM4 on GPIO board connector (pin 11). +DEFAULT_PWM = 0,0 + +[ADC] + +# ADC1_IN2 on GPIO board connector (pin 13) +DEFAULT_ADC = 0,2 diff --git a/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx6ulstarter/board.conf b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx6ulstarter/board.conf new file mode 100644 index 000000000..cfce290e0 --- /dev/null +++ b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx6ulstarter/board.conf @@ -0,0 +1,30 @@ +[board] +model = Digi International ConnectCore 6UL Starter Board. + +[GPIO] + +# USER LED - GPIO03_IO11 +USER_LED = 75 + +# USER BUTTON - GPIO03_IO03 +USER_BUTTON = 67 + +[I2C] + +# I2C-2 on Expansion connector. +DEFAULT_I2C_BUS = 1 + +[SPI] + +# SPI-3 on Expansion connector. +DEFAULT_SPI = 2,0 + +[PWM] + +# PWM1 on Expansion connector (pin 27). +DEFAULT_PWM = 0,0 + +[ADC] + +# ADC1_IN4 on Expansion connector (pin 7). +DEFAULT_ADC = 1,4 diff --git a/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/digiapix.sh b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/digiapix.sh new file mode 100644 index 000000000..bc3897c85 --- /dev/null +++ b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/digiapix.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Copyright (c) 2017, Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +if basename "${DEVPATH}" | grep -qs "gpiochip0$"; then + # Use 'gpiochip0' event to set group and mode for 'export/unexport' files + chown root:digiapix /sys/class/gpio/export /sys/class/gpio/unexport + chmod g+w /sys/class/gpio/export /sys/class/gpio/unexport +elif basename "${DEVPATH}" | grep -qs "pwmchip[0-9]\+$"; then + # Set group and mode for pwmchip's 'export/unexport' files + chown root:digiapix /sys${DEVPATH}/export /sys${DEVPATH}/unexport + chmod g+w /sys${DEVPATH}/export /sys${DEVPATH}/unexport +else + # Change group and mode of the sysfs files created whenever a 'gpioX' + # or 'pwmX' is exported + chown -h root:digiapix /sys${DEVPATH}/* + chmod g+w /sys${DEVPATH}/* +fi diff --git a/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix_git.bb b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix_git.bb new file mode 100644 index 000000000..7d67c9075 --- /dev/null +++ b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix_git.bb @@ -0,0 +1,45 @@ +# Copyright (C) 2017 Digi International Inc. + +SUMMARY = "Digi APIX library" +DESCRIPTION = "C library to access and manage your ConnectCore platform interfaces in an easy manner" +SECTION = "libs" +LICENSE = "ISC" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/ISC;md5=f3b90e78ea0cffb20bf5cca7947a896d" + +DEPENDS = "libsoc" + +SRCBRANCH ?= "master" +SRCREV = "${AUTOREV}" + +LIBDIGIAPIX_URI_STASH = "${DIGI_MTK_GIT}dey/libdigiapix.git;protocol=ssh" +LIBDIGIAPIX_URI_GITHUB = "git://github.com/digi-embedded/libdigiapix.git;protocol=git" + +LIBDIGIAPIX_GIT_URI ?= "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${LIBDIGIAPIX_URI_STASH}', '${LIBDIGIAPIX_URI_GITHUB}', d)}" + +SRC_URI = " \ + ${LIBDIGIAPIX_GIT_URI};branch=${SRCBRANCH} \ + file://99-digiapix.rules \ + file://board.conf \ + file://digiapix.sh \ +" + +S = "${WORKDIR}/git" + +inherit pkgconfig useradd + +do_install() { + oe_runmake 'DESTDIR=${D}' install + + # Install udev rules for digiapix + install -d ${D}${sysconfdir}/udev/rules.d ${D}${sysconfdir}/udev/scripts + install -m 0644 ${WORKDIR}/99-digiapix.rules ${D}${sysconfdir}/udev/rules.d/ + install -m 0755 ${WORKDIR}/digiapix.sh ${D}${sysconfdir}/udev/scripts/ + + # Install board config file + install -m 0644 ${WORKDIR}/board.conf ${D}${sysconfdir}/libdigiapix.conf +} + +USERADD_PACKAGES = "${PN}" +GROUPADD_PARAM_${PN} = "-r digiapix" + +PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb b/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb index 77bbc682b..e9c891015 100644 --- a/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb +++ b/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb @@ -1,4 +1,4 @@ -# Copyright (C) 2013-2017 Digi International. +# Copyright (C) 2013-2017, Digi International Inc. SUMMARY = "DEY examples packagegroup" @@ -16,13 +16,6 @@ RDEPENDS_${PN} = "\ dey-examples-watchdog \ " -RDEPENDS_${PN}_append_ccardimx28 = "\ - ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-bt", "", d)} \ - ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-btconfig", "", d)} \ - dey-examples-can \ - ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-hdp", "", d)} \ -" - RDEPENDS_${PN}_append_ccimx6 = "\ awsiotsdk-demo \ ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-bt", "", d)} \ @@ -46,4 +39,4 @@ RDEPENDS_${PN}_append_ccimx6ul = "\ dey-examples-tamper \ " -COMPATIBLE_MACHINE = "(ccardimx28|ccimx6$|ccimx6ul)" +COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/swu-images/files/ccimx6/preinstall_swu.sh b/meta-digi-dey/recipes-digi/swu-images/files/ccimx6/preinstall_swu.sh index 07bca0909..8723cfc11 100644 --- a/meta-digi-dey/recipes-digi/swu-images/files/ccimx6/preinstall_swu.sh +++ b/meta-digi-dey/recipes-digi/swu-images/files/ccimx6/preinstall_swu.sh @@ -72,7 +72,7 @@ if [ -b /dev/mapper/cryptroot ]; then exit 0 fi -rootfs_block="/dev/mmcblk0p$(parted -s /dev/mmcblk0 print | sed -ne "s,^[^0-9]*\([0-9]\+\).*\.*,\1,g;T;p")" +rootfs_block="/dev/mmcblk0p$(fdisk -l /dev/mmcblk0 | sed -ne "s,^[^0-9]*\([0-9]\+\).*\.*,\1,g;T;p")" # Open LUKS encrypted device trustfence-tool ${rootfs_block} cryptroot diff --git a/meta-digi-dey/recipes-digi/swu-images/swu.inc b/meta-digi-dey/recipes-digi/swu-images/swu.inc index d88e78df2..e4024216f 100644 --- a/meta-digi-dey/recipes-digi/swu-images/swu.inc +++ b/meta-digi-dey/recipes-digi/swu-images/swu.inc @@ -32,7 +32,7 @@ ROOTFS_ENC_DEV_ccimx6ul = "${ROOTFS_DEV_NAME}" ROOTFS_DEV_NAME_FINAL = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '${ROOTFS_ENC_DEV}', '${ROOTFS_DEV_NAME}')}" PREINST_SCRIPT_TEMPLATE = "scripts: ( { filename = \\"preinstall_swu.sh\\"; type = \\"preinstall\\"; sha256 = \\"@preinstall_swu.sh\\"; \\x7D );" PREINST_SCRIPT_DESC = "" -PREINST_SCRIPT_DESC_ccimx6sbc = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '${PREINST_SCRIPT_TEMPLATE}', '')}" +PREINST_SCRIPT_DESC_ccimx6 = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '${PREINST_SCRIPT_TEMPLATE}', '')}" PREINST_SCRIPT_DESC_ccimx6ul = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_INITRAMFS_IMAGE', True), '', '${PREINST_SCRIPT_TEMPLATE}')}" python () { diff --git a/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo b/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo index 9d0695a87..f21c798e1 100755 --- a/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo +++ b/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo @@ -266,13 +266,13 @@ BOARD_SN="$(cat /proc/device-tree/digi,hwid,sn)" BOARD_VERSION="$(cat /proc/device-tree/digi,carrierboard,version)" BOARD_ID="$(cat /proc/device-tree/digi,carrierboard,id)" if grep -qs '\' /proc/device-tree/compatible; then - MCA_NODE="/sys/devices/platform/soc/2100000.aips-bus/21a0000.i2c/i2c-0/0-007e" + MCA_NODE="/sys/bus/i2c/devices/0-007e" MCA_HW_VERSION=$(cat ${MCA_NODE}/hw_version) || MCA_HW_VERSION="??" MCA_FW_VERSION=$(cat ${MCA_NODE}/fw_version) || MCA_FW_VERSION="??" MCA_VERSION="HW_VERSION=${MCA_HW_VERSION} FW_VERSION=${MCA_FW_VERSION}" fi -IOEXP_NODE="/sys/devices/platform/soc/2100000.aips-bus/21a0000.i2c/i2c-0/0-006e" +IOEXP_NODE="/sys/bus/i2c/devices/0-006e" if [ -d "$IOEXP_NODE" ]; then IOEXP_HW_VERSION=$(cat ${IOEXP_NODE}/hw_version 2>/dev/null) || IOEXP_HW_VERSION="??" IOEXP_FW_VERSION=$(cat ${IOEXP_NODE}/fw_version 2>/dev/null) || IOEXP_FW_VERSION="??" @@ -297,7 +297,7 @@ printf "\n\n" echo "|| Firmware | ${DISTRO}-${DEY_VERSION}-$(cat /etc/version)" echo "|| Kernel | $(uname -a)" echo "|| meta-digi | $(sed -ne '/^meta-digi-dey/s,.*= \(.*\)$,\1,g;T;p' /etc/build)" - [ -n "${MCA_VERSION}" ] && echo "|| Kinetis | ${MCA_VERSION}" + [ -n "${MCA_VERSION}" ] && echo "|| MCA | ${MCA_VERSION}" [ -n "${IOEXP_VERSION}" ] && echo "|| I/O Expander | ${IOEXP_VERSION}" printf "\n\n" ) | tee ${FILE} diff --git a/meta-digi-dey/recipes-graphics/imx-gpu-g2d/imx-gpu-g2d_6.2.2.p0.bb b/meta-digi-dey/recipes-graphics/imx-gpu-g2d/imx-gpu-g2d_6.2.2.p0.bb new file mode 100644 index 000000000..8be05f93f --- /dev/null +++ b/meta-digi-dey/recipes-graphics/imx-gpu-g2d/imx-gpu-g2d_6.2.2.p0.bb @@ -0,0 +1,36 @@ +# Copyright (C) 2016 Freescale Semiconductor +# Copyright 2017 NXP +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "GPU G2D library and apps for imx6" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://COPYING;md5=08fd295cce89b0a9c74b9b83ed74f671" + +PROVIDES += "virtual/libg2d" + +SRC_URI = "${FSL_MIRROR}/${PN}-${PV}.bin;fsl-eula=true" + +S="${WORKDIR}/${PN}-${PV}" + +inherit fsl-eula-unpack + +SRC_URI[md5sum] = "64720dda9b96fd7af5be7e2c654ab72a" +SRC_URI[sha256sum] = "070a95aa9942bd67e8ba4012962df74143bffb9998301ac097dab5e1437000d8" + +do_install () { + + install -d ${D}${libdir} + install -d ${D}${includedir} + + cp ${S}/g2d/usr/lib/*.so* ${D}${libdir} + cp -Pr ${S}/g2d/usr/include/* ${D}${includedir} + cp -r ${S}/gpu-demos/opt ${D} +} + +RDEPENDS_${PN} = "libgal-imx" + +FILES_${PN} = "${libdir}/libg2d* /opt" +FILES_${PN}-dev = "${includedir}" +INSANE_SKIP_${PN} = "ldflags" + +COMPATIBLE_MACHINE = "(mx6|mx7ulp)" diff --git a/meta-digi-dey/recipes-graphics/imx-gpu-viv/imx-gpu-viv-v6.inc b/meta-digi-dey/recipes-graphics/imx-gpu-viv/imx-gpu-viv-v6.inc new file mode 100644 index 000000000..d7716601d --- /dev/null +++ b/meta-digi-dey/recipes-graphics/imx-gpu-viv/imx-gpu-viv-v6.inc @@ -0,0 +1,327 @@ +# Copyright (C) 2012-2016 Freescale Semiconductor +# Copyright (C) 2012-2016 O.S. Systems Software LTDA. +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "GPU driver and apps for imx" +SECTION = "libs" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://COPYING;md5=08fd295cce89b0a9c74b9b83ed74f671" + +DEPENDS += " \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', \ + bb.utils.contains('DISTRO_FEATURES', 'x11', 'virtual/libx11 libxdamage libxext libxfixes', \ + '', d), d)} \ +" +DEPENDS += "libdrm" + +# imx-gpu-viv does not provide everything it needs to for virtual/libgl +# on x11 backend or on Wayland backend with XWayland support. +# We depend on mesa to fill in what is missing. +DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'mesa', '', d)}" + +EXTRA_PROVIDES = "" +EXTRA_PROVIDES_append_imxgpu3d = " virtual/libgl virtual/libgles1 virtual/libgles2" +EXTRA_PROVIDES_append_mx6q = " virtual/opencl-icd opencl-headers" +EXTRA_PROVIDES_append_mx8 = " virtual/opencl-icd opencl-headers virtual/libopenvx" +PROVIDES += "imx-gpu-viv virtual/wayland-egl virtual/libgal-x11 virtual/egl virtual/libopenvg ${EXTRA_PROVIDES}" + +RPROVIDES_${PN}_imxgpu3d += "imx-gpu-viv" + +PE = "1" + +inherit fsl-eula-unpack + +SRC_URI = "${FSL_MIRROR}/${PN}-${PV}.bin;fsl-eula=true" + +# Note : If you add a package here, to prevent a naming conflict see the python_anonymous() futher below +PACKAGES =+ "libclc-imx libclc-imx-dev \ + libgl-imx libgl-imx-dev \ + libgles-imx libgles-imx-dev \ + libgles2-imx libgles2-imx-dev \ + libgles3-imx-dev \ + libglslc-imx libglslc-imx-dev \ + libopencl-imx libopencl-imx-dev \ + libopenvg-imx libopenvg-imx-dev \ + libvdk-imx libvdk-imx-dev \ + libegl-imx libegl-imx-dev \ + libgal-imx libgal-imx-dev \ + libvivante-dri-imx \ + libvsc-imx \ + libgbm-imx libgbm-imx-dev \ + libwayland-viv-imx libwayland-viv-imx-dev \ + libgc-wayland-protocol-imx libgc-wayland-protocol-imx-dev \ + libwayland-egl-imx-dev \ + imx-gpu-viv-tools \ + imx-gpu-viv-demos \ + libvulkan-imx libvulkan-imx-dev \ + libopenvx-imx libopenvx-imx-dev \ +" +python __anonymous () { + has_vivante_kernel_driver_support = (d.getVar('MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT', True) or '0') + if has_vivante_kernel_driver_support != '1': + raise bb.parse.SkipPackage('The kernel of machine needs to have Vivante kernel driver support for this recipe to be used.') +} + +USE_X11 = "${@bb.utils.contains("DISTRO_FEATURES", "x11", "yes", "no", d)}" +USE_WL = "${@bb.utils.contains("DISTRO_FEATURES", "wayland", "yes", "no", d)}" + +# Inhibit warnings about files being stripped. +INHIBIT_PACKAGE_STRIP = "1" +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" + +# FIXME: The provided binary doesn't provide soname. If in future BSP +# release the libraries are fixed, we can drop this hack. +REALSOLIBS := "${SOLIBS}" +SOLIBS = "${SOLIBSDEV}" + +# For the packages that make up the OpenGL interfaces, inject variables so that +# they don't get Debian-renamed (which would remove the -imx suffix). +# +# FIXME: All binaries lack GNU_HASH in elf binary but as we don't have +# the source we cannot fix it. Disable the insane check for now. +python __anonymous() { + packages = d.getVar('PACKAGES', True).split() + for p in packages: + d.appendVar("INSANE_SKIP_%s" % p, " ldflags") + + for p in (("libegl", "libegl1"), ("libgl", "libgl1"), + ("libgles1", "libglesv1-cm1"), ("libgles2", "libglesv2-2"), + ("libgles3",) , ("libvulkan",)): + fullp = p[0] + "-imx" + pkgs = " ".join(p) + d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1") + d.appendVar("RREPLACES_" + fullp, pkgs) + d.appendVar("RPROVIDES_" + fullp, pkgs) + d.appendVar("RCONFLICTS_" + fullp, pkgs) + + # For -dev, the first element is both the Debian and original name + fullp += "-dev" + pkgs = p[0] + "-dev" + d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1") + d.appendVar("RREPLACES_" + fullp, pkgs) + d.appendVar("RPROVIDES_" + fullp, pkgs) + d.appendVar("RCONFLICTS_" + fullp, pkgs) +} + +IS_MX6SL = "0" +IS_MX6SL_mx6sl = "1" + +IS_MX8 = "0" +IS_MX8_mx8 = "1" + +do_install () { + install -d ${D}${libdir} + install -d ${D}${includedir} + install -d ${D}${bindir} + + cp -P ${S}/gpu-core/usr/lib/*.so* ${D}${libdir} + cp -r ${S}/gpu-core/usr/include/* ${D}${includedir} + cp -r ${S}/gpu-demos/opt ${D} + cp -r ${S}/gpu-tools/gmem-info/usr/bin/* ${D}${bindir} + + + install -d ${D}${libdir}/pkgconfig + + # The preference order, based in DISTRO_FEATURES, is Wayland (with or without X11), X11 and fb + if [ "${USE_WL}" = "yes" ]; then + + backend=wl + + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/egl_wayland.pc ${D}${libdir}/pkgconfig/egl.pc + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/glesv1_cm.pc ${D}${libdir}/pkgconfig/glesv1_cm.pc + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/glesv2.pc ${D}${libdir}/pkgconfig/glesv2.pc + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/vg.pc ${D}${libdir}/pkgconfig/vg.pc + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/gc_wayland_protocol.pc ${D}${libdir}/pkgconfig/gc_wayland_protocol.pc + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/wayland-egl.pc ${D}${libdir}/pkgconfig/wayland-egl.pc + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/wayland-viv.pc ${D}${libdir}/pkgconfig/wayland-viv.pc + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/gbm.pc ${D}${libdir}/pkgconfig/gbm.pc + + if [ "${USE_X11}" = "yes" ]; then + + cp -r ${S}/gpu-core/usr/lib/dri ${D}${libdir} + + fi + + elif [ "${USE_X11}" = "yes" ]; then + + cp -r ${S}/gpu-core/usr/lib/dri ${D}${libdir} + + backend=x11 + + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/gl_x11.pc ${D}${libdir}/pkgconfig/gl.pc + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/egl_x11.pc ${D}${libdir}/pkgconfig/egl.pc + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/glesv1_cm_x11.pc ${D}${libdir}/pkgconfig/glesv1_cm.pc + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/glesv2_x11.pc ${D}${libdir}/pkgconfig/glesv2.pc + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/vg_x11.pc ${D}${libdir}/pkgconfig/vg.pc + + else + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/glesv1_cm.pc ${D}${libdir}/pkgconfig/glesv1_cm.pc + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/glesv2.pc ${D}${libdir}/pkgconfig/glesv2.pc + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/vg.pc ${D}${libdir}/pkgconfig/vg.pc + + # Regular framebuffer + install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/egl_linuxfb.pc ${D}${libdir}/pkgconfig/egl.pc + + backend=fb + + fi + + # Install Vendor ICDs for OpenCL's installable client driver loader (ICDs Loader) + install -d ${D}${sysconfdir}/OpenCL/vendors/ + install -m 0644 ${S}/gpu-core/etc/Vivante.icd ${D}${sysconfdir}/OpenCL/vendors/Vivante.icd + + # We'll only have one backend here so we rename it to generic name + # and avoid rework in other packages, when possible + mv ${D}${libdir}/libGL.so.1.2 ${D}${libdir}/libGL.so.1.2.0 + ln -sf libGL.so.1.2.0 ${D}${libdir}/libGL.so.1.2 + ln -sf libGL.so.1.2.0 ${D}${libdir}/libGL.so.1 + ln -sf libGL.so.1.2.0 ${D}${libdir}/libGL.so + mv ${D}${libdir}/libEGL-${backend}.so ${D}${libdir}/libEGL.so.1.0 + ln -sf libEGL.so.1.0 ${D}${libdir}/libEGL.so.1 + ln -sf libEGL.so.1.0 ${D}${libdir}/libEGL.so + mv ${D}${libdir}/libGAL-${backend}.so ${D}${libdir}/libGAL.so + mv ${D}${libdir}/libVDK-${backend}.so ${D}${libdir}/libVDK.so + + # update libglesv2 as backend dependent + rm -rf ${D}${libdir}/libGLESv2* + cp ${S}/gpu-core/usr/lib/libGLESv2-${backend}.so ${D}${libdir}/libGLESv2.so.2.0.0 + ln -sf libGLESv2.so.2.0.0 ${D}${libdir}/libGLESv2.so.2 + ln -sf libGLESv2.so.2.0.0 ${D}${libdir}/libGLESv2.so + + if [ "${IS_MX8}" = "1" ]; then + # Install the vulkan driver in a sub-folder. When installed in the same + # folder as the vulkan loader layer library, an incorrect linkage is + # created from libvulkan.so.1 to our library instead of the loader + # layer library. + install -d ${D}${libdir}/vulkan + mv ${D}${libdir}/libvulkan-${backend}.so ${D}${libdir}/vulkan/libvulkan_VSI.so + fi + + # skip packaging wayland libraries if no support is requested + if [ "${USE_WL}" = "no" ]; then + rm ${D}${libdir}/libgc_wayland_protocol.* + rm ${D}${libdir}/libwayland-viv.* + fi + + for i in wl x11 fb dri; do + find ${D}${libdir} -name "*-$i.so" -exec rm '{}' ';' + find ${D}${libdir} -name "*.$i.so" -exec rm '{}' ';' + done + + # FIXME: MX6SL does not have 3D support; hack it for now + if [ "${IS_MX6SL}" = "1" ]; then + rm -rf ${D}${libdir}/libCLC* ${D}${includedir}/CL \ + \ + ${D}${libdir}/libGL* ${D}${includedir}/GL* ${D}${libdir}/pkgconfig/gl.pc \ + \ + ${D}${libdir}/libGLES* ${D}${libdir}/pkgconfig/gles*.pc \ + \ + ${D}${libdir}/libOpenCL* ${D}${includedir}/CL \ + \ + ${D}${libdir}/libOpenVG.3d.so \ + \ + ${D}${libdir}/libVivanteOpenCL.so \ + \ + ${D}/opt/viv_samples/vdk \ + ${D}/opt/viv_samples/es20 ${D}/opt/viv_samples/cl11 + + ln -sf libOpenVG.2d.so ${D}${libdir}/libOpenVG.so + fi + + find ${D}${libdir} -type f -exec chmod 644 {} \; + find ${D}${includedir} -type f -exec chmod 644 {} \; + + chown -R root:root "${D}" +} + +ALLOW_EMPTY_${PN} = "1" + +# FIXME: Remove the following lines after adding libopenvx package +INSANE_SKIP_imx-gpu-viv-dev += "dev-elf" +INSANE_SKIP_libclc-imx += "dev-deps" + +FILES_libclc-imx = "${libdir}/libCLC${SOLIBS}" +FILES_libclc-imx-dev = "${includedir}/CL ${libdir}/libCLC${SOLIBSDEV}" + +# libEGL.so is used by some demo apps from Freescale +INSANE_SKIP_libegl-imx += "dev-so" +FILES_libegl-imx = "${libdir}/libEGL${REALSOLIBS} ${libdir}/libEGL${SOLIBSDEV} " +FILES_libegl-imx-dev = "${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc" +RDEPENDS_libegl-imx += "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'libgc-wayland-protocol-imx libwayland-viv-imx libgc-wayland-protocol-imx', '', d)}" +RDEPENDS_libegl-imx-dev += "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'libwayland-egl-imx-dev', '', d)}" + +FILES_libgal-imx = "${libdir}/libGAL${SOLIBS} ${libdir}/libGAL_egl${SOLIBS}" +FILES_libgal-imx-dev = "${libdir}/libGAL${SOLIBSDEV} ${includedir}/HAL" +RDEPENDS_libgal-imx += "kernel-module-imx-gpu-viv" +RPROVIDES_libgal-imx += "libgal-imx" +INSANE_SKIP_libgal-imx += "build-deps" + +FILES_libvsc-imx = "${libdir}/libVSC${SOLIBS}" + +FILES_libgbm-imx = "${libdir}/libgbm${SOLIBS} ${libdir}/gbm_viv${SOLIBS}" +FILES_libgbm-imx-dev = "${libdir}/pkgconfig/gbm.pc ${includedir}/gbm.h ${libdir}/libgbm${SOLIBSDEV}" +RDEPENDS_libgbm-imx += "libdrm" + +FILES_libvulkan-imx = "${libdir}/vulkan/libvulkan_VSI${SOLIBS}" +FILES_libvulkan-imx-dev = "${includedir}/vulkan ${libdir}/vulkan/libvulkan_VSI${SOLIBSDEV}" +INSANE_SKIP_libvulkan-imx += "dev-deps dev-so" + +FILES_libopenvx-imx = "${libdir}/libOpenVX${SOLIBS} ${libdir}/libOpenVXC${SOLIBS} ${libdir}/libOpenVXU${SOLIBS}" +FILES_libopenvx-imx-dev = "${includedir}/VX ${libdir}/libopenVX${SOLIBSDEV}" + +FILES_libgl-imx = "${libdir}/libGL${REALSOLIBS}" +FILES_libgl-imx-dev = "${libdir}/libGL${SOLIBSDEV} ${includedir}/GL" +# Includes GL headers from mesa +RDEPENDS_libgl-imx-dev += "libgl-mesa-dev" + +# libEGL needs to open libGLESv1.so +INSANE_SKIP_libgles-imx += "dev-so" +FILES_libgles-imx = "${libdir}/libGLESv1*${REALSOLIBS} ${libdir}/libGLESv1*${SOLIBS} ${libdir}/libGLES_*${REALSOLIBS} ${libdir}/libGLES_*${SOLIBS}" +FILES_libgles-imx-dev = "${includedir}/GLES ${libdir}/libGLESv1*${SOLIBS} ${libdir}/libGLES_*${SOLIBSDEV} ${libdir}/pkgconfig/glesv1_cm.pc" + +# libEGL needs to open libGLESv2.so +INSANE_SKIP_libgles2-imx += "dev-so" +FILES_libgles2-imx = "${libdir}/libGLESv2${REALSOLIBS} ${libdir}/libGLESv2${SOLIBS}" +FILES_libgles2-imx-dev = "${includedir}/GLES2 ${libdir}/libGLESv2${SOLIBSDEV} ${libdir}/pkgconfig/glesv2.pc" +RDEPENDS_libgles2-imx = "libglslc-imx" + +FILES_libgles3-imx-dev = "${includedir}/GLES3" +# as long as there is no libgles3: ship libgles3-dev along with +# libgles2-dev - otherwise GLES3 headers have to be added manually +RDEPENDS_libgles2-imx-dev += "libgles3-imx-dev" + +FILES_libglslc-imx = "${libdir}/libGLSLC${SOLIBS}" +FILES_libglslc-imx-dev = "${includedir}/CL ${libdir}/libGLSLC${SOLIBSDEV}" + +FILES_libopencl-imx = "${libdir}/libOpenCL${SOLIBS} \ + ${libdir}/libVivanteOpenCL${SOLIBS} \ + ${sysconfdir}/OpenCL/vendors/Vivante.icd" +FILES_libopencl-imx-dev = "${includedir}/CL ${libdir}/libOpenCL${SOLIBSDEV}" +RDEPENDS_libopencl-imx= "libclc-imx" + +INSANE_SKIP_libopenvg-imx += "dev-so" +FILES_libopenvg-imx = "${libdir}/libOpenVG*${SOLIBS}" +FILES_libopenvg-imx-dev = "${includedir}/VG ${libdir}/libOpenVG*${SOLIBSDEV} ${libdir}/pkgconfig/vg.pc" +RDEPENDS_libopenvg-imx += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-gpuconfig', '', d)}" + +FILES_libvdk-imx = "${libdir}/libVDK${SOLIBS}" +FILES_libvdk-imx-dev = "${includedir}/*vdk*.h ${libdir}/libVDK${SOLIBSDEV}" + +FILES_libvivante-dri-imx = "${libdir}/dri/vivante_dri.so" +RDEPENDS_libvivante-dri-imx = "libdrm" + +INSANE_SKIP_libwayland-viv-imx += "dev-so" +FILES_libwayland-viv-imx = "${libdir}/libwayland-viv${REALSOLIBS} ${libdir}/libwayland-viv${SOLIBS}" +FILES_libwayland-viv-imx-dev = "${includedir}/wayland-viv ${libdir})/libwayland-viv${SOLIBSDEV} ${libdir}/pkgconfig/wayland-viv.pc" +RPROVIDES_libwayland-viv-imx += "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'xf86-video-imxfb-vivante', '', d)}" + +INSANE_SKIP_libgc-wayland-protocol-imx += "dev-so" +FILES_libgc-wayland-protocol-imx = "${libdir}/libgc_wayland_protocol${REALSOLIBS} ${libdir}/libgc_wayland_protocol${SOLIBS}" +FILES_libgc-wayland-protocol-imx-dev = "${libdir}/libgc_wayland_protocol${SOLIBSDEV} ${libdir}/pkgconfig/gc_wayland_protocol.pc" + +FILES_libwayland-egl-imx-dev = "${libdir}/pkgconfig/wayland-egl.pc" + +FILES_imx-gpu-viv-tools = "${bindir}/gmem_info" + +FILES_imx-gpu-viv-demos = "/opt" +INSANE_SKIP_imx-gpu-viv-demos += "rpaths dev-deps" diff --git a/meta-digi-dey/recipes-graphics/imx-gpu-viv/imx-gpu-viv_6.2.2.p0-aarch32.bb b/meta-digi-dey/recipes-graphics/imx-gpu-viv/imx-gpu-viv_6.2.2.p0-aarch32.bb new file mode 100644 index 000000000..c48216ab5 --- /dev/null +++ b/meta-digi-dey/recipes-graphics/imx-gpu-viv/imx-gpu-viv_6.2.2.p0-aarch32.bb @@ -0,0 +1,16 @@ +# Copyright (C) 2013-2016 Freescale Semiconductor +# Copyright 2017 NXP +# Released under the MIT license (see COPYING.MIT for the terms) + +require recipes-graphics/imx-gpu-viv/imx-gpu-viv-v6.inc + +SRC_URI = "${FSL_MIRROR}/${PN}-${PV}.bin;fsl-eula=true" + +S="${WORKDIR}/${PN}-${PV}" + +SRC_URI[md5sum] = "7d43f73b8bc0c1c442587f819218a1d5" +SRC_URI[sha256sum] = "4f93a4412c93ca5959aa2437bfed2ecbaf983b5b272be5977f76a967de5db150" + +PACKAGE_FP_TYPE = "hardfp" + +COMPATIBLE_MACHINE = "(mx6q|mx6dl|mx6sx|mx6sl|mx7ulp)" diff --git a/meta-digi-dey/recipes-graphics/mesa/mesa_%.bbappend b/meta-digi-dey/recipes-graphics/mesa/mesa_%.bbappend index d9020a0e6..a244fe9a4 100644 --- a/meta-digi-dey/recipes-graphics/mesa/mesa_%.bbappend +++ b/meta-digi-dey/recipes-graphics/mesa/mesa_%.bbappend @@ -4,3 +4,23 @@ # Add runtime dependency so that GLES3 headers don't need to be added manually # RDEPENDS_libgles2-mesa-dev += "libgles3-mesa-dev" + +# +# Add platform dependency to maintain compatibility +# with GPU driver previous to v6. +# +PROVIDES_remove_ccimx6qpsbc = "gbm" +PACKAGECONFIG_remove_ccimx6qpsbc = "gbm" + +BACKEND = \ + "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', \ + bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', \ + 'fb', d), d)}" + +do_install_append_ccimx6qpsbc () { + rm -f ${D}${includedir}/GL/glx.h \ + ${D}${includedir}/GL/glxext.h + if [ "${BACKEND}" = "x11" ]; then + rm -f ${D}${libdir}/pkgconfig/gl.pc + fi +} diff --git a/meta-digi-dey/recipes-graphics/xinput-calibrator/pointercal-xinput/ccardimx28/pointercal.xinput b/meta-digi-dey/recipes-graphics/xinput-calibrator/pointercal-xinput/ccardimx28/pointercal.xinput deleted file mode 100644 index d6d9582ac..000000000 --- a/meta-digi-dey/recipes-graphics/xinput-calibrator/pointercal-xinput/ccardimx28/pointercal.xinput +++ /dev/null @@ -1,2 +0,0 @@ -xinput set-int-prop "mxs-lradc" "Evdev Axis Calibration" 32 4200 269 4020 250 -xinput set-int-prop "mxs-lradc" "Evdev Axes Swap" 8 1 diff --git a/meta-digi-dey/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/Stop-using-Git-to-write-local-version.patch b/meta-digi-dey/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/Stop-using-Git-to-write-local-version.patch new file mode 100644 index 000000000..f541e5c17 --- /dev/null +++ b/meta-digi-dey/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/Stop-using-Git-to-write-local-version.patch @@ -0,0 +1,87 @@ +From 69a92f4576a1e789ba2fcf957164d2c4013020c5 Mon Sep 17 00:00:00 2001 +From: Otavio Salvador +Date: Wed, 2 Dec 2015 13:36:25 +0000 +Subject: [PATCH] Stop using Git to write local version +Organization: O.S. Systems Software LTDA. + +The standard version does not use a Git repository so we should not +use Git to identify the commit of the build as it can end getting the +version from a wrong repository and can be misleading. + +Upstream-Status: Pending + +Signed-off-by: Otavio Salvador +--- + EXA/src/makefile.tc | 6 +++--- + FslExt/src/makefile.tc | 6 +++--- + util/autohdmi/makefile.tc | 6 +++--- + util/pandisplay/makefile.tc | 6 +++--- + 4 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/EXA/src/makefile.tc b/EXA/src/makefile.tc +index 0b9a9e6..ec6e68d 100644 +--- a/EXA/src/makefile.tc ++++ b/EXA/src/makefile.tc +@@ -52,8 +52,8 @@ prefix ?= /usr + sysroot ?= / + + # get git commit number +-COMMITNR := `git log -n 1 --format=%H` +-DIRTY := `git diff-index --quiet HEAD || echo '-dirty'` +-LOCAL_CFLAGS += -DCOMMIT="${COMMITNR}${DIRTY}" ++#COMMITNR := `git log -n 1 --format=%H` ++#DIRTY := `git diff-index --quiet HEAD || echo '-dirty'` ++#LOCAL_CFLAGS += -DCOMMIT="${COMMITNR}${DIRTY}" + + +diff --git a/FslExt/src/makefile.tc b/FslExt/src/makefile.tc +index 0b9a9e6..ec6e68d 100644 +--- a/FslExt/src/makefile.tc ++++ b/FslExt/src/makefile.tc +@@ -52,8 +52,8 @@ prefix ?= /usr + sysroot ?= / + + # get git commit number +-COMMITNR := `git log -n 1 --format=%H` +-DIRTY := `git diff-index --quiet HEAD || echo '-dirty'` +-LOCAL_CFLAGS += -DCOMMIT="${COMMITNR}${DIRTY}" ++#COMMITNR := `git log -n 1 --format=%H` ++#DIRTY := `git diff-index --quiet HEAD || echo '-dirty'` ++#LOCAL_CFLAGS += -DCOMMIT="${COMMITNR}${DIRTY}" + + +diff --git a/util/autohdmi/makefile.tc b/util/autohdmi/makefile.tc +index c9de0a6..d0a468c 100644 +--- a/util/autohdmi/makefile.tc ++++ b/util/autohdmi/makefile.tc +@@ -64,8 +64,8 @@ prefix ?= /usr + sysroot ?= / + + # get git commit number +-COMMITNR := `git log -n 1 --format=%H` +-DIRTY := `git diff-index --quiet HEAD || echo '-dirty'` +-LOCAL_CFLAGS += -DCOMMIT="${COMMITNR}${DIRTY}" ++#COMMITNR := `git log -n 1 --format=%H` ++#DIRTY := `git diff-index --quiet HEAD || echo '-dirty'` ++#LOCAL_CFLAGS += -DCOMMIT="${COMMITNR}${DIRTY}" + + +diff --git a/util/pandisplay/makefile.tc b/util/pandisplay/makefile.tc +index 28732b9..bf54c20 100644 +--- a/util/pandisplay/makefile.tc ++++ b/util/pandisplay/makefile.tc +@@ -64,8 +64,8 @@ prefix ?= /usr + sysroot ?= / + + # get git commit number +-COMMITNR := `git log -n 1 --format=%H` +-DIRTY := `git diff-index --quiet HEAD || echo '-dirty'` +-LOCAL_CFLAGS += -DCOMMIT="${COMMITNR}${DIRTY}" ++#COMMITNR := `git log -n 1 --format=%H` ++#DIRTY := `git diff-index --quiet HEAD || echo '-dirty'` ++#LOCAL_CFLAGS += -DCOMMIT="${COMMITNR}${DIRTY}" + + +-- +2.1.4 + diff --git a/meta-digi-dey/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/rc.autohdmi b/meta-digi-dey/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/rc.autohdmi new file mode 100644 index 000000000..8c16a1d7f --- /dev/null +++ b/meta-digi-dey/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/rc.autohdmi @@ -0,0 +1,42 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: rc.autohdmi +# Required-Start: $all +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: +### END INIT INFO + +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +# Source function library. +. /etc/init.d/functions + +case "$1" in + start) + echo -n "Starting autohdmi: " + export DISPLAY=:0 + autohdmi & + echo + exit 0 + ;; + reload|force-reload) + echo "Error: argument '$1' not supported" >&2 + exit 3 + ;; + stop) + echo -n "Shutting down autohdmi: " + killproc autohdmi + echo + ;; + restart) + echo -n "Restarting autohdmi: " + $0 stop + $0 start + echo + ;; + *) + echo "Usage: $0 start|stop" >&2 + exit 3 + ;; +esac diff --git a/meta-digi-dey/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_6.2.2.p0.bb b/meta-digi-dey/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_6.2.2.p0.bb new file mode 100644 index 000000000..3768064a3 --- /dev/null +++ b/meta-digi-dey/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_6.2.2.p0.bb @@ -0,0 +1,24 @@ +# Copyright (C) 2012-2016 Freescale Semiconductor +# Copyright (C) 2012-2014 O.S. Systems Software LTDA. +# Copyright 2017 NXP +# Released under the MIT license (see COPYING.MIT for the terms) + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +require recipes-graphics/xorg-driver/xf86-video-imxfb-vivante.inc + +NXP_REPO_MIRROR ?= "nxp/" +SRCBRANCH = "${NXP_REPO_MIRROR}imx_4.9.11_1.0.0_ga" +S = "${WORKDIR}/git/" +XF86_VIDEO_IMX_VIVANTE_SRC ?= "git://source.codeaurora.org/external/imx/xf86-video-imx-vivante.git;protocol=https" +SRC_URI = "${XF86_VIDEO_IMX_VIVANTE_SRC};branch=${SRCBRANCH}" +SRC_URI +="file://rc.autohdmi" +SRCREV = "07ef065dfe09f1c05a1a188c371577faa3677a17" + +DEPENDS += "virtual/libg2d" + +RDEPENDS_${PN}_remove = "libvivante-dri-mx6" + +RDEPENDS_${PN}_append = " libvivante-dri-imx" + +COMPATIBLE_MACHINE = "(mx6|mx8|mx7ulp)" diff --git a/meta-digi-dey/recipes-multimedia/imx-codec/imx-codec_4.1.4.bbappend b/meta-digi-dey/recipes-multimedia/imx-codec/imx-codec_4.1.4.bbappend new file mode 100644 index 000000000..4438d9cfd --- /dev/null +++ b/meta-digi-dey/recipes-multimedia/imx-codec/imx-codec_4.1.4.bbappend @@ -0,0 +1,31 @@ +# Copyright (C) 2017 Digi International Inc. + +# Empirically detected binaries that are not needed for a given platform +REDUNDANT_BINS ?= "" +REDUNDANT_BINS_ccimx6ul ?= " \ + usr/lib/imx-mm/audio-codec/wrap/lib_aacd_wrap_arm11_elinux.so* \ + usr/lib/imx-mm/audio-codec/wrap/lib_aacd_wrap_arm9_elinux.so* \ + usr/lib/imx-mm/audio-codec/wrap/lib_mp3d_wrap_arm11_elinux.so* \ + usr/lib/imx-mm/audio-codec/wrap/lib_mp3d_wrap_arm9_elinux.so* \ + usr/lib/imx-mm/audio-codec/wrap/lib_nbamrd_wrap_arm9_elinux.so* \ + usr/lib/imx-mm/audio-codec/wrap/lib_vorbisd_wrap_arm11_elinux.so* \ + usr/lib/imx-mm/audio-codec/wrap/lib_wbamrd_wrap_arm9_elinux.so* \ + usr/lib/lib_aac_dec_arm11_elinux.so* \ + usr/lib/lib_aac_dec_arm9_elinux.so* \ + usr/lib/lib_mp3_dec_arm11_elinux.so* \ + usr/lib/lib_mp3_dec_arm9_elinux.so* \ + usr/lib/lib_mp3_enc_arm11_elinux.so* \ + usr/lib/lib_mp3_enc_arm9_elinux.so* \ + usr/share/imx-mm/audio-codec/examples/aac-dec/bin/test_aac_dec_arm11_elinux* \ + usr/share/imx-mm/audio-codec/examples/aac-dec/bin/test_aac_dec_arm9_elinux* \ + usr/share/imx-mm/audio-codec/examples/mp3-dec/bin/test_mp3_dec_arm11_elinux* \ + usr/share/imx-mm/audio-codec/examples/mp3-dec/bin/test_mp3_dec_arm9_elinux* \ + usr/share/imx-mm/audio-codec/examples/mp3-enc/bin/test_mp3_enc_arm11_elinux* \ + usr/share/imx-mm/audio-codec/examples/mp3-enc/bin/test_mp3_enc_arm9_elinux* \ +" + +do_install_append() { + for i in ${REDUNDANT_BINS}; do + rm -f ${D}/${i} + done +} diff --git a/meta-digi-dey/recipes-multimedia/imx-codec/imx-codec_4.2.1.bb b/meta-digi-dey/recipes-multimedia/imx-codec/imx-codec_4.2.1.bb new file mode 100644 index 000000000..6076ee964 --- /dev/null +++ b/meta-digi-dey/recipes-multimedia/imx-codec/imx-codec_4.2.1.bb @@ -0,0 +1,11 @@ +# Copyright (C) 2013-2016 Freescale Semiconductor +# Copyright 2017 NXP +# Released under the MIT license (see COPYING.MIT for the terms) + +require recipes-multimedia/imx-codec/imx-codec.inc +LIC_FILES_CHKSUM = "file://COPYING;md5=6b552f505eedab4a11ab538cf3db743a" + +SRC_URI[md5sum] = "3db67e3f602e65fe0ac00ae4f9ea6109" +SRC_URI[sha256sum] = "20d3f9b4187fcd9e7007c94558a00bab1191513eee74b6f0d8c7b43f874e06ed" + +COMPATIBLE_MACHINE = "(ccimx6qpsbc)" diff --git a/meta-digi-dey/recipes-multimedia/imx-parser/imx-parser_4.1.4.bbappend b/meta-digi-dey/recipes-multimedia/imx-parser/imx-parser_4.1.4.bbappend new file mode 100644 index 000000000..e8363a7e8 --- /dev/null +++ b/meta-digi-dey/recipes-multimedia/imx-parser/imx-parser_4.1.4.bbappend @@ -0,0 +1,18 @@ +# Copyright (C) 2017 Digi International Inc. + +# Empirically detected binaries that are not needed for a given platform +REDUNDANT_BINS ?= "" +REDUNDANT_BINS_ccimx6ul ?= " \ + usr/lib/imx-mm/parser/lib_avi_parser_arm9_elinux* \ + usr/lib/imx-mm/parser/lib_flv_parser_arm9_elinux* \ + usr/lib/imx-mm/parser/lib_mkv_parser_arm9_elinux* \ + usr/lib/imx-mm/parser/lib_mp4_parser_arm9_elinux* \ + usr/lib/imx-mm/parser/lib_mpg2_parser_arm9_elinux* \ + usr/lib/imx-mm/parser/lib_ogg_parser_arm9_elinux* \ +" + +do_install_append() { + for i in ${REDUNDANT_BINS}; do + rm -f ${D}/${i} + done +} diff --git a/meta-digi-dey/recipes-multimedia/imx-parser/imx-parser_4.2.1.bb b/meta-digi-dey/recipes-multimedia/imx-parser/imx-parser_4.2.1.bb new file mode 100644 index 000000000..dcac23417 --- /dev/null +++ b/meta-digi-dey/recipes-multimedia/imx-parser/imx-parser_4.2.1.bb @@ -0,0 +1,11 @@ +# Copyright (C) 2013-2016 Freescale Semiconductor +# Copyright 2017 NXP +# Released under the MIT license (see COPYING.MIT for the terms) + +include recipes-multimedia/imx-parser/imx-parser.inc +LIC_FILES_CHKSUM = "file://COPYING;md5=6b552f505eedab4a11ab538cf3db743a" + +SRC_URI[md5sum] = "6717799abce0dc5918db8d3fd0e39184" +SRC_URI[sha256sum] = "36d3ae7285f3a83a87abf680b8a52b3c07df869d2443de844fb5f0ff528ca862" + +COMPATIBLE_MACHINE = "(ccimx6qpsbc)" diff --git a/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-audio.bb b/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-audio.bb index 1f5ece5d1..9ea584779 100644 --- a/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-audio.bb +++ b/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-audio.bb @@ -1,5 +1,5 @@ # -# Copyright (C) 2012 Digi International. +# Copyright (C) 2012-2017 Digi International. # SUMMARY = "Audio packagegroup for DEY image" @@ -21,4 +21,4 @@ RDEPENDS_${PN} = "\ ${ALSA_UTILS_PKGS} \ " -RDEPENDS_${PN}_append_ccimx6sbc = " card-detect" +RDEPENDS_${PN}_append_ccimx6 = " card-detect" diff --git a/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-gstreamer.bb b/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-gstreamer.bb index 85d4803f6..a51f3e079 100644 --- a/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-gstreamer.bb +++ b/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-gstreamer.bb @@ -1,11 +1,34 @@ # -# Copyright (C) 2012 Digi International. +# Copyright (C) 2012-2017 Digi International Inc. # SUMMARY = "Gstreamer framework packagegroup for DEY image" PACKAGE_ARCH = "${MACHINE_ARCH}" inherit packagegroup +# Per machine gstreamer base packages +MACHINE_GSTREAMER_1_0_PKGS = " \ + gstreamer1.0-meta-audio \ + gstreamer1.0-meta-video \ + gstreamer1.0-plugins-base-meta \ + gstreamer1.0-plugins-good-meta \ +" +# Minimal set of gstreamer elements to play a local WEBM video +MACHINE_GSTREAMER_1_0_PKGS_ccimx6ul = " \ + gstreamer1.0-plugins-base-alsa \ + gstreamer1.0-plugins-base-audioconvert \ + gstreamer1.0-plugins-base-audioresample \ + gstreamer1.0-plugins-base-playback \ + gstreamer1.0-plugins-base-typefindfunctions \ + gstreamer1.0-plugins-base-videoconvert \ + gstreamer1.0-plugins-base-videoscale \ + gstreamer1.0-plugins-base-volume \ + gstreamer1.0-plugins-good-pulse \ + gstreamer1.0-plugins-good-video4linux2 \ + gstreamer1.0-plugins-good-videofilter \ + gstreamer1.0-plugins-good-vpx \ +" + MACHINE_GSTREAMER_1_0_EXTRA_INSTALL ?= "" MACHINE_GSTREAMER_1_0_EXTRA_INSTALL_ccimx6 ?= " \ gstreamer1.0-plugins-bad-meta \ @@ -14,10 +37,7 @@ MACHINE_GSTREAMER_1_0_EXTRA_INSTALL_ccimx6 ?= " \ " RDEPENDS_${PN} = " \ - gstreamer1.0-meta-audio \ - gstreamer1.0-meta-video \ - gstreamer1.0-plugins-base-meta \ - gstreamer1.0-plugins-good-meta \ + ${MACHINE_GSTREAMER_1_0_PKGS} \ ${MACHINE_GSTREAMER_1_0_EXTRA_INSTALL} \ ${MACHINE_GSTREAMER_1_0_PLUGIN} \ " diff --git a/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend b/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend index 1889c09a0..0b6d1ad0b 100644 --- a/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend +++ b/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend @@ -3,15 +3,15 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" SRC_URI_append_ccimx6ulsbc = " file://0001-pulseaudio-keep-headphones-volume-in-platforms-witho.patch" -SRC_URI_append_ccimx6sbc = " \ +SRC_URI_append_ccimx6 = " \ file://hdmi_hotplug.sh \ file://dey-audio-hdmi.conf \ file://dey-audio-sgtl5000.conf \ " -EXTRA_OECONF_append_ccimx6sbc = " --disable-memfd" +EXTRA_OECONF_append_ccimx6 = " --disable-memfd" -do_install_append_ccimx6sbc() { +do_install_append_ccimx6() { install -d ${D}${sysconfdir}/udev/scripts install -m 0755 ${WORKDIR}/hdmi_hotplug.sh ${D}${sysconfdir}/udev/scripts @@ -34,5 +34,5 @@ do_install_append_ccimx6sbc() { PACKAGE_ARCH = "${MACHINE_ARCH}" -# The card-detect binary is only necessary for the HDMI hotplug to work on the ccimx6sbc -RDEPENDS_${PN}_append_ccimx6sbc = " card-detect" +# The card-detect binary is only necessary for the HDMI hotplug to work on the ccimx6sbc/ccimx6qpsbc +RDEPENDS_${PN}_append_ccimx6 = " card-detect" diff --git a/meta-digi-dey/recipes-support/curl/curl_7.50.1.bbappend b/meta-digi-dey/recipes-support/curl/curl_7.50.1.bbappend new file mode 100644 index 000000000..29bf61f82 --- /dev/null +++ b/meta-digi-dey/recipes-support/curl/curl_7.50.1.bbappend @@ -0,0 +1,6 @@ +# Copyright (C) 2017 Digi International Inc. + +# 'ares' and 'threaded-resolver' are mutually exclusive +PACKAGECONFIG_append_class-target = " ares" +PACKAGECONFIG[ares] = "--enable-ares,--disable-ares,c-ares" +PACKAGECONFIG[threaded-resolver] = "--enable-threaded-resolver,--disable-threaded-resolver," diff --git a/meta-digi-dey/recipes-support/dnsmasq/dnsmasq/lua.patch b/meta-digi-dey/recipes-support/dnsmasq/dnsmasq/lua.patch new file mode 100644 index 000000000..0991dd8b9 --- /dev/null +++ b/meta-digi-dey/recipes-support/dnsmasq/dnsmasq/lua.patch @@ -0,0 +1,30 @@ +From be1b3d2d0f1608cba5efee73d6aac5ad0709041b Mon Sep 17 00:00:00 2001 +From: Joe MacDonald +Date: Tue, 9 Sep 2014 10:24:58 -0400 +Subject: [PATCH] Upstream-status: Inappropriate [OE specific] + +Signed-off-by: Christopher Larson +Signed-off-by: Paul Eggleton + +--- + Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 73ea23e..ed3eeb9 100644 +--- a/Makefile ++++ b/Makefile +@@ -59,8 +59,8 @@ idn2_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LIBIDN2 $(PKG_CONFI + idn2_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LIBIDN2 $(PKG_CONFIG) --libs libidn2` + ct_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --cflags libnetfilter_conntrack` + ct_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --libs libnetfilter_conntrack` +-lua_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --cflags lua5.2` +-lua_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --libs lua5.2` ++lua_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --cflags lua` ++lua_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --libs lua` + nettle_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC $(PKG_CONFIG) --cflags nettle hogweed` + nettle_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC $(PKG_CONFIG) --libs nettle hogweed` + gmp_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC NO_GMP --copy -lgmp` +-- +2.9.5 + diff --git a/meta-digi-dey/recipes-support/dnsmasq/dnsmasq_%.bbappend b/meta-digi-dey/recipes-support/dnsmasq/dnsmasq_%.bbappend new file mode 100644 index 000000000..10804155e --- /dev/null +++ b/meta-digi-dey/recipes-support/dnsmasq/dnsmasq_%.bbappend @@ -0,0 +1,8 @@ +# Copyright (C) 2017, Digi International Inc. + +# Enable DBUS support so it can be used from NetworkManager +PACKAGECONFIG_append = " dbus" + +# NetworkManager will launch 'dnsmasq' using DBUS, so disable the creation +# of runlevel's symlinks. +INHIBIT_UPDATERCD_BBCLASS = "1" diff --git a/meta-digi-dey/recipes-support/dnsmasq/dnsmasq_2.78.bb b/meta-digi-dey/recipes-support/dnsmasq/dnsmasq_2.78.bb new file mode 100644 index 000000000..e768551f4 --- /dev/null +++ b/meta-digi-dey/recipes-support/dnsmasq/dnsmasq_2.78.bb @@ -0,0 +1,10 @@ +# Copyright (C) 2017 Digi International Inc. + +require recipes-support/dnsmasq/dnsmasq.inc + +SRC_URI += "\ + file://lua.patch \ +" + +SRC_URI[dnsmasq-2.78.md5sum] = "3bb97f264c73853f802bf70610150788" +SRC_URI[dnsmasq-2.78.sha256sum] = "c92e5d78aa6353354d02aabf74590d08980bb1385d8a00b80ef9bc80430aa1dc" diff --git a/meta-digi-dey/recipes-support/dnsmasq/files/99_dnsmasq b/meta-digi-dey/recipes-support/dnsmasq/files/99_dnsmasq new file mode 100644 index 000000000..f52ce4e8f --- /dev/null +++ b/meta-digi-dey/recipes-support/dnsmasq/files/99_dnsmasq @@ -0,0 +1 @@ +d root root 0755 /run/dnsmasq none diff --git a/meta-digi-dey/recipes-support/dnsmasq/files/dnsmasq-noresolvconf.service b/meta-digi-dey/recipes-support/dnsmasq/files/dnsmasq-noresolvconf.service new file mode 100644 index 000000000..0c64fab00 --- /dev/null +++ b/meta-digi-dey/recipes-support/dnsmasq/files/dnsmasq-noresolvconf.service @@ -0,0 +1,15 @@ +[Unit] +Description=DNS forwarder and DHCP server +After=network.target + +[Service] +Type=forking +PIDFile=/run/dnsmasq.pid +ExecStartPre=/usr/bin/dnsmasq --test +ExecStart=/usr/bin/dnsmasq -x /run/dnsmasq.pid -7 /etc/dnsmasq.d --local-service +ExecStop=/bin/kill $MAINPID +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target + diff --git a/meta-digi-dey/recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper b/meta-digi-dey/recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper new file mode 100644 index 000000000..db54d467e --- /dev/null +++ b/meta-digi-dey/recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper @@ -0,0 +1,62 @@ +#!/bin/bash +# +# Borrowing heavily from the dnsmasq initscript's version of support for +# resolvconf, intended for use in systemd-only configurations. +# +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/dnsmasq +NAME=dnsmasq + +# Most configuration options in /etc/default/dnsmasq are deprecated +# but still honoured. +if [ -r /etc/default/$NAME ]; then + . /etc/default/$NAME +fi + +start_resolvconf() +{ + # If interface "lo" is explicitly disabled in /etc/default/dnsmasq + # Then dnsmasq won't be providing local DNS, so don't add it to + # the resolvconf server set. + for interface in $DNSMASQ_EXCEPT + do + [ $interface = lo ] && return + done + + if [ -x /sbin/resolvconf ] ; then + echo "nameserver 127.0.0.1" | + /sbin/resolvconf -a lo.$NAME + fi + return 0 +} + +stop_resolvconf() +{ + if [ -x /sbin/resolvconf ] ; then + /sbin/resolvconf -d lo.$NAME + fi + return 0 +} + +case "$1" in + start) + start_resolvconf + exit 0 + ;; + stop) + stop_resolvconf + exit 0 + ;; + restart) + stop_resolvconf + start_resolvconf + exit 0 + ;; + *) + echo "Usage: /etc/init.d/$NAME {start|stop|restart}" >&2 + exit 3 + ;; +esac + +exit 0 + diff --git a/meta-digi-dey/recipes-support/dnsmasq/files/dnsmasq-resolvconf.service b/meta-digi-dey/recipes-support/dnsmasq/files/dnsmasq-resolvconf.service new file mode 100644 index 000000000..2980f7def --- /dev/null +++ b/meta-digi-dey/recipes-support/dnsmasq/files/dnsmasq-resolvconf.service @@ -0,0 +1,17 @@ +[Unit] +Description=DNS forwarder and DHCP server +After=network.target + +[Service] +Type=forking +PIDFile=/run/dnsmasq.pid +ExecStartPre=/usr/bin/dnsmasq --test +ExecStart=/usr/bin/dnsmasq -x /run/dnsmasq.pid -7 /etc/dnsmasq.d --local-service +ExecStartPost=/usr/bin/dnsmasq-resolvconf-helper start +ExecStopPre=/usr/bin/dnsmasq-resolvconf-helper stop +ExecStop=/bin/kill $MAINPID +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target + diff --git a/meta-digi-dey/recipes-support/dnsmasq/files/dnsmasq.conf b/meta-digi-dey/recipes-support/dnsmasq/files/dnsmasq.conf new file mode 100755 index 000000000..9e5ab9f81 --- /dev/null +++ b/meta-digi-dey/recipes-support/dnsmasq/files/dnsmasq.conf @@ -0,0 +1,298 @@ +# Configuration file for dnsmasq. +# +# Format is one option per line, legal options are the same +# as the long options legal on the command line. See +# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details. + +# Listen on this specific port instead of the standard DNS port +# (53). Setting this to zero completely disables DNS function, +# leaving only DHCP and/or TFTP. +#port=5353 + +# Change these lines if you want dnsmasq to serve MX records. +# Only one of mx-host and mx-target need be set, the other defaults +# to the name of the host running dnsmasq. +#mx-host= +#mx-target= +#selfmx +#localmx + +# The following two options make you a better netizen, since they +# tell dnsmasq to filter out queries which the public DNS cannot +# answer, and which load the servers (especially the root servers) +# uneccessarily. If you have a dial-on-demand link they also stop +# these requests from bringing up the link uneccessarily. + +# Never forward plain names (with a dot or domain part) +domain-needed +# Never forward addresses in the non-routed address spaces. +bogus-priv + + +# Uncomment this to filter useless windows-originated DNS requests +# which can trigger dial-on-demand links needlessly. +# Note that (amongst other things) this blocks all SRV requests, +# so don't use it if you use eg Kerberos. +#filterwin2k + +# Change this line if you want dns to get its upstream servers from +# somewhere other that /etc/resolv.conf +#resolv-file= + +# By default, dnsmasq will send queries to any of the upstream +# servers it knows about and tries to favour servers to are known +# to be up. Uncommenting this forces dnsmasq to try each query +# with each server strictly in the order they appear in +# /etc/resolv.conf +#strict-order + +# If you don't want dnsmasq to read /etc/resolv.conf or any other +# file, getting its servers for this file instead (see below), then +# uncomment this +#no-resolv + +# If you don't want dnsmasq to poll /etc/resolv.conf or other resolv +# files for changes and re-read them then uncomment this. +#no-poll + +# Add other name servers here, with domain specs if they are for +# non-public domains. +#server=/localnet/192.168.0.1 + +# Add local-only domains here, queries in these domains are answered +# from /etc/hosts or DHCP only. +#local=/localnet/ + +# Add domains which you want to force to an IP address here. +# The example below send any host in doubleclick.net to a local +# webserver. +#address=/doubleclick.net/127.0.0.1 + +# You no longer (as of version 1.7) need to set these to enable +# dnsmasq to read /etc/ppp/resolv.conf since dnsmasq now uses the +# "dip" group to achieve this. +#user= +#group= + +# If you want dnsmasq to listen for requests only on specified interfaces +# (and the loopback) give the name of the interface (eg eth0) here. +# Repeat the line for more than one interface. +#interface= +# Or you can specify which interface _not_ to listen on +#except-interface= +# Or which to listen on by address (remember to include 127.0.0.1 if +# you use this.) +#listen-address=127.0.0.1 + +# On systems which support it, dnsmasq binds the wildcard address, +# even when it is listening on only some interfaces. It then discards +# requests that it shouldn't reply to. This has the advantage of +# working even when interfaces come and go and change address. If you +# want dnsmasq to really bind only the interfaces it is listening on, +# uncomment this option. About the only time you may need this is when +# running another nameserver on the same machine. +#bind-interfaces + +# If you don't want dnsmasq to read /etc/hosts, uncomment the +# following line. +#no-hosts +# or if you want it to read another file, as well as /etc/hosts, use +# this. +#addn-hosts=/etc/banner_add_hosts + +# Set this (and domain: see below) if you want to have a domain +# automatically added to simple names in a hosts-file. +#expand-hosts + +# Set the domain for dnsmasq. this is optional, but if it is set, it +# does the following things. +# 1) Allows DHCP hosts to have fully qualified domain names, as long +# as the domain part matches this setting. +# 2) Sets the "domain" DHCP option thereby potentially setting the +# domain of all systems configured by DHCP +# 3) Provides the domain part for "expand-hosts" +#domain=thekelleys.org.uk + +# Uncomment this to enable the integrated DHCP server, you need +# to supply the range of addresses available for lease and optionally +# a lease time. If you have more than one network, you will need to +# repeat this for each network on which you want to supply DHCP +# service. +#dhcp-range=192.168.0.50,192.168.0.150,12h +#dhcp-range=10.0.0.10,10.0.0.200,2h + +# This is an example of a DHCP range where the netmask is given. This +# is needed for networks we reach the dnsmasq DHCP server via a relay +# agent. If you don't know what a DHCP relay agent is, you probably +# don't need to worry about this. +#dhcp-range=192.168.0.50,192.168.0.150,255.255.255.0,12h + +# This is an example of a DHCP range with a network-id, so that +# some DHCP options may be set only for this network. +#dhcp-range=red,192.168.0.50,192.168.0.150 + +# Supply parameters for specified hosts using DHCP. There are lots +# of valid alternatives, so we will give examples of each. Note that +# IP addresses DO NOT have to be in the range given above, they just +# need to be on the same network. The order of the parameters in these +# do not matter, it's permissble to give name,adddress and MAC in any order + +# Always allocate the host with ethernet address 11:22:33:44:55:66 +# The IP address 192.168.0.60 +#dhcp-host=11:22:33:44:55:66,192.168.0.60 + +# Always set the name of the host with hardware address +# 11:22:33:44:55:66 to be "fred" +#dhcp-host=11:22:33:44:55:66,fred + +# Always give the host with ethernet address 11:22:33:44:55:66 +# the name fred and IP address 192.168.0.60 and lease time 45 minutes +#dhcp-host=11:22:33:44:55:66,fred,192.168.0.60,45m + +# Give the machine which says it's name is "bert" IP address +# 192.168.0.70 and an infinite lease +#dhcp-host=bert,192.168.0.70,infinite + +# Always give the host with client identifier 01:02:02:04 +# the IP address 192.168.0.60 +#dhcp-host=id:01:02:02:04,192.168.0.60 + +# Always give the host with client identifier "marjorie" +# the IP address 192.168.0.60 +#dhcp-host=id:marjorie,192.168.0.60 + +# Enable the address given for "judge" in /etc/hosts +# to be given to a machine presenting the name "judge" when +# it asks for a DHCP lease. +#dhcp-host=judge + +# Never offer DHCP service to a machine whose ethernet +# address is 11:22:33:44:55:66 +#dhcp-host=11:22:33:44:55:66,ignore + +# Ignore any client-id presented by the machine with ethernet +# address 11:22:33:44:55:66. This is useful to prevent a machine +# being treated differently when running under different OS's or +# between PXE boot and OS boot. +#dhcp-host=11:22:33:44:55:66,id:* + +# Send extra options which are tagged as "red" to +# the machine with ethernet address 11:22:33:44:55:66 +#dhcp-host=11:22:33:44:55:66,net:red + +# Send extra options which are tagged as "red" to any machine whose +# DHCP vendorclass string includes the substring "Linux" +#dhcp-vendorclass=red,Linux + +# Send extra options which are tagged as "red" to any machine one +# of whose DHCP userclass strings includes the substring "accounts" +#dhcp-userclass=red,accounts + +# If this line is uncommented, dnsmasq will read /etc/ethers and act +# on the ethernet-address/IP pairs found there just as if they had +# been given as --dhcp-host options. Useful if you keep +# MAC-address/host mappings there for other purposes. +#read-ethers + +# Send options to hosts which ask for a DHCP lease. +# See RFC 2132 for details of available options. +# Note that all the common settings, such as netmask and +# broadcast address, DNS server and default route, are given +# sane defaults by dnsmasq. You very likely will not need any +# any dhcp-options. If you use Windows clients and Samba, there +# are some options which are recommended, they are detailed at the +# end of this section. +# For reference, the common options are: +# subnet mask - 1 +# default router - 3 +# DNS server - 6 +# broadcast address - 28 + +# Set the NTP time server addresses to 192.168.0.4 and 10.10.0.5 +#dhcp-option=42,192.168.0.4,10.10.0.5 + +# Set the NTP time server address to be the same machine as +# is running dnsmasq +#dhcp-option=42,0.0.0.0 + +# Set the NIS domain name to "welly" +#dhcp-option=40,welly + +# Set the default time-to-live to 50 +#dhcp-option=23,50 + +# Set the "all subnets are local" flag +#dhcp-option=27,1 + +# Send the etherboot magic flag and then etherboot options (a string). +#dhcp-option=128,e4:45:74:68:00:00 +#dhcp-option=129,NIC=eepro100 + +# Specify an option which will only be sent to the "red" network +# (see dhcp-range for the declaration of the "red" network) +#dhcp-option=red,42,192.168.1.1 + +# The following DHCP options set up dnsmasq in the same way as is specified +# for the ISC dhcpcd in +# http://www.samba.org/samba/ftp/docs/textdocs/DHCP-Server-Configuration.txt +# adapted for a typical dnsmasq installation where the host running +# dnsmasq is also the host running samba. +# you may want to uncomment them if you use Windows clients and Samba. +#dhcp-option=19,0 # option ip-forwarding off +#dhcp-option=44,0.0.0.0 # set netbios-over-TCP/IP nameserver(s) aka WINS server(s) +#dhcp-option=45,0.0.0.0 # netbios datagram distribution server +#dhcp-option=46,8 # netbios node type +#dhcp-option=47 # empty netbios scope. + + +# Set the boot filename and tftpd server name and address +# for BOOTP. You will only need this is you want to +# boot machines over the network. +#dhcp-boot=/var/ftpd/pxelinux.0,boothost,192.168.0.3 + +# Set the limit on DHCP leases, the default is 150 +#dhcp-lease-max=150 + +# The DHCP server needs somewhere on disk to keep its lease database. +# This defaults to a sane location, but if you want to change it, use +# the line below. +#dhcp-leasefile=/var/lib/misc/dnsmasq.leases + +# Set the cachesize here. +#cache-size=150 + +# If you want to disable negative caching, uncomment this. +#no-negcache + +# Normally responses which come form /etc/hosts and the DHCP lease +# file have Time-To-Live set as zero, which conventionally means +# do not cache further. If you are happy to trade lower load on the +# server for potentially stale date, you can set a time-to-live (in +# seconds) here. +#local-ttl= + +# If you want dnsmasq to detect attempts by Verisign to send queries +# to unregistered .com and .net hosts to its sitefinder service and +# have dnsmasq instead return the correct NXDOMAIN response, uncomment +# this line. You can add similar lines to do the same for other +# registries which have implemented wildcard A records. +#bogus-nxdomain=64.94.110.11 + +# If you want to fix up DNS results from upstream servers, use the +# alias option. This only works for IPv4. +# This alias makes a result of 1.2.3.4 appear as 5.6.7.8 +#alias=1.2.3.4,5.6.7.8 +# and this maps 1.2.3.x to 5.6.7.x +#alias=1.2.3.0,5.6.7.0,255.255.255.0 + +# For debugging purposes, log each DNS query as it passes through +# dnsmasq. +#log-queries + +# Include a another lot of configuration options. +#conf-file=/etc/dnsmasq.more.conf + + + + + diff --git a/meta-digi-dey/recipes-support/dnsmasq/files/dnsmasq.resolvconf b/meta-digi-dey/recipes-support/dnsmasq/files/dnsmasq.resolvconf new file mode 100755 index 000000000..06cd25cec --- /dev/null +++ b/meta-digi-dey/recipes-support/dnsmasq/files/dnsmasq.resolvconf @@ -0,0 +1,84 @@ +#!/bin/sh +# +# Script to update the resolver list for dnsmasq +# +# N.B. Resolvconf may run us even if dnsmasq is not (yet) running. +# If dnsmasq is installed then we go ahead and update the resolver list +# in case dnsmasq is started later. +# +# Assumption: On entry, PWD contains the resolv.conf-type files. +# +# This file is part of the dnsmasq package. +# + +set -e + +RUN_DIR="/run/dnsmasq" +RSLVRLIST_FILE="${RUN_DIR}/resolv.conf" +TMP_FILE="${RSLVRLIST_FILE}_new.$$" +MY_NAME_FOR_RESOLVCONF="dnsmasq" + +[ -x /usr/bin/dnsmasq ] || exit 0 +[ -x /lib/resolvconf/list-records ] || exit 1 + +PATH=/bin:/sbin + +report_err() { echo "$0: Error: $*" >&2 ; } + +# Stores arguments (minus duplicates) in RSLT, separated by spaces +# Doesn't work properly if an argument itself contains whitespace +uniquify() +{ + RSLT="" + while [ "$1" ] ; do + for E in $RSLT ; do + [ "$1" = "$E" ] && { shift ; continue 2 ; } + done + RSLT="${RSLT:+$RSLT }$1" + shift + done +} + +if [ ! -d "$RUN_DIR" ] && ! mkdir --parents --mode=0755 "$RUN_DIR" ; then + report_err "Failed trying to create directory $RUN_DIR" + exit 1 +fi + +RSLVCNFFILES="" +for F in $(/lib/resolvconf/list-records --after "lo.$MY_NAME_FOR_RESOLVCONF") ; do + case "$F" in + "lo.$MY_NAME_FOR_RESOLVCONF") + # Omit own record + ;; + lo.*) + # Include no more records after one for a local nameserver + RSLVCNFFILES="${RSLVCNFFILES:+$RSLVCNFFILES }$F" + break + ;; + *) + RSLVCNFFILES="${RSLVCNFFILES:+$RSLVCNFFILES }$F" + ;; + esac +done + +NMSRVRS="" +if [ "$RSLVCNFFILES" ] ; then + uniquify $(sed -n -e 's/^[[:space:]]*nameserver[[:space:]]\+//p' $RSLVCNFFILES) + NMSRVRS="$RSLT" +fi + +# Dnsmasq uses the mtime of $RSLVRLIST_FILE, with a resolution of one second, +# to detect changes in the file. This means that if a resolvconf update occurs +# within one second of the previous one then dnsmasq may fail to notice the +# more recent change. To work around this problem we sleep one second here +# if necessary in order to ensure that the new mtime is different. +if [ -f "$RSLVRLIST_FILE" ] && [ "$(stat -c %X "$RSLVRLIST_FILE")" = "$(date +%s)" ] ; then + sleep 1 +fi + +clean_up() { rm -f "$TMP_FILE" ; } +trap clean_up EXIT +: >| "$TMP_FILE" +for N in $NMSRVRS ; do echo "nameserver $N" >> "$TMP_FILE" ; done +mv -f "$TMP_FILE" "$RSLVRLIST_FILE" + diff --git a/meta-digi-dey/recipes-support/dnsmasq/files/init b/meta-digi-dey/recipes-support/dnsmasq/files/init new file mode 100644 index 000000000..51c95dfed --- /dev/null +++ b/meta-digi-dey/recipes-support/dnsmasq/files/init @@ -0,0 +1,117 @@ +#!/bin/sh +DAEMON=/usr/bin/dnsmasq +NAME=dnsmasq +DESC="DNS forwarder and DHCP server" +ARGS="-7 /etc/dnsmasq.d" + +test -f $DAEMON || exit 0 + +set -e + +if [ -r /etc/default/$NAME ] +then + . /etc/default/$NAME +fi + +DNSMASQ_CONF="/etc/dnsmasq.conf" +test "/etc/dnsmasq.d/*" != '/etc/dnsmasq.d/*' && DNSMASQ_CONF="${DNSMASQ_CONF} /etc/dnsmasq.d/*" + +test -z "${PIDFILE}" && PIFILE="/run/dnsmasq.pid" + +if [ -z "$IGNORE_RESOLVCONF" ] +then + egrep -h -q '^no-resolv' ${DNSMASQ_CONF} && IGNORE_RESOLVCONF="yes" +fi + +# RESOLV_CONF: +# If the resolvconf package is installed then use the resolv conf file +# that it provides as the default. Otherwise use /etc/resolv.conf as +# the default. +# +# If IGNORE_RESOLVCONF is set in /etc/default/dnsmasq or an explicit +# filename is set there then this inhibits the use of the resolvconf-provided +# information. +# +# Note that if the resolvconf package is installed it is not possible to +# override it just by configuration in /etc/dnsmasq.conf, it is necessary +# to set IGNORE_RESOLVCONF=yes in /etc/default/dnsmasq. + +test -z "$RESOLV_CONF" -a "$IGNORE_RESOLVCONF" != "yes" -a -x /sbin/resolvconf && \ + RESOLV_CONF=/run/dnsmasq/resolv.conf + +start_resolvconf() +{ + if [ "$IGNORE_RESOLVCONF" != "yes" -a -x /sbin/resolvconf ] + then + echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo.$NAME + fi + : +} + +stop_resolvconf() +{ + if [ "$IGNORE_RESOLVCONF" != "yes" -a -x /sbin/resolvconf ] + then + /sbin/resolvconf -d lo.$NAME + fi + : +} + +case "$1" in + start) + echo -n "starting $DESC: $NAME... " + test -d /var/lib/misc/ || mkdir /var/lib/misc/ + start-stop-daemon -S -x $DAEMON -- $ARGS \ + ${RESOLV_CONF:+ -r $RESOLV_CONF} \ + ${PIDFILE:+ -x $PIDFILE} + test $? -eq 0 && start_resolvconf + echo "done." + ;; + stop) + echo -n "stopping $DESC: $NAME... " + stop_resolvconf + start-stop-daemon -K -x $DAEMON + echo "done." + ;; + status) + echo -n "dnsmasq " + start-stop-daemon -q -K -t -x $DAEMON + RET=$? + if [ "$RET" = "0" ]; then + PID=`cat ${PIDFILE}` + echo "($PID) is running" + else + echo "is not running" + exit $RET + fi + ;; + restart) + echo "restarting $DESC: $NAME... " + $0 stop + $0 start + echo "done." + ;; + reload) + echo -n "reloading $DESC: $NAME... " + killall -HUP $(basename ${DAEMON}) + echo "done." + ;; + systemd-start-resolvconf) + start_resolvconf + ;; + systemd-stop-resolvconf) + stop_resolvconf + ;; + systemd-exec) + test -d /var/lib/misc/ || mkdir /var/lib/misc/ + exec $DAEMON --keep-in-foreground $ARGS \ + ${RESOLV_CONF:+ -r $RESOLV_CONF} \ + ${PIDFILE:+ -x $PIDFILE} + ;; + *) + echo "Usage: $0 {start|stop|status|restart|reload}" + exit 1 + ;; +esac + +exit 0 diff --git a/meta-digi-dey/recipes-support/libsoc/libsoc/0001-gpio-pwm-add-delay-to-allow-udev-rules-to-complete.patch b/meta-digi-dey/recipes-support/libsoc/libsoc/0001-gpio-pwm-add-delay-to-allow-udev-rules-to-complete.patch new file mode 100644 index 000000000..911b7f964 --- /dev/null +++ b/meta-digi-dey/recipes-support/libsoc/libsoc/0001-gpio-pwm-add-delay-to-allow-udev-rules-to-complete.patch @@ -0,0 +1,46 @@ +From: Javier Viguera +Date: Tue, 28 Nov 2017 17:39:05 +0100 +Subject: [PATCH] gpio,pwm: add delay to allow udev rules to complete + +After exporting a GPIO or PWM, we need to give some time for udev rules +to complete, before actually trying to access the newly created entries +in the sysfs. + +This solves a problem, where udev was setting the mode and group of +the newly created files, so they are accessible for users (not root) +belonging to that group. + +Signed-off-by: Javier Viguera +--- + lib/gpio.c | 3 +++ + lib/pwm.c | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/lib/gpio.c b/lib/gpio.c +index bc509f8f09d7..527f2be649a4 100644 +--- a/lib/gpio.c ++++ b/lib/gpio.c +@@ -104,6 +104,9 @@ libsoc_gpio_request (unsigned int gpio_id, gpio_mode mode) + if (file_close (fd)) + return NULL; + ++ /* Give udev some time to execute the rules of the exported GPIO */ ++ usleep(200000); ++ + sprintf (tmp_str, "/sys/class/gpio/gpio%d", gpio_id); + + if (!file_valid (tmp_str)) +diff --git a/lib/pwm.c b/lib/pwm.c +index 94a20d9be281..ed6dec8ee2a9 100644 +--- a/lib/pwm.c ++++ b/lib/pwm.c +@@ -88,6 +88,9 @@ pwm* libsoc_pwm_request (unsigned int chip, unsigned int pwm_num, + return NULL; + } + ++ /* Give udev some time to execute the rules of the exported PWM */ ++ usleep(200000); ++ + sprintf(tmp_str, "/sys/class/pwm/pwmchip%d/pwm%d/enable", chip, pwm_num); + + if (!file_valid(tmp_str)) diff --git a/meta-digi-dey/recipes-support/libsoc/libsoc_git.bb b/meta-digi-dey/recipes-support/libsoc/libsoc_git.bb new file mode 100644 index 000000000..e3c4da70d --- /dev/null +++ b/meta-digi-dey/recipes-support/libsoc/libsoc_git.bb @@ -0,0 +1,38 @@ +# Copyright (C) 2017 Digi International Inc. + +SUMMARY = "Library for interfacing with common SoC peripherals" +DESCRIPTION = "libsoc is a C library to interface with common peripherals (gpio, i2c, spi, pwm) \ + found in SoC (System on Chips) through generic Linux Kernel interfaces." + +HOMEPAGE = "https://github.com/jackmitch/libsoc" + +LICENSE = "LGPLv2.1" +LIC_FILES_CHKSUM = "file://LICENCE;md5=e0bfebea12a718922225ba987b2126a5" + +inherit autotools pkgconfig python-dir + +SRCBRANCH ?= "master" +SRCREV = "${AUTOREV}" +SRC_URI = "git://github.com/jackmitch/libsoc.git" + +S = "${WORKDIR}/git" + +BOARD ??= "devboard" + +PACKAGECONFIG ?= "" + +PACKAGECONFIG[disabledebug] = "--disable-debug,," +PACKAGECONFIG[allboardconfigs] = "--with-board-configs,," +PACKAGECONFIG[enableboardconfig] = "--enable-board=${BOARD},," +PACKAGECONFIG[python] = "--enable-python=${PYTHON_PN},,${PYTHON_PN}" + +PACKAGES =+ "${@bb.utils.contains('PACKAGECONFIG', 'python', \ + '${PYTHON_PN}-libsoc-staticdev ${PYTHON_PN}-libsoc', '', d)}" + +RDEPENDS_${PN} = "libgcc" +RDEPENDS_${PYTHON_PN}-libsoc = "${PN} ${PYTHON_PN}-ctypes" + +FILES_${PYTHON_PN}-libsoc-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*/*.a" +FILES_${PYTHON_PN}-libsoc += "${PYTHON_SITEPACKAGES_DIR}" + +DEFAULT_PREFERENCE = "-1" diff --git a/meta-digi-dey/recipes-support/libsoc/libsoc_git.bbappend b/meta-digi-dey/recipes-support/libsoc/libsoc_git.bbappend new file mode 100644 index 000000000..70d0ba51e --- /dev/null +++ b/meta-digi-dey/recipes-support/libsoc/libsoc_git.bbappend @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Digi International Inc. + +FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" + +LIBSOC_URI_STASH = "${DIGI_MTK_GIT}dey/libsoc.git;protocol=ssh" +LIBSOC_URI_GITHUB = "git://github.com/jackmitch/libsoc.git;protocol=git" +LIBSOC_URI ?= "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${LIBSOC_URI_STASH}', '${LIBSOC_URI_GITHUB}', d)}" + +SRCREV = "dc62bb1f04c13d0423078b1af2bb439c62023d6c" +SRC_URI = " \ + ${LIBSOC_URI};nobranch=1 \ + file://0001-gpio-pwm-add-delay-to-allow-udev-rules-to-complete.patch \ +" + +PACKAGECONFIG = "python" diff --git a/sdk/build-github.sh b/sdk/build-github.sh index f84156d02..2c1af809e 100755 --- a/sdk/build-github.sh +++ b/sdk/build-github.sh @@ -3,7 +3,7 @@ # # build-github.sh # -# Copyright (C) 2015 by Digi International Inc. +# Copyright (C) 2015-2017 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ set -e -AVAILABLE_PLATFORMS="ccardimx28js ccimx6sbc ccimx6ulsbc ccimx6ulstarter" +AVAILABLE_PLATFORMS="ccimx6qpsbc ccimx6sbc ccimx6ulsbc ccimx6ulstarter" MANIFEST_URL="https://github.com/digi-embedded/dey-manifest.git" @@ -119,7 +119,7 @@ while read _pl _tgt; do [ -n "${DY_TARGET}" ] && _tgt="${DY_TARGET}" || true eval "${_pl}_tgt=\"${_tgt}\"" done<<-_EOF_ - ccardimx28js dey-image-qt + ccimx6qpsbc dey-image-qt ccimx6sbc dey-image-qt ccimx6ulsbc dey-image-qt ccimx6ulstarter core-image-base diff --git a/sdk/build.sh b/sdk/build.sh index a26f5c656..e11e88c9a 100755 --- a/sdk/build.sh +++ b/sdk/build.sh @@ -3,7 +3,7 @@ # # build.sh # -# Copyright (C) 2013 by Digi International Inc. +# Copyright (C) 2013-2017 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it @@ -169,7 +169,7 @@ while read _pl _var _tgt; do eval "${_pl}_var=\"${_var//,/ }\"" eval "${_pl}_tgt=\"${_tgt//,/ }\"" done<<-_EOF_ - ccardimx28js -,e,w,wb,web,web1 dey-image-qt + ccimx6qpsbc DONTBUILDVARIANTS dey-image-qt,dey-image-aws ccimx6sbc DONTBUILDVARIANTS dey-image-qt,dey-image-aws ccimx6ulsbc DONTBUILDVARIANTS dey-image-qt,dey-image-aws ccimx6ulstarter DONTBUILDVARIANTS core-image-base,dey-image-aws diff --git a/sdk/config/ccardimx28js/bblayers.conf.sample b/sdk/config/ccimx6qpsbc/bblayers.conf.sample similarity index 100% rename from sdk/config/ccardimx28js/bblayers.conf.sample rename to sdk/config/ccimx6qpsbc/bblayers.conf.sample diff --git a/sdk/config/ccardimx28js/conf-notes.txt b/sdk/config/ccimx6qpsbc/conf-notes.txt similarity index 57% rename from sdk/config/ccardimx28js/conf-notes.txt rename to sdk/config/ccimx6qpsbc/conf-notes.txt index d8fa34f70..ed1cd5158 100644 --- a/sdk/config/ccardimx28js/conf-notes.txt +++ b/sdk/config/ccimx6qpsbc/conf-notes.txt @@ -10,3 +10,9 @@ Digi Embedded Yocto provides the following image recipes: DISTRO_FEATURES_remove = "x11" + * dey-image-aws: console-only image supporting Amazon Web Services IoT + + This image includes the AWS Greengrass Core and an AWS IoT platform + example application. For more information on AWS support in Digi + Embedded Yocto see the online documentation. + diff --git a/sdk/config/ccardimx28js/local.conf.sample b/sdk/config/ccimx6qpsbc/local.conf.sample similarity index 95% rename from sdk/config/ccardimx28js/local.conf.sample rename to sdk/config/ccimx6qpsbc/local.conf.sample index a77a66ace..6b857638b 100644 --- a/sdk/config/ccardimx28js/local.conf.sample +++ b/sdk/config/ccimx6qpsbc/local.conf.sample @@ -37,22 +37,7 @@ # This sets the default machine to be qemux86 if no other machine is selected: #MACHINE ??= "qemux86" -MACHINE = "ccardimx28js" - -# -# Supported variants -# -# Maintain in sync with the same table in platform machine config file. -# -# Name WiFi Eth2 BT 1wire -# ------------------------------------------- -# - N N N N (empty MACHINE_VARIANT="") -# e N Y N N -# w Y N N N -# wb Y N Y N -# web Y Y Y N -# web1 Y Y Y Y -MACHINE_VARIANT = "web1" +MACHINE = "ccimx6qpsbc" # # Use Digi's internal git repositories diff --git a/sdk/mkproject.sh b/sdk/mkproject.sh index 576e7cc7d..7ea2bd9bb 100755 --- a/sdk/mkproject.sh +++ b/sdk/mkproject.sh @@ -3,7 +3,7 @@ # # mkproject.sh # -# Copyright (C) 2013 by Digi International Inc. +# Copyright (C) 2013-2017 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ MKP_NONE="\033[0m" MKP_CONFIGPATH="${MKP_SCRIPTPATH}/sources/meta-digi/sdk/config" # Blacklist platforms (not officially supported in a DEY release) -MKP_BLACKLIST_PLATFORMS="ccardimx28js" +MKP_BLACKLIST_PLATFORMS="" MKP_SETUP_ENVIRONMENT='#!/bin/bash