Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add support for SPI on GPIOs of Jetson Nano Device #38

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions layers/meta-balena-jetson/conf/machine/spi-jetson-nano.conf
@@ -0,0 +1,6 @@
#@TYPE: Machine
##@NAME: spi-jetson-nano
##@DESCRIPTION: Machine configuration for SPI support on the Carrier Dev Board for Nvdia Jetson Nano

MACHINEOVERRIDES = "jetson-nano:${MACHINE}"
include conf/machine/jetson-nano.conf
Expand Up @@ -27,6 +27,7 @@ SRC_URI = " \
# them here instead of machine.conf.
KERNEL_DEVICETREE_jetson-nano = "${DEPLOY_DIR_IMAGE}/tegra210-p3448-0000-p3449-0000-a02.dtb"
KERNEL_DEVICETREE_jn30b-nano = "${DEPLOY_DIR_IMAGE}/tegra210-p3448-0002-p3449-0000-b00-jn30b-JP4.2.2.dtb"
KERNEL_DEVICETREE_spi-jetson-nano = "${DEPLOY_DIR_IMAGE}/tegra210-p3448-0002-p3449-0000-b00-SPI-JP4.2.2.dtb"
DTBFILE ?= "${@os.path.basename(d.getVar('KERNEL_DEVICETREE', True).split()[0])}"
LNXSIZE ?= "67108864"

Expand Down
2 changes: 2 additions & 0 deletions layers/meta-balena-jetson/recipes-core/images/resin-image.inc
Expand Up @@ -6,8 +6,10 @@ do_rootfs_resinos-img_jetson-nano[depends] += " tegra210-flash:do_deploy \

DTBFILE ?= "${@os.path.basename(d.getVar('KERNEL_DEVICETREE', True).split()[0])}"
DTBFILE_jn30b-nano = "tegra210-p3448-0002-p3449-0000-b00-jn30b-JP4.2.2.dtb"
DTBFILE_spi-jetson-nano = "tegra210-p3448-0002-p3449-0000-b00-SPI-JP4.2.2.dtb"

# Name update files as partition names for easier updating

RESIN_BOOT_PARTITION_FILES_jetson-nano = " \
bootfiles/nvtboot_cpu.bin.encrypt:/bootfiles/TBC \
bootfiles/${DTBFILE}.encrypt:/bootfiles/RP1 \
Expand Down
@@ -0,0 +1,22 @@
diff a/kernel-source/drivers/gpio/gpio-tegra.c b/kernel-source/drivers/gpio/gpio-tegra.c
--- kernel-source/drivers/gpio/gpio-tegra.c
+++ kernel-source/drivers/gpio/gpio-tegra_new.c
@@ -223,10 +223,18 @@
return pinctrl_request_gpio(chip->base + offset);
}

+static void tegra_gpio_disable(struct tegra_gpio_info *tgi, int gpio)
+{
+ tegra_gpio_mask_write(tgi, GPIO_MSK_CNF(tgi, gpio), gpio, 0);
+}
+
static void tegra_gpio_free(struct gpio_chip *chip, unsigned offset)
{
+ struct tegra_gpio_info *tgi = gpiochip_get_data(chip);
+
pinctrl_free_gpio(chip->base + offset);
tegra_gpio_restore_gpio_state(offset);
+ tegra_gpio_disable(tgi, offset);
}

static void tegra_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
@@ -0,0 +1 @@
ToDo
Expand Up @@ -33,6 +33,11 @@ SRC_URI_append_jetson-tx2 = " \
file://0001-mttcan_ivc-Fix-build-failure-with-kernel-4.9.patch \
"

SRC_URI_append_spi-jetson-nano = " \
file://tegra210-p3448-0002-p3449-0000-b00-SPI-JP4.2.2.dtb \
file://0001-spi-patch-linux-drivers-gpio-tegra.patch \
"

SRC_URI_append_jn30b-nano = " \
file://tegra210-p3448-0002-p3449-0000-b00-jn30b-JP4.2.2.dtb \
"
Expand Down Expand Up @@ -190,6 +195,10 @@ do_deploy_append_blackboard-tx2() {
cp ${WORKDIR}/tegra186-tx2-blackboard.dtb "${DEPLOYDIR}"
}

do_deploy_append_spi-jetson-nano() {
cp ${WORKDIR}/tegra210-p3448-0002-p3449-0000-b00-SPI-JP4.2.2.dtb "${DEPLOYDIR}"
}

do_deploy_append_jn30b-nano() {
cp ${WORKDIR}/tegra210-p3448-0002-p3449-0000-b00-jn30b-JP4.2.2.dtb "${DEPLOYDIR}"
}
44 changes: 44 additions & 0 deletions spi-jetson-nano.coffee
@@ -0,0 +1,44 @@
deviceTypesCommon = require '@resin.io/device-types/common'
{ networkOptions, commonImg, instructions } = deviceTypesCommon

BOARD_POWEROFF = 'Remove power from the board and insert frelshy burnt SD-CARD.'
BOARD_POWERON = 'Power on the board.'

module.exports =
version: 1
slug: 'spi-jetson-nano'
aliases: [ 'spi-jetson-nano' ]
name: 'SPI Jetson Nano'
arch: 'aarch64'
state: 'experimental'
community: 'true'

instructions: [
instructions.ETCHER_SD
BOARD_POWEROFF
BOARD_POWERON
]

gettingStartedLink:
windows: 'https://docs.resin.io/jetson-nano/nodejs/getting-started/#adding-your-first-device'
osx: 'https://docs.resin.io/jetson-nano/nodejs/getting-started/#adding-your-first-device'
linux: 'https://docs.resin.io/jetson-nano/nodejs/getting-started/#adding-your-first-device'

supportsBlink: false

yocto:
machine: 'spi-jetson-nano'
image: 'resin-image'
fstype: 'resinos-img'
version: 'yocto-warrior'
deployArtifact: 'resin-image-spi-jetson-nano.resinos-img'
compressed: true

options: [ networkOptions.group ]

configuration:
config:
partition: 12
path: '/config.json'

initialization: commonImg.initialization
30 changes: 30 additions & 0 deletions spi-jetson-nano.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.