├── LICENSE ├── README.md ├── flash ├── create-flash-package.sh ├── create-signed-partitions.sh └── flashme.sh └── spi ├── l4t-sources-kernel-hardware-nvidia-platform-t210-porg-spidev0-0.patch ├── l4t-sources-u-boot-spidev0-0.patch ├── tegra210-p3448-0000-p3449-0000-a02-spidev-0.dtb └── u-boot-spidev0-0.bin /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019, George Joseph 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the "Software"), 5 | to deal in the Software without restriction, including without limitation 6 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the 8 | Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included 11 | in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 14 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 15 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 17 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 18 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 19 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | 21 | 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jetson-nano-support 2 | 3 | ### SPI 4 | 5 | The spi directory contains dtb and u-boot binaries for the DevKit 6 | with part number p3448-0000-p3449-0000-a02 as well as the patch files 7 | used to create them. Together they enable spi1 on the 40-pin connector and 8 | create a device node for /dev/spidev0.0. 9 | 10 | Unlike earlier install methods, you can install the binaries 11 | _on a running Nano_ without the need for any other downloads, compiling, etc. 12 | 13 | The [latest release](https://github.com/gtjoseph/jetson-nano-support/releases/latest) 14 | contains a tarball which, when extracted 15 | and run on the Nano, will update the appropriate partitions. 16 | 17 | Extract the tarball then change to the directory created. 18 | Run `sudo ./flashme.sh /dev/mmcblk0` (assuming /dev/mmcblk0 contains the system partitions) 19 | Reboot and you should have the spidev0.0 device. 20 | 21 | **NOTE:** This program doesn't touch any other partitions or files so it's safe to run 22 | on an existing customized filesystem. The program will also make sure that the needed 23 | partitions are already on the device before it writes anything. 24 | 25 | You can also run this program on any other computer to update an SDCard 26 | that's not currently in a Nano. The above note still applies. 27 | 28 | 29 | ### Customization 30 | 31 | The patches that created the DTB and u-boot binaries are included here. You'll 32 | need to follow the instructions in the Nvidia documentation for customizing 33 | the DTBs and u-boot. 34 | 35 | If you want to create your own flash package you can use the scripts in the 36 | [flash](flash) directory. 37 | 38 | * Use the Nvidia documentation to create your DTB and u-boot images. 39 | Follow the instructions to copy the DTBs to your Linux_for_Tegra/kernel/dtb 40 | directory, and your u-boot.bin file to Linux_for_Tegra/bootloader/t210ref/p3450-porg/ 41 | directory. 42 | 43 | * Copy create-signed-partitions.sh and create-flash-package.sh to your 44 | Linux_for_Tegra directory. 45 | 46 | * From your Linux_for_Tegra directory, run `sudo ./create-signed-partitions.sh -r 200` 47 | where "200" is the board rev id for the "a02" boards. Adjust as necessary. 48 | This command will apply the DTBs to the appropriate partition blobs and sign 49 | the partition blobs. They'll be located in bootloader/signed directory. 50 | 51 | * From your Linux_for_Tegra directory, run `./create-flash-package.sh`. 52 | You don't need to be root for this command. When it's done (it'll be very quick) 53 | you should have a /tmp/flash-dtb-update-.tar.gz file that you can copy 54 | to any Nano and execute as above. 55 | -------------------------------------------------------------------------------- /flash/create-flash-package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | whereami=$PWD 4 | dtb_id=a02 5 | date=$(date -Idate) 6 | flashdir=flash-dtb-update-$date 7 | 8 | rm -rf /tmp/$flashdir /tmp/$flashdir.tar.gz 9 | mkdir /tmp/$flashdir 10 | 11 | echo 'declare -A partitions=(\' > /tmp/$flashdir/partitions 12 | sed -n -r -e "/EBT|RP1|WB0|LNX|DTB/p" bootloader/signed/partitions >> /tmp/$flashdir/partitions 13 | echo ")" >> /tmp/$flashdir/partitions 14 | 15 | source /tmp/$flashdir/partitions 16 | for p in ${partitions[@]} ; do 17 | eval $p 18 | echo "Copying $part_file to /tmp/$flashdir/" 19 | cp bootloader/signed/$part_file /tmp/$flashdir/ 20 | done 21 | 22 | cp ./flashme.sh /tmp/$flashdir 23 | cp ./FLASHME_README /tmp/$flashdir 24 | 25 | cd /tmp/$flashdir/ 26 | md5sum * >../hash.md5 27 | mv ../hash.md5 ./ 28 | cd .. 29 | 30 | tar --owner=0 --group=0 -czvf $flashdir.tar.gz $flashdir/* 31 | -------------------------------------------------------------------------------- /flash/create-signed-partitions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # * Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # * Neither the name of NVIDIA CORPORATION nor the names of its 14 | # contributors may be used to endorse or promote products derived 15 | # from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 25 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | # This is a script to generate the SD card flashable image for 30 | # jetson-nano platform 31 | 32 | set -e 33 | 34 | function usage() 35 | { 36 | if [ -n "${1}" ]; then 37 | echo "${1}" 38 | fi 39 | 40 | echo "Usage:" 41 | echo "${script_name} -r " 42 | echo " revision - SKU revision number" 43 | echo "Example for board rev a02:" 44 | echo "${script_name} -r 200" 45 | exit 1 46 | } 47 | 48 | function check_pre_req() 49 | { 50 | this_user="$(whoami)" 51 | if [ "${this_user}" != "root" ]; then 52 | echo "ERROR: This script requires root privilege" > /dev/stderr 53 | usage 54 | exit 1 55 | fi 56 | 57 | while [ -n "${1}" ]; do 58 | case "${1}" in 59 | -h | --help) 60 | usage 61 | ;; 62 | -r | --revision) 63 | [ -n "${2}" ] || usage "Not enough parameters" 64 | rev="${2}" 65 | shift 2 66 | ;; 67 | *) 68 | usage "Unknown option: ${1}" 69 | ;; 70 | esac 71 | done 72 | 73 | case "${rev}" in 74 | "100") 75 | dtb_id="a01" 76 | ;; 77 | "200") 78 | dtb_id="a02" 79 | ;; 80 | "300") 81 | dtb_id="b00" 82 | ;; 83 | *) 84 | usage "Incorrect Revision - Supported revisions - 100, 200, 300" 85 | ;; 86 | esac 87 | 88 | if [ ! -f "${l4t_dir}/flash.sh" ]; then 89 | echo "ERROR: ${l4t_dir}/flash.sh is not found" > /dev/stderr 90 | usage 91 | fi 92 | 93 | if [ ! -d "${bootloader_dir}" ]; then 94 | echo "ERROR: ${bootloader_dir} directory not found" > /dev/stderr 95 | usage 96 | fi 97 | 98 | } 99 | 100 | function create_signed_images() 101 | { 102 | echo "${script_name} - creating signed images" 103 | 104 | # Generate flashcmd.txt for signing images 105 | BOARDID="3448" FAB="${rev}" "${l4t_dir}/flash.sh" "--no-flash" "--no-systemimg" "p3448-0000-sd" "mmcblk0p1" 106 | 107 | if [ ! -f "${bootloader_dir}/flashcmd.txt" ]; then 108 | echo "ERROR: ${bootloader_dir}/flashcmd.txt not found" > /dev/stderr 109 | exit 1 110 | fi 111 | 112 | # Generate signed images 113 | sed -i 's/flash; reboot/sign/g' "${l4t_dir}/bootloader/flashcmd.txt" 114 | pushd "${bootloader_dir}" > /dev/null 2>&1 115 | bash ./flashcmd.txt 116 | popd > /dev/null 117 | 118 | if [ ! -d "${signed_image_dir}" ]; then 119 | echo "ERROR: ${bootloader_dir}/signed directory not found" > /dev/stderr 120 | exit 1 121 | fi 122 | } 123 | 124 | function create_partitions() 125 | { 126 | echo "${script_name} - create partitions" 127 | 128 | partitions=(\ 129 | 'part_num=2;part_name=TBC;part_size=131072;part_file=nvtboot_cpu.bin.encrypt' \ 130 | 'part_num=3;part_name=RP1;part_size=458752;part_file=tegra210-p3448-0000-p3449-0000-${dtb_id}.dtb.encrypt' \ 131 | 'part_num=4;part_name=EBT;part_size=589824;part_file=cboot.bin.encrypt' \ 132 | 'part_num=5;part_name=WB0;part_size=65536;part_file=warmboot.bin.encrypt' \ 133 | 'part_num=6;part_name=BPF;part_size=196608;part_file=sc7entry-firmware.bin.encrypt' \ 134 | 'part_num=7;part_name=TOS;part_size=589824;part_file=tos-mon-only.img.encrypt' \ 135 | 'part_num=8;part_name=EKS;part_size=65536;part_file=eks.img' \ 136 | 'part_num=9;part_name=LNX;part_size=655360;part_file=boot.img.encrypt' \ 137 | 'part_num=10;part_name=DTB;part_size=458752;part_file=tegra210-p3448-0000-p3449-0000-${dtb_id}.dtb.encrypt' \ 138 | 'part_num=11;part_name=RP4;part_size=131072;part_file=rp4.blob' \ 139 | 'part_num=12;part_name=BMP;part_size=81920;part_file=bmp.blob' \ 140 | ) 141 | 142 | part_type=8300 # Linux Filesystem 143 | echo "declare -A partitions=(\\" > "${signed_image_dir}/partitions" 144 | for part in "${partitions[@]}"; do 145 | eval "$part" 146 | echo "[$part_name]='$part' \\" >> "${signed_image_dir}/partitions" 147 | done 148 | echo ")" >> "${signed_image_dir}/partitions" 149 | } 150 | 151 | script_name="$(basename "${0}")" 152 | l4t_dir="$(cd "$(dirname "${0}")" && pwd)" 153 | bootloader_dir="${l4t_dir}/bootloader" 154 | signed_image_dir="${bootloader_dir}/signed" 155 | dtb_id="a02" 156 | loop_dev="" 157 | tmpdir="" 158 | 159 | echo "********************************************" 160 | echo " Jetson-Nano SD Image Creation Tool " 161 | echo "********************************************" 162 | 163 | check_pre_req "${@}" 164 | create_signed_images 165 | create_partitions 166 | 167 | echo "********************************************" 168 | echo " Jetson-Nano SD Image Creation Complete " 169 | echo "********************************************" 170 | -------------------------------------------------------------------------------- /flash/flashme.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | d=$(dirname $0) 3 | dtb_id=a02 4 | 5 | 6 | usage() { 7 | echo "Usage: $0 " 8 | echo "Example: sudo $0 /dev/mmcblk0" 9 | } 10 | 11 | this_user="$(whoami)" 12 | if [ "${this_user}" != "root" ]; then 13 | echo "ERROR: This script requires root privilege" > /dev/stderr 14 | usage 15 | exit 1 16 | fi 17 | 18 | if [ -z "$1" ] ; then 19 | usage 20 | exit 1 21 | fi 22 | 23 | if [ ! -b $1 ] ; then 24 | echo "$1 does not exist" 25 | exit 1 26 | fi 27 | 28 | device=$1 29 | 30 | block_array=$(blkid ${device}* | sed -n -r -e "s#^${device}([^:]+):\s+PARTLABEL=[\"]([^\"]+)[\"].*#[\2]=${device}\1 #p") 31 | eval "declare -xA block_devs=( $block_array )" 32 | 33 | md5sum --status -c ./hash.md5 || { echo -e "One or more files are corrupt or missing.\n" ; md5sum -c ./hash.md5 | grep "FAILED" ; exit 1 ; } 34 | 35 | if [ ! -f partitions ] ; then 36 | echo "The $d/partitions file is missing" 37 | exit 1 38 | fi 39 | 40 | 41 | source ./partitions 42 | 43 | declare -i rc=0 44 | for pn in ${!partitions[@]} ; do 45 | block_dev=${block_devs[$pn]} 46 | if [ -z "$block_dev" ] ; then 47 | echo "There was no partition named $pn on device $device" 48 | rc+=1 49 | else 50 | block_devs[$pn]=$block_dev 51 | fi 52 | done 53 | 54 | if [ $rc -ne 0 ] ; then 55 | echo "$rc errors were encountered." 56 | exit 1 57 | fi 58 | 59 | set -e 60 | 61 | for p in ${partitions[@]} ; do 62 | eval $p 63 | echo "Flashing $d/$part_file to ${block_devs[$part_name]} ($part_name)" 64 | dd if=$part_file of=${block_devs[$part_name]} conv=fsync 65 | done 66 | -------------------------------------------------------------------------------- /spi/l4t-sources-kernel-hardware-nvidia-platform-t210-porg-spidev0-0.patch: -------------------------------------------------------------------------------- 1 | diff --git a/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0000-a02.dtsi b/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0000-a02.dtsi 2 | index 6acdc55..75e199d 100755 3 | --- a/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0000-a02.dtsi 4 | +++ b/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0000-a02.dtsi 5 | @@ -50,10 +50,6 @@ 6 | TEGRA_GPIO(J, 7) 7 | TEGRA_GPIO(G, 2) 8 | TEGRA_GPIO(G, 3) 9 | - TEGRA_GPIO(C, 0) 10 | - TEGRA_GPIO(C, 1) 11 | - TEGRA_GPIO(C, 2) 12 | - TEGRA_GPIO(C, 3) 13 | TEGRA_GPIO(C, 4) 14 | TEGRA_GPIO(H, 2) 15 | TEGRA_GPIO(H, 5) 16 | diff --git a/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0000-a02.dtsi b/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0000-a02.dtsi 17 | index b226e1a..68f451c 100755 18 | --- a/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0000-a02.dtsi 19 | +++ b/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0000-a02.dtsi 20 | @@ -825,7 +825,7 @@ 21 | 22 | spi1_mosi_pc0 { 23 | nvidia,pins = "spi1_mosi_pc0"; 24 | - nvidia,function = "rsvd1"; 25 | + nvidia,function = "spi1"; 26 | nvidia,pull = ; 27 | nvidia,tristate = ; 28 | nvidia,enable-input = ; 29 | @@ -833,7 +833,7 @@ 30 | 31 | spi1_miso_pc1 { 32 | nvidia,pins = "spi1_miso_pc1"; 33 | - nvidia,function = "rsvd1"; 34 | + nvidia,function = "spi1"; 35 | nvidia,pull = ; 36 | nvidia,tristate = ; 37 | nvidia,enable-input = ; 38 | @@ -841,7 +841,7 @@ 39 | 40 | spi1_sck_pc2 { 41 | nvidia,pins = "spi1_sck_pc2"; 42 | - nvidia,function = "rsvd1"; 43 | + nvidia,function = "spi1"; 44 | nvidia,pull = ; 45 | nvidia,tristate = ; 46 | nvidia,enable-input = ; 47 | @@ -849,7 +849,7 @@ 48 | 49 | spi1_cs0_pc3 { 50 | nvidia,pins = "spi1_cs0_pc3"; 51 | - nvidia,function = "rsvd1"; 52 | + nvidia,function = "spi1"; 53 | nvidia,pull = ; 54 | nvidia,tristate = ; 55 | nvidia,enable-input = ; 56 | diff --git a/kernel-dts/tegra210-porg-p3448-common.dtsi b/kernel-dts/tegra210-porg-p3448-common.dtsi 57 | index 79e916f..6bea53c 100644 58 | --- a/kernel-dts/tegra210-porg-p3448-common.dtsi 59 | +++ b/kernel-dts/tegra210-porg-p3448-common.dtsi 60 | @@ -203,6 +203,22 @@ 61 | 62 | spi@7000d400 { /* SPI 1 to 40 pin header */ 63 | status = "okay"; 64 | + num-cs = <1>; 65 | + cs-gpios = <&gpio TEGRA_GPIO(C, 3) GPIO_ACTIVE_LOW>; 66 | + spi0_0 { 67 | + #address-cells = <0x1>; 68 | + #size-cells = <0x0>; 69 | + compatible = "spidev"; 70 | + status = "okay"; 71 | + reg = <0>; 72 | + spi-max-frequency = <65000000>; 73 | + controller-data { 74 | + nvidia,cs-setup-clk-count = <0x1e>; 75 | + nvidia,cs-hold-clk-count = <0x1e>; 76 | + nvidia,rx-clk-tap-delay = <0x1f>; 77 | + nvidia,tx-clk-tap-delay = <0x0>; 78 | + }; 79 | + }; 80 | }; 81 | 82 | spi@7000d600 { /* SPI 2 to 40 pin header */ 83 | -------------------------------------------------------------------------------- /spi/l4t-sources-u-boot-spidev0-0.patch: -------------------------------------------------------------------------------- 1 | diff --git a/board/nvidia/p3450-porg/pinmux-config-p3450-porg.h b/board/nvidia/p3450-porg/pinmux-config-p3450-porg.h 2 | index 49df131335..0b56a315c1 100644 3 | --- a/board/nvidia/p3450-porg/pinmux-config-p3450-porg.h 4 | +++ b/board/nvidia/p3450-porg/pinmux-config-p3450-porg.h 5 | @@ -34,10 +34,6 @@ static const struct tegra_gpio_config p3450_porg_gpio_inits[] = { 6 | GPIO_INIT(B, 5, IN), 7 | GPIO_INIT(B, 6, IN), 8 | GPIO_INIT(B, 7, IN), 9 | - GPIO_INIT(C, 0, IN), 10 | - GPIO_INIT(C, 1, IN), 11 | - GPIO_INIT(C, 2, IN), 12 | - GPIO_INIT(C, 3, IN), 13 | GPIO_INIT(C, 4, IN), 14 | GPIO_INIT(E, 6, IN), 15 | GPIO_INIT(G, 2, IN), 16 | -------------------------------------------------------------------------------- /spi/tegra210-p3448-0000-p3449-0000-a02-spidev-0.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtjoseph/jetson-nano-support/13678f66116b7994fb42221afd81bd370b2dcf2b/spi/tegra210-p3448-0000-p3449-0000-a02-spidev-0.dtb -------------------------------------------------------------------------------- /spi/u-boot-spidev0-0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtjoseph/jetson-nano-support/13678f66116b7994fb42221afd81bd370b2dcf2b/spi/u-boot-spidev0-0.bin --------------------------------------------------------------------------------