Commit 71ba6850 authored by Lukas Posadka's avatar Lukas Posadka

CGT SX8M: Updates necessary to make Basler camera work with the conga-SMX8-Mini module.

parent ee9c8162
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "basler-imx8"
BBFILE_PATTERN_basler-imx8 = "^${LAYERDIR}/"
BBFILE_PRIORITY_basler-imx8 = "50"
LAYERVERSION_basler-imx8 = "1"
LAYERSERIES_COMPAT_basler-imx8 = "sumo"
#@TYPE: Machine
#@NAME: SX8M
#@SOC: i.MX8MM
#@DESCRIPTION: Machine configuration for congatec SX8M board
#@MAINTAINER: Lukas Posadka <lukas.posadka@congatec.com>
MACHINEOVERRIDES =. "mx8:mx8m:mx8mm:sx8m:"
MACHINE_USES_VIVANTE_KERNEL_DRIVER_MODULE = "0"
require conf/machine/include/imx-base.inc
require conf/machine/include/arm/arch-arm64.inc
MACHINE_FEATURES += " pci"
PREFERRED_PROVIDER_virtual/kernel_imx8mm-cgt-basler = "linux-congatec"
KERNEL_DEVICETREE = "congatec/imx8mm-cgtsx8m-basler-camera-csi0-2ch.dtb"
KERNEL_DEVICETREE += " congatec/imx8mm-cgtsx8m-basler-camera-csi1-4ch.dtb"
PREFERRED_PROVIDER_virtual/bootloader_imx8mm-cgt-basler = "u-boot-congatec"
UBOOT_DTB_NAME = "imx8mm-cgtsx8m.dtb"
UBOOT_CONFIG ??= "sd"
UBOOT_CONFIG[sd] = "cgtsx8m_basler_defconfig"
UBOOT_CONFIG[fspi] = "cgtsx8m_fspi_basler_defconfig"
SPL_BINARY = "spl/u-boot-spl.bin"
# Set DDR FIRMWARE
DDR_FIRMWARE_NAME = "lpddr4_pmu_train_1d_imem.bin lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_2d_imem.bin lpddr4_pmu_train_2d_dmem.bin"
# Set imx-mkimage boot target
IMXBOOT_TARGETS = "${@bb.utils.contains('UBOOT_CONFIG', 'fspi', 'flash_sx8m_flexspi', 'flash_sx8m', d)}"
SERIAL_CONSOLES = "115200;ttymxc1"
IMAGE_BOOTLOADER = "imx-boot"
BOOT_SPACE = "65536"
LOADADDR = ""
UBOOT_SUFFIX = "bin"
UBOOT_MAKE_TARGET = ""
IMX_BOOT_SEEK = "33"
require conf/machine/imx8mmevk.conf
KERNEL_DEVICETREE =+ "freescale/fsl-imx8mm-evk-basler-camera.dtb"
MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-basler-camera-driver"
require conf/machine/imx8mqevk.conf
KERNEL_DEVICETREE =+ "freescale/fsl-imx8mq-evk-basler-camera-csi1.dtb freescale/fsl-imx8mq-evk-basler-camera-csi2.dtb freescale/fsl-imx8mq-evk-basler-camera.dtb"
MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-basler-camera-driver"
From fcc1d024cb27ca58744583d22cd7a88154ad219e Mon Sep 17 00:00:00 2001
From: Lukas Posadka <lukas.posadka@congatec.com>
Date: Sat, 25 Jul 2020 15:04:50 +0200
Subject: [PATCH] CGT SX8M: Basler camera support
---
configs/cgtsx8m_basler_defconfig | 73 +++++++++++++++++++++++++++
configs/cgtsx8m_fspi_basler_defconfig | 72 ++++++++++++++++++++++++++
2 files changed, 145 insertions(+)
create mode 100644 configs/cgtsx8m_basler_defconfig
create mode 100644 configs/cgtsx8m_fspi_basler_defconfig
diff --git a/configs/cgtsx8m_basler_defconfig b/configs/cgtsx8m_basler_defconfig
new file mode 100644
index 0000000000..22983ca4c6
--- /dev/null
+++ b/configs/cgtsx8m_basler_defconfig
@@ -0,0 +1,73 @@
+CONFIG_ARM=y
+CONFIG_ARCH_IMX8M=y
+CONFIG_SYS_TEXT_BASE=0x40200000
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_TARGET_CONGA_SX8M=y
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,SPL_TEXT_BASE=0x7E1000"
+CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_ARCH_MISC_INIT=y
+CONFIG_SPL=y
+CONFIG_SPL_BOARD_INIT=y
+CONFIG_SPL_MMC_SUPPORT=y
+CONFIG_SPL_NOR_SUPPORT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_OF_LIBFDT=y
+CONFIG_FS_FAT=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_DEFAULT_DEVICE_TREE="imx8mm-cgtsx8m"
+CONFIG_DEFAULT_FDT_FILE="imx8mm-cgtsx8m-basler-camera-csi0-2ch.dtb"
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_MEMTEST=y
+CONFIG_OF_CONTROL=y
+CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_CMD_FASTBOOT=y
+CONFIG_ANDROID_BOOT_IMAGE=y
+CONFIG_FSL_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x42800000
+CONFIG_FASTBOOT_BUF_SIZE=0x40000000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+
+CONFIG_DM_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MXC=y
+CONFIG_DM_MMC=y
+# CONFIG_DM_PMIC=y
+CONFIG_EFI_PARTITION=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_DM_ETH=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX8M=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_SPI=y
+CONFIG_FSL_FSPI=y
+CONFIG_NXP_TMU=y
+CONFIG_DM_THERMAL=y
+CONFIG_USB=y
+CONFIG_USB_GADGET=y
+CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y
+
+CONFIG_SPL_USB_HOST_SUPPORT=y
+CONFIG_SPL_USB_GADGET_SUPPORT=y
+CONFIG_SPL_USB_SDP_SUPPORT=y
+CONFIG_SDP_LOADADDR=0x40400000
+CONFIG_USB_GADGET_MANUFACTURER="FSL"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0525
+CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
+CONFIG_VIDEO=y
+CONFIG_IMX_SEC_MIPI_DSI=y
diff --git a/configs/cgtsx8m_fspi_basler_defconfig b/configs/cgtsx8m_fspi_basler_defconfig
new file mode 100644
index 0000000000..3134fc6902
--- /dev/null
+++ b/configs/cgtsx8m_fspi_basler_defconfig
@@ -0,0 +1,72 @@
+CONFIG_ARM=y
+CONFIG_ARCH_IMX8M=y
+CONFIG_SYS_TEXT_BASE=0x40200000
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_TARGET_CONGA_SX8M=y
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_qspi.cfg,SPL_TEXT_BASE=0x7E2000"
+CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_ARCH_MISC_INIT=y
+CONFIG_SPL=y
+CONFIG_SPL_BOARD_INIT=y
+CONFIG_SPL_NOR_SUPPORT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_OF_LIBFDT=y
+CONFIG_FS_FAT=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_DEFAULT_DEVICE_TREE="imx8mm-cgtsx8m"
+CONFIG_DEFAULT_FDT_FILE="imx8mm-cgtsx8m-basler-camera-csi0-2ch.dtb"
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_MEMTEST=y
+CONFIG_OF_CONTROL=y
+CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_CMD_FASTBOOT=y
+CONFIG_ANDROID_BOOT_IMAGE=y
+CONFIG_FSL_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x42800000
+CONFIG_FASTBOOT_BUF_SIZE=0x40000000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+
+CONFIG_DM_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MXC=y
+CONFIG_DM_MMC=y
+# CONFIG_DM_PMIC=y
+CONFIG_EFI_PARTITION=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_DM_ETH=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX8M=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_SPI=y
+CONFIG_FSL_FSPI=y
+CONFIG_NXP_TMU=y
+CONFIG_DM_THERMAL=y
+CONFIG_USB=y
+CONFIG_USB_GADGET=y
+CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y
+
+CONFIG_SPL_USB_HOST_SUPPORT=y
+CONFIG_SPL_USB_GADGET_SUPPORT=y
+CONFIG_SPL_USB_SDP_SUPPORT=y
+CONFIG_SDP_LOADADDR=0x40400000
+CONFIG_USB_GADGET_MANUFACTURER="FSL"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0525
+CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
+CONFIG_VIDEO=y
+CONFIG_IMX_SEC_MIPI_DSI=y
--
2.17.1
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
SRC_URI_append = \
" file://0001-CGT-SX8M-Basler-camera-support.patch;name=p0001\
"
SRC_URI[p0001.md5sum] = "2ccde5db7e209723e907f251e42c52d4"
SRC_URI[p0001.sha256sum] = "7eea0924a38ac5349b5ae935bec9918264ab95000e0326a64d7ced144e2d98e9"
This diff is collapsed.
ifneq ($(KERNELRELEASE),)
obj-m += basler-camera-driver.o
else
# normal makefile
SRC := $(shell pwd)
all:
$(MAKE) -C $(KERNEL_SRC) M=$(SRC)
modules_install:
$(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install
clean:
rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
rm -f Module.markers Module.symvers modules.order
rm -rf .tmp_versions Modules.s
endif
#ifndef BASLER_CAMERA_DRIVER_H
#define BASLER_CAMERA_DRIVER_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __KERNEL__
#include <linux/types.h>
#include <linux/v4l2-controls.h>
#endif /* __KERNEL__ */
#define V4L2_CID_PROXY_BASE (V4L2_CTRL_CLASS_USER | 0x1000)
#define V4L2_CID_BASLER_INTERFACE_VERSION (V4L2_CID_PROXY_BASE+1)
#define V4L2_CID_BASLER_ACCESS_REGISTER (V4L2_CID_PROXY_BASE+2)
#define V4L2_CID_BASLER_DEVICE_INFORMATION (V4L2_CID_PROXY_BASE+3)
#define V4L2_CID_BASLER_CSI_INFORMATION (V4L2_CID_PROXY_BASE+4)
#define BIT(nr) (1UL << (nr))
#define I2CREAD BIT(0)
#define I2CWRITE BIT(1)
#define GENCP_STRING_BUFFER_SIZE (64)
#define STRING_TERMINATION (1)
#define BDI_MAGIC 84513200
/*
* Basler interface Version
*/
#define BASLER_INTERFACE_VERSION_MAJOR ((__u16) 1)
#define BASLER_INTERFACE_VERSION_MINOR ((__u16) 0)
/*
Write register:
IOCTL VIDIOC_S_EXT_CTRLS with command == I2CWRITE + address, size and value
Read register:
IOCTL VIDIOC_S_EXT_CTRLS with command == I2CREAD + address and size
then IOCTL VIDIOC_G_EXT_CTRLS returns value
For the maximum buffer size to use in a read or write command please considder the values
"Maximum Write Transfer Length" and "Maximum Read Transfer Length" as described in the MCM Interface Specification.
These values can differ on the different sensor modules.
*/
struct register_access {
__u16 address; /* Register address; host endianness*/
__u8 data[256]; /* Read/Write register value - target endianness */
__u16 data_size; /* Host endianness */
__u8 command; /* On a VIDIOC_S_EXT_CTRLS identifies to store the register address */
};
struct basler_device_information {
__u32 _magic;
__u32 gencpVersion;
__u8 manufacturerName[GENCP_STRING_BUFFER_SIZE + STRING_TERMINATION];
__u8 modelName[GENCP_STRING_BUFFER_SIZE + STRING_TERMINATION];
__u8 familyName[GENCP_STRING_BUFFER_SIZE + STRING_TERMINATION];
__u8 deviceVersion[GENCP_STRING_BUFFER_SIZE + STRING_TERMINATION];
__u8 manufacturerInfo[GENCP_STRING_BUFFER_SIZE + STRING_TERMINATION];
__u8 serialNumber[GENCP_STRING_BUFFER_SIZE + STRING_TERMINATION];
__u8 userDefinedName[GENCP_STRING_BUFFER_SIZE + STRING_TERMINATION];
};
/**
* struct basler_csi_information - sensor specific csi2 bus configuration.
* The cid to query this structure is V4L2_CID_BASLER_CSI_INFORMATION.
*
* @max_lanefrequency Max theoretical CSI frequency per lane in hertz.
* @lanecount Available CSI lane count.
* @laneassignment describes the physical CSI-2 connection between host and camera module.
* The index starts with 0 as CSI lane 1 of the host.
* The value starts with 1 as the CSI lane 1 of the sensor.
*/
struct basler_csi_information {
__u64 max_lane_frequency;
__u8 lane_count;
__u8 lane_assignment[4];
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* BASLER_CAMERA_DRIVER_H */
SUMMARY = "Basler camera sensor driver"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=801f80980d171dd6425610833a22dbe6"
inherit module
SRC_URI = "file://basler-camera-driver/* file://COPYING;subdir=basler-camera-driver"
S = "${WORKDIR}/basler-camera-driver"
# The inheritance of module.bbclass will automatically name module packages with
# "kernel-module-" prefix as required by the oe-core build environment.
RPROVIDES_${PN} += "kernel-module-basler-camera-driver"
PACKAGES =+ " basler-camera-driver-kernel-headers"
FILES_${PN}-dev = "${includedir}/linux/basler-camera-driver.h"
do_install_append() {
install -d ${D}${includedir}/linux
install -m 644 ${S}/basler-camera-driver.h ${D}${includedir}/linux/basler-camera-driver.h
rm -R ${D}${includedir}/basler-camera-driver/
}
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
SRC_URI_append = \
" file://0001-CGT-SX8M-Basler-camera-support.patch;name=p0001\
"
SRC_URI[p0001.md5sum] = "ec1ce37606b165c32992647180118e81"
SRC_URI[p0001.sha256sum] = "f962e569a7d9922dde2ae26fed9ab4b8a58f1c7557d22d4233992459189a6674"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment