├── README.md └── RESOURCES ├── buildroot ├── dl-file-list.txt ├── eale-gpio-app │ ├── Makefile │ └── eale-gpio-app.c ├── genimage.cfg ├── overlay │ └── etc │ │ ├── init.d │ │ └── S30usbgadget │ │ └── network │ │ └── interfaces ├── patches │ ├── linux │ │ └── 0001-Stripped-back-pocketbeagle-devicetree.patch │ └── uboot │ │ ├── 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch │ │ ├── 0002-U-Boot-BeagleBone-Cape-Manager.patch │ │ └── 0003-pocketbeagle-tweaks.patch ├── post-image.sh └── uEnv.txt ├── common └── linux-headers-4.9.82-ti-r102_1stretch_armhf.deb ├── debugging ├── Makefile ├── debug-labs.tar.gz └── pocket-debs.tar.gz ├── i2c-drivers ├── Makefile ├── README ├── i2c-accel.dts ├── i2c-accel.sh ├── i2c-foo.dts ├── i2c-foo.sh ├── lab1.c └── lab2.c ├── modules-kbuild ├── Makefile ├── lab1.c ├── lab2_1.c ├── lab2_2.c └── red-module.c ├── pocketbeagle ├── BaconCapeLabs.pdf ├── Makefile ├── README.md ├── i2c-accel.dts ├── i2c-accel.sh ├── js-spi-write-digit │ ├── README.md │ ├── write-digit.js │ └── writeDigitTest.js ├── pwm.js ├── rgb.pru0c ├── run-rgb-pru0.sh ├── shiftout.js └── spidev.sh ├── spi-drivers ├── Makefile ├── lab1.c ├── sparkle.sh ├── spi-gpio.dts ├── spi-gpio.sh ├── spi_test.c └── write-digit.sh ├── u-boot └── Makefile ├── usb-subsystem ├── lab_1 │ └── acm_setup.sh ├── lab_2 │ ├── ffs-test │ │ ├── Makefile │ │ ├── ffs-test.c │ │ └── le_byteshift.h │ └── ffs_setup.sh └── lab_3 │ └── libusb_test │ ├── Makefile │ └── test.c ├── yocto-images └── Makefile └── yocto-intro └── Makefile /README.md: -------------------------------------------------------------------------------- 1 | You can find supporting files for the respective E-ALE talks as follows: 2 | 3 | * RESOURCES/ 4 | - pocketbeagle 5 | - modules-kbuild 6 | - u-boot 7 | - usb-subsystem 8 | - debugging 9 | - i2c-drivers 10 | - spi-drivers 11 | - yocto-intro 12 | - buildroot 13 | - yocto-images 14 | 15 | These directories will be tarred up and made available to attendees 16 | -------------------------------------------------------------------------------- /RESOURCES/buildroot/dl-file-list.txt: -------------------------------------------------------------------------------- 1 | acl-2.2.52.src.tar.gz 2 | attr-2.4.47.src.tar.gz 3 | busybox-1.27.2.tar.bz2 4 | confuse-3.2.tar.xz 5 | dosfstools-4.1.tar.xz 6 | dropbear-2017.75.tar.bz2 7 | e2fsprogs-1.43.9.tar.xz 8 | fakeroot_1.20.2.orig.tar.bz2 9 | gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf.tar.xz 10 | genimage-9.tar.xz 11 | kmod-24.tar.xz 12 | libgpiod-0.3.2.tar.xz 13 | linux-4.14.tar.xz 14 | mtools-4.0.18.tar.bz2 15 | patchelf-0.9.tar.bz2 16 | pkgconf-0.9.12.tar.bz2 17 | u-boot-2018.01.tar.bz2 18 | util-linux-2.31.1.tar.xz 19 | zlib-1.2.11.tar.xz 20 | -------------------------------------------------------------------------------- /RESOURCES/buildroot/eale-gpio-app/Makefile: -------------------------------------------------------------------------------- 1 | OBJS = eale-gpio-app.o 2 | LIBS = -lgpiod 3 | 4 | all: eale-gpio-app 5 | 6 | eale-gpio-app: $(OBJS) 7 | $(CC) -o $@ $< $(LIBS) 8 | 9 | install: 10 | install -D -m 0755 eale-gpio-app $(DESTDIR)/usr/bin/eale-gpio-app 11 | -------------------------------------------------------------------------------- /RESOURCES/buildroot/eale-gpio-app/eale-gpio-app.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define NGPIOS 6 6 | 7 | int main(void) 8 | { 9 | struct gpiod_chip *chip; 10 | struct gpiod_line *lines[NGPIOS]; 11 | int ret; 12 | int i; 13 | 14 | chip = gpiod_chip_open("/dev/gpiochip4"); 15 | assert(chip != NULL); 16 | 17 | for (i = 0; i < NGPIOS; i++) { 18 | lines[i] = gpiod_chip_get_line(chip, i); 19 | assert(lines[i] != NULL); 20 | 21 | ret = gpiod_line_request_output(lines[i], "eale-app", 22 | false, 1); 23 | assert(ret == 0); 24 | } 25 | 26 | i = 0; 27 | while(1) { 28 | struct timespec ts = { .tv_nsec = 200 * 1000 * 1000 }; 29 | gpiod_line_set_value(lines[i], 0); 30 | nanosleep(&ts, NULL); 31 | gpiod_line_set_value(lines[i], 1); 32 | if (++i == NGPIOS) 33 | i = 0; 34 | } 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /RESOURCES/buildroot/genimage.cfg: -------------------------------------------------------------------------------- 1 | image boot.vfat { 2 | vfat { 3 | files = { 4 | "MLO", 5 | "u-boot.img", 6 | "zImage", 7 | "uEnv.txt", 8 | "am335x-pocketbeagle.dtb", 9 | } 10 | } 11 | size = 16M 12 | } 13 | 14 | image sdcard.img { 15 | hdimage { 16 | } 17 | 18 | partition u-boot { 19 | partition-type = 0xC 20 | bootable = "true" 21 | image = "boot.vfat" 22 | } 23 | 24 | partition rootfs { 25 | partition-type = 0x83 26 | image = "rootfs.ext4" 27 | size = 512M 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /RESOURCES/buildroot/overlay/etc/init.d/S30usbgadget: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | GADGET_DIR=/config/usb_gadget/g1 6 | OLDPWD=$(pwd) 7 | 8 | printf "Starting USB gadget: " 9 | 10 | modprobe cppi41 11 | modprobe musb-am335x 12 | modprobe musb-dsps 13 | modprobe phy-am335x 14 | modprobe libcomposite 15 | 16 | mkdir /config 17 | mount -t configfs none /config 18 | mkdir ${GADGET_DIR} 19 | cd ${GADGET_DIR} 20 | echo "0x05e8" > idVendor 21 | echo "0xa4a1" > idProduct 22 | mkdir strings/0x409 23 | echo "serialnumber" > strings/0x409/serialnumber 24 | echo "manufacturer" > strings/0x409/manufacturer 25 | echo "ECM Gadget" > strings/0x409/product 26 | mkdir functions/ecm.usb0 27 | mkdir configs/c.1 28 | mkdir configs/c.1/strings/0x409 29 | echo Conf 1 > configs/c.1/strings/0x409/configuration 30 | echo 120 > configs/c.1/MaxPower 31 | ln -s functions/ecm.usb0 configs/c.1 32 | echo musb-hdrc.0 > UDC 33 | cd ${OLDPWD} 34 | 35 | echo "OK" 36 | -------------------------------------------------------------------------------- /RESOURCES/buildroot/overlay/etc/network/interfaces: -------------------------------------------------------------------------------- 1 | auto lo 2 | iface lo inet loopback 3 | 4 | auto usb0 5 | iface usb0 inet static 6 | address 192.168.42.2 7 | netmask 255.255.255.0 8 | -------------------------------------------------------------------------------- /RESOURCES/buildroot/patches/linux/0001-Stripped-back-pocketbeagle-devicetree.patch: -------------------------------------------------------------------------------- 1 | diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile 2 | index eff87a3..5a5b055 100644 3 | --- a/arch/arm/boot/dts/Makefile 4 | +++ b/arch/arm/boot/dts/Makefile 5 | @@ -629,6 +629,7 @@ dtb-$(CONFIG_SOC_AM33XX) += \ 6 | am335x-nano.dtb \ 7 | am335x-pepper.dtb \ 8 | am335x-phycore-rdk.dtb \ 9 | + am335x-pocketbeagle.dtb \ 10 | am335x-shc.dtb \ 11 | am335x-sbc-t335.dtb \ 12 | am335x-sl50.dtb \ 13 | diff --git a/arch/arm/boot/dts/am335x-pocketbeagle-common.dtsi b/arch/arm/boot/dts/am335x-pocketbeagle-common.dtsi 14 | new file mode 100644 15 | index 0000000..f9269d6 16 | --- /dev/null 17 | +++ b/arch/arm/boot/dts/am335x-pocketbeagle-common.dtsi 18 | @@ -0,0 +1,373 @@ 19 | +/* 20 | + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ 21 | + * 22 | + * This program is free software; you can redistribute it and/or modify 23 | + * it under the terms of the GNU General Public License version 2 as 24 | + * published by the Free Software Foundation. 25 | + */ 26 | + 27 | +#include "am33xx.dtsi" 28 | + 29 | +/ { 30 | + model = "TI AM335x PocketBeagle"; 31 | + compatible = "ti,am335x-pocketbeagle", "ti,am335x-bone", "ti,am33xx"; 32 | + 33 | + cpus { 34 | + cpu@0 { 35 | + cpu0-supply = <&dcdc2_reg>; 36 | + }; 37 | + }; 38 | + 39 | + memory@80000000 { 40 | + device_type = "memory"; 41 | + reg = <0x80000000 0x20000000>; /* 512 MB */ 42 | + }; 43 | + 44 | + chosen { 45 | + stdout-path = &uart0; 46 | + }; 47 | + 48 | + leds { 49 | + pinctrl-names = "default", "sleep"; 50 | + pinctrl-0 = <&user_leds_default>; 51 | + pinctrl-1 = <&user_leds_sleep>; 52 | + 53 | + compatible = "gpio-leds"; 54 | + 55 | + led@2 { 56 | + label = "beaglebone:green:usr0"; 57 | + gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>; 58 | + linux,default-trigger = "heartbeat"; 59 | + default-state = "off"; 60 | + }; 61 | + 62 | + led@3 { 63 | + label = "beaglebone:green:usr1"; 64 | + gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>; 65 | + linux,default-trigger = "mmc0"; 66 | + default-state = "off"; 67 | + }; 68 | + 69 | + led@4 { 70 | + label = "beaglebone:green:usr2"; 71 | + gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; 72 | + linux,default-trigger = "cpu0"; 73 | + default-state = "off"; 74 | + }; 75 | + 76 | + led@5 { 77 | + label = "beaglebone:green:usr3"; 78 | + gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>; 79 | + linux,default-trigger = "mmc1"; 80 | + default-state = "off"; 81 | + }; 82 | + }; 83 | + 84 | + vmmcsd_fixed: fixedregulator0 { 85 | + compatible = "regulator-fixed"; 86 | + regulator-name = "vmmcsd_fixed"; 87 | + regulator-min-microvolt = <3300000>; 88 | + regulator-max-microvolt = <3300000>; 89 | + }; 90 | +}; 91 | + 92 | +&cpu0_opp_table { 93 | + /* 94 | + * All PG 2.0 silicon may not support 1GHz but some of the early 95 | + * BeagleBone Blacks have PG 2.0 silicon which is guaranteed 96 | + * to support 1GHz OPP so enable it for PG 2.0 on this board. 97 | + */ 98 | + oppnitro-1000000000 { 99 | + opp-supported-hw = <0x06 0x0100>; 100 | + }; 101 | +}; 102 | + 103 | +&am33xx_pinmux { 104 | + user_leds_default: user_leds_default { 105 | + pinctrl-single,pins = < 106 | + AM33XX_IOPAD(0x0854, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a5.gpio1_21 */ 107 | + AM33XX_IOPAD(0x0858, PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_a6.gpio1_22 */ 108 | + AM33XX_IOPAD(0x085c, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a7.gpio1_23 */ 109 | + AM33XX_IOPAD(0x0860, PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_a8.gpio1_24 */ 110 | + >; 111 | + }; 112 | + 113 | + user_leds_sleep: user_leds_sleep { 114 | + pinctrl-single,pins = < 115 | + AM33XX_IOPAD(0x0854, PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_a5.gpio1_21 */ 116 | + AM33XX_IOPAD(0x0858, PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_a6.gpio1_22 */ 117 | + AM33XX_IOPAD(0x085c, PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_a7.gpio1_23 */ 118 | + AM33XX_IOPAD(0x0860, PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_a8.gpio1_24 */ 119 | + >; 120 | + }; 121 | + 122 | + i2c0_pins: pinmux_i2c0_pins { 123 | + pinctrl-single,pins = < 124 | + AM33XX_IOPAD(0x0988, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */ 125 | + AM33XX_IOPAD(0x098c, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */ 126 | + >; 127 | + }; 128 | + 129 | + mmc0_pins: pinmux_mmc0_pins { 130 | + pinctrl-single,pins = < 131 | + AM33XX_IOPAD(0x0960, PIN_INPUT | MUX_MODE7) /* GPIO0_6 */ 132 | + >; 133 | + }; 134 | + 135 | + spi1_pins: pinmux_spi1_pins { 136 | + pinctrl-single,pins = < 137 | + AM33XX_IOPAD(0x096c, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE4) /* uart0_rtsn.spi1_d1 */ 138 | + AM33XX_IOPAD(0x0968, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE4) /* uart0_ctsn.spi1_d0 */ 139 | + AM33XX_IOPAD(0x0964, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE4) /* eCAP0_in_PWM0_out.spi1_sclk */ 140 | + AM33XX_IOPAD(0x09b0, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE4) /* xdma_event_intr0.spi1_cs1 */ 141 | + >; 142 | + }; 143 | +}; 144 | + 145 | +&uart0 { 146 | + status = "okay"; 147 | + pinctrl-names = "default"; 148 | + pinctrl-0 = <>; 149 | +}; 150 | + 151 | +&uart1 { 152 | + status = "okay"; 153 | + pinctrl-names = "default"; 154 | + pinctrl-0 = <>; 155 | +}; 156 | + 157 | +&uart2 { 158 | + status = "okay"; 159 | + pinctrl-names = "default"; 160 | + pinctrl-0 = <>; 161 | +}; 162 | + 163 | +&uart4 { 164 | + status = "okay"; 165 | + pinctrl-names = "default"; 166 | + pinctrl-0 = <>; 167 | +}; 168 | + 169 | +&usb { 170 | + status = "okay"; 171 | +}; 172 | + 173 | +&usb_ctrl_mod { 174 | + status = "okay"; 175 | +}; 176 | + 177 | +&usb0_phy { 178 | + status = "okay"; 179 | +}; 180 | + 181 | +&usb0 { 182 | + status = "okay"; 183 | + dr_mode = "otg"; 184 | +}; 185 | + 186 | +&usb1_phy { 187 | + status = "okay"; 188 | +}; 189 | + 190 | +&usb1 { 191 | + status = "okay"; 192 | + dr_mode = "host"; 193 | +}; 194 | + 195 | +&cppi41dma { 196 | + status = "okay"; 197 | +}; 198 | + 199 | +&i2c0 { 200 | + pinctrl-names = "default"; 201 | + pinctrl-0 = <&i2c0_pins>; 202 | + 203 | + status = "okay"; 204 | + clock-frequency = <400000>; 205 | + 206 | + tps: tps@24 { 207 | + reg = <0x24>; 208 | + }; 209 | + 210 | + baseboard_eeprom: baseboard_eeprom@50 { 211 | + compatible = "atmel,24c256"; 212 | + reg = <0x50>; 213 | + 214 | + #address-cells = <1>; 215 | + #size-cells = <1>; 216 | + baseboard_data: baseboard_data@0 { 217 | + reg = <0 0x100>; 218 | + }; 219 | + }; 220 | +}; 221 | + 222 | +&i2c1 { 223 | + #address-cells = <1>; 224 | + #size-cells = <0>; 225 | + status = "okay"; 226 | + clock-frequency = <400000>; 227 | +}; 228 | + 229 | +&i2c2 { 230 | + #address-cells = <1>; 231 | + #size-cells = <0>; 232 | + status = "okay"; 233 | + clock-frequency = <400000>; 234 | +}; 235 | + 236 | +/include/ "tps65217.dtsi" 237 | + 238 | +&tps { 239 | + /* 240 | + * Configure pmic to enter OFF-state instead of SLEEP-state ("RTC-only 241 | + * mode") at poweroff. Most BeagleBone versions do not support RTC-only 242 | + * mode and risk hardware damage if this mode is entered. 243 | + * 244 | + * For details, see linux-omap mailing list May 2015 thread 245 | + * [PATCH] ARM: dts: am335x-bone* enable pmic-shutdown-controller 246 | + * In particular, messages: 247 | + * http://www.spinics.net/lists/linux-omap/msg118585.html 248 | + * http://www.spinics.net/lists/linux-omap/msg118615.html 249 | + * 250 | + * You can override this later with 251 | + * &tps { /delete-property/ ti,pmic-shutdown-controller; } 252 | + * if you want to use RTC-only mode and made sure you are not affected 253 | + * by the hardware problems. (Tip: double-check by performing a current 254 | + * measurement after shutdown: it should be less than 1 mA.) 255 | + */ 256 | + 257 | + interrupts = <7>; /* NMI */ 258 | + interrupt-parent = <&intc>; 259 | + 260 | + ti,pmic-shutdown-controller; 261 | + 262 | + charger { 263 | + status = "okay"; 264 | + }; 265 | + 266 | + pwrbutton { 267 | + status = "okay"; 268 | + }; 269 | + 270 | + regulators { 271 | + dcdc1_reg: regulator@0 { 272 | + regulator-name = "vdds_dpr"; 273 | + regulator-always-on; 274 | + }; 275 | + 276 | + dcdc2_reg: regulator@1 { 277 | + /* VDD_MPU voltage limits 0.95V - 1.26V with +/-4% tolerance */ 278 | + regulator-name = "vdd_mpu"; 279 | + regulator-min-microvolt = <925000>; 280 | + regulator-max-microvolt = <1351500>; 281 | + regulator-boot-on; 282 | + regulator-always-on; 283 | + }; 284 | + 285 | + dcdc3_reg: regulator@2 { 286 | + /* VDD_CORE voltage limits 0.95V - 1.1V with +/-4% tolerance */ 287 | + regulator-name = "vdd_core"; 288 | + regulator-min-microvolt = <925000>; 289 | + regulator-max-microvolt = <1150000>; 290 | + regulator-boot-on; 291 | + regulator-always-on; 292 | + }; 293 | + 294 | + ldo1_reg: regulator@3 { 295 | + regulator-name = "vio,vrtc,vdds"; 296 | + regulator-always-on; 297 | + }; 298 | + 299 | + ldo2_reg: regulator@4 { 300 | + regulator-name = "vdd_3v3aux"; 301 | + regulator-always-on; 302 | + }; 303 | + 304 | + ldo3_reg: regulator@5 { 305 | + regulator-name = "vdd_1v8"; 306 | + regulator-min-microvolt = <1800000>; 307 | + regulator-max-microvolt = <1800000>; 308 | + regulator-always-on; 309 | + }; 310 | + 311 | + ldo4_reg: regulator@6 { 312 | + regulator-name = "vdd_3v3a"; 313 | + regulator-always-on; 314 | + }; 315 | + }; 316 | +}; 317 | + 318 | +&tscadc { 319 | + status = "okay"; 320 | + adc { 321 | + ti,adc-channels = <0 1 2 3 4 5 6 7>; 322 | + ti,chan-step-avg = <0x16 0x16 0x16 0x16 0x16 0x16 0x16 0x16>; 323 | + ti,chan-step-opendelay = <0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98>; 324 | + ti,chan-step-sampledelay = <0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0>; 325 | + }; 326 | +}; 327 | + 328 | +&mmc1 { 329 | + status = "okay"; 330 | + vmmc-supply = <&vmmcsd_fixed>; 331 | + bus-width = <4>; 332 | + pinctrl-names = "default"; 333 | + pinctrl-0 = <&mmc0_pins>; 334 | + cd-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; 335 | +}; 336 | + 337 | +&aes { 338 | + status = "okay"; 339 | +}; 340 | + 341 | +&sham { 342 | + status = "okay"; 343 | +}; 344 | + 345 | +&rtc { 346 | + clocks = <&clk_32768_ck>, <&clkdiv32k_ick>; 347 | + clock-names = "ext-clk", "int-clk"; 348 | + system-power-controller; 349 | +}; 350 | + 351 | +&epwmss0 { 352 | + status = "okay"; 353 | +}; 354 | + 355 | +&ehrpwm0 { 356 | + status = "okay"; 357 | + pinctrl-names = "default"; 358 | + pinctrl-0 = <>; 359 | +}; 360 | + 361 | +&epwmss1 { 362 | + status = "okay"; 363 | +}; 364 | + 365 | +&ehrpwm1 { 366 | + status = "okay"; 367 | + pinctrl-names = "default"; 368 | + pinctrl-0 = <>; 369 | +}; 370 | + 371 | +&epwmss2 { 372 | + status = "okay"; 373 | +}; 374 | + 375 | +&ehrpwm2 { 376 | + status = "okay"; 377 | + pinctrl-names = "default"; 378 | + pinctrl-0 = <>; 379 | +}; 380 | + 381 | +&dcan0 { 382 | + status = "okay"; 383 | + pinctrl-names = "default"; 384 | + pinctrl-0 = <>; 385 | +}; 386 | + 387 | +&dcan1 { 388 | + status = "okay"; 389 | + pinctrl-names = "default"; 390 | + pinctrl-0 = <>; 391 | +}; 392 | diff --git a/arch/arm/boot/dts/am335x-pocketbeagle.dts b/arch/arm/boot/dts/am335x-pocketbeagle.dts 393 | new file mode 100644 394 | index 0000000..11d3f90 395 | --- /dev/null 396 | +++ b/arch/arm/boot/dts/am335x-pocketbeagle.dts 397 | @@ -0,0 +1,81 @@ 398 | +/* 399 | + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ 400 | + * 401 | + * This program is free software; you can redistribute it and/or modify 402 | + * it under the terms of the GNU General Public License version 2 as 403 | + * published by the Free Software Foundation. 404 | + */ 405 | +/dts-v1/; 406 | + 407 | +#include "am33xx.dtsi" 408 | +#include "am335x-pocketbeagle-common.dtsi" 409 | + 410 | +&am33xx_pinmux { 411 | + mma8452_pins: mma8452_pins_default { 412 | + pinctrl-single,pins = < 413 | + AM33XX_IOPAD(0x9a0, PIN_INPUT_PULLUP | MUX_MODE7) /* mcasp0_aclkr.gpio3[18] */ 414 | + >; 415 | + }; 416 | +}; 417 | + 418 | +&spi0 { 419 | + #address-cells = <1>; 420 | + #size-cells = <0>; 421 | + status = "okay"; 422 | + 423 | + channel@0 { 424 | + #address-cells = <1>; 425 | + #size-cells = <0>; 426 | + compatible = "spidev"; 427 | + reg = <0>; 428 | + spi-max-frequency = <24000000>; 429 | + }; 430 | + 431 | + channel@1 { 432 | + #address-cells = <1>; 433 | + #size-cells = <0>; 434 | + compatible = "spidev"; 435 | + reg = <1>; 436 | + spi-max-frequency = <24000000>; 437 | + status = "disabled"; 438 | + }; 439 | +}; 440 | + 441 | +&spi1 { 442 | + #address-cells = <1>; 443 | + #size-cells = <0>; 444 | + status = "okay"; 445 | + 446 | + pinctrl-names = "default"; 447 | + pinctrl-0 = <&spi1_pins>; 448 | + 449 | + mcp23s18@1 { 450 | + #address-cells = <1>; 451 | + #size-cells = <1>; 452 | + compatible = "microchip,mcp23s18"; 453 | + gpio-controller; 454 | + microchip,spi-present-mask = <0x01>; 455 | + reg = <1>; 456 | + spi-max-frequency = <1000000>; 457 | + }; 458 | +}; 459 | + 460 | +&i2c2 { 461 | + #address-cells = <1>; 462 | + #size-cells = <0>; 463 | + status = "okay"; 464 | + clock-frequency = <400000>; 465 | + 466 | + pinctrl-names = "default"; 467 | + pinctrl-0 = <&mma8452_pins>; 468 | + 469 | + mma8452@1c { 470 | + compatible = "fsl,mma8452"; 471 | + reg = <0x1c>; 472 | + interrupt-parent = <&gpio3>; 473 | + interrupts = <18 0>; 474 | + interrupt-names = "INT2"; 475 | + }; 476 | +}; 477 | + 478 | + 479 | -------------------------------------------------------------------------------- /RESOURCES/buildroot/patches/uboot/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch: -------------------------------------------------------------------------------- 1 | From fcf74906abe2a13a54b90ba45a3523a0d3855a0f Mon Sep 17 00:00:00 2001 2 | From: Robert Nelson 3 | Date: Sat, 20 Jan 2018 12:43:22 -0600 4 | Subject: [PATCH] am335x_evm: uEnv.txt, bootz, n fixes 5 | 6 | Signed-off-by: Robert Nelson 7 | --- 8 | board/ti/am335x/board.c | 120 +++- 9 | board/ti/am335x/board.h | 48 +- 10 | board/ti/am335x/mux.c | 18 +- 11 | configs/am335x_boneblack_defconfig | 7 +- 12 | configs/am335x_evm_defconfig | 36 +- 13 | configs/am335x_pocketbeagle_defconfig | 1055 +++++++++++++++++++++++++++++++++ 14 | fs/btrfs/compression.c | 5 +- 15 | fs/btrfs/hash.c | 3 +- 16 | fs/ext4/ext4_common.c | 2 +- 17 | include/configs/am335x_evm.h | 101 +++- 18 | include/configs/ti_am335x_common.h | 2 + 19 | include/configs/ti_armv7_common.h | 299 ++++++++++ 20 | include/environment/ti/mmc.h | 67 ++- 21 | 13 files changed, 1685 insertions(+), 78 deletions(-) 22 | create mode 100644 configs/am335x_pocketbeagle_defconfig 23 | 24 | diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c 25 | index 1a52bffc00..8a41a03e7a 100644 26 | --- a/board/ti/am335x/board.c 27 | +++ b/board/ti/am335x/board.c 28 | @@ -84,6 +84,8 @@ struct serial_device *default_serial_console(void) 29 | { 30 | if (board_is_icev2()) 31 | return &eserial4_device; 32 | + else if (board_is_beaglelogic()) 33 | + return &eserial5_device; 34 | else 35 | return &eserial1_device; 36 | } 37 | @@ -264,7 +266,7 @@ const struct dpll_params *get_dpll_ddr_params(void) 38 | 39 | if (board_is_evm_sk()) 40 | return &dpll_ddr3_303MHz[ind]; 41 | - else if (board_is_bone_lt() || board_is_icev2()) 42 | + else if (board_is_pb() || board_is_bone_lt() || board_is_icev2() || board_is_beaglelogic()) 43 | return &dpll_ddr3_400MHz[ind]; 44 | else if (board_is_evm_15_or_later()) 45 | return &dpll_ddr3_303MHz[ind]; 46 | @@ -274,7 +276,7 @@ const struct dpll_params *get_dpll_ddr_params(void) 47 | 48 | static u8 bone_not_connected_to_ac_power(void) 49 | { 50 | - if (board_is_bone()) { 51 | + if (board_is_bone() && !board_is_pb()) { 52 | uchar pmic_status_reg; 53 | if (tps65217_reg_read(TPS65217_STATUS, 54 | &pmic_status_reg)) 55 | @@ -295,7 +297,7 @@ const struct dpll_params *get_dpll_mpu_params(void) 56 | if (bone_not_connected_to_ac_power()) 57 | freq = MPUPLL_M_600; 58 | 59 | - if (board_is_bone_lt()) 60 | + if (board_is_pb() || board_is_bone_lt() || board_is_beaglelogic()) 61 | freq = MPUPLL_M_1000; 62 | 63 | switch (freq) { 64 | @@ -324,7 +326,7 @@ static void scale_vcores_bone(int freq) 65 | * Only perform PMIC configurations if board rev > A1 66 | * on Beaglebone White 67 | */ 68 | - if (board_is_bone() && !strncmp(board_ti_get_rev(), "00A1", 4)) 69 | + if (!board_is_pb() && board_is_bone() && !strncmp(board_ti_get_rev(), "00A1", 4)) 70 | return; 71 | 72 | if (i2c_probe(TPS65217_CHIP_PM)) 73 | @@ -341,7 +343,7 @@ static void scale_vcores_bone(int freq) 74 | * Override what we have detected since we know if we have 75 | * a Beaglebone Black it supports 1GHz. 76 | */ 77 | - if (board_is_bone_lt()) 78 | + if (board_is_pb() || board_is_bone_lt() || board_is_beaglelogic()) 79 | freq = MPUPLL_M_1000; 80 | 81 | switch (freq) { 82 | @@ -387,9 +389,10 @@ static void scale_vcores_bone(int freq) 83 | 84 | /* 85 | * Set LDO3, LDO4 output voltage to 3.3V for Beaglebone. 86 | - * Set LDO3 to 1.8V and LDO4 to 3.3V for Beaglebone Black. 87 | + * Set LDO3 to 1.8V and LDO4 to 3.3V for Beaglebone Black 88 | + * and PocketBeagle. 89 | */ 90 | - if (board_is_bone()) { 91 | + if (board_is_bone() && !board_is_pb()) { 92 | if (tps65217_reg_write(TPS65217_PROT_LEVEL_2, 93 | TPS65217_DEFLS1, 94 | TPS65217_LDO_VOLTAGE_OUT_3_3, 95 | @@ -472,7 +475,11 @@ void scale_vcores(void) 96 | void set_uart_mux_conf(void) 97 | { 98 | #if CONFIG_CONS_INDEX == 1 99 | - enable_uart0_pin_mux(); 100 | + if (board_is_beaglelogic()) 101 | + enable_uart4_pin_mux(); 102 | + else 103 | + enable_uart0_pin_mux(); 104 | + 105 | #elif CONFIG_CONS_INDEX == 2 106 | enable_uart1_pin_mux(); 107 | #elif CONFIG_CONS_INDEX == 3 108 | @@ -542,7 +549,7 @@ void sdram_init(void) 109 | if (board_is_evm_sk()) 110 | config_ddr(303, &ioregs_evmsk, &ddr3_data, 111 | &ddr3_cmd_ctrl_data, &ddr3_emif_reg_data, 0); 112 | - else if (board_is_bone_lt()) 113 | + else if (board_is_pb() || board_is_bone_lt() || board_is_beaglelogic()) 114 | config_ddr(400, &ioregs_bonelt, 115 | &ddr3_beagleblack_data, 116 | &ddr3_beagleblack_cmd_ctrl_data, 117 | @@ -612,6 +619,24 @@ static struct clk_synth cdce913_data = { 118 | */ 119 | int board_init(void) 120 | { 121 | + u32 sys_reboot; 122 | + 123 | + sys_reboot = readl(PRM_RSTST); 124 | + if (sys_reboot & (1 << 9)) 125 | + puts("Reset Source: IcePick reset has occurred.\n"); 126 | + 127 | + if (sys_reboot & (1 << 5)) 128 | + puts("Reset Source: Global external warm reset has occurred.\n"); 129 | + 130 | + if (sys_reboot & (1 << 4)) 131 | + puts("Reset Source: watchdog reset has occurred.\n"); 132 | + 133 | + if (sys_reboot & (1 << 1)) 134 | + puts("Reset Source: Global warm SW reset has occurred.\n"); 135 | + 136 | + if (sys_reboot & (1 << 0)) 137 | + puts("Reset Source: Power-on reset has occurred.\n"); 138 | + 139 | #if defined(CONFIG_HW_WATCHDOG) 140 | hw_watchdog_init(); 141 | #endif 142 | @@ -708,6 +733,8 @@ int board_late_init(void) 143 | char *name = NULL; 144 | 145 | if (board_is_bone_lt()) { 146 | + puts("Board: BeagleBone Black\n"); 147 | + name = "A335BNLT"; 148 | /* BeagleBoard.org BeagleBone Black Wireless: */ 149 | if (!strncmp(board_ti_get_rev(), "BWA", 3)) { 150 | name = "BBBW"; 151 | @@ -720,10 +747,29 @@ int board_late_init(void) 152 | if (!strncmp(board_ti_get_rev(), "BLA", 3)) { 153 | name = "BBBL"; 154 | } 155 | + /* SanCloud BeagleBone Enhanced */ 156 | + if (!strncmp(board_ti_get_rev(), "SE", 2)) { 157 | + puts("Model: SanCloud BeagleBone Enhanced\n"); 158 | + name = "SBBE"; 159 | + } 160 | + /* Octavo Systems OSD3358-SM-RED */ 161 | + if (!strncmp(board_ti_get_rev(), "OS00", 4)) { 162 | + puts("Model: Octavo Systems OSD3358-SM-RED\n"); 163 | + name = "OS00"; 164 | + } 165 | } 166 | 167 | if (board_is_bbg1()) 168 | name = "BBG1"; 169 | + 170 | + if (board_is_pb()) { 171 | + puts("Model: BeagleBoard.org PocketBeagle\n"); 172 | + } 173 | + 174 | + if (board_is_beaglelogic()) { 175 | + puts("Model: BeagleLogic\n"); 176 | + } 177 | + 178 | set_board_info_env(name); 179 | 180 | /* 181 | @@ -859,28 +905,33 @@ int board_eth_init(bd_t *bis) 182 | (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD)) 183 | 184 | #ifdef CONFIG_DRIVER_TI_CPSW 185 | - if (board_is_bone() || board_is_bone_lt() || 186 | - board_is_idk()) { 187 | - writel(MII_MODE_ENABLE, &cdev->miisel); 188 | - cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if = 189 | - PHY_INTERFACE_MODE_MII; 190 | - } else if (board_is_icev2()) { 191 | - writel(RMII_MODE_ENABLE | RMII_CHIPCKL_ENABLE, &cdev->miisel); 192 | - cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RMII; 193 | - cpsw_slaves[1].phy_if = PHY_INTERFACE_MODE_RMII; 194 | - cpsw_slaves[0].phy_addr = 1; 195 | - cpsw_slaves[1].phy_addr = 3; 196 | - } else { 197 | - writel((RGMII_MODE_ENABLE | RGMII_INT_DELAY), &cdev->miisel); 198 | - cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if = 199 | - PHY_INTERFACE_MODE_RGMII; 200 | - } 201 | + if (!board_is_pb()) { 202 | + if (board_is_bone() || (board_is_bone_lt() && !board_is_bone_lt_enhanced() && !board_is_m10a()) || 203 | + board_is_idk() || board_is_beaglelogic()) { 204 | + puts("eth0: MII MODE\n"); 205 | + writel(MII_MODE_ENABLE, &cdev->miisel); 206 | + cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if = 207 | + PHY_INTERFACE_MODE_MII; 208 | + } else if (board_is_icev2()) { 209 | + puts("eth0: icev2: RGMII MODE\n"); 210 | + writel(RMII_MODE_ENABLE | RMII_CHIPCKL_ENABLE, &cdev->miisel); 211 | + cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RMII; 212 | + cpsw_slaves[1].phy_if = PHY_INTERFACE_MODE_RMII; 213 | + cpsw_slaves[0].phy_addr = 1; 214 | + cpsw_slaves[1].phy_addr = 3; 215 | + } else { 216 | + puts("eth0: RGMII MODE\n"); 217 | + writel((RGMII_MODE_ENABLE | RGMII_INT_DELAY), &cdev->miisel); 218 | + cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if = 219 | + PHY_INTERFACE_MODE_RGMII; 220 | + } 221 | 222 | - rv = cpsw_register(&cpsw_data); 223 | - if (rv < 0) 224 | - printf("Error %d registering CPSW switch\n", rv); 225 | - else 226 | - n += rv; 227 | + rv = cpsw_register(&cpsw_data); 228 | + if (rv < 0) 229 | + printf("Error %d registering CPSW switch\n", rv); 230 | + else 231 | + n += rv; 232 | + } 233 | #endif 234 | 235 | /* 236 | @@ -895,7 +946,7 @@ int board_eth_init(bd_t *bis) 237 | #define AR8051_DEBUG_RGMII_CLK_DLY_REG 0x5 238 | #define AR8051_RGMII_TX_CLK_DLY 0x100 239 | 240 | - if (board_is_evm_sk() || board_is_gp_evm()) { 241 | + if (board_is_evm_sk() || board_is_gp_evm() || board_is_bone_lt_enhanced() || board_is_m10a()) { 242 | const char *devname; 243 | devname = miiphy_get_current_dev(); 244 | 245 | @@ -925,8 +976,15 @@ int board_eth_init(bd_t *bis) 246 | #ifdef CONFIG_SPL_LOAD_FIT 247 | int board_fit_config_name_match(const char *name) 248 | { 249 | + //FIME: we currently dont use this, yet... 250 | if (board_is_gp_evm() && !strcmp(name, "am335x-evm")) 251 | return 0; 252 | + else if (board_is_pb() && !strcmp(name, "am335x-pocketbeagle")) 253 | + return 0; 254 | + else if (board_is_beaglelogic() && !strcmp(name, "am335x-beaglelogic")) 255 | + return 0; 256 | + else if (board_is_os00() && !strcmp(name, "am335x-boneblack")) 257 | + return 0; 258 | else if (board_is_bone() && !strcmp(name, "am335x-bone")) 259 | return 0; 260 | else if (board_is_bone_lt() && !strcmp(name, "am335x-boneblack")) 261 | diff --git a/board/ti/am335x/board.h b/board/ti/am335x/board.h 262 | index e13fcff02a..6f96532bac 100644 263 | --- a/board/ti/am335x/board.h 264 | +++ b/board/ti/am335x/board.h 265 | @@ -24,6 +24,16 @@ 266 | #define EMIF_OCP_CONFIG_BEAGLEBONE_BLACK 0x00141414 267 | #define EMIF_OCP_CONFIG_AM335X_EVM 0x003d3d3d 268 | 269 | +static inline int board_is_pb(void) 270 | +{ 271 | + return board_ti_is("A335PBGL"); 272 | +} 273 | + 274 | +static inline int board_is_beaglelogic(void) 275 | +{ 276 | + return board_ti_is("A335BLGC"); 277 | +} 278 | + 279 | static inline int board_is_bone(void) 280 | { 281 | return board_ti_is("A335BONE"); 282 | @@ -34,14 +44,50 @@ static inline int board_is_bone_lt(void) 283 | return board_ti_is("A335BNLT"); 284 | } 285 | 286 | +static inline int board_is_bbbw(void) 287 | +{ 288 | + return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "BW", 2); 289 | +} 290 | + 291 | +static inline int board_is_blue(void) 292 | +{ 293 | + return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "BLA", 3); 294 | +} 295 | + 296 | static inline int board_is_bbg1(void) 297 | { 298 | return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "BBG1", 4); 299 | } 300 | 301 | +static inline int board_is_bone_lt_enhanced(void) 302 | +{ 303 | + return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "SE", 2); 304 | +} 305 | + 306 | +static inline int board_is_m10a(void) 307 | +{ 308 | + return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "M10A", 4); 309 | +} 310 | + 311 | +//Element14 BeagleBone Black Industrial: 312 | +static inline int board_is_e14bbbi(void) 313 | +{ 314 | + return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "EIA0", 4); 315 | +} 316 | + 317 | +static inline int board_is_marsboard(void) 318 | +{ 319 | + return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "00A5", 4); 320 | +} 321 | + 322 | +static inline int board_is_os00(void) 323 | +{ 324 | + return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "OS00", 4); 325 | +} 326 | + 327 | static inline int board_is_beaglebonex(void) 328 | { 329 | - return board_is_bone() || board_is_bone_lt() || board_is_bbg1(); 330 | + return board_is_pb() || board_is_bone() || (board_is_bone_lt() && !board_is_marsboard()) || board_is_e14bbbi() || board_is_bbg1() || board_is_beaglelogic() || board_is_os00(); 331 | } 332 | 333 | static inline int board_is_evm_sk(void) 334 | diff --git a/board/ti/am335x/mux.c b/board/ti/am335x/mux.c 335 | index ad85b3a19a..2b10b64d3a 100644 336 | --- a/board/ti/am335x/mux.c 337 | +++ b/board/ti/am335x/mux.c 338 | @@ -341,7 +341,14 @@ static unsigned short detect_daughter_board_profile(void) 339 | void enable_board_pin_mux(void) 340 | { 341 | /* Do board-specific muxes. */ 342 | - if (board_is_bone()) { 343 | + if (board_is_pb()) { 344 | + configure_module_pin_mux(mii1_pin_mux); 345 | + configure_module_pin_mux(mmc0_pin_mux); 346 | + } else if (board_is_beaglelogic()) { 347 | + /* BeagleLogic pinmux */ 348 | + configure_module_pin_mux(mii1_pin_mux); 349 | + configure_module_pin_mux(mmc0_pin_mux); 350 | + } else if (board_is_bone()) { 351 | /* Beaglebone pinmux */ 352 | configure_module_pin_mux(mii1_pin_mux); 353 | configure_module_pin_mux(mmc0_pin_mux); 354 | @@ -381,7 +388,14 @@ void enable_board_pin_mux(void) 355 | configure_module_pin_mux(mmc0_pin_mux_sk_evm); 356 | } else if (board_is_bone_lt()) { 357 | /* Beaglebone LT pinmux */ 358 | - configure_module_pin_mux(mii1_pin_mux); 359 | + if(board_is_bone_lt_enhanced() || board_is_m10a()) { 360 | + /* SanCloud Beaglebone LT Enhanced pinmux */ 361 | + configure_module_pin_mux(rgmii1_pin_mux); 362 | + } 363 | + else { 364 | + /* Beaglebone LT pinmux */ 365 | + configure_module_pin_mux(mii1_pin_mux); 366 | + } 367 | configure_module_pin_mux(mmc0_pin_mux); 368 | #if defined(CONFIG_NAND) && defined(CONFIG_EMMC_BOOT) 369 | configure_module_pin_mux(nand_pin_mux); 370 | diff --git a/configs/am335x_boneblack_defconfig b/configs/am335x_boneblack_defconfig 371 | index 50093cd662..873090a7ad 100644 372 | --- a/configs/am335x_boneblack_defconfig 373 | +++ b/configs/am335x_boneblack_defconfig 374 | @@ -4,8 +4,9 @@ CONFIG_TI_COMMON_CMD_OPTIONS=y 375 | CONFIG_AM33XX=y 376 | # CONFIG_SPL_NAND_SUPPORT is not set 377 | CONFIG_DISTRO_DEFAULTS=y 378 | -CONFIG_SYS_EXTRA_OPTIONS="EMMC_BOOT" 379 | CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd" 380 | +# CONFIG_ENV_IS_IN_FAT is not set 381 | +CONFIG_ENV_IS_NOWHERE=y 382 | CONFIG_SYS_CONSOLE_INFO_QUIET=y 383 | CONFIG_VERSION_VARIABLE=y 384 | CONFIG_ARCH_MISC_INIT=y 385 | @@ -20,7 +21,6 @@ CONFIG_FASTBOOT=y 386 | CONFIG_CMD_SPL=y 387 | # CONFIG_CMD_FLASH is not set 388 | # CONFIG_CMD_SETEXPR is not set 389 | -CONFIG_ENV_IS_IN_MMC=y 390 | CONFIG_DFU_TFTP=y 391 | CONFIG_DFU_MMC=y 392 | CONFIG_DFU_RAM=y 393 | @@ -40,6 +40,9 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0451 394 | CONFIG_USB_GADGET_PRODUCT_NUM=0xd022 395 | CONFIG_USB_ETHER=y 396 | CONFIG_USBNET_HOST_ADDR="de:ad:be:af:00:00" 397 | +CONFIG_FS_BTRFS=y 398 | +CONFIG_CMD_BTRFS=y 399 | CONFIG_LZO=y 400 | CONFIG_OF_LIBFDT=y 401 | CONFIG_OF_LIBFDT_OVERLAY=y 402 | +CONFIG_PHY_MSCC=y 403 | diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig 404 | index 9c97009891..873090a7ad 100644 405 | --- a/configs/am335x_evm_defconfig 406 | +++ b/configs/am335x_evm_defconfig 407 | @@ -2,57 +2,47 @@ CONFIG_ARM=y 408 | CONFIG_ARCH_OMAP2PLUS=y 409 | CONFIG_TI_COMMON_CMD_OPTIONS=y 410 | CONFIG_AM33XX=y 411 | -CONFIG_DEFAULT_DEVICE_TREE="am335x-evm" 412 | +# CONFIG_SPL_NAND_SUPPORT is not set 413 | CONFIG_DISTRO_DEFAULTS=y 414 | -CONFIG_SPL_LOAD_FIT=y 415 | CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd" 416 | +# CONFIG_ENV_IS_IN_FAT is not set 417 | +CONFIG_ENV_IS_NOWHERE=y 418 | CONFIG_SYS_CONSOLE_INFO_QUIET=y 419 | CONFIG_VERSION_VARIABLE=y 420 | CONFIG_ARCH_MISC_INIT=y 421 | CONFIG_SPL=y 422 | -CONFIG_SPL_MTD_SUPPORT=y 423 | CONFIG_SPL_MUSB_NEW_SUPPORT=y 424 | CONFIG_SPL_OS_BOOT=y 425 | +CONFIG_AUTOBOOT_KEYED=y 426 | +CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n" 427 | +CONFIG_AUTOBOOT_DELAY_STR="d" 428 | +CONFIG_AUTOBOOT_STOP_STR=" " 429 | CONFIG_FASTBOOT=y 430 | CONFIG_CMD_SPL=y 431 | -CONFIG_CMD_SPL_NAND_OFS=0x00080000 432 | # CONFIG_CMD_FLASH is not set 433 | -CONFIG_CMD_NAND=y 434 | # CONFIG_CMD_SETEXPR is not set 435 | -CONFIG_CMD_MTDPARTS=y 436 | -CONFIG_MTDIDS_DEFAULT="nand0=nand.0" 437 | -CONFIG_MTDPARTS_DEFAULT="mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.backup2),128k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),128k(NAND.u-boot-env),128k(NAND.u-boot-env.backup1),8m(NAND.kernel),-(NAND.file-system)" 438 | -CONFIG_OF_CONTROL=y 439 | -CONFIG_OF_LIST="am335x-evm am335x-bone am335x-boneblack am335x-evmsk am335x-bonegreen am335x-icev2" 440 | -# CONFIG_BLK is not set 441 | +CONFIG_DFU_TFTP=y 442 | CONFIG_DFU_MMC=y 443 | -CONFIG_DFU_NAND=y 444 | CONFIG_DFU_RAM=y 445 | -CONFIG_DM_I2C=y 446 | -CONFIG_MISC=y 447 | -CONFIG_DM_MMC=y 448 | CONFIG_MMC_OMAP_HS=y 449 | -CONFIG_NAND=y 450 | CONFIG_SPI_FLASH=y 451 | CONFIG_SPI_FLASH_WINBOND=y 452 | CONFIG_PHYLIB=y 453 | -CONFIG_DM_ETH=y 454 | -CONFIG_PHY_GIGE=y 455 | CONFIG_SYS_NS16550=y 456 | CONFIG_OMAP3_SPI=y 457 | -CONFIG_TIMER=y 458 | -CONFIG_OMAP_TIMER=y 459 | CONFIG_USB=y 460 | -CONFIG_DM_USB=y 461 | CONFIG_USB_MUSB_HOST=y 462 | CONFIG_USB_MUSB_GADGET=y 463 | -CONFIG_USB_MUSB_TI=y 464 | CONFIG_USB_STORAGE=y 465 | CONFIG_USB_GADGET=y 466 | CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" 467 | CONFIG_USB_GADGET_VENDOR_NUM=0x0451 468 | CONFIG_USB_GADGET_PRODUCT_NUM=0xd022 469 | CONFIG_USB_ETHER=y 470 | -CONFIG_RSA=y 471 | +CONFIG_USBNET_HOST_ADDR="de:ad:be:af:00:00" 472 | +CONFIG_FS_BTRFS=y 473 | +CONFIG_CMD_BTRFS=y 474 | CONFIG_LZO=y 475 | +CONFIG_OF_LIBFDT=y 476 | CONFIG_OF_LIBFDT_OVERLAY=y 477 | +CONFIG_PHY_MSCC=y 478 | diff --git a/configs/am335x_pocketbeagle_defconfig b/configs/am335x_pocketbeagle_defconfig 479 | new file mode 100644 480 | index 0000000000..d817fac61e 481 | --- /dev/null 482 | +++ b/configs/am335x_pocketbeagle_defconfig 483 | @@ -0,0 +1,1055 @@ 484 | +# 485 | +# Automatically generated file; DO NOT EDIT. 486 | +# U-Boot 2017.09 Configuration 487 | +# 488 | +CONFIG_CREATE_ARCH_SYMLINK=y 489 | +# CONFIG_ARC is not set 490 | +CONFIG_ARM=y 491 | +# CONFIG_M68K is not set 492 | +# CONFIG_MICROBLAZE is not set 493 | +# CONFIG_MIPS is not set 494 | +# CONFIG_NDS32 is not set 495 | +# CONFIG_NIOS2 is not set 496 | +# CONFIG_PPC is not set 497 | +# CONFIG_SANDBOX is not set 498 | +# CONFIG_SH is not set 499 | +# CONFIG_X86 is not set 500 | +# CONFIG_XTENSA is not set 501 | +CONFIG_SYS_ARCH="arm" 502 | +CONFIG_SYS_CPU="armv7" 503 | +CONFIG_SYS_SOC="am33xx" 504 | +CONFIG_SYS_VENDOR="ti" 505 | +CONFIG_SYS_BOARD="am335x" 506 | +CONFIG_SYS_CONFIG_NAME="am335x_evm" 507 | + 508 | +# 509 | +# ARM architecture 510 | +# 511 | +CONFIG_HAS_VBAR=y 512 | +CONFIG_HAS_THUMB2=y 513 | +CONFIG_ARM_ASM_UNIFIED=y 514 | +CONFIG_CPU_V7=y 515 | +CONFIG_SYS_ARM_ARCH=7 516 | +CONFIG_SYS_CACHE_SHIFT_6=y 517 | +CONFIG_SYS_CACHELINE_SIZE=64 518 | +# CONFIG_ARM_SMCCC is not set 519 | +# CONFIG_SEMIHOSTING is not set 520 | +CONFIG_SYS_THUMB_BUILD=y 521 | +CONFIG_SPL_SYS_THUMB_BUILD=y 522 | +# CONFIG_SYS_L2CACHE_OFF is not set 523 | +# CONFIG_ENABLE_ARM_SOC_BOOT0_HOOK is not set 524 | +# CONFIG_ARM_CORTEX_CPU_IS_UP is not set 525 | +CONFIG_USE_ARCH_MEMCPY=y 526 | +CONFIG_SPL_USE_ARCH_MEMCPY=y 527 | +CONFIG_USE_ARCH_MEMSET=y 528 | +CONFIG_SPL_USE_ARCH_MEMSET=y 529 | +# CONFIG_ARM64_SUPPORT_AARCH32 is not set 530 | +# CONFIG_ARCH_AT91 is not set 531 | +# CONFIG_TARGET_EDB93XX is not set 532 | +# CONFIG_TARGET_ASPENITE is not set 533 | +# CONFIG_TARGET_GPLUGD is not set 534 | +# CONFIG_ARCH_DAVINCI is not set 535 | +# CONFIG_KIRKWOOD is not set 536 | +# CONFIG_ARCH_MVEBU is not set 537 | +# CONFIG_TARGET_DEVKIT3250 is not set 538 | +# CONFIG_TARGET_WORK_92105 is not set 539 | +# CONFIG_TARGET_MX25PDK is not set 540 | +# CONFIG_TARGET_ZMX25 is not set 541 | +# CONFIG_TARGET_APF27 is not set 542 | +# CONFIG_TARGET_APX4DEVKIT is not set 543 | +# CONFIG_TARGET_XFI3 is not set 544 | +# CONFIG_TARGET_M28EVK is not set 545 | +# CONFIG_TARGET_MX23EVK is not set 546 | +# CONFIG_TARGET_MX28EVK is not set 547 | +# CONFIG_TARGET_MX23_OLINUXINO is not set 548 | +# CONFIG_TARGET_BG0900 is not set 549 | +# CONFIG_TARGET_SANSA_FUZE_PLUS is not set 550 | +# CONFIG_TARGET_SC_SPS_1 is not set 551 | +# CONFIG_ORION5X is not set 552 | +# CONFIG_TARGET_SPEAR300 is not set 553 | +# CONFIG_TARGET_SPEAR310 is not set 554 | +# CONFIG_TARGET_SPEAR320 is not set 555 | +# CONFIG_TARGET_SPEAR600 is not set 556 | +# CONFIG_TARGET_STV0991 is not set 557 | +# CONFIG_TARGET_X600 is not set 558 | +# CONFIG_TARGET_IMX31_PHYCORE is not set 559 | +# CONFIG_TARGET_IMX31_PHYCORE_EET is not set 560 | +# CONFIG_TARGET_MX31ADS is not set 561 | +# CONFIG_TARGET_MX31PDK is not set 562 | +# CONFIG_TARGET_WOODBURN is not set 563 | +# CONFIG_TARGET_WOODBURN_SD is not set 564 | +# CONFIG_TARGET_FLEA3 is not set 565 | +# CONFIG_TARGET_MX35PDK is not set 566 | +# CONFIG_ARCH_BCM283X is not set 567 | +# CONFIG_TARGET_VEXPRESS_CA15_TC2 is not set 568 | +# CONFIG_TARGET_VEXPRESS_CA5X2 is not set 569 | +# CONFIG_TARGET_VEXPRESS_CA9X4 is not set 570 | +# CONFIG_TARGET_BCM23550_W1D is not set 571 | +# CONFIG_TARGET_BCM28155_AP is not set 572 | +# CONFIG_TARGET_BCMCYGNUS is not set 573 | +# CONFIG_TARGET_BCMNSP is not set 574 | +# CONFIG_TARGET_BCMNS2 is not set 575 | +# CONFIG_ARCH_EXYNOS is not set 576 | +# CONFIG_ARCH_S5PC1XX is not set 577 | +# CONFIG_ARCH_HIGHBANK is not set 578 | +# CONFIG_ARCH_INTEGRATOR is not set 579 | +# CONFIG_ARCH_KEYSTONE is not set 580 | +CONFIG_ARCH_OMAP2PLUS=y 581 | +# CONFIG_ARCH_MESON is not set 582 | +# CONFIG_ARCH_MX7ULP is not set 583 | +# CONFIG_ARCH_MX7 is not set 584 | +# CONFIG_ARCH_MX6 is not set 585 | +CONFIG_SPL_LDSCRIPT="arch/arm/mach-omap2/u-boot-spl.lds" 586 | +# CONFIG_ARCH_MX5 is not set 587 | +# CONFIG_ARCH_RMOBILE is not set 588 | +# CONFIG_TARGET_S32V234EVB is not set 589 | +# CONFIG_ARCH_SNAPDRAGON is not set 590 | +# CONFIG_ARCH_SOCFPGA is not set 591 | +# CONFIG_ARCH_SUNXI is not set 592 | +# CONFIG_TARGET_TS4600 is not set 593 | +# CONFIG_ARCH_VF610 is not set 594 | +# CONFIG_ARCH_ZYNQ is not set 595 | +# CONFIG_ARCH_ZYNQMP is not set 596 | +# CONFIG_TEGRA is not set 597 | +# CONFIG_TARGET_VEXPRESS64_AEMV8A is not set 598 | +# CONFIG_TARGET_VEXPRESS64_BASE_FVP is not set 599 | +# CONFIG_TARGET_VEXPRESS64_BASE_FVP_DRAM is not set 600 | +# CONFIG_TARGET_VEXPRESS64_JUNO is not set 601 | +# CONFIG_TARGET_LS2080A_EMU is not set 602 | +# CONFIG_TARGET_LS2080A_SIMU is not set 603 | +# CONFIG_TARGET_LS2080AQDS is not set 604 | +# CONFIG_TARGET_LS2080ARDB is not set 605 | +# CONFIG_TARGET_LS2081ARDB is not set 606 | +# CONFIG_TARGET_HIKEY is not set 607 | +# CONFIG_TARGET_POPLAR is not set 608 | +# CONFIG_TARGET_LS1012AQDS is not set 609 | +# CONFIG_TARGET_LS1012ARDB is not set 610 | +# CONFIG_TARGET_LS1012AFRDM is not set 611 | +# CONFIG_TARGET_LS1021AQDS is not set 612 | +# CONFIG_TARGET_LS1021ATWR is not set 613 | +# CONFIG_TARGET_LS1021AIOT is not set 614 | +# CONFIG_TARGET_LS1043AQDS is not set 615 | +# CONFIG_TARGET_LS1043ARDB is not set 616 | +# CONFIG_TARGET_LS1046AQDS is not set 617 | +# CONFIG_TARGET_LS1046ARDB is not set 618 | +# CONFIG_TARGET_H2200 is not set 619 | +# CONFIG_TARGET_ZIPITZ2 is not set 620 | +# CONFIG_TARGET_COLIBRI_PXA270 is not set 621 | +# CONFIG_ARCH_UNIPHIER is not set 622 | +# CONFIG_STM32 is not set 623 | +# CONFIG_ARCH_STI is not set 624 | +# CONFIG_ARCH_ROCKCHIP is not set 625 | +# CONFIG_TARGET_THUNDERX_88XX is not set 626 | +# CONFIG_ARCH_ASPEED is not set 627 | +CONFIG_SYS_TEXT_BASE=0x80800000 628 | +CONFIG_TI_I2C_BOARD_DETECT=y 629 | +CONFIG_EEPROM_BUS_ADDRESS=0 630 | +CONFIG_EEPROM_CHIP_ADDRESS=0x50 631 | +CONFIG_TI_COMMON_CMD_OPTIONS=y 632 | +CONFIG_SPL_GPIO_SUPPORT=y 633 | +CONFIG_SPL_LIBCOMMON_SUPPORT=y 634 | +CONFIG_SPL_LIBGENERIC_SUPPORT=y 635 | +CONFIG_SYS_MALLOC_F_LEN=0x400 636 | +# CONFIG_OMAP34XX is not set 637 | +# CONFIG_OMAP44XX is not set 638 | +# CONFIG_OMAP54XX is not set 639 | +# CONFIG_TI814X is not set 640 | +# CONFIG_TI816X is not set 641 | +# CONFIG_AM43XX is not set 642 | +CONFIG_AM33XX=y 643 | +CONFIG_SYS_MPUCLK=500 644 | +# CONFIG_TI_SECURE_DEVICE is not set 645 | +CONFIG_CONS_INDEX=1 646 | +CONFIG_TARGET_AM335X_EVM=y 647 | +# CONFIG_TARGET_AM335X_BALTOS is not set 648 | +# CONFIG_TARGET_AM335X_IGEP003X is not set 649 | +# CONFIG_TARGET_AM335X_SHC is not set 650 | +# CONFIG_TARGET_AM335X_SL50 is not set 651 | +# CONFIG_TARGET_BAV335X is not set 652 | +# CONFIG_TARGET_BRXRE1 is not set 653 | +# CONFIG_TARGET_BRPPT1 is not set 654 | +# CONFIG_TARGET_CHILIBOARD is not set 655 | +# CONFIG_TARGET_CM_T335 is not set 656 | +# CONFIG_TARGET_DRACO is not set 657 | +# CONFIG_TARGET_ETAMIN is not set 658 | +# CONFIG_TARGET_PCM051 is not set 659 | +# CONFIG_TARGET_PENGWYN is not set 660 | +# CONFIG_TARGET_PEPPER is not set 661 | +# CONFIG_TARGET_PXM2 is not set 662 | +# CONFIG_TARGET_RASTABAN is not set 663 | +# CONFIG_TARGET_RUT is not set 664 | +# CONFIG_TARGET_THUBAN is not set 665 | +CONFIG_ISW_ENTRY_ADDR=0x402F0400 666 | +CONFIG_PUB_ROM_DATA_SIZE=0x8400 667 | +# CONFIG_NOR is not set 668 | +CONFIG_SPL_MMC_SUPPORT=y 669 | +CONFIG_SPL_SERIAL_SUPPORT=y 670 | +# CONFIG_SPL_DRIVERS_MISC_SUPPORT is not set 671 | +CONFIG_SPL_LIBDISK_SUPPORT=y 672 | +# CONFIG_SPL_NAND_SUPPORT is not set 673 | +# CONFIG_SPL_SPI_FLASH_SUPPORT is not set 674 | +# CONFIG_SPL_SPI_SUPPORT is not set 675 | +CONFIG_SPL_WATCHDOG_SUPPORT=y 676 | +CONFIG_IDENT_STRING="" 677 | +# CONFIG_VIDEO is not set 678 | +CONFIG_SPL_STACK_R_ADDR=0x82000000 679 | +CONFIG_SPL_FAT_SUPPORT=y 680 | +# CONFIG_ARMV7_LPAE is not set 681 | +# CONFIG_CMD_DEKBLOB is not set 682 | +# CONFIG_CMD_HDMIDETECT is not set 683 | + 684 | +# 685 | +# ARM debug 686 | +# 687 | +# CONFIG_DEBUG_LL is not set 688 | +CONFIG_SMBIOS_PRODUCT_NAME="am335x" 689 | +# CONFIG_DEBUG_UART is not set 690 | +# CONFIG_AHCI is not set 691 | + 692 | +# 693 | +# General setup 694 | +# 695 | +CONFIG_LOCALVERSION="" 696 | +CONFIG_LOCALVERSION_AUTO=y 697 | +CONFIG_CC_OPTIMIZE_FOR_SIZE=y 698 | +CONFIG_DISTRO_DEFAULTS=y 699 | +CONFIG_SYS_MALLOC_F=y 700 | +CONFIG_SPL_SYS_MALLOC_F_LEN=0x400 701 | +CONFIG_TPL_SYS_MALLOC_F_LEN=0x400 702 | +CONFIG_EXPERT=y 703 | +CONFIG_SYS_MALLOC_CLEAR_ON_INIT=y 704 | +# CONFIG_TOOLS_DEBUG is not set 705 | +# CONFIG_PHYS_64BIT is not set 706 | + 707 | +# 708 | +# Boot images 709 | +# 710 | +# CONFIG_ANDROID_BOOT_IMAGE is not set 711 | +CONFIG_FIT=y 712 | +CONFIG_FIT_ENABLE_SHA256_SUPPORT=y 713 | +# CONFIG_FIT_SIGNATURE is not set 714 | +# CONFIG_FIT_VERBOSE is not set 715 | +# CONFIG_FIT_BEST_MATCH is not set 716 | +# CONFIG_SPL_FIT is not set 717 | +# CONFIG_SPL_FIT_SIGNATURE is not set 718 | +# CONFIG_SPL_LOAD_FIT is not set 719 | +# CONFIG_OF_BOARD_SETUP is not set 720 | +# CONFIG_OF_SYSTEM_SETUP is not set 721 | +# CONFIG_OF_STDOUT_VIA_ALIAS is not set 722 | +CONFIG_SYS_EXTRA_OPTIONS="" 723 | +CONFIG_ARCH_FIXUP_FDT_MEMORY=y 724 | + 725 | +# 726 | +# API 727 | +# 728 | +# CONFIG_API is not set 729 | + 730 | +# 731 | +# Boot timing 732 | +# 733 | +# CONFIG_BOOTSTAGE is not set 734 | +CONFIG_BOOTSTAGE_USER_COUNT=20 735 | +CONFIG_BOOTSTAGE_RECORD_COUNT=30 736 | +CONFIG_BOOTSTAGE_STASH_ADDR=0 737 | +CONFIG_BOOTSTAGE_STASH_SIZE=0x1000 738 | + 739 | +# 740 | +# Boot media 741 | +# 742 | +# CONFIG_NAND_BOOT is not set 743 | +# CONFIG_ONENAND_BOOT is not set 744 | +# CONFIG_QSPI_BOOT is not set 745 | +# CONFIG_SATA_BOOT is not set 746 | +# CONFIG_SD_BOOT is not set 747 | +# CONFIG_SPI_BOOT is not set 748 | +CONFIG_BOOTDELAY=2 749 | +# CONFIG_USE_BOOTARGS is not set 750 | + 751 | +# 752 | +# Console 753 | +# 754 | +CONFIG_MENU=y 755 | +# CONFIG_CONSOLE_RECORD is not set 756 | +# CONFIG_SILENT_CONSOLE is not set 757 | +# CONFIG_PRE_CONSOLE_BUFFER is not set 758 | +CONFIG_CONSOLE_MUX=y 759 | +CONFIG_SYS_CONSOLE_IS_IN_ENV=y 760 | +# CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE is not set 761 | +CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y 762 | +CONFIG_SYS_CONSOLE_INFO_QUIET=y 763 | +# CONFIG_SYS_STDIO_DEREGISTER is not set 764 | +# CONFIG_FIT_EMBED is not set 765 | +CONFIG_DEFAULT_FDT_FILE="" 766 | +CONFIG_VERSION_VARIABLE=y 767 | +CONFIG_BOARD_LATE_INIT=y 768 | +CONFIG_DISPLAY_CPUINFO=y 769 | +CONFIG_DISPLAY_BOARDINFO=y 770 | + 771 | +# 772 | +# Start-up hooks 773 | +# 774 | +# CONFIG_ARCH_EARLY_INIT_R is not set 775 | +CONFIG_ARCH_MISC_INIT=y 776 | +# CONFIG_BOARD_EARLY_INIT_F is not set 777 | + 778 | +# 779 | +# Security support 780 | +# 781 | +CONFIG_HASH=y 782 | + 783 | +# 784 | +# SPL / TPL 785 | +# 786 | +CONFIG_SUPPORT_SPL=y 787 | +CONFIG_SPL=y 788 | +CONFIG_SPL_BOARD_INIT=y 789 | +# CONFIG_SPL_BOOTROM_SUPPORT is not set 790 | +CONFIG_SPL_RAW_IMAGE_SUPPORT=y 791 | +CONFIG_SPL_LEGACY_IMAGE_SUPPORT=y 792 | +CONFIG_SPL_SYS_MALLOC_SIMPLE=y 793 | +# CONFIG_TPL_SYS_MALLOC_SIMPLE is not set 794 | +CONFIG_SPL_STACK_R=y 795 | +CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x100000 796 | +CONFIG_SPL_SEPARATE_BSS=y 797 | +# CONFIG_SPL_DISPLAY_PRINT is not set 798 | +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y 799 | +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300 800 | +# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION is not set 801 | +# CONFIG_SPL_CPU_SUPPORT is not set 802 | +# CONFIG_SPL_CRYPTO_SUPPORT is not set 803 | +# CONFIG_SPL_HASH_SUPPORT is not set 804 | +# CONFIG_SPL_DMA_SUPPORT is not set 805 | +CONFIG_SPL_ENV_SUPPORT=y 806 | +# CONFIG_SPL_SAVEENV is not set 807 | +# CONFIG_SPL_ETH_SUPPORT is not set 808 | +CONFIG_SPL_EXT_SUPPORT=y 809 | +# CONFIG_SPL_FPGA_SUPPORT is not set 810 | +CONFIG_SPL_I2C_SUPPORT=y 811 | +# CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT is not set 812 | +# CONFIG_SPL_MTD_SUPPORT is not set 813 | +CONFIG_SPL_MUSB_NEW_SUPPORT=y 814 | +# CONFIG_SPL_NET_SUPPORT is not set 815 | +# CONFIG_SPL_NO_CPU_SUPPORT is not set 816 | +# CONFIG_SPL_NOR_SUPPORT is not set 817 | +# CONFIG_SPL_XIP_SUPPORT is not set 818 | +# CONFIG_SPL_ONENAND_SUPPORT is not set 819 | +CONFIG_SPL_OS_BOOT=y 820 | +# CONFIG_SPL_PCI_SUPPORT is not set 821 | +# CONFIG_SPL_PCH_SUPPORT is not set 822 | +# CONFIG_SPL_POST_MEM_SUPPORT is not set 823 | +CONFIG_SPL_POWER_SUPPORT=y 824 | +# CONFIG_SPL_RAM_SUPPORT is not set 825 | +# CONFIG_SPL_RTC_SUPPORT is not set 826 | +# CONFIG_SPL_SATA_SUPPORT is not set 827 | +# CONFIG_SPL_USB_HOST_SUPPORT is not set 828 | +# CONFIG_SPL_USB_GADGET_SUPPORT is not set 829 | +CONFIG_SPL_YMODEM_SUPPORT=y 830 | + 831 | +# 832 | +# Command line interface 833 | +# 834 | +CONFIG_CMDLINE=y 835 | +CONFIG_HUSH_PARSER=y 836 | +CONFIG_SYS_PROMPT="=> " 837 | + 838 | +# 839 | +# Autoboot options 840 | +# 841 | +CONFIG_AUTOBOOT=y 842 | +CONFIG_AUTOBOOT_KEYED=y 843 | +CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n" 844 | +# CONFIG_AUTOBOOT_ENCRYPTION is not set 845 | +CONFIG_AUTOBOOT_DELAY_STR="d" 846 | +CONFIG_AUTOBOOT_STOP_STR=" " 847 | +# CONFIG_AUTOBOOT_KEYED_CTRLC is not set 848 | + 849 | +# 850 | +# FASTBOOT 851 | +# 852 | +CONFIG_FASTBOOT=y 853 | +CONFIG_USB_FUNCTION_FASTBOOT=y 854 | +CONFIG_CMD_FASTBOOT=y 855 | +CONFIG_FASTBOOT_BUF_ADDR=0x81000000 856 | +CONFIG_FASTBOOT_BUF_SIZE=0x07000000 857 | +CONFIG_FASTBOOT_USB_DEV=0 858 | +# CONFIG_FASTBOOT_FLASH is not set 859 | + 860 | +# 861 | +# Commands 862 | +# 863 | + 864 | +# 865 | +# Info commands 866 | +# 867 | +CONFIG_CMD_BDI=y 868 | +# CONFIG_CMD_CONFIG is not set 869 | +CONFIG_CMD_CONSOLE=y 870 | +# CONFIG_CMD_CPU is not set 871 | +# CONFIG_CMD_LICENSE is not set 872 | + 873 | +# 874 | +# Boot commands 875 | +# 876 | +CONFIG_CMD_BOOTD=y 877 | +CONFIG_CMD_BOOTM=y 878 | +CONFIG_CMD_BOOTZ=y 879 | +CONFIG_CMD_BOOTEFI=y 880 | +CONFIG_CMD_BOOTEFI_HELLO_COMPILE=y 881 | +# CONFIG_CMD_BOOTEFI_HELLO is not set 882 | +# CONFIG_CMD_BOOTMENU is not set 883 | +CONFIG_CMD_ELF=y 884 | +CONFIG_CMD_FDT=y 885 | +CONFIG_CMD_GO=y 886 | +CONFIG_CMD_RUN=y 887 | +CONFIG_CMD_IMI=y 888 | +# CONFIG_CMD_IMLS is not set 889 | +CONFIG_CMD_XIMG=y 890 | +# CONFIG_CMD_POWEROFF is not set 891 | +# CONFIG_CMD_SPL is not set 892 | +# CONFIG_CMD_THOR_DOWNLOAD is not set 893 | +# CONFIG_CMD_ZBOOT is not set 894 | + 895 | +# 896 | +# Environment commands 897 | +# 898 | +CONFIG_CMD_ASKENV=y 899 | +CONFIG_CMD_EXPORTENV=y 900 | +CONFIG_CMD_IMPORTENV=y 901 | +CONFIG_CMD_EDITENV=y 902 | +# CONFIG_CMD_GREPENV is not set 903 | +CONFIG_CMD_SAVEENV=y 904 | +CONFIG_CMD_ENV_EXISTS=y 905 | +# CONFIG_CMD_ENV_CALLBACK is not set 906 | +# CONFIG_CMD_ENV_FLAGS is not set 907 | + 908 | +# 909 | +# Memory commands 910 | +# 911 | +CONFIG_CMD_CRC32=y 912 | +# CONFIG_CRC32_VERIFY is not set 913 | +CONFIG_CMD_EEPROM=y 914 | +# CONFIG_CMD_EEPROM_LAYOUT is not set 915 | +# CONFIG_LOOPW is not set 916 | +# CONFIG_CMD_MD5SUM is not set 917 | +# CONFIG_CMD_MEMINFO is not set 918 | +CONFIG_CMD_MEMORY=y 919 | +# CONFIG_CMD_MEMTEST is not set 920 | +# CONFIG_CMD_MX_CYCLIC is not set 921 | +# CONFIG_CMD_SHA1SUM is not set 922 | +# CONFIG_CMD_STRINGS is not set 923 | + 924 | +# 925 | +# Compression commands 926 | +# 927 | +# CONFIG_CMD_LZMADEC is not set 928 | +# CONFIG_CMD_UNZIP is not set 929 | +# CONFIG_CMD_ZIP is not set 930 | + 931 | +# 932 | +# Device access commands 933 | +# 934 | +# CONFIG_CMD_ARMFLASH is not set 935 | +# CONFIG_CMD_CLK is not set 936 | +# CONFIG_CMD_DEMO is not set 937 | +CONFIG_CMD_DFU=y 938 | +CONFIG_CMD_DM=y 939 | +# CONFIG_CMD_FDC is not set 940 | +# CONFIG_CMD_FLASH is not set 941 | +# CONFIG_CMD_FPGA is not set 942 | +# CONFIG_CMD_FPGAD is not set 943 | +# CONFIG_CMD_FUSE is not set 944 | +CONFIG_CMD_GPIO=y 945 | +CONFIG_CMD_GPT=y 946 | +# CONFIG_CMD_GPT_RENAME is not set 947 | +# CONFIG_CMD_IDE is not set 948 | +# CONFIG_CMD_IO is not set 949 | +# CONFIG_CMD_IOTRACE is not set 950 | +CONFIG_CMD_I2C=y 951 | +CONFIG_CMD_LOADB=y 952 | +CONFIG_CMD_LOADS=y 953 | +CONFIG_CMD_MMC=y 954 | +# CONFIG_CMD_NAND is not set 955 | +# CONFIG_CMD_MMC_SPI is not set 956 | +# CONFIG_CMD_ONENAND is not set 957 | +CONFIG_CMD_PART=y 958 | +# CONFIG_CMD_PCI is not set 959 | +# CONFIG_CMD_PCMCIA is not set 960 | +# CONFIG_CMD_READ is not set 961 | +# CONFIG_CMD_SATA is not set 962 | +# CONFIG_CMD_SAVES is not set 963 | +# CONFIG_CMD_SDRAM is not set 964 | +CONFIG_CMD_SF=y 965 | +# CONFIG_CMD_SF_TEST is not set 966 | +CONFIG_CMD_SPI=y 967 | +# CONFIG_CMD_TSI148 is not set 968 | +# CONFIG_CMD_UNIVERSE is not set 969 | +CONFIG_CMD_USB=y 970 | +# CONFIG_CMD_USB_SDP is not set 971 | +CONFIG_CMD_USB_MASS_STORAGE=y 972 | + 973 | +# 974 | +# Shell scripting commands 975 | +# 976 | +CONFIG_CMD_ECHO=y 977 | +CONFIG_CMD_ITEST=y 978 | +CONFIG_CMD_SOURCE=y 979 | +# CONFIG_CMD_SETEXPR is not set 980 | + 981 | +# 982 | +# Network commands 983 | +# 984 | +CONFIG_CMD_NET=y 985 | +# CONFIG_CMD_TFTPPUT is not set 986 | +# CONFIG_CMD_TFTPSRV is not set 987 | +# CONFIG_CMD_RARP is not set 988 | +CONFIG_CMD_DHCP=y 989 | +CONFIG_CMD_PXE=y 990 | +CONFIG_CMD_NFS=y 991 | +CONFIG_CMD_MII=y 992 | +CONFIG_CMD_PING=y 993 | +# CONFIG_CMD_CDP is not set 994 | +# CONFIG_CMD_SNTP is not set 995 | +# CONFIG_CMD_DNS is not set 996 | +# CONFIG_CMD_LINK_LOCAL is not set 997 | +# CONFIG_CMD_ETHSW is not set 998 | + 999 | +# 1000 | +# Misc commands 1001 | +# 1002 | +# CONFIG_CMD_BSP is not set 1003 | +# CONFIG_CMD_BKOPS_ENABLE is not set 1004 | +# CONFIG_CMD_CACHE is not set 1005 | +# CONFIG_CMD_DISPLAY is not set 1006 | +# CONFIG_CMD_LED is not set 1007 | +# CONFIG_CMD_DATE is not set 1008 | +CONFIG_CMD_TIME=y 1009 | +# CONFIG_CMD_GETTIME is not set 1010 | +CONFIG_CMD_MISC=y 1011 | +# CONFIG_CMD_TIMER is not set 1012 | +# CONFIG_CMD_QFW is not set 1013 | +# CONFIG_CMD_TERMINAL is not set 1014 | +# CONFIG_CMD_UUID is not set 1015 | + 1016 | +# 1017 | +# Power commands 1018 | +# 1019 | + 1020 | +# 1021 | +# Security commands 1022 | +# 1023 | +# CONFIG_CMD_AES is not set 1024 | +# CONFIG_CMD_BLOB is not set 1025 | +# CONFIG_CMD_HASH is not set 1026 | + 1027 | +# 1028 | +# Firmware commands 1029 | +# 1030 | + 1031 | +# 1032 | +# Filesystem commands 1033 | +# 1034 | +CONFIG_CMD_EXT2=y 1035 | +CONFIG_CMD_EXT4=y 1036 | +CONFIG_CMD_EXT4_WRITE=y 1037 | +CONFIG_CMD_FAT=y 1038 | +CONFIG_CMD_FS_GENERIC=y 1039 | +# CONFIG_CMD_FS_UUID is not set 1040 | +# CONFIG_CMD_JFFS2 is not set 1041 | +# CONFIG_CMD_MTDPARTS is not set 1042 | +# CONFIG_CMD_REISER is not set 1043 | +# CONFIG_CMD_SCSI is not set 1044 | +# CONFIG_CMD_ZFS is not set 1045 | + 1046 | +# 1047 | +# Debug commands 1048 | +# 1049 | +# CONFIG_CMD_BEDBUG is not set 1050 | +# CONFIG_CMD_DIAG is not set 1051 | +# CONFIG_CMD_KGDB is not set 1052 | +# CONFIG_CMD_TRACE is not set 1053 | +# CONFIG_CMD_UBI is not set 1054 | + 1055 | +# 1056 | +# Partition Types 1057 | +# 1058 | +CONFIG_PARTITIONS=y 1059 | +# CONFIG_MAC_PARTITION is not set 1060 | +# CONFIG_SPL_MAC_PARTITION is not set 1061 | +CONFIG_DOS_PARTITION=y 1062 | +CONFIG_SPL_DOS_PARTITION=y 1063 | +CONFIG_ISO_PARTITION=y 1064 | +CONFIG_SPL_ISO_PARTITION=y 1065 | +# CONFIG_AMIGA_PARTITION is not set 1066 | +# CONFIG_SPL_AMIGA_PARTITION is not set 1067 | +CONFIG_EFI_PARTITION=y 1068 | +CONFIG_EFI_PARTITION_ENTRIES_OFF=0 1069 | +CONFIG_SPL_EFI_PARTITION=y 1070 | +CONFIG_PARTITION_UUIDS=y 1071 | +CONFIG_SPL_PARTITION_UUIDS=y 1072 | +# CONFIG_PARTITION_TYPE_GUID is not set 1073 | +CONFIG_SUPPORT_OF_CONTROL=y 1074 | + 1075 | +# 1076 | +# Device Tree Control 1077 | +# 1078 | +# CONFIG_OF_CONTROL is not set 1079 | +# CONFIG_OF_BOARD_FIXUP is not set 1080 | + 1081 | +# 1082 | +# Environment 1083 | +# 1084 | +# CONFIG_ENV_IS_NOWHERE is not set 1085 | +# CONFIG_ENV_IS_IN_DATAFLASH is not set 1086 | +# CONFIG_ENV_IS_IN_EEPROM is not set 1087 | +CONFIG_ENV_IS_IN_FAT=y 1088 | +# CONFIG_ENV_IS_IN_FLASH is not set 1089 | +# CONFIG_ENV_IS_IN_MMC is not set 1090 | +# CONFIG_ENV_IS_IN_NAND is not set 1091 | +# CONFIG_ENV_IS_IN_NVRAM is not set 1092 | +# CONFIG_ENV_IS_IN_ONENAND is not set 1093 | +# CONFIG_ENV_IS_IN_REMOTE is not set 1094 | +# CONFIG_ENV_IS_IN_SPI_FLASH is not set 1095 | +# CONFIG_ENV_IS_IN_UBI is not set 1096 | +# CONFIG_ENV_AES is not set 1097 | +CONFIG_ENV_FAT_INTERFACE="mmc" 1098 | +CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" 1099 | +CONFIG_ENV_FAT_FILE="uboot.env" 1100 | +CONFIG_NET=y 1101 | +# CONFIG_NET_RANDOM_ETHADDR is not set 1102 | +CONFIG_NETCONSOLE=y 1103 | +CONFIG_NET_TFTP_VARS=y 1104 | +CONFIG_BOOTP_PXE_CLIENTARCH=0x15 1105 | +CONFIG_BOOTP_VCI_STRING="U-Boot.armv7" 1106 | + 1107 | +# 1108 | +# Device Drivers 1109 | +# 1110 | + 1111 | +# 1112 | +# Generic Driver Options 1113 | +# 1114 | +CONFIG_DM=y 1115 | +CONFIG_SPL_DM=y 1116 | +CONFIG_DM_WARN=y 1117 | +CONFIG_DM_DEVICE_REMOVE=y 1118 | +CONFIG_DM_STDIO=y 1119 | +CONFIG_DM_SEQ_ALIAS=y 1120 | +CONFIG_SPL_DM_SEQ_ALIAS=y 1121 | +# CONFIG_REGMAP is not set 1122 | +# CONFIG_SPL_REGMAP is not set 1123 | +# CONFIG_DEVRES is not set 1124 | +CONFIG_DM_DEV_READ_INLINE=y 1125 | +# CONFIG_ADC is not set 1126 | +# CONFIG_ADC_EXYNOS is not set 1127 | +# CONFIG_ADC_SANDBOX is not set 1128 | +# CONFIG_SATA is not set 1129 | + 1130 | +# 1131 | +# SATA/SCSI device support 1132 | +# 1133 | +# CONFIG_BLK is not set 1134 | +# CONFIG_BLOCK_CACHE is not set 1135 | +# CONFIG_IDE is not set 1136 | + 1137 | +# 1138 | +# Clock 1139 | +# 1140 | +# CONFIG_CLK is not set 1141 | +# CONFIG_CPU is not set 1142 | + 1143 | +# 1144 | +# Hardware crypto devices 1145 | +# 1146 | +# CONFIG_FSL_CAAM is not set 1147 | +# CONFIG_SYS_FSL_SEC_BE is not set 1148 | +# CONFIG_SYS_FSL_SEC_LE is not set 1149 | + 1150 | +# 1151 | +# Demo for driver model 1152 | +# 1153 | +# CONFIG_DM_DEMO is not set 1154 | + 1155 | +# 1156 | +# DFU support 1157 | +# 1158 | +CONFIG_USB_FUNCTION_DFU=y 1159 | +CONFIG_DFU_TFTP=y 1160 | +CONFIG_DFU_MMC=y 1161 | +# CONFIG_DFU_NAND is not set 1162 | +CONFIG_DFU_RAM=y 1163 | +# CONFIG_DFU_SF is not set 1164 | + 1165 | +# 1166 | +# DMA Support 1167 | +# 1168 | +# CONFIG_DMA is not set 1169 | +# CONFIG_TI_EDMA3 is not set 1170 | + 1171 | +# 1172 | +# FPGA support 1173 | +# 1174 | +# CONFIG_FPGA_ALTERA is not set 1175 | +# CONFIG_FPGA_SOCFPGA is not set 1176 | +# CONFIG_FPGA_XILINX is not set 1177 | + 1178 | +# 1179 | +# GPIO Support 1180 | +# 1181 | +CONFIG_DM_GPIO=y 1182 | +# CONFIG_ALTERA_PIO is not set 1183 | +# CONFIG_DWAPB_GPIO is not set 1184 | +# CONFIG_AT91_GPIO is not set 1185 | +# CONFIG_ATMEL_PIO4 is not set 1186 | +# CONFIG_INTEL_BROADWELL_GPIO is not set 1187 | +# CONFIG_INTEL_ICH6_GPIO is not set 1188 | +# CONFIG_IMX_RGPIO2P is not set 1189 | +# CONFIG_LPC32XX_GPIO is not set 1190 | +# CONFIG_MSM_GPIO is not set 1191 | +CONFIG_OMAP_GPIO=y 1192 | +# CONFIG_CMD_PCA953X is not set 1193 | +# CONFIG_ROCKCHIP_GPIO is not set 1194 | +# CONFIG_CMD_TCA642X is not set 1195 | +# CONFIG_TEGRA_GPIO is not set 1196 | +# CONFIG_TEGRA186_GPIO is not set 1197 | +# CONFIG_VYBRID_GPIO is not set 1198 | +# CONFIG_DM_74X164 is not set 1199 | +# CONFIG_DM_PCA953X is not set 1200 | +# CONFIG_MPC85XX_GPIO is not set 1201 | + 1202 | +# 1203 | +# I2C support 1204 | +# 1205 | +# CONFIG_DM_I2C is not set 1206 | +# CONFIG_DM_I2C_COMPAT is not set 1207 | +# CONFIG_SYS_I2C_DW is not set 1208 | +# CONFIG_SYS_I2C_IMX_LPI2C is not set 1209 | +CONFIG_SYS_I2C_OMAP24XX=y 1210 | +CONFIG_SYS_I2C_BUS_MAX=3 1211 | +CONFIG_DM_KEYBOARD=y 1212 | +# CONFIG_CROS_EC_KEYB is not set 1213 | +# CONFIG_I8042_KEYB is not set 1214 | + 1215 | +# 1216 | +# LED Support 1217 | +# 1218 | +# CONFIG_LED is not set 1219 | +# CONFIG_SPL_LED is not set 1220 | +# CONFIG_LED_STATUS is not set 1221 | + 1222 | +# 1223 | +# Mailbox Controller Support 1224 | +# 1225 | + 1226 | +# 1227 | +# Memory Controller drivers 1228 | +# 1229 | + 1230 | +# 1231 | +# Multifunction device drivers 1232 | +# 1233 | +# CONFIG_MISC is not set 1234 | +# CONFIG_CROS_EC is not set 1235 | +# CONFIG_DS4510 is not set 1236 | +# CONFIG_FSL_SEC_MON is not set 1237 | +# CONFIG_MXC_OCOTP is not set 1238 | +# CONFIG_NUVOTON_NCT6102D is not set 1239 | +# CONFIG_PWRSEQ is not set 1240 | +# CONFIG_PCA9551_LED is not set 1241 | +# CONFIG_WINBOND_W83627 is not set 1242 | + 1243 | +# 1244 | +# MMC Host controller Support 1245 | +# 1246 | +CONFIG_MMC=y 1247 | +# CONFIG_DM_MMC is not set 1248 | +# CONFIG_SPL_MMC_TINY is not set 1249 | +# CONFIG_MMC_DW is not set 1250 | +# CONFIG_MMC_MXC is not set 1251 | +# CONFIG_MMC_MXS is not set 1252 | +# CONFIG_MMC_PCI is not set 1253 | +CONFIG_MMC_OMAP_HS=y 1254 | +# CONFIG_MMC_SDHCI is not set 1255 | + 1256 | +# 1257 | +# MTD Support 1258 | +# 1259 | +# CONFIG_MTD is not set 1260 | +# CONFIG_MTD_NOR_FLASH is not set 1261 | +# CONFIG_NAND is not set 1262 | + 1263 | +# 1264 | +# SPI Flash Support 1265 | +# 1266 | +CONFIG_SPI_FLASH=y 1267 | +# CONFIG_SPI_FLASH_BAR is not set 1268 | +# CONFIG_SF_DUAL_FLASH is not set 1269 | +# CONFIG_SPI_FLASH_ATMEL is not set 1270 | +# CONFIG_SPI_FLASH_EON is not set 1271 | +# CONFIG_SPI_FLASH_GIGADEVICE is not set 1272 | +# CONFIG_SPI_FLASH_MACRONIX is not set 1273 | +# CONFIG_SPI_FLASH_SPANSION is not set 1274 | +# CONFIG_SPI_FLASH_STMICRO is not set 1275 | +# CONFIG_SPI_FLASH_SST is not set 1276 | +CONFIG_SPI_FLASH_WINBOND=y 1277 | +CONFIG_SPI_FLASH_USE_4K_SECTORS=y 1278 | +# CONFIG_SPI_FLASH_MTD is not set 1279 | + 1280 | +# 1281 | +# UBI support 1282 | +# 1283 | +# CONFIG_MTD_UBI is not set 1284 | +# CONFIG_BITBANGMII is not set 1285 | +# CONFIG_MV88E6352_SWITCH is not set 1286 | +CONFIG_PHYLIB=y 1287 | +# CONFIG_MV88E61XX_SWITCH is not set 1288 | +# CONFIG_PHYLIB_10G is not set 1289 | +# CONFIG_PHY_AQUANTIA is not set 1290 | +# CONFIG_PHY_ATHEROS is not set 1291 | +# CONFIG_PHY_BROADCOM is not set 1292 | +# CONFIG_PHY_CORTINA is not set 1293 | +# CONFIG_PHY_DAVICOM is not set 1294 | +# CONFIG_PHY_ET1011C is not set 1295 | +# CONFIG_PHY_LXT is not set 1296 | +# CONFIG_PHY_MARVELL is not set 1297 | +# CONFIG_PHY_MICREL is not set 1298 | +# CONFIG_PHY_MSCC is not set 1299 | +# CONFIG_PHY_NATSEMI is not set 1300 | +# CONFIG_PHY_REALTEK is not set 1301 | +# CONFIG_PHY_SMSC is not set 1302 | +# CONFIG_PHY_TERANETICS is not set 1303 | +# CONFIG_PHY_TI is not set 1304 | +# CONFIG_PHY_VITESSE is not set 1305 | +# CONFIG_PHY_XILINX is not set 1306 | +# CONFIG_DM_ETH is not set 1307 | +# CONFIG_NETDEVICES is not set 1308 | +# CONFIG_PCI is not set 1309 | + 1310 | +# 1311 | +# PHY Subsystem 1312 | +# 1313 | +# CONFIG_PHY is not set 1314 | +# CONFIG_SPL_PHY is not set 1315 | +# CONFIG_MVEBU_COMPHY_SUPPORT is not set 1316 | + 1317 | +# 1318 | +# Pin controllers 1319 | +# 1320 | +# CONFIG_PINCTRL is not set 1321 | +# CONFIG_SPL_PINCTRL is not set 1322 | + 1323 | +# 1324 | +# Power 1325 | +# 1326 | + 1327 | +# 1328 | +# Power Domain Support 1329 | +# 1330 | +# CONFIG_DM_PMIC is not set 1331 | +# CONFIG_PMIC_AS3722 is not set 1332 | +# CONFIG_POWER_MC34VR500 is not set 1333 | +# CONFIG_DM_REGULATOR is not set 1334 | +# CONFIG_DM_PWM is not set 1335 | +# CONFIG_PWM_SANDBOX is not set 1336 | +# CONFIG_RAM is not set 1337 | + 1338 | +# 1339 | +# Remote Processor drivers 1340 | +# 1341 | + 1342 | +# 1343 | +# Reset Controller Support 1344 | +# 1345 | + 1346 | +# 1347 | +# Real Time Clock 1348 | +# 1349 | +# CONFIG_DM_RTC is not set 1350 | +# CONFIG_SCSI is not set 1351 | + 1352 | +# 1353 | +# Serial drivers 1354 | +# 1355 | +CONFIG_BAUDRATE=115200 1356 | +CONFIG_REQUIRE_SERIAL_CONSOLE=y 1357 | +CONFIG_SERIAL_PRESENT=y 1358 | +CONFIG_SPL_SERIAL_PRESENT=y 1359 | +CONFIG_DM_SERIAL=y 1360 | +# CONFIG_SERIAL_RX_BUFFER is not set 1361 | +CONFIG_SPL_DM_SERIAL=y 1362 | +# CONFIG_TPL_DM_SERIAL is not set 1363 | +# CONFIG_DEBUG_UART_SKIP_INIT is not set 1364 | +# CONFIG_ALTERA_JTAG_UART is not set 1365 | +# CONFIG_ALTERA_UART is not set 1366 | +# CONFIG_ATMEL_USART is not set 1367 | +# CONFIG_FSL_LPUART is not set 1368 | +# CONFIG_MVEBU_A3700_UART is not set 1369 | +CONFIG_SYS_NS16550=y 1370 | +# CONFIG_MSM_SERIAL is not set 1371 | +# CONFIG_PXA_SERIAL is not set 1372 | + 1373 | +# 1374 | +# Sound support 1375 | +# 1376 | +# CONFIG_SOUND is not set 1377 | + 1378 | +# 1379 | +# SPI Support 1380 | +# 1381 | +# CONFIG_DM_SPI is not set 1382 | +# CONFIG_SOFT_SPI is not set 1383 | +# CONFIG_FSL_ESPI is not set 1384 | +# CONFIG_FSL_QSPI is not set 1385 | +# CONFIG_TI_QSPI is not set 1386 | +# CONFIG_OMAP3_SPI is not set 1387 | + 1388 | +# 1389 | +# SPMI support 1390 | +# 1391 | +# CONFIG_SPMI is not set 1392 | + 1393 | +# 1394 | +# System reset device drivers 1395 | +# 1396 | +# CONFIG_SYSRESET is not set 1397 | +# CONFIG_SYSRESET_SYSCON is not set 1398 | +# CONFIG_SYSRESET_WATCHDOG is not set 1399 | +# CONFIG_DM_THERMAL is not set 1400 | + 1401 | +# 1402 | +# Timer Support 1403 | +# 1404 | +# CONFIG_TIMER is not set 1405 | + 1406 | +# 1407 | +# TPM support 1408 | +# 1409 | +CONFIG_USB=y 1410 | +# CONFIG_DM_USB is not set 1411 | + 1412 | +# 1413 | +# USB Host Controller Drivers 1414 | +# 1415 | +# CONFIG_USB_XHCI_HCD is not set 1416 | +# CONFIG_USB_EHCI_HCD is not set 1417 | +# CONFIG_USB_OHCI_HCD is not set 1418 | +# CONFIG_USB_UHCI_HCD is not set 1419 | +# CONFIG_USB_DWC2 is not set 1420 | +# CONFIG_USB_DWC3 is not set 1421 | + 1422 | +# 1423 | +# MUSB Controller Driver 1424 | +# 1425 | +CONFIG_USB_MUSB_HOST=y 1426 | +CONFIG_USB_MUSB_GADGET=y 1427 | + 1428 | +# 1429 | +# ULPI drivers 1430 | +# 1431 | + 1432 | +# 1433 | +# USB peripherals 1434 | +# 1435 | +CONFIG_USB_STORAGE=y 1436 | +# CONFIG_USB_KEYBOARD is not set 1437 | +CONFIG_USB_GADGET=y 1438 | +# CONFIG_USB_GADGET_ATMEL_USBA is not set 1439 | +# CONFIG_USB_GADGET_BCM_UDC_OTG_PHY is not set 1440 | +# CONFIG_USB_GADGET_DWC2_OTG is not set 1441 | +# CONFIG_CI_UDC is not set 1442 | +CONFIG_USB_GADGET_VBUS_DRAW=2 1443 | +CONFIG_USB_GADGET_DUALSPEED=y 1444 | +CONFIG_USB_GADGET_DOWNLOAD=y 1445 | +# CONFIG_USB_FUNCTION_SDP is not set 1446 | +CONFIG_G_DNL_MANUFACTURER="Texas Instruments" 1447 | +CONFIG_G_DNL_VENDOR_NUM=0x0451 1448 | +CONFIG_G_DNL_PRODUCT_NUM=0xd022 1449 | +CONFIG_USBNET_DEVADDR="de:ad:be:ef:00:01" 1450 | +# CONFIG_USB_HOST_ETHER is not set 1451 | + 1452 | +# 1453 | +# Graphics support 1454 | +# 1455 | +# CONFIG_DM_VIDEO is not set 1456 | +# CONFIG_SYS_WHITE_ON_BLACK is not set 1457 | + 1458 | +# 1459 | +# TrueType Fonts 1460 | +# 1461 | +# CONFIG_VIDEO_VESA is not set 1462 | +# CONFIG_VIDEO_LCD_ANX9804 is not set 1463 | +# CONFIG_VIDEO_LCD_SSD2828 is not set 1464 | +# CONFIG_VIDEO_MVEBU is not set 1465 | +# CONFIG_DISPLAY is not set 1466 | +# CONFIG_VIDEO_BRIDGE is not set 1467 | +# CONFIG_LCD is not set 1468 | + 1469 | +# 1470 | +# Watchdog Timer Support 1471 | +# 1472 | +CONFIG_HW_WATCHDOG=y 1473 | +# CONFIG_BCM2835_WDT is not set 1474 | +CONFIG_OMAP_WATCHDOG=y 1475 | +# CONFIG_ULP_WATCHDOG is not set 1476 | +# CONFIG_WDT is not set 1477 | +# CONFIG_PHYS_TO_BUS is not set 1478 | + 1479 | +# 1480 | +# File systems 1481 | +# 1482 | +# CONFIG_FS_CBFS is not set 1483 | +CONFIG_FS_FAT=y 1484 | +CONFIG_FAT_WRITE=y 1485 | +CONFIG_FS_FAT_MAX_CLUSTSIZE=65536 1486 | +# CONFIG_FS_JFFS2 is not set 1487 | +# CONFIG_FS_CRAMFS is not set 1488 | +# CONFIG_YAFFS2 is not set 1489 | + 1490 | +# 1491 | +# Library routines 1492 | +# 1493 | +# CONFIG_BCH is not set 1494 | +# CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED is not set 1495 | +CONFIG_HAVE_PRIVATE_LIBGCC=y 1496 | +CONFIG_USE_PRIVATE_LIBGCC=y 1497 | +CONFIG_SYS_HZ=1000 1498 | +CONFIG_USE_TINY_PRINTF=y 1499 | +CONFIG_REGEX=y 1500 | +# CONFIG_LIB_RAND is not set 1501 | +# CONFIG_SPL_TINY_MEMSET is not set 1502 | +# CONFIG_TPL_TINY_MEMSET is not set 1503 | +# CONFIG_CMD_DHRYSTONE is not set 1504 | + 1505 | +# 1506 | +# Security support 1507 | +# 1508 | +# CONFIG_AES is not set 1509 | +# CONFIG_RSA is not set 1510 | +# CONFIG_TPM is not set 1511 | + 1512 | +# 1513 | +# Hashing Support 1514 | +# 1515 | +CONFIG_SHA1=y 1516 | +CONFIG_SHA256=y 1517 | +# CONFIG_SHA_HW_ACCEL is not set 1518 | +CONFIG_MD5=y 1519 | + 1520 | +# 1521 | +# Compression Support 1522 | +# 1523 | +# CONFIG_LZ4 is not set 1524 | +# CONFIG_LZMA is not set 1525 | +CONFIG_LZO=y 1526 | +# CONFIG_ERRNO_STR is not set 1527 | +CONFIG_OF_LIBFDT=y 1528 | +CONFIG_OF_LIBFDT_OVERLAY=y 1529 | +CONFIG_SPL_OF_LIBFDT=y 1530 | +# CONFIG_FDT_FIXUP_PARTITIONS is not set 1531 | + 1532 | +# 1533 | +# System tables 1534 | +# 1535 | +CONFIG_GENERATE_SMBIOS_TABLE=y 1536 | +CONFIG_SMBIOS_MANUFACTURER="ti" 1537 | +# CONFIG_EFI_LOADER is not set 1538 | +# CONFIG_UNIT_TEST is not set 1539 | diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c 1540 | index a59ff5a8bb..4e685a0931 100644 1541 | --- a/fs/btrfs/compression.c 1542 | +++ b/fs/btrfs/compression.c 1543 | @@ -9,6 +9,7 @@ 1544 | #include "btrfs.h" 1545 | #include 1546 | #include 1547 | +#include 1548 | 1549 | static u32 decompress_lzo(const u8 *cbuf, u32 clen, u8 *dbuf, u32 dlen) 1550 | { 1551 | @@ -19,7 +20,7 @@ static u32 decompress_lzo(const u8 *cbuf, u32 clen, u8 *dbuf, u32 dlen) 1552 | if (clen < 4) 1553 | return -1; 1554 | 1555 | - tot_len = le32_to_cpu(*(u32 *) cbuf); 1556 | + tot_len = le32_to_cpu(get_unaligned((u32 *) cbuf)); 1557 | cbuf += 4; 1558 | clen -= 4; 1559 | tot_len -= 4; 1560 | @@ -32,7 +33,7 @@ static u32 decompress_lzo(const u8 *cbuf, u32 clen, u8 *dbuf, u32 dlen) 1561 | res = 0; 1562 | 1563 | while (tot_len > 4) { 1564 | - in_len = le32_to_cpu(*(u32 *) cbuf); 1565 | + in_len = le32_to_cpu(get_unaligned((u32 *) cbuf)); 1566 | cbuf += 4; 1567 | clen -= 4; 1568 | 1569 | diff --git a/fs/btrfs/hash.c b/fs/btrfs/hash.c 1570 | index f8a50e532a..1c75ea8b48 100644 1571 | --- a/fs/btrfs/hash.c 1572 | +++ b/fs/btrfs/hash.c 1573 | @@ -8,6 +8,7 @@ 1574 | 1575 | #include "btrfs.h" 1576 | #include 1577 | +#include 1578 | 1579 | static u32 btrfs_crc32c_table[256]; 1580 | 1581 | @@ -34,5 +35,5 @@ u32 btrfs_csum_data(char *data, u32 seed, size_t len) 1582 | 1583 | void btrfs_csum_final(u32 crc, void *result) 1584 | { 1585 | - *((u32 *) result) = cpu_to_le32(~crc); 1586 | + put_unaligned(cpu_to_le32(~crc), (u32 *) result); 1587 | } 1588 | diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c 1589 | index dac9545365..a8e6fdef51 100644 1590 | --- a/fs/ext4/ext4_common.c 1591 | +++ b/fs/ext4/ext4_common.c 1592 | @@ -2378,7 +2378,7 @@ int ext4fs_mount(unsigned part_length) 1593 | 1594 | return 1; 1595 | fail: 1596 | - printf("Failed to mount ext2 filesystem...\n"); 1597 | + //printf("Failed to mount ext2 filesystem...\n"); 1598 | free(data); 1599 | ext4fs_root = NULL; 1600 | 1601 | diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h 1602 | index 856c546fc1..078a706676 100644 1603 | --- a/include/configs/am335x_evm.h 1604 | +++ b/include/configs/am335x_evm.h 1605 | @@ -59,9 +59,14 @@ 1606 | 1607 | #define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \ 1608 | "bootcmd_" #devtypel #instance "=" \ 1609 | + "gpio clear 56; " \ 1610 | + "gpio clear 55; " \ 1611 | + "gpio clear 54; " \ 1612 | + "gpio set 53; " \ 1613 | + "setenv devtype mmc; " \ 1614 | "setenv mmcdev " #instance"; "\ 1615 | - "setenv bootpart " #instance":2 ; "\ 1616 | - "run mmcboot\0" 1617 | + "setenv bootpart " #instance":1 ; "\ 1618 | + "run boot\0" 1619 | 1620 | #define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \ 1621 | #devtypel #instance " " 1622 | @@ -78,7 +83,6 @@ 1623 | func(LEGACY_MMC, legacy_mmc, 0) \ 1624 | func(MMC, mmc, 1) \ 1625 | func(LEGACY_MMC, legacy_mmc, 1) \ 1626 | - func(NAND, nand, 0) \ 1627 | func(PXE, pxe, na) \ 1628 | func(DHCP, dhcp, na) 1629 | 1630 | @@ -95,6 +99,7 @@ 1631 | "bootpart=0:2\0" \ 1632 | "bootdir=/boot\0" \ 1633 | "bootfile=zImage\0" \ 1634 | + "board_eeprom_header=undefined\0" \ 1635 | "fdtfile=undefined\0" \ 1636 | "console=ttyO0,115200n8\0" \ 1637 | "partitions=" \ 1638 | @@ -125,11 +130,66 @@ 1639 | "ramboot=echo Booting from ramdisk ...; " \ 1640 | "run ramargs; " \ 1641 | "bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \ 1642 | + "pb_eeprom_hdr=" \ 1643 | + "mw 82001000 ee3355aa; " \ 1644 | + "mw 82001004 35333341; " \ 1645 | + "mw 82001008 4c474250\0" \ 1646 | + "serverip=192.168.1.1\0" \ 1647 | + "ipaddr=192.168.1.2\0" \ 1648 | + "if_netconsole=ping $serverip\0" \ 1649 | + "start_netconsole=" \ 1650 | + "setenv ncip $serverip; " \ 1651 | + "setenv bootdelay 10; " \ 1652 | + "setenv stdin serial,nc; " \ 1653 | + "setenv stdout serial,nc; " \ 1654 | + "setenv stderr serial,nc; " \ 1655 | + "version\0" \ 1656 | + "preboot=run if_netconsole start_netconsole\0"\ 1657 | + "eeprom_program="\ 1658 | + "if test $board_eeprom_header = bbb_blank; then " \ 1659 | + "run eeprom_dump; run eeprom_blank; run eeprom_bbb_header; run eeprom_dump; reset; fi; " \ 1660 | + "if test $board_eeprom_header = bbbl_blank; then " \ 1661 | + "run eeprom_dump; run eeprom_blank; run eeprom_bbb_header; run eeprom_bbbl_footer; run eeprom_dump; reset; fi; " \ 1662 | + "if test $board_eeprom_header = bbbw_blank; then " \ 1663 | + "run eeprom_dump; run eeprom_blank; run eeprom_bbb_header; run eeprom_bbbw_footer; run eeprom_dump; reset; fi; " \ 1664 | + "if test $board_eeprom_header = os00_blank; then " \ 1665 | + "run eeprom_dump; run eeprom_blank; run eeprom_bbb_header; run eeprom_os00_footer; run eeprom_dump; reset; fi; " \ 1666 | + "if test $board_eeprom_header = beaglelogic_blank; then " \ 1667 | + "run eeprom_dump; run eeprom_blank; run eeprom_beaglelogic; run eeprom_dump; reset; fi; \0" \ 1668 | "findfdt="\ 1669 | + "echo board_name=[$board_name] ...; " \ 1670 | + "if test $board_name = A335PBGL; then " \ 1671 | + "setenv fdtfile am335x-pocketbeagle.dtb; fi; " \ 1672 | + "if test $board_name = A335BLGC; then " \ 1673 | + "setenv fdtfile am335x-beaglelogic.dtb; fi; " \ 1674 | "if test $board_name = A335BONE; then " \ 1675 | "setenv fdtfile am335x-bone.dtb; fi; " \ 1676 | "if test $board_name = A335BNLT; then " \ 1677 | - "setenv fdtfile am335x-boneblack.dtb; fi; " \ 1678 | + "echo board_rev=[$board_rev] ...; " \ 1679 | + "if test $board_rev = GH01; then " \ 1680 | + "setenv fdtfile am335x-boneblack.dtb; " \ 1681 | + "elif test $board_rev = BBG1; then " \ 1682 | + "setenv fdtfile am335x-bonegreen.dtb; " \ 1683 | + "elif test $board_rev = BP00; then " \ 1684 | + "setenv fdtfile am335x-pocketbone.dtb; " \ 1685 | + "elif test $board_rev = GW1A; then " \ 1686 | + "setenv fdtfile am335x-bonegreen-wireless.dtb; " \ 1687 | + "elif test $board_rev = AIA0; then " \ 1688 | + "setenv fdtfile am335x-abbbi.dtb; " \ 1689 | + "elif test $board_rev = EIA0; then " \ 1690 | + "setenv fdtfile am335x-boneblack.dtb; " \ 1691 | + "elif test $board_rev = SE0A; then " \ 1692 | + "setenv fdtfile am335x-sancloud-bbe.dtb; " \ 1693 | + "elif test $board_rev = ME06; then " \ 1694 | + "setenv fdtfile am335x-bonegreen.dtb; " \ 1695 | + "elif test $board_rev = M10A; then " \ 1696 | + "setenv fdtfile am335x-vsc8531bbb.dtb; " \ 1697 | + "elif test $board_rev = OS00; then " \ 1698 | + "setenv fdtfile am335x-osd3358-sm-red.dtb; " \ 1699 | + "else " \ 1700 | + "setenv fdtfile am335x-boneblack.dtb; " \ 1701 | + "fi; " \ 1702 | + "fi; " \ 1703 | "if test $board_name = BBBW; then " \ 1704 | "setenv fdtfile am335x-boneblack-wireless.dtb; fi; " \ 1705 | "if test $board_name = BBG1; then " \ 1706 | @@ -138,6 +198,10 @@ 1707 | "setenv fdtfile am335x-bonegreen-wireless.dtb; fi; " \ 1708 | "if test $board_name = BBBL; then " \ 1709 | "setenv fdtfile am335x-boneblue.dtb; fi; " \ 1710 | + "if test $board_name = SBBE; then " \ 1711 | + "setenv fdtfile am335x-sancloud-bbe.dtb; fi; " \ 1712 | + "if test $board_name = OS00; then " \ 1713 | + "setenv fdtfile am335x-osd3358-sm-red.dtb; fi; " \ 1714 | "if test $board_name = A33515BB; then " \ 1715 | "setenv fdtfile am335x-evm.dtb; fi; " \ 1716 | "if test $board_name = A335X_SK; then " \ 1717 | @@ -145,13 +209,22 @@ 1718 | "if test $board_name = A335_ICE; then " \ 1719 | "setenv fdtfile am335x-icev2.dtb; fi; " \ 1720 | "if test $fdtfile = undefined; then " \ 1721 | - "echo WARNING: Could not determine device tree to use; fi; \0" \ 1722 | + "setenv board_name A335BNLT; " \ 1723 | + "setenv board_rev EMMC; " \ 1724 | + "setenv fdtfile am335x-boneblack-emmc-overlay.dtb; " \ 1725 | + "fi; \0" \ 1726 | "init_console=" \ 1727 | "if test $board_name = A335_ICE; then "\ 1728 | "setenv console ttyO3,115200n8;" \ 1729 | + "elif test $board_name = A335BLGC; then " \ 1730 | + "setenv console ttyO4,115200n8;" \ 1731 | "else " \ 1732 | "setenv console ttyO0,115200n8;" \ 1733 | "fi;\0" \ 1734 | + EEWIKI_NFS \ 1735 | + EEWIKI_BOOT \ 1736 | + EEWIKI_UNAME_BOOT \ 1737 | + EEPROM_PROGRAMMING \ 1738 | NANDARGS \ 1739 | NETARGS \ 1740 | DFUARGS \ 1741 | @@ -232,9 +305,14 @@ 1742 | #define CONFIG_USB_MUSB_PIO_ONLY 1743 | #define CONFIG_USB_MUSB_DISABLE_BULK_COMBINE_SPLIT 1744 | #define CONFIG_AM335X_USB0 1745 | -#define CONFIG_AM335X_USB0_MODE MUSB_PERIPHERAL 1746 | #define CONFIG_AM335X_USB1 1747 | +#ifdef CONFIG_AM335X_USB_SWAP 1748 | +#define CONFIG_AM335X_USB0_MODE MUSB_HOST 1749 | +#define CONFIG_AM335X_USB1_MODE MUSB_PERIPHERAL 1750 | +#else 1751 | +#define CONFIG_AM335X_USB0_MODE MUSB_PERIPHERAL 1752 | #define CONFIG_AM335X_USB1_MODE MUSB_HOST 1753 | +#endif 1754 | 1755 | /* 1756 | * Disable MMC DM for SPL build and can be re-enabled after adding 1757 | @@ -287,6 +365,17 @@ 1758 | #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) 1759 | #define CONFIG_SYS_REDUNDAND_ENVIRONMENT 1760 | #define CONFIG_SYS_MMC_MAX_DEVICE 2 1761 | +#elif defined(CONFIG_SD_BOOT) 1762 | +#define CONFIG_ENV_IS_IN_FAT 1763 | +#define FAT_ENV_INTERFACE "mmc" 1764 | +#define FAT_ENV_DEVICE_AND_PART "0:1" 1765 | +#define FAT_ENV_FILE "uboot.env" 1766 | +#ifndef CONFIG_FAT_WRITE 1767 | +#define CONFIG_FAT_WRITE 1768 | +#endif 1769 | +#define FAT_ENV_DEVICE 0 1770 | +#define FAT_ENV_PART 1 1771 | +#define CONFIG_BOOT_PARTITION_ACCESS 1772 | #elif defined(CONFIG_NOR_BOOT) 1773 | #define CONFIG_ENV_SECT_SIZE (128 << 10) /* 128 KiB */ 1774 | #define CONFIG_ENV_OFFSET (512 << 10) /* 512 KiB */ 1775 | diff --git a/include/configs/ti_am335x_common.h b/include/configs/ti_am335x_common.h 1776 | index 66cacdf347..1f4da159d9 100644 1777 | --- a/include/configs/ti_am335x_common.h 1778 | +++ b/include/configs/ti_am335x_common.h 1779 | @@ -39,7 +39,9 @@ 1780 | #define CONFIG_MII /* Required in net/eth.c */ 1781 | #endif 1782 | 1783 | +#ifndef CONFIG_DISABLE_CPSW 1784 | #define CONFIG_DRIVER_TI_CPSW /* Driver for IP block */ 1785 | +#endif 1786 | /* 1787 | * RTC related defines. To use bootcount you must set bootlimit in the 1788 | * environment to a non-zero value and enable CONFIG_BOOTCOUNT_LIMIT 1789 | diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h 1790 | index 91e139853c..b5d2f8b1df 100644 1791 | --- a/include/configs/ti_armv7_common.h 1792 | +++ b/include/configs/ti_armv7_common.h 1793 | @@ -129,6 +129,305 @@ 1794 | /* Boot Argument Buffer Size */ 1795 | #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE 1796 | 1797 | +#define EEPROM_PROGRAMMING \ 1798 | + "eeprom_dump=i2c dev 0; " \ 1799 | + "i2c md 0x50 0x00.2 20; " \ 1800 | + "\0" \ 1801 | + "eeprom_blank=i2c dev 0; " \ 1802 | + "i2c mw 0x50 0x00.2 ff; " \ 1803 | + "i2c mw 0x50 0x01.2 ff; " \ 1804 | + "i2c mw 0x50 0x02.2 ff; " \ 1805 | + "i2c mw 0x50 0x03.2 ff; " \ 1806 | + "i2c mw 0x50 0x04.2 ff; " \ 1807 | + "i2c mw 0x50 0x05.2 ff; " \ 1808 | + "i2c mw 0x50 0x06.2 ff; " \ 1809 | + "i2c mw 0x50 0x07.2 ff; " \ 1810 | + "i2c mw 0x50 0x08.2 ff; " \ 1811 | + "i2c mw 0x50 0x09.2 ff; " \ 1812 | + "i2c mw 0x50 0x0a.2 ff; " \ 1813 | + "i2c mw 0x50 0x0b.2 ff; " \ 1814 | + "i2c mw 0x50 0x0c.2 ff; " \ 1815 | + "i2c mw 0x50 0x0d.2 ff; " \ 1816 | + "i2c mw 0x50 0x0e.2 ff; " \ 1817 | + "i2c mw 0x50 0x0f.2 ff; " \ 1818 | + "i2c mw 0x50 0x10.2 ff; " \ 1819 | + "i2c mw 0x50 0x11.2 ff; " \ 1820 | + "i2c mw 0x50 0x12.2 ff; " \ 1821 | + "i2c mw 0x50 0x13.2 ff; " \ 1822 | + "i2c mw 0x50 0x14.2 ff; " \ 1823 | + "i2c mw 0x50 0x15.2 ff; " \ 1824 | + "i2c mw 0x50 0x16.2 ff; " \ 1825 | + "i2c mw 0x50 0x17.2 ff; " \ 1826 | + "i2c mw 0x50 0x18.2 ff; " \ 1827 | + "i2c mw 0x50 0x19.2 ff; " \ 1828 | + "i2c mw 0x50 0x1a.2 ff; " \ 1829 | + "i2c mw 0x50 0x1b.2 ff; " \ 1830 | + "i2c mw 0x50 0x1c.2 ff; " \ 1831 | + "i2c mw 0x50 0x1d.2 ff; " \ 1832 | + "i2c mw 0x50 0x1e.2 ff; " \ 1833 | + "i2c mw 0x50 0x1f.2 ff; " \ 1834 | + "\0" \ 1835 | + "eeprom_bbb_header=i2c dev 0; " \ 1836 | + "i2c mw 0x50 0x00.2 aa; " \ 1837 | + "i2c mw 0x50 0x01.2 55; " \ 1838 | + "i2c mw 0x50 0x02.2 33; " \ 1839 | + "i2c mw 0x50 0x03.2 ee; " \ 1840 | + "i2c mw 0x50 0x04.2 41; " \ 1841 | + "i2c mw 0x50 0x05.2 33; " \ 1842 | + "i2c mw 0x50 0x06.2 33; " \ 1843 | + "i2c mw 0x50 0x07.2 35; " \ 1844 | + "i2c mw 0x50 0x08.2 42; " \ 1845 | + "i2c mw 0x50 0x09.2 4e; " \ 1846 | + "i2c mw 0x50 0x0a.2 4c; " \ 1847 | + "i2c mw 0x50 0x0b.2 54; " \ 1848 | + "\0" \ 1849 | + "eeprom_bbbl_footer= " \ 1850 | + "i2c mw 0x50 0x0c.2 42; " \ 1851 | + "i2c mw 0x50 0x0d.2 4c; " \ 1852 | + "i2c mw 0x50 0x0e.2 41; " \ 1853 | + "i2c mw 0x50 0x0f.2 32; " \ 1854 | + "\0" \ 1855 | + "eeprom_bbbw_footer= " \ 1856 | + "i2c mw 0x50 0x0c.2 42; " \ 1857 | + "i2c mw 0x50 0x0d.2 57; " \ 1858 | + "i2c mw 0x50 0x0e.2 41; " \ 1859 | + "i2c mw 0x50 0x0f.2 35; " \ 1860 | + "\0" \ 1861 | + "eeprom_os00_footer= " \ 1862 | + "i2c mw 0x50 0x0c.2 4F; " \ 1863 | + "i2c mw 0x50 0x0d.2 53; " \ 1864 | + "i2c mw 0x50 0x0e.2 30; " \ 1865 | + "i2c mw 0x50 0x0f.2 30; " \ 1866 | + "\0" \ 1867 | + "eeprom_beaglelogic= " \ 1868 | + "i2c mw 0x50 0x00.2 aa; " \ 1869 | + "i2c mw 0x50 0x01.2 55; " \ 1870 | + "i2c mw 0x50 0x02.2 33; " \ 1871 | + "i2c mw 0x50 0x03.2 ee; " \ 1872 | + "i2c mw 0x50 0x04.2 41; " \ 1873 | + "i2c mw 0x50 0x05.2 33; " \ 1874 | + "i2c mw 0x50 0x06.2 33; " \ 1875 | + "i2c mw 0x50 0x07.2 35; " \ 1876 | + "i2c mw 0x50 0x08.2 42; " \ 1877 | + "i2c mw 0x50 0x09.2 4c; " \ 1878 | + "i2c mw 0x50 0x0a.2 47; " \ 1879 | + "i2c mw 0x50 0x0b.2 43; " \ 1880 | + "i2c mw 0x50 0x0c.2 30; " \ 1881 | + "i2c mw 0x50 0x0d.2 30; " \ 1882 | + "i2c mw 0x50 0x0e.2 30; " \ 1883 | + "i2c mw 0x50 0x0f.2 41; " \ 1884 | + "\0" \ 1885 | + 1886 | + 1887 | +#define EEWIKI_NFS \ 1888 | + "server_ip=192.168.1.100\0" \ 1889 | + "gw_ip=192.168.1.1\0" \ 1890 | + "netmask=255.255.255.0\0" \ 1891 | + "hostname=\0" \ 1892 | + "device=eth0\0" \ 1893 | + "autoconf=off\0" \ 1894 | + "root_dir=/home/userid/targetNFS\0" \ 1895 | + "tftp_dir=\0" \ 1896 | + "nfs_options=,vers=3\0" \ 1897 | + "nfsrootfstype=ext4 rootwait fixrtc\0" \ 1898 | + "nfsargs=setenv bootargs console=${console} " \ 1899 | + "${optargs} " \ 1900 | + "${cape_disable} " \ 1901 | + "${cape_enable} " \ 1902 | + "${cape_uboot} " \ 1903 | + "root=/dev/nfs rw " \ 1904 | + "rootfstype=${nfsrootfstype} " \ 1905 | + "nfsroot=${nfsroot} " \ 1906 | + "ip=${ip} " \ 1907 | + "${cmdline}\0" \ 1908 | + "nfsboot=echo Booting from ${server_ip} ...; " \ 1909 | + "setenv nfsroot ${server_ip}:${root_dir}${nfs_options}; " \ 1910 | + "setenv ip ${client_ip}:${server_ip}:${gw_ip}:${netmask}:${hostname}:${device}:${autoconf}; " \ 1911 | + "setenv autoload no; " \ 1912 | + "setenv serverip ${server_ip}; " \ 1913 | + "setenv ipaddr ${client_ip}; " \ 1914 | + "tftp ${loadaddr} ${tftp_dir}${bootfile}; " \ 1915 | + "tftp ${fdtaddr} ${tftp_dir}dtbs/${fdtfile}; " \ 1916 | + "run nfsargs; " \ 1917 | + "bootz ${loadaddr} - ${fdtaddr}\0" \ 1918 | + "nfsboot_uname_r=echo Booting from ${server_ip} ...; " \ 1919 | + "setenv nfsroot ${server_ip}:${root_dir}${nfs_options}; " \ 1920 | + "setenv ip ${client_ip}:${server_ip}:${gw_ip}:${netmask}:${hostname}:${device}:${autoconf}; " \ 1921 | + "setenv autoload no; " \ 1922 | + "setenv serverip ${server_ip}; " \ 1923 | + "setenv ipaddr ${client_ip}; " \ 1924 | + "tftp ${loadaddr} ${tftp_dir}vmlinuz-${uname_r}; " \ 1925 | + "tftp ${fdtaddr} ${tftp_dir}dtbs/${uname_r}/${fdtfile}; " \ 1926 | + "run nfsargs; " \ 1927 | + "bootz ${loadaddr} - ${fdtaddr}\0" \ 1928 | + 1929 | +#define EEWIKI_BOOT \ 1930 | + "boot=${devtype} dev ${mmcdev}; " \ 1931 | + "if ${devtype} rescan; then " \ 1932 | + "gpio set 54;" \ 1933 | + "setenv bootpart ${mmcdev}:1; " \ 1934 | + "if test -e ${devtype} ${bootpart} /etc/fstab; then " \ 1935 | + "setenv mmcpart 1;" \ 1936 | + "fi; " \ 1937 | + "echo Checking for: /uEnv.txt ...;" \ 1938 | + "if test -e ${devtype} ${bootpart} /uEnv.txt; then " \ 1939 | + "if run loadbootenv; then " \ 1940 | + "gpio set 55;" \ 1941 | + "echo Loaded environment from /uEnv.txt;" \ 1942 | + "run importbootenv;" \ 1943 | + "fi;" \ 1944 | + "echo Checking if uenvcmd is set ...;" \ 1945 | + "if test -n ${uenvcmd}; then " \ 1946 | + "gpio set 56; " \ 1947 | + "echo Running uenvcmd ...;" \ 1948 | + "run uenvcmd;" \ 1949 | + "fi;" \ 1950 | + "echo Checking if client_ip is set ...;" \ 1951 | + "if test -n ${client_ip}; then " \ 1952 | + "if test -n ${dtb}; then " \ 1953 | + "setenv fdtfile ${dtb};" \ 1954 | + "echo using ${fdtfile} ...;" \ 1955 | + "fi;" \ 1956 | + "gpio set 56; " \ 1957 | + "if test -n ${uname_r}; then " \ 1958 | + "echo Running nfsboot_uname_r ...;" \ 1959 | + "run nfsboot_uname_r;" \ 1960 | + "fi;" \ 1961 | + "echo Running nfsboot ...;" \ 1962 | + "run nfsboot;" \ 1963 | + "fi;" \ 1964 | + "fi; " \ 1965 | + "echo Checking for: /${script} ...;" \ 1966 | + "if test -e ${devtype} ${bootpart} /${script}; then " \ 1967 | + "gpio set 55;" \ 1968 | + "setenv scriptfile ${script};" \ 1969 | + "run loadbootscript;" \ 1970 | + "echo Loaded script from ${scriptfile};" \ 1971 | + "gpio set 56; " \ 1972 | + "run bootscript;" \ 1973 | + "fi; " \ 1974 | + "echo Checking for: /boot/${script} ...;" \ 1975 | + "if test -e ${devtype} ${bootpart} /boot/${script}; then " \ 1976 | + "gpio set 55;" \ 1977 | + "setenv scriptfile /boot/${script};" \ 1978 | + "run loadbootscript;" \ 1979 | + "echo Loaded script from ${scriptfile};" \ 1980 | + "gpio set 56; " \ 1981 | + "run bootscript;" \ 1982 | + "fi; " \ 1983 | + "echo Checking for: /boot/uEnv.txt ...;" \ 1984 | + "for i in 1 2 3 4 5 6 7 ; do " \ 1985 | + "setenv mmcpart ${i};" \ 1986 | + "setenv bootpart ${mmcdev}:${mmcpart};" \ 1987 | + "if test -e ${devtype} ${bootpart} /boot/uEnv.txt; then " \ 1988 | + "gpio set 55;" \ 1989 | + "load ${devtype} ${bootpart} ${loadaddr} /boot/uEnv.txt;" \ 1990 | + "env import -t ${loadaddr} ${filesize};" \ 1991 | + "echo Loaded environment from /boot/uEnv.txt;" \ 1992 | + "if test -n ${dtb}; then " \ 1993 | + "echo debug: [dtb=${dtb}] ... ;" \ 1994 | + "setenv fdtfile ${dtb};" \ 1995 | + "echo Using: dtb=${fdtfile} ...;" \ 1996 | + "fi;" \ 1997 | + "echo Checking if uname_r is set in /boot/uEnv.txt...;" \ 1998 | + "if test -n ${uname_r}; then " \ 1999 | + "gpio set 56; " \ 2000 | + "setenv oldroot /dev/mmcblk${mmcdev}p${mmcpart};" \ 2001 | + "echo Running uname_boot ...;" \ 2002 | + "run uname_boot;" \ 2003 | + "fi;" \ 2004 | + "fi;" \ 2005 | + "done;" \ 2006 | + "fi;\0" \ 2007 | + 2008 | +#define EEWIKI_UNAME_BOOT \ 2009 | + "uname_boot="\ 2010 | + "setenv bootdir /boot; " \ 2011 | + "setenv bootfile vmlinuz-${uname_r}; " \ 2012 | + "if test -e ${devtype} ${bootpart} ${bootdir}/${bootfile}; then " \ 2013 | + "echo loading ${bootdir}/${bootfile} ...; "\ 2014 | + "run loadimage;" \ 2015 | + "setenv fdtdir /boot/dtbs/${uname_r}; " \ 2016 | + "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \ 2017 | + "run loadfdt;" \ 2018 | + "else " \ 2019 | + "setenv fdtdir /usr/lib/linux-image-${uname_r}; " \ 2020 | + "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \ 2021 | + "run loadfdt;" \ 2022 | + "else " \ 2023 | + "setenv fdtdir /lib/firmware/${uname_r}/device-tree; " \ 2024 | + "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \ 2025 | + "run loadfdt;" \ 2026 | + "else " \ 2027 | + "setenv fdtdir /boot/dtb-${uname_r}; " \ 2028 | + "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \ 2029 | + "run loadfdt;" \ 2030 | + "else " \ 2031 | + "setenv fdtdir /boot/dtbs; " \ 2032 | + "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \ 2033 | + "run loadfdt;" \ 2034 | + "else " \ 2035 | + "setenv fdtdir /boot/dtb; " \ 2036 | + "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \ 2037 | + "run loadfdt;" \ 2038 | + "else " \ 2039 | + "setenv fdtdir /boot; " \ 2040 | + "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \ 2041 | + "run loadfdt;" \ 2042 | + "else " \ 2043 | + "if test -e ${devtype} ${bootpart} ${fdtfile}; then " \ 2044 | + "run loadfdt;" \ 2045 | + "else " \ 2046 | + "echo; echo unable to find [dtb=${fdtfile}] did you name it correctly? ...; " \ 2047 | + "run failumsboot;" \ 2048 | + "fi;" \ 2049 | + "fi;" \ 2050 | + "fi;" \ 2051 | + "fi;" \ 2052 | + "fi;" \ 2053 | + "fi;" \ 2054 | + "fi;" \ 2055 | + "fi; " \ 2056 | + "setenv rdfile initrd.img-${uname_r}; " \ 2057 | + "if test -e ${devtype} ${bootpart} ${bootdir}/${rdfile}; then " \ 2058 | + "echo loading ${bootdir}/${rdfile} ...; "\ 2059 | + "run loadrd;" \ 2060 | + "if test -n ${netinstall_enable}; then " \ 2061 | + "run args_netinstall; run message;" \ 2062 | + "echo debug: [${bootargs}] ... ;" \ 2063 | + "echo debug: [bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}] ... ;" \ 2064 | + "bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}; " \ 2065 | + "fi;" \ 2066 | + "if test -n ${uenv_root}; then " \ 2067 | + "run args_uenv_root;" \ 2068 | + "echo debug: [${bootargs}] ... ;" \ 2069 | + "echo debug: [bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}] ... ;" \ 2070 | + "bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}; " \ 2071 | + "fi;" \ 2072 | + "if test -n ${uuid}; then " \ 2073 | + "run args_mmc_uuid;" \ 2074 | + "echo debug: [${bootargs}] ... ;" \ 2075 | + "echo debug: [bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}] ... ;" \ 2076 | + "bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}; " \ 2077 | + "fi;" \ 2078 | + "run args_mmc_old;" \ 2079 | + "echo debug: [${bootargs}] ... ;" \ 2080 | + "echo debug: [bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}] ... ;" \ 2081 | + "bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}; " \ 2082 | + "else " \ 2083 | + "if test -n ${uenv_root}; then " \ 2084 | + "run args_uenv_root;" \ 2085 | + "echo debug: [${bootargs}] ... ;" \ 2086 | + "echo debug: [bootz ${loadaddr} - ${fdtaddr}] ... ;" \ 2087 | + "bootz ${loadaddr} - ${fdtaddr}; " \ 2088 | + "fi;" \ 2089 | + "run args_mmc_old;" \ 2090 | + "echo debug: [${bootargs}] ... ;" \ 2091 | + "echo debug: [bootz ${loadaddr} - ${fdtaddr}] ... ;" \ 2092 | + "bootz ${loadaddr} - ${fdtaddr}; " \ 2093 | + "fi;" \ 2094 | + "fi;\0" \ 2095 | + 2096 | /* 2097 | * When we have SPI, NOR or NAND flash we expect to be making use of 2098 | * mtdparts, both for ease of use in U-Boot and for passing information 2099 | diff --git a/include/environment/ti/mmc.h b/include/environment/ti/mmc.h 2100 | index 4305ebdaaf..0364f62c3d 100644 2101 | --- a/include/environment/ti/mmc.h 2102 | +++ b/include/environment/ti/mmc.h 2103 | @@ -12,20 +12,65 @@ 2104 | #define DEFAULT_MMC_TI_ARGS \ 2105 | "mmcdev=0\0" \ 2106 | "mmcrootfstype=ext4 rootwait\0" \ 2107 | - "finduuid=part uuid mmc ${bootpart} uuid\0" \ 2108 | + "finduuid=part uuid ${devtype} ${bootpart} uuid\0" \ 2109 | "args_mmc=run finduuid;setenv bootargs console=${console} " \ 2110 | + "${cape_disable} " \ 2111 | + "${cape_enable} " \ 2112 | + "${cape_uboot} " \ 2113 | + "root=PARTUUID=${uuid} ro " \ 2114 | + "rootfstype=${mmcrootfstype} " \ 2115 | + "${uboot_detected_capes} " \ 2116 | + "${cmdline}\0" \ 2117 | + "args_mmc_old=setenv bootargs console=${console} " \ 2118 | "${optargs} " \ 2119 | - "root=PARTUUID=${uuid} rw " \ 2120 | - "rootfstype=${mmcrootfstype}\0" \ 2121 | - "loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr\0" \ 2122 | - "bootscript=echo Running bootscript from mmc${mmcdev} ...; " \ 2123 | + "${cape_disable} " \ 2124 | + "${cape_enable} " \ 2125 | + "${cape_uboot} " \ 2126 | + "root=${oldroot} ro " \ 2127 | + "rootfstype=${mmcrootfstype} " \ 2128 | + "${uboot_detected_capes} " \ 2129 | + "${cmdline}\0" \ 2130 | + "args_mmc_uuid=setenv bootargs console=${console} " \ 2131 | + "${optargs} " \ 2132 | + "${cape_disable} " \ 2133 | + "${cape_enable} " \ 2134 | + "${cape_uboot} " \ 2135 | + "root=UUID=${uuid} ro " \ 2136 | + "rootfstype=${mmcrootfstype} " \ 2137 | + "${uboot_detected_capes} " \ 2138 | + "${cmdline}\0" \ 2139 | + "args_uenv_root=setenv bootargs console=${console} " \ 2140 | + "${optargs} " \ 2141 | + "${cape_disable} " \ 2142 | + "${cape_enable} " \ 2143 | + "${cape_uboot} " \ 2144 | + "root=${uenv_root} ro " \ 2145 | + "rootfstype=${mmcrootfstype} " \ 2146 | + "${uboot_detected_capes} " \ 2147 | + "${cmdline}\0" \ 2148 | + "args_netinstall=setenv bootargs ${netinstall_bootargs} " \ 2149 | + "${optargs} " \ 2150 | + "${cape_disable} " \ 2151 | + "${cape_enable} " \ 2152 | + "${cape_uboot} " \ 2153 | + "root=/dev/ram rw " \ 2154 | + "${uboot_detected_capes} " \ 2155 | + "${cmdline}\0" \ 2156 | + "script=boot.scr\0" \ 2157 | + "scriptfile=${script}\0" \ 2158 | + "loadbootscript=load ${devtype} ${bootpart} ${loadaddr} ${scriptfile};\0" \ 2159 | + "bootscript=echo Running bootscript from mmc${bootpart} ...; " \ 2160 | "source ${loadaddr}\0" \ 2161 | "bootenvfile=uEnv.txt\0" \ 2162 | - "importbootenv=echo Importing environment from mmc${mmcdev} ...; " \ 2163 | + "bootenv=uEnv.txt\0" \ 2164 | + "importbootenv=echo Importing environment from ${devtype} ...; " \ 2165 | "env import -t ${loadaddr} ${filesize}\0" \ 2166 | - "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}\0" \ 2167 | + "loadbootenv=load ${devtype} ${bootpart} ${loadaddr} ${bootenvfile}\0" \ 2168 | "loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \ 2169 | - "loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \ 2170 | + "loadrd=load ${devtype} ${bootpart} ${rdaddr} ${bootdir}/${rdfile}; setenv rdsize ${filesize}\0" \ 2171 | + "loadfdt=echo loading ${fdtdir}/${fdtfile} ...; load ${devtype} ${bootpart} ${fdtaddr} ${fdtdir}/${fdtfile}\0" \ 2172 | + "failumsboot=echo; echo FAILSAFE: U-Boot UMS (USB Mass Storage) enabled, media now available over the usb slave port ...; " \ 2173 | + "ums 0 ${devtype} 1;\0" \ 2174 | "envboot=mmc dev ${mmcdev}; " \ 2175 | "if mmc rescan; then " \ 2176 | "echo SD/MMC found on device ${mmcdev};" \ 2177 | @@ -45,7 +90,11 @@ 2178 | "mmcloados=run args_mmc; " \ 2179 | "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ 2180 | "if run loadfdt; then " \ 2181 | - "bootz ${loadaddr} - ${fdtaddr}; " \ 2182 | + "if test -n ${uname_r}; then " \ 2183 | + "bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}; " \ 2184 | + "else " \ 2185 | + "bootz ${loadaddr} - ${fdtaddr}; " \ 2186 | + "fi; " \ 2187 | "else " \ 2188 | "if test ${boot_fdt} = try; then " \ 2189 | "bootz; " \ 2190 | -- 2191 | 2.15.1 2192 | 2193 | -------------------------------------------------------------------------------- /RESOURCES/buildroot/patches/uboot/0002-U-Boot-BeagleBone-Cape-Manager.patch: -------------------------------------------------------------------------------- 1 | From 4a7d1730af53b6e5fb83429f464335f986da54cf Mon Sep 17 00:00:00 2001 2 | From: Robert Nelson 3 | Date: Thu, 18 Jan 2018 14:51:58 -0600 4 | Subject: [PATCH 2/2] U-Boot: BeagleBone Cape Manager 5 | 6 | Signed-off-by: Robert Nelson 7 | --- 8 | arch/arm/mach-omap2/am33xx/clock_am33xx.c | 1 + 9 | board/ti/am335x/board.c | 451 ++++++++++++++++++++++++++++++ 10 | board/ti/am335x/board.h | 17 ++ 11 | board/ti/am335x/hash-string.h | 59 ++++ 12 | board/ti/am335x/mux.c | 15 + 13 | include/configs/ti_armv7_common.h | 189 +++++++++++++ 14 | include/configs/ti_armv7_omap.h | 3 + 15 | include/environment/ti/mmc.h | 15 + 16 | 8 files changed, 750 insertions(+) 17 | create mode 100644 board/ti/am335x/hash-string.h 18 | 19 | diff --git a/arch/arm/mach-omap2/am33xx/clock_am33xx.c b/arch/arm/mach-omap2/am33xx/clock_am33xx.c 20 | index 1780bbdb6f..a1ee457328 100644 21 | --- a/arch/arm/mach-omap2/am33xx/clock_am33xx.c 22 | +++ b/arch/arm/mach-omap2/am33xx/clock_am33xx.c 23 | @@ -214,6 +214,7 @@ void enable_basic_clocks(void) 24 | &cmper->gpio2clkctrl, 25 | &cmper->gpio3clkctrl, 26 | &cmper->i2c1clkctrl, 27 | + &cmper->i2c2clkctrl, 28 | &cmper->cpgmac0clkctrl, 29 | &cmper->spi0clkctrl, 30 | &cmrtc->rtcclkctrl, 31 | diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c 32 | index 8a41a03e7a..4942003439 100644 33 | --- a/board/ti/am335x/board.c 34 | +++ b/board/ti/am335x/board.c 35 | @@ -39,6 +39,7 @@ 36 | #include 37 | #include "../common/board_detect.h" 38 | #include "board.h" 39 | +#include "hash-string.h" 40 | 41 | DECLARE_GLOBAL_DATA_PTR; 42 | 43 | @@ -76,9 +77,451 @@ void do_board_detect(void) 44 | if (ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS, 45 | CONFIG_EEPROM_CHIP_ADDRESS)) 46 | printf("ti_i2c_eeprom_init failed\n"); 47 | + 48 | + //hack-ish, needs to mux'ed early, in do_cape_detect was too late... 49 | + enable_i2c2_pin_mux(); 50 | + i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED2, CONFIG_SYS_OMAP24_I2C_SLAVE2); 51 | } 52 | #endif 53 | 54 | +#define CAPE_EEPROM_ADDR0 0x54 55 | +#define CAPE_EEPROM_ADDR1 0x55 56 | +#define CAPE_EEPROM_ADDR2 0x56 57 | +#define CAPE_EEPROM_ADDR3 0x57 58 | + 59 | +void write_hex (unsigned char i) 60 | +{ 61 | + char cc; 62 | + 63 | + cc = i >> 4; 64 | + cc &= 0xf; 65 | + if (cc > 9) 66 | + serial_putc (cc + 55); 67 | + else 68 | + serial_putc (cc + 48); 69 | + cc = i & 0xf; 70 | + if (cc > 9) 71 | + serial_putc (cc + 55); 72 | + else 73 | + serial_putc (cc + 48); 74 | +} 75 | + 76 | +#define NOT_POP 0x0 77 | +#define PINS_TAKEN 0x0 78 | + 79 | +#define UNK_BASE_DTB 0x0 80 | +#define BB_BASE_DTB 0x1 81 | +#define BBB_BASE_DTB 0x2 82 | +#define BBBL_BASE_DTB 0x3 83 | +#define BBE_BASE_DTB 0x4 84 | + 85 | +#define BBB_EMMC 0x1 86 | + 87 | +#define BBB_TDA998X_AUDIO 0x1 88 | +#define BBB_TDA998X_NAUDIO 0x2 89 | +#define BBB_ADV7511_AUDIO 0x3 90 | +#define BBB_ADV7511_NAUDIO 0x4 91 | + 92 | +#define BBB_ADC 0x1 93 | + 94 | +#define BBBW_WL1835 0x1 95 | +#define BBGW_WL1835 0x2 96 | + 97 | +#define CAPE_UNIVERSAL 0x0 98 | +#define CAPE_UNIVERSAL_BBB 0x01 99 | +#define CAPE_UNIVERSAL_BBG 0x02 100 | +#define CAPE_UNIVERSAL_BBGW 0x03 101 | + 102 | +#define M_BBG1 0x01 103 | +#define M_OS00 0x02 104 | + 105 | +static int probe_cape_eeprom(struct am335x_cape_eeprom_id *cape_header) 106 | +{ 107 | + unsigned char addr; 108 | + /* /lib/firmware/BB-CAPE-DISP-CT4-00A0.dtbo */ 109 | + /* 14 + 16 + 1 + 4 + 5 = 40 */ 110 | + char cape_overlay[40]; 111 | + char process_cape_part_number[16]; 112 | + char end_part_number; 113 | + char cape_overlay_pass_to_kernel[18]; 114 | + 115 | + //Don't forget about the BeagleBone Classic (White) 116 | + char base_dtb=UNK_BASE_DTB; 117 | + char virtual_emmc=NOT_POP; 118 | + char virtual_video=NOT_POP; 119 | + char virtual_audio=NOT_POP; 120 | + char virtual_wireless=NOT_POP; 121 | + char cape_universal=CAPE_UNIVERSAL; 122 | + char virtual_adc=NOT_POP; 123 | + char model=NOT_POP; 124 | + 125 | + char *name = NULL; 126 | + 127 | + if (board_is_bone_lt()) { 128 | + puts("BeagleBone Black:\n"); 129 | + base_dtb=BBB_BASE_DTB; 130 | + virtual_emmc=BBB_EMMC; 131 | + virtual_video=BBB_TDA998X_AUDIO; 132 | + virtual_audio=BBB_TDA998X_AUDIO; 133 | + virtual_wireless=NOT_POP; 134 | + virtual_adc=BBB_ADC; 135 | + cape_universal=CAPE_UNIVERSAL_BBB; 136 | + name = "A335BNLT"; 137 | + 138 | + if (!strncmp(board_ti_get_rev(), "BLA", 3)) { 139 | + puts("Model: BeagleBoard.org BeagleBone Blue:\n"); 140 | + /* Special case */ 141 | + base_dtb=BBBL_BASE_DTB; 142 | + virtual_emmc=NOT_POP; 143 | + virtual_video=NOT_POP; 144 | + virtual_audio=NOT_POP; 145 | + virtual_wireless=NOT_POP; 146 | + virtual_adc=NOT_POP; 147 | + cape_universal=CAPE_UNIVERSAL; 148 | + name = "BBBL"; 149 | + } 150 | + if (!strncmp(board_ti_get_rev(), "BW", 2)) { 151 | + puts("Model: BeagleBoard.org BeagleBone Black Wireless:\n"); 152 | + virtual_wireless=BBBW_WL1835; 153 | + name = "BBBW"; 154 | + } 155 | + if (!strncmp(board_ti_get_rev(), "BBG", 3)) { 156 | + /* catches again in board_is_bbg1() */ 157 | + //puts("Model: SeeedStudio BeagleBone Green:\n"); 158 | + virtual_video=NOT_POP; 159 | + virtual_audio=NOT_POP; 160 | + cape_universal=CAPE_UNIVERSAL_BBG; 161 | + name = "BBG1"; 162 | + model=M_BBG1; 163 | + } 164 | + if (!strncmp(board_ti_get_rev(), "GW1", 3)) { 165 | + puts("Model: SeeedStudio BeagleBone Green Wireless:\n"); 166 | + virtual_video=NOT_POP; 167 | + virtual_audio=NOT_POP; 168 | + virtual_wireless=BBGW_WL1835; 169 | + cape_universal=CAPE_UNIVERSAL_BBGW; 170 | + } 171 | + if (!strncmp(board_ti_get_rev(), "AIA", 3)) { 172 | + puts("Model: Arrow BeagleBone Black Industrial:\n"); 173 | + virtual_video=BBB_ADV7511_AUDIO; 174 | + virtual_audio=BBB_ADV7511_AUDIO; 175 | + cape_universal=CAPE_UNIVERSAL; 176 | + } 177 | + if (!strncmp(board_ti_get_rev(), "EIA", 3)) { 178 | + puts("Model: Element14 BeagleBone Black Industrial:\n"); 179 | + } 180 | + if (!strncmp(board_ti_get_rev(), "SE", 2)) { 181 | + puts("Model: SanCloud BeagleBone Enhanced:\n"); 182 | + base_dtb=BBE_BASE_DTB; 183 | + cape_universal=CAPE_UNIVERSAL_BBB; 184 | + name = "SBBE"; 185 | + } 186 | + if (!strncmp(board_ti_get_rev(), "ME0", 3)) { 187 | + puts("Model: MENTOREL BeagleBone uSomIQ:\n"); 188 | + virtual_video=NOT_POP; 189 | + virtual_audio=NOT_POP; 190 | + cape_universal=CAPE_UNIVERSAL_BBG; 191 | + } 192 | + if (!strncmp(board_ti_get_rev(), "NAD", 3)) { 193 | + puts("Model: Neuromeka BeagleBone Air:\n"); 194 | + cape_universal=CAPE_UNIVERSAL; 195 | + } 196 | + if (!strncmp(board_ti_get_rev(), "OS0", 3)) { 197 | + puts("Model: Octavo Systems OSD3358-SM-RED:\n"); 198 | + name = "OS00"; 199 | + cape_universal=NOT_POP; 200 | + model=M_OS00; 201 | + } 202 | + } 203 | + 204 | + if (board_is_bone()) { 205 | + puts("Model: BeagleBone:\n"); 206 | + base_dtb=BB_BASE_DTB; 207 | + virtual_emmc=NOT_POP; 208 | + virtual_video=NOT_POP; 209 | + virtual_audio=NOT_POP; 210 | + virtual_wireless=NOT_POP; 211 | + virtual_adc=BBB_ADC; 212 | + cape_universal=CAPE_UNIVERSAL_BBB; 213 | + name = "A335BONE"; 214 | + } 215 | + 216 | + if (board_is_bbg1()) { 217 | + puts("Model: SeeedStudio BeagleBone Green:\n"); 218 | + base_dtb=BBB_BASE_DTB; 219 | + virtual_emmc=BBB_EMMC; 220 | + virtual_video=NOT_POP; 221 | + virtual_audio=NOT_POP; 222 | + virtual_wireless=NOT_POP; 223 | + virtual_adc=BBB_ADC; 224 | + cape_universal=CAPE_UNIVERSAL_BBG; 225 | + name = "BBG1"; 226 | + model=M_BBG1; 227 | + } 228 | + 229 | + set_board_info_env(name); 230 | + 231 | + i2c_set_bus_num(2); 232 | + strlcpy(cape_overlay_pass_to_kernel, "", 1); 233 | + 234 | + for ( addr = CAPE_EEPROM_ADDR0; addr <= CAPE_EEPROM_ADDR3; addr++ ) { 235 | + if (i2c_probe(addr)) { 236 | + puts("BeagleBone: cape eeprom: i2c_probe: 0x"); write_hex(addr); puts(":\n"); 237 | + } else { 238 | + /* read the eeprom using i2c */ 239 | + if (i2c_read(addr, 0, 2, (uchar *)cape_header, 240 | + sizeof(struct am335x_cape_eeprom_id))) { 241 | + puts("BeagleBone: cape eeprom: Could not read the EEPROM; something fundamentally" 242 | + " wrong on the I2C bus.\n"); 243 | + return -EIO; 244 | + } 245 | + 246 | + if (cape_header->header == 0xEE3355AA) { 247 | + strlcpy(cape_overlay, "/lib/firmware/", 14 + 1); 248 | + strlcpy(cape_overlay_pass_to_kernel, "", 2); 249 | + strlcpy(process_cape_part_number, "...............", 16 + 1); 250 | + 251 | + strlcpy(process_cape_part_number, cape_header->part_number, 16 + 1); 252 | + printf("debug: process_cape_part_number:[%s]\n", process_cape_part_number); 253 | + 254 | + //FIXME: some capes end with '.' 255 | + if ( process_cape_part_number[15] == 0x2E ) { 256 | + puts("debug: fixup, extra . in eeprom field\n"); 257 | + process_cape_part_number[15] = 0x00; 258 | + if ( process_cape_part_number[14] == 0x2E ) { 259 | + process_cape_part_number[14] = 0x00; 260 | + } 261 | + } 262 | + 263 | + //Find ending 0x00 264 | + puts("debug: process_cape_part_number:["); 265 | + end_part_number=16; 266 | + for ( int i=0; i <= 16; i++ ) { 267 | + if ( process_cape_part_number[i] == 0x00 ) { 268 | + end_part_number=i; 269 | + i=17; 270 | + } else { 271 | + write_hex(process_cape_part_number[i]); 272 | + } 273 | + } 274 | + puts("]\n"); 275 | + 276 | + strncat(cape_overlay, process_cape_part_number, end_part_number); 277 | + //printf("debug: %s\n", cape_overlay); 278 | + 279 | + strncat(cape_overlay, "-", 1); 280 | + //printf("debug: %s\n", cape_overlay); 281 | + 282 | + strncat(cape_overlay, cape_header->version, 4); 283 | + //printf("debug: %s\n", cape_overlay); 284 | + 285 | + strncat(cape_overlay, ".dtbo", 5); 286 | + //printf("debug: %s\n", cape_overlay); 287 | + 288 | + unsigned long cape_overlay_hash = hash_string(cape_overlay); 289 | + 290 | + puts("BeagleBone: cape eeprom: i2c_probe: 0x"); 291 | + write_hex(addr); 292 | + printf(": %s [0x%lx]\n", cape_overlay, cape_overlay_hash); 293 | + 294 | + strncat(cape_overlay_pass_to_kernel, process_cape_part_number, end_part_number); 295 | + strncat(cape_overlay_pass_to_kernel, ",", 1); 296 | + 297 | + switch(cape_overlay_hash) { 298 | + case 0x3c766f: /* /lib/firmware/BB-CAPE-DISP-CT4-00A0.dtbo */ 299 | + virtual_video=PINS_TAKEN; 300 | + break; 301 | + case 0x24f51cf: /* /lib/firmware/BB-BONE-CAM-VVDN-00A0.dtbo */ 302 | + virtual_emmc=PINS_TAKEN; 303 | + break; 304 | + case 0x4b0c13f: /* /lib/firmware/NL-AB-BBCL-00B0.dtbo */ 305 | + virtual_video=PINS_TAKEN; 306 | + break; 307 | + case 0x74e7bbf: /* /lib/firmware/bb-justboom-dac-00A0.dtbo */ 308 | + virtual_audio=PINS_TAKEN; 309 | + break; 310 | + case 0x93b574f: /* /lib/firmware/BB-GREEN-HDMI-00A0.dtbo */ 311 | + virtual_video=PINS_TAKEN; 312 | + break; 313 | + case 0xb1b7bbf: /* /lib/firmware/bb-justboom-amp-00A0.dtbo */ 314 | + virtual_audio=PINS_TAKEN; 315 | + break; 316 | + //d15bb 317 | + case 0xd15b80f: /* /lib/firmware/DLPDLCR2000-00A0.dtbo */ 318 | + virtual_video=PINS_TAKEN; 319 | + break; 320 | + case 0xd4c9eff: /* /lib/firmware/bb-justboom-digi-00A0.dtbo */ 321 | + virtual_audio=PINS_TAKEN; 322 | + break; 323 | + case 0xe3f55df: /* /lib/firmware/BB-BONE-NH7C-01-A0.dtbo */ 324 | + virtual_video=PINS_TAKEN; 325 | + break; 326 | + case 0xfc93c8f: /* /lib/firmware/BB-BONE-LCD7-01-00A3.dtbo */ 327 | + virtual_video=PINS_TAKEN; 328 | + virtual_adc=PINS_TAKEN; 329 | + break; 330 | + //fe131 331 | + case 0xfe1313f: /* /lib/firmware/BB-BONE-4D5R-01-00A1.dtbo */ 332 | + virtual_video=PINS_TAKEN; 333 | + break; 334 | + //fe132 335 | + case 0xfe1323f: /* /lib/firmware/BB-BONE-4D4R-01-00A1.dtbo */ 336 | + virtual_video=PINS_TAKEN; 337 | + break; 338 | + case 0xfe1327f: /* /lib/firmware/BB-BONE-4D4N-01-00A1.dtbo */ 339 | + virtual_video=PINS_TAKEN; 340 | + break; 341 | + case 0xfe132cf: /* /lib/firmware/BB-BONE-4D4C-01-00A1.dtbo */ 342 | + virtual_video=PINS_TAKEN; 343 | + break; 344 | + //fe133 345 | + case 0xfe1337f: /* /lib/firmware/BB-BONE-4D7N-01-00A1.dtbo */ 346 | + virtual_video=PINS_TAKEN; 347 | + break; 348 | + case 0xfe133cf: /* /lib/firmware/BB-BONE-4D7C-01-00A1.dtbo */ 349 | + virtual_video=PINS_TAKEN; 350 | + break; 351 | + //fe135 352 | + case 0xfe1357f: /* /lib/firmware/BB-BONE-4D5N-01-00A1.dtbo */ 353 | + virtual_video=PINS_TAKEN; 354 | + break; 355 | + case 0xfe135cf: /* /lib/firmware/BB-BONE-4D5C-01-00A1.dtbo */ 356 | + virtual_video=PINS_TAKEN; 357 | + break; 358 | + //fe137 359 | + case 0xfe1373f: /* /lib/firmware/BB-BONE-4D7R-01-00A1.dtbo */ 360 | + virtual_video=PINS_TAKEN; 361 | + break; 362 | + case 0xfe93c1f: /* /lib/firmware/BB-BONE-LCD4-01-00A1.dtbo */ 363 | + virtual_video=PINS_TAKEN; 364 | + virtual_adc=PINS_TAKEN; 365 | + break; 366 | + } 367 | + 368 | + switch(addr) { 369 | + case CAPE_EEPROM_ADDR0: 370 | + env_set("uboot_overlay_addr0", cape_overlay); 371 | + env_set("uboot_detected_capes_addr0", cape_overlay_pass_to_kernel); 372 | + break; 373 | + case CAPE_EEPROM_ADDR1: 374 | + env_set("uboot_overlay_addr1", cape_overlay); 375 | + env_set("uboot_detected_capes_addr1", cape_overlay_pass_to_kernel); 376 | + break; 377 | + case CAPE_EEPROM_ADDR2: 378 | + env_set("uboot_overlay_addr2", cape_overlay); 379 | + env_set("uboot_detected_capes_addr2", cape_overlay_pass_to_kernel); 380 | + break; 381 | + case CAPE_EEPROM_ADDR3: 382 | + env_set("uboot_overlay_addr3", cape_overlay); 383 | + env_set("uboot_detected_capes_addr3", cape_overlay_pass_to_kernel); 384 | + break; 385 | + } 386 | + env_set("uboot_detected_capes", "1"); 387 | + } else { 388 | + puts("BeagleBone: found invalid cape eeprom: i2c_probe: 0x"); write_hex(addr); puts(":\n"); 389 | + } 390 | + } 391 | + }//for 392 | + 393 | + switch(base_dtb) { 394 | + case BB_BASE_DTB: 395 | + env_set("uboot_base_dtb", "am335x-bone.dtb"); 396 | + env_set("uboot_try_cape_universal", "1"); 397 | + break; 398 | + case BBB_BASE_DTB: 399 | + env_set("uboot_base_dtb", "am335x-boneblack-uboot.dtb"); 400 | + env_set("uboot_try_cape_universal", "1"); 401 | + break; 402 | + case BBE_BASE_DTB: 403 | + env_set("uboot_base_dtb", "am335x-sancloud-bbe-uboot.dtb"); 404 | + env_set("uboot_try_cape_universal", "1"); 405 | + break; 406 | + case BBBL_BASE_DTB: 407 | + env_set("uboot_base_dtb", "am335x-boneblue.dtb"); 408 | + break; 409 | + } 410 | + 411 | + if (virtual_emmc == BBB_EMMC) { 412 | + env_set("uboot_emmc", "/lib/firmware/BB-BONE-eMMC1-01-00A0.dtbo"); 413 | + } 414 | + 415 | + switch(virtual_video) { 416 | + case BBB_TDA998X_AUDIO: 417 | + if (virtual_audio == PINS_TAKEN) { 418 | + env_set("uboot_video", "/lib/firmware/BB-NHDMI-TDA998x-00A0.dtbo"); 419 | + env_set("uboot_video_naudio", "/lib/firmware/BB-NHDMI-TDA998x-00A0.dtbo"); 420 | + } else { 421 | + env_set("uboot_video", "/lib/firmware/BB-HDMI-TDA998x-00A0.dtbo"); 422 | + env_set("uboot_video_naudio", "/lib/firmware/BB-NHDMI-TDA998x-00A0.dtbo"); 423 | + } 424 | + break; 425 | + case BBB_TDA998X_NAUDIO: 426 | + env_set("uboot_video", "/lib/firmware/BB-NHDMI-TDA998x-00A0.dtbo"); 427 | + env_set("uboot_video_naudio", "/lib/firmware/BB-NHDMI-TDA998x-00A0.dtbo"); 428 | + break; 429 | + case BBB_ADV7511_AUDIO: 430 | + if (virtual_audio == PINS_TAKEN) { 431 | + env_set("uboot_video", "/lib/firmware/BB-NHDMI-ADV7511-00A0.dtbo"); 432 | + env_set("uboot_video_naudio", "/lib/firmware/BB-NHDMI-ADV7511-00A0.dtbo"); 433 | + } else { 434 | + env_set("uboot_video", "/lib/firmware/BB-HDMI-ADV7511-00A0.dtbo"); 435 | + env_set("uboot_video_naudio", "/lib/firmware/BB-NHDMI-ADV7511-00A0.dtbo"); 436 | + } 437 | + break; 438 | + case BBB_ADV7511_NAUDIO: 439 | + env_set("uboot_video", "/lib/firmware/BB-NHDMI-ADV7511-00A0.dtbo"); 440 | + env_set("uboot_video_naudio", "/lib/firmware/BB-NHDMI-ADV7511-00A0.dtbo"); 441 | + break; 442 | + } 443 | + 444 | + switch(virtual_wireless) { 445 | + case BBBW_WL1835: 446 | + env_set("uboot_wireless", "/lib/firmware/BB-BBBW-WL1835-00A0.dtbo"); 447 | + break; 448 | + case BBGW_WL1835: 449 | + env_set("uboot_wireless", "/lib/firmware/BB-BBGW-WL1835-00A0.dtbo"); 450 | + break; 451 | + } 452 | + 453 | + switch(virtual_adc) { 454 | + case BBB_ADC: 455 | + env_set("uboot_adc", "/lib/firmware/BB-ADC-00A0.dtbo"); 456 | + break; 457 | + } 458 | + 459 | + switch(model) { 460 | + case M_BBG1: 461 | + env_set("uboot_model", "/lib/firmware/M-BB-BBG-00A0.dtbo"); 462 | + break; 463 | + case M_OS00: 464 | + env_set("uboot_model", "/lib/firmware/M-BB-OSD3358-SM-RED-00A0.dtbo"); 465 | + break; 466 | + } 467 | + 468 | + switch(cape_universal) { 469 | + case CAPE_UNIVERSAL_BBB: 470 | + env_set("uboot_cape_universal_bbb", "1"); 471 | + break; 472 | + case CAPE_UNIVERSAL_BBG: 473 | + env_set("uboot_cape_universal_bbg", "1"); 474 | + break; 475 | + case CAPE_UNIVERSAL_BBGW: 476 | + env_set("uboot_cape_universal_bbgw", "1"); 477 | + break; 478 | + } 479 | + 480 | + i2c_set_bus_num(0); 481 | + return 0; 482 | +} 483 | + 484 | +void do_cape_detect(void) 485 | +{ 486 | + struct am335x_cape_eeprom_id cape_header; 487 | + 488 | + i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED2, CONFIG_SYS_OMAP24_I2C_SLAVE2); 489 | + probe_cape_eeprom(&cape_header); 490 | +} 491 | + 492 | #ifndef CONFIG_DM_SERIAL 493 | struct serial_device *default_serial_console(void) 494 | { 495 | @@ -813,6 +1256,14 @@ int board_late_init(void) 496 | } 497 | #endif 498 | 499 | +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG 500 | +#ifdef CONFIG_TI_I2C_BOARD_DETECT 501 | + if (!board_is_pb() && !board_is_beaglelogic()) { 502 | + do_cape_detect(); 503 | + } 504 | +#endif 505 | +#endif 506 | + 507 | return 0; 508 | } 509 | #endif 510 | diff --git a/board/ti/am335x/board.h b/board/ti/am335x/board.h 511 | index 6f96532bac..e4d5daf269 100644 512 | --- a/board/ti/am335x/board.h 513 | +++ b/board/ti/am335x/board.h 514 | @@ -11,6 +11,22 @@ 515 | #ifndef _BOARD_H_ 516 | #define _BOARD_H_ 517 | 518 | +struct am335x_cape_eeprom_id { 519 | + unsigned int header; 520 | + char eeprom_rev[2]; 521 | + char board_name[32]; 522 | + char version[4]; 523 | + char manufacture[16]; 524 | + char part_number[16]; 525 | + char number_of_pins[2]; 526 | + char serial_number[12]; 527 | + char pin_usage[140]; 528 | + char vdd_3v3exp[ 2]; 529 | + char vdd_5v[ 2]; 530 | + char sys_5v[2]; 531 | + char dc_supplied[2]; 532 | +}; 533 | + 534 | /** 535 | * AM335X (EMIF_4D) EMIF REG_COS_COUNT_1, REG_COS_COUNT_2, and 536 | * REG_PR_OLD_COUNT values to avoid LCDC DMA FIFO underflows and Frame 537 | @@ -129,5 +145,6 @@ void enable_uart3_pin_mux(void); 538 | void enable_uart4_pin_mux(void); 539 | void enable_uart5_pin_mux(void); 540 | void enable_i2c0_pin_mux(void); 541 | +void enable_i2c2_pin_mux(void); 542 | void enable_board_pin_mux(void); 543 | #endif 544 | diff --git a/board/ti/am335x/hash-string.h b/board/ti/am335x/hash-string.h 545 | new file mode 100644 546 | index 0000000000..b267a87788 547 | --- /dev/null 548 | +++ b/board/ti/am335x/hash-string.h 549 | @@ -0,0 +1,59 @@ 550 | +/* Description of GNU message catalog format: string hashing function. 551 | + Copyright (C) 1995, 1997, 1998, 2000, 2001 Free Software Foundation, Inc. 552 | + 553 | + This program is free software; you can redistribute it and/or modify it 554 | + under the terms of the GNU Library General Public License as published 555 | + by the Free Software Foundation; either version 2, or (at your option) 556 | + any later version. 557 | + 558 | + This program is distributed in the hope that it will be useful, 559 | + but WITHOUT ANY WARRANTY; without even the implied warranty of 560 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 561 | + Library General Public License for more details. 562 | + 563 | + You should have received a copy of the GNU Library General Public 564 | + License along with this program; if not, write to the Free Software 565 | + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 566 | + USA. */ 567 | + 568 | +/* @@ end of prolog @@ */ 569 | + 570 | +#ifndef PARAMS 571 | +# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES 572 | +# define PARAMS(Args) Args 573 | +# else 574 | +# define PARAMS(Args) () 575 | +# endif 576 | +#endif 577 | + 578 | +/* We assume to have `unsigned long int' value with at least 32 bits. */ 579 | +#define HASHWORDBITS 32 580 | + 581 | + 582 | +/* Defines the so called `hashpjw' function by P.J. Weinberger 583 | + [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools, 584 | + 1986, 1987 Bell Telephone Laboratories, Inc.] */ 585 | +static unsigned long int hash_string PARAMS ((const char *__str_param)); 586 | + 587 | +static inline unsigned long int 588 | +hash_string (str_param) 589 | + const char *str_param; 590 | +{ 591 | + unsigned long int hval, g; 592 | + const char *str = str_param; 593 | + 594 | + /* Compute the hash value for the given string. */ 595 | + hval = 0; 596 | + while (*str != '\0') 597 | + { 598 | + hval <<= 4; 599 | + hval += (unsigned long int) *str++; 600 | + g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4)); 601 | + if (g != 0) 602 | + { 603 | + hval ^= g >> (HASHWORDBITS - 8); 604 | + hval ^= g; 605 | + } 606 | + } 607 | + return hval; 608 | +} 609 | diff --git a/board/ti/am335x/mux.c b/board/ti/am335x/mux.c 610 | index 2b10b64d3a..3733246852 100644 611 | --- a/board/ti/am335x/mux.c 612 | +++ b/board/ti/am335x/mux.c 613 | @@ -120,6 +120,14 @@ static struct module_pin_mux i2c1_pin_mux[] = { 614 | {-1}, 615 | }; 616 | 617 | +static struct module_pin_mux i2c2_pin_mux[] = { 618 | + {OFFSET(uart1_ctsn), (MODE(3) | RXACTIVE | 619 | + PULLUP_EN | PULLUDEN | SLEWCTRL)}, /* I2C_DATA */ 620 | + {OFFSET(uart1_rtsn), (MODE(3) | RXACTIVE | 621 | + PULLUP_EN | PULLUDEN | SLEWCTRL)}, /* I2C_SCLK */ 622 | + {-1}, 623 | +}; 624 | + 625 | static struct module_pin_mux spi0_pin_mux[] = { 626 | {OFFSET(spi0_sclk), (MODE(0) | RXACTIVE | PULLUDEN)}, /* SPI0_SCLK */ 627 | {OFFSET(spi0_d0), (MODE(0) | RXACTIVE | 628 | @@ -304,6 +312,11 @@ void enable_i2c0_pin_mux(void) 629 | configure_module_pin_mux(i2c0_pin_mux); 630 | } 631 | 632 | +void enable_i2c2_pin_mux(void) 633 | +{ 634 | + configure_module_pin_mux(i2c2_pin_mux); 635 | +} 636 | + 637 | /* 638 | * The AM335x GP EVM, if daughter card(s) are connected, can have 8 639 | * different profiles. These profiles determine what peripherals are 640 | @@ -359,6 +372,7 @@ void enable_board_pin_mux(void) 641 | #else 642 | configure_module_pin_mux(mmc1_pin_mux); 643 | #endif 644 | + configure_module_pin_mux(i2c2_pin_mux); 645 | } else if (board_is_gp_evm()) { 646 | /* General Purpose EVM */ 647 | unsigned short profile = detect_daughter_board_profile(); 648 | @@ -404,6 +418,7 @@ void enable_board_pin_mux(void) 649 | #else 650 | configure_module_pin_mux(mmc1_pin_mux); 651 | #endif 652 | + configure_module_pin_mux(i2c2_pin_mux); 653 | } else if (board_is_icev2()) { 654 | configure_module_pin_mux(mmc0_pin_mux); 655 | configure_module_pin_mux(gpio0_18_pin_mux); 656 | diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h 657 | index b5d2f8b1df..956d3c2c11 100644 658 | --- a/include/configs/ti_armv7_common.h 659 | +++ b/include/configs/ti_armv7_common.h 660 | @@ -348,6 +348,19 @@ 661 | "echo loading ${bootdir}/${bootfile} ...; "\ 662 | "run loadimage;" \ 663 | "setenv fdtdir /boot/dtbs/${uname_r}; " \ 664 | + "if test -n ${enable_uboot_overlays}; then " \ 665 | + "if test -n ${uboot_base_dtb}; then " \ 666 | + "if test -n ${dtb}; then " \ 667 | + "echo uboot_overlays: dtb=${dtb} in /boot/uEnv.txt, unable to use [uboot_base_dtb=${uboot_base_dtb}] ... ;" \ 668 | + "else " \ 669 | + "echo uboot_overlays: [uboot_base_dtb=${uboot_base_dtb}] ... ;" \ 670 | + "if test -e ${devtype} ${bootpart} ${fdtdir}/${uboot_base_dtb}; then " \ 671 | + "setenv fdtfile ${uboot_base_dtb};" \ 672 | + "echo uboot_overlays: Switching too: dtb=${fdtfile} ...;" \ 673 | + "fi;" \ 674 | + "fi;" \ 675 | + "fi;" \ 676 | + "fi;" \ 677 | "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \ 678 | "run loadfdt;" \ 679 | "else " \ 680 | @@ -388,6 +401,182 @@ 681 | "fi;" \ 682 | "fi;" \ 683 | "fi; " \ 684 | + "if test $board_name = BBBL; then " \ 685 | + "env delete -f enable_uboot_overlays; fi; " \ 686 | + "if test -n ${enable_uboot_overlays}; then " \ 687 | + "setenv fdt_buffer 0x60000;" \ 688 | + "if test -n ${uboot_fdt_buffer}; then " \ 689 | + "setenv fdt_buffer ${uboot_fdt_buffer};" \ 690 | + "fi;" \ 691 | + "echo uboot_overlays: [fdt_buffer=${fdt_buffer}] ... ;" \ 692 | + "if test -n ${uboot_silicon}; then " \ 693 | + "setenv uboot_overlay ${uboot_silicon}; " \ 694 | + "run virtualloadoverlay;" \ 695 | + "fi;" \ 696 | + "if test -n ${uboot_model}; then " \ 697 | + "setenv uboot_overlay ${uboot_model}; " \ 698 | + "run virtualloadoverlay;" \ 699 | + "fi;" \ 700 | + "if test -n ${uboot_overlay_addr0}; then " \ 701 | + "if test -n ${disable_uboot_overlay_addr0}; then " \ 702 | + "echo uboot_overlays: uboot loading of [${uboot_overlay_addr0}] disabled by /boot/uEnv.txt [disable_uboot_overlay_addr0=1]...;" \ 703 | + "else " \ 704 | + "setenv uboot_overlay ${uboot_overlay_addr0}; " \ 705 | + "run capeloadoverlay;" \ 706 | + "fi;" \ 707 | + "fi;" \ 708 | + "if test -n ${uboot_overlay_addr1}; then " \ 709 | + "if test -n ${disable_uboot_overlay_addr1}; then " \ 710 | + "echo uboot_overlays: uboot loading of [${uboot_overlay_addr1}] disabled by /boot/uEnv.txt [disable_uboot_overlay_addr1=1]...;" \ 711 | + "else " \ 712 | + "setenv uboot_overlay ${uboot_overlay_addr1}; " \ 713 | + "run capeloadoverlay;" \ 714 | + "fi;" \ 715 | + "fi;" \ 716 | + "if test -n ${uboot_overlay_addr2}; then " \ 717 | + "if test -n ${disable_uboot_overlay_addr2}; then " \ 718 | + "echo uboot_overlays: uboot loading of [${uboot_overlay_addr2}] disabled by /boot/uEnv.txt [disable_uboot_overlay_addr2=1]...;" \ 719 | + "else " \ 720 | + "setenv uboot_overlay ${uboot_overlay_addr2}; " \ 721 | + "run capeloadoverlay;" \ 722 | + "fi;" \ 723 | + "fi;" \ 724 | + "if test -n ${uboot_overlay_addr3}; then " \ 725 | + "if test -n ${disable_uboot_overlay_addr3}; then " \ 726 | + "echo uboot_overlays: uboot loading of [${uboot_overlay_addr3}] disabled by /boot/uEnv.txt [disable_uboot_overlay_addr3=1]...;" \ 727 | + "else " \ 728 | + "setenv uboot_overlay ${uboot_overlay_addr3}; " \ 729 | + "run capeloadoverlay;" \ 730 | + "fi;" \ 731 | + "fi;" \ 732 | + "if test -n ${uboot_overlay_addr4}; then " \ 733 | + "setenv uboot_overlay ${uboot_overlay_addr4}; " \ 734 | + "run capeloadoverlay;" \ 735 | + "fi;" \ 736 | + "if test -n ${uboot_overlay_addr5}; then " \ 737 | + "setenv uboot_overlay ${uboot_overlay_addr5}; " \ 738 | + "run capeloadoverlay;" \ 739 | + "fi;" \ 740 | + "if test -n ${uboot_overlay_addr6}; then " \ 741 | + "setenv uboot_overlay ${uboot_overlay_addr6}; " \ 742 | + "run capeloadoverlay;" \ 743 | + "fi;" \ 744 | + "if test -n ${uboot_overlay_addr7}; then " \ 745 | + "setenv uboot_overlay ${uboot_overlay_addr7}; " \ 746 | + "run capeloadoverlay;" \ 747 | + "fi;" \ 748 | + "if test -n ${uboot_emmc}; then " \ 749 | + "if test -n ${disable_uboot_overlay_emmc}; then " \ 750 | + "echo uboot_overlays: uboot loading of [${uboot_emmc}] disabled by /boot/uEnv.txt [disable_uboot_overlay_emmc=1]...;" \ 751 | + "else " \ 752 | + "setenv uboot_overlay ${uboot_emmc}; " \ 753 | + "run virtualloadoverlay;" \ 754 | + "fi;" \ 755 | + "fi;" \ 756 | + "if test -n ${uboot_video}; then " \ 757 | + "if test -n ${disable_uboot_overlay_video}; then " \ 758 | + "echo uboot_overlays: uboot loading of [${uboot_video}] disabled by /boot/uEnv.txt [disable_uboot_overlay_video=1]...;" \ 759 | + "else " \ 760 | + "if test -n ${disable_uboot_overlay_audio}; then " \ 761 | + "echo uboot_overlays: uboot loading of [${uboot_video}] disabled by /boot/uEnv.txt [disable_uboot_overlay_audio=1]...;" \ 762 | + "setenv uboot_overlay ${uboot_video_naudio}; " \ 763 | + "run virtualloadoverlay;" \ 764 | + "else " \ 765 | + "setenv uboot_overlay ${uboot_video}; " \ 766 | + "run virtualloadoverlay;" \ 767 | + "fi;" \ 768 | + "fi;" \ 769 | + "fi;" \ 770 | + "if test -n ${uboot_wireless}; then " \ 771 | + "if test -n ${disable_uboot_overlay_wireless}; then " \ 772 | + "echo uboot_overlays: uboot loading of [${uboot_wireless}] disabled by /boot/uEnv.txt [disable_uboot_overlay_wireless=1]...;" \ 773 | + "else " \ 774 | + "setenv uboot_overlay ${uboot_wireless}; " \ 775 | + "run virtualloadoverlay;" \ 776 | + "fi;" \ 777 | + "fi;" \ 778 | + "if test -n ${uboot_adc}; then " \ 779 | + "if test -n ${disable_uboot_overlay_adc}; then " \ 780 | + "echo uboot_overlays: uboot loading of [${uboot_adc}] disabled by /boot/uEnv.txt [disable_uboot_overlay_adc=1]...;" \ 781 | + "else " \ 782 | + "setenv uboot_overlay ${uboot_adc}; " \ 783 | + "run virtualloadoverlay;" \ 784 | + "fi;" \ 785 | + "fi;" \ 786 | + "if test -n ${uboot_overlay_pru}; then " \ 787 | + "setenv uboot_overlay ${uboot_overlay_pru}; " \ 788 | + "run virtualloadoverlay;" \ 789 | + "fi;" \ 790 | + "if test -n ${dtb_overlay}; then " \ 791 | + "setenv uboot_overlay ${dtb_overlay}; " \ 792 | + "echo uboot_overlays: [dtb_overlay=${uboot_overlay}] ... ;" \ 793 | + "run capeloadoverlay;" \ 794 | + "fi;" \ 795 | + "if test -n ${uboot_detected_capes}; then " \ 796 | + "echo uboot_overlays: [uboot_detected_capes=${uboot_detected_capes_addr0}${uboot_detected_capes_addr1}${uboot_detected_capes_addr2}${uboot_detected_capes_addr3}] ... ;" \ 797 | + "setenv uboot_detected_capes uboot_detected_capes=${uboot_detected_capes_addr0}${uboot_detected_capes_addr1}${uboot_detected_capes_addr2}${uboot_detected_capes_addr3}; " \ 798 | + "fi;" \ 799 | + "if test -n ${uboot_try_cape_universal}; then " \ 800 | + "if test -n ${enable_uboot_cape_universal}; then " \ 801 | + "if test -n ${cape_uboot}; then " \ 802 | + "echo uboot_overlays: cape universal disabled, external cape enabled or detected...;" \ 803 | + "else " \ 804 | + "if test -n ${uboot_cape_universal_bbb}; then " \ 805 | + "if test -n ${disable_uboot_overlay_emmc}; then " \ 806 | + "if test -n ${disable_uboot_overlay_video}; then " \ 807 | + "setenv uboot_overlay /lib/firmware/univ-bbb-xxx-00A0.dtbo; " \ 808 | + "else " \ 809 | + "if test -n ${disable_uboot_overlay_audio}; then " \ 810 | + "setenv uboot_overlay /lib/firmware/univ-bbb-xVx-00A0.dtbo; " \ 811 | + "else " \ 812 | + "setenv uboot_overlay /lib/firmware/univ-bbb-xVA-00A0.dtbo; " \ 813 | + "fi;" \ 814 | + "fi;" \ 815 | + "else " \ 816 | + "if test -n ${disable_uboot_overlay_video}; then " \ 817 | + "setenv uboot_overlay /lib/firmware/univ-bbb-Exx-00A0.dtbo; " \ 818 | + "else " \ 819 | + "if test -n ${disable_uboot_overlay_audio}; then " \ 820 | + "setenv uboot_overlay /lib/firmware/univ-bbb-EVx-00A0.dtbo; " \ 821 | + "else " \ 822 | + "setenv uboot_overlay /lib/firmware/univ-bbb-EVA-00A0.dtbo; " \ 823 | + "fi;" \ 824 | + "fi;" \ 825 | + "fi;" \ 826 | + "run capeloadoverlay;" \ 827 | + "fi;" \ 828 | + "if test -n ${uboot_cape_universal_bbg}; then " \ 829 | + "if test -n ${disable_uboot_overlay_emmc}; then " \ 830 | + "setenv uboot_overlay /lib/firmware/univ-bbb-xxx-00A0.dtbo; " \ 831 | + "else " \ 832 | + "setenv uboot_overlay /lib/firmware/univ-bbb-Exx-00A0.dtbo; " \ 833 | + "fi;" \ 834 | + "run capeloadoverlay;" \ 835 | + "fi;" \ 836 | + "if test -n ${uboot_cape_universal_bbgw}; then " \ 837 | + "if test -n ${disable_uboot_overlay_emmc}; then " \ 838 | + "if test -n ${disable_uboot_overlay_wireless}; then " \ 839 | + "setenv uboot_overlay /lib/firmware/univ-bbgw-xx-00A0.dtbo; " \ 840 | + "else " \ 841 | + "setenv uboot_overlay /lib/firmware/univ-bbgw-xW-00A0.dtbo; " \ 842 | + "fi;" \ 843 | + "else " \ 844 | + "if test -n ${disable_uboot_overlay_wireless}; then " \ 845 | + "setenv uboot_overlay /lib/firmware/univ-bbgw-Ex-00A0.dtbo; " \ 846 | + "else " \ 847 | + "setenv uboot_overlay /lib/firmware/univ-bbgw-EW-00A0.dtbo; " \ 848 | + "fi;" \ 849 | + "fi;" \ 850 | + "run capeloadoverlay;" \ 851 | + "fi;" \ 852 | + "fi;" \ 853 | + "else " \ 854 | + "echo uboot_overlays: add [enable_uboot_cape_universal=1] to /boot/uEnv.txt to enable...;" \ 855 | + "fi;" \ 856 | + "fi;" \ 857 | + "else " \ 858 | + "echo uboot_overlays: add [enable_uboot_overlays=1] to /boot/uEnv.txt to enable...;" \ 859 | + "fi;" \ 860 | "setenv rdfile initrd.img-${uname_r}; " \ 861 | "if test -e ${devtype} ${bootpart} ${bootdir}/${rdfile}; then " \ 862 | "echo loading ${bootdir}/${rdfile} ...; "\ 863 | diff --git a/include/configs/ti_armv7_omap.h b/include/configs/ti_armv7_omap.h 864 | index da5fc8108f..c513fff82a 100644 865 | --- a/include/configs/ti_armv7_omap.h 866 | +++ b/include/configs/ti_armv7_omap.h 867 | @@ -16,6 +16,9 @@ 868 | #define CONFIG_SYS_OMAP24_I2C_SPEED 100000 869 | #define CONFIG_SYS_OMAP24_I2C_SLAVE 1 870 | 871 | +#define CONFIG_SYS_OMAP24_I2C_SPEED2 100000 872 | +#define CONFIG_SYS_OMAP24_I2C_SLAVE2 1 873 | + 874 | /* 875 | * GPMC NAND block. We support 1 device and the physical address to 876 | * access CS0 at is 0x8000000. 877 | diff --git a/include/environment/ti/mmc.h b/include/environment/ti/mmc.h 878 | index 0364f62c3d..d48d6c2d91 100644 879 | --- a/include/environment/ti/mmc.h 880 | +++ b/include/environment/ti/mmc.h 881 | @@ -69,6 +69,21 @@ 882 | "loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \ 883 | "loadrd=load ${devtype} ${bootpart} ${rdaddr} ${bootdir}/${rdfile}; setenv rdsize ${filesize}\0" \ 884 | "loadfdt=echo loading ${fdtdir}/${fdtfile} ...; load ${devtype} ${bootpart} ${fdtaddr} ${fdtdir}/${fdtfile}\0" \ 885 | + "loadoverlay=echo uboot_overlays: loading ${uboot_overlay} ...; " \ 886 | + "load ${devtype} ${bootpart} ${rdaddr} ${uboot_overlay}; " \ 887 | + "fdt addr ${fdtaddr}; fdt resize ${fdt_buffer}; " \ 888 | + "fdt apply ${rdaddr}; fdt resize ${fdt_buffer};\0" \ 889 | + "virtualloadoverlay=if test -e ${devtype} ${bootpart} ${uboot_overlay}; then " \ 890 | + "run loadoverlay;" \ 891 | + "else " \ 892 | + "echo uboot_overlays: unable to find [${devtype} ${bootpart} ${uboot_overlay}]...;" \ 893 | + "fi;\0" \ 894 | + "capeloadoverlay=if test -e ${devtype} ${bootpart} ${uboot_overlay}; then " \ 895 | + "run loadoverlay;" \ 896 | + "setenv cape_uboot bone_capemgr.uboot_capemgr_enabled=1; " \ 897 | + "else " \ 898 | + "echo uboot_overlays: unable to find [${devtype} ${bootpart} ${uboot_overlay}]...;" \ 899 | + "fi;\0" \ 900 | "failumsboot=echo; echo FAILSAFE: U-Boot UMS (USB Mass Storage) enabled, media now available over the usb slave port ...; " \ 901 | "ums 0 ${devtype} 1;\0" \ 902 | "envboot=mmc dev ${mmcdev}; " \ 903 | -- 904 | 2.15.1 905 | 906 | -------------------------------------------------------------------------------- /RESOURCES/buildroot/patches/uboot/0003-pocketbeagle-tweaks.patch: -------------------------------------------------------------------------------- 1 | diff -Naur uboot-2018.01/configs/am335x_pocketbeagle_defconfig uboot-2018.01-new/configs/am335x_pocketbeagle_defconfig 2 | --- uboot-2018.01/configs/am335x_pocketbeagle_defconfig 2018-02-08 22:49:28.236008103 -0600 3 | +++ uboot-2018.01-new/configs/am335x_pocketbeagle_defconfig 2018-02-08 22:53:47.281852406 -0600 4 | @@ -1,6 +1,7 @@ 5 | + 6 | # 7 | # Automatically generated file; DO NOT EDIT. 8 | -# U-Boot 2017.09 Configuration 9 | +# U-Boot 2018.01 Configuration 10 | # 11 | CONFIG_CREATE_ARCH_SYMLINK=y 12 | # CONFIG_ARC is not set 13 | @@ -53,8 +54,6 @@ 14 | # CONFIG_ARCH_MVEBU is not set 15 | # CONFIG_TARGET_DEVKIT3250 is not set 16 | # CONFIG_TARGET_WORK_92105 is not set 17 | -# CONFIG_TARGET_MX25PDK is not set 18 | -# CONFIG_TARGET_ZMX25 is not set 19 | # CONFIG_TARGET_APF27 is not set 20 | # CONFIG_TARGET_APX4DEVKIT is not set 21 | # CONFIG_TARGET_XFI3 is not set 22 | @@ -96,11 +95,13 @@ 23 | # CONFIG_ARCH_KEYSTONE is not set 24 | CONFIG_ARCH_OMAP2PLUS=y 25 | # CONFIG_ARCH_MESON is not set 26 | +# CONFIG_ARCH_MX25 is not set 27 | # CONFIG_ARCH_MX7ULP is not set 28 | # CONFIG_ARCH_MX7 is not set 29 | # CONFIG_ARCH_MX6 is not set 30 | CONFIG_SPL_LDSCRIPT="arch/arm/mach-omap2/u-boot-spl.lds" 31 | # CONFIG_ARCH_MX5 is not set 32 | +# CONFIG_ARCH_QEMU is not set 33 | # CONFIG_ARCH_RMOBILE is not set 34 | # CONFIG_TARGET_S32V234EVB is not set 35 | # CONFIG_ARCH_SNAPDRAGON is not set 36 | @@ -117,6 +118,7 @@ 37 | # CONFIG_TARGET_VEXPRESS64_JUNO is not set 38 | # CONFIG_TARGET_LS2080A_EMU is not set 39 | # CONFIG_TARGET_LS2080A_SIMU is not set 40 | +# CONFIG_TARGET_LS1088AQDS is not set 41 | # CONFIG_TARGET_LS2080AQDS is not set 42 | # CONFIG_TARGET_LS2080ARDB is not set 43 | # CONFIG_TARGET_LS2081ARDB is not set 44 | @@ -125,6 +127,7 @@ 45 | # CONFIG_TARGET_LS1012AQDS is not set 46 | # CONFIG_TARGET_LS1012ARDB is not set 47 | # CONFIG_TARGET_LS1012AFRDM is not set 48 | +# CONFIG_TARGET_LS1088ARDB is not set 49 | # CONFIG_TARGET_LS1021AQDS is not set 50 | # CONFIG_TARGET_LS1021ATWR is not set 51 | # CONFIG_TARGET_LS1021AIOT is not set 52 | @@ -191,7 +194,6 @@ 53 | # CONFIG_SPL_SPI_SUPPORT is not set 54 | CONFIG_SPL_WATCHDOG_SUPPORT=y 55 | CONFIG_IDENT_STRING="" 56 | -# CONFIG_VIDEO is not set 57 | CONFIG_SPL_STACK_R_ADDR=0x82000000 58 | CONFIG_SPL_FAT_SUPPORT=y 59 | # CONFIG_ARMV7_LPAE is not set 60 | @@ -202,7 +204,6 @@ 61 | # ARM debug 62 | # 63 | # CONFIG_DEBUG_LL is not set 64 | -CONFIG_SMBIOS_PRODUCT_NAME="am335x" 65 | # CONFIG_DEBUG_UART is not set 66 | # CONFIG_AHCI is not set 67 | 68 | @@ -248,8 +249,8 @@ 69 | # Boot timing 70 | # 71 | # CONFIG_BOOTSTAGE is not set 72 | -CONFIG_BOOTSTAGE_USER_COUNT=20 73 | CONFIG_BOOTSTAGE_RECORD_COUNT=30 74 | +CONFIG_SPL_BOOTSTAGE_RECORD_COUNT=5 75 | CONFIG_BOOTSTAGE_STASH_ADDR=0 76 | CONFIG_BOOTSTAGE_STASH_SIZE=0x1000 77 | 78 | @@ -264,12 +265,16 @@ 79 | # CONFIG_SPI_BOOT is not set 80 | CONFIG_BOOTDELAY=2 81 | # CONFIG_USE_BOOTARGS is not set 82 | +CONFIG_USE_BOOTCOMMAND=y 83 | +CONFIG_BOOTCOMMAND="run distro_bootcmd" 84 | 85 | # 86 | # Console 87 | # 88 | CONFIG_MENU=y 89 | # CONFIG_CONSOLE_RECORD is not set 90 | +CONFIG_LOGLEVEL=4 91 | +CONFIG_SPL_LOGLEVEL=4 92 | # CONFIG_SILENT_CONSOLE is not set 93 | # CONFIG_PRE_CONSOLE_BUFFER is not set 94 | CONFIG_CONSOLE_MUX=y 95 | @@ -278,7 +283,12 @@ 96 | CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y 97 | CONFIG_SYS_CONSOLE_INFO_QUIET=y 98 | # CONFIG_SYS_STDIO_DEREGISTER is not set 99 | -# CONFIG_FIT_EMBED is not set 100 | + 101 | +# 102 | +# Logging 103 | +# 104 | +# CONFIG_LOG is not set 105 | +# CONFIG_SPL_LOG is not set 106 | CONFIG_DEFAULT_FDT_FILE="" 107 | CONFIG_VERSION_VARIABLE=y 108 | CONFIG_BOARD_LATE_INIT=y 109 | @@ -341,6 +351,7 @@ 110 | # CONFIG_SPL_RAM_SUPPORT is not set 111 | # CONFIG_SPL_RTC_SUPPORT is not set 112 | # CONFIG_SPL_SATA_SUPPORT is not set 113 | +# CONFIG_SPL_THERMAL is not set 114 | # CONFIG_SPL_USB_HOST_SUPPORT is not set 115 | # CONFIG_SPL_USB_GADGET_SUPPORT is not set 116 | CONFIG_SPL_YMODEM_SUPPORT=y 117 | @@ -393,9 +404,6 @@ 118 | CONFIG_CMD_BOOTD=y 119 | CONFIG_CMD_BOOTM=y 120 | CONFIG_CMD_BOOTZ=y 121 | -CONFIG_CMD_BOOTEFI=y 122 | -CONFIG_CMD_BOOTEFI_HELLO_COMPILE=y 123 | -# CONFIG_CMD_BOOTEFI_HELLO is not set 124 | # CONFIG_CMD_BOOTMENU is not set 125 | CONFIG_CMD_ELF=y 126 | CONFIG_CMD_FDT=y 127 | @@ -460,6 +468,7 @@ 128 | # CONFIG_CMD_FUSE is not set 129 | CONFIG_CMD_GPIO=y 130 | CONFIG_CMD_GPT=y 131 | +CONFIG_RANDOM_UUID=y 132 | # CONFIG_CMD_GPT_RENAME is not set 133 | # CONFIG_CMD_IDE is not set 134 | # CONFIG_CMD_IO is not set 135 | @@ -548,6 +557,7 @@ 136 | # 137 | # Filesystem commands 138 | # 139 | +# CONFIG_CMD_BTRFS is not set 140 | CONFIG_CMD_EXT2=y 141 | CONFIG_CMD_EXT4=y 142 | CONFIG_CMD_EXT4_WRITE=y 143 | @@ -566,6 +576,7 @@ 144 | # CONFIG_CMD_BEDBUG is not set 145 | # CONFIG_CMD_DIAG is not set 146 | # CONFIG_CMD_KGDB is not set 147 | +# CONFIG_CMD_LOG is not set 148 | # CONFIG_CMD_TRACE is not set 149 | # CONFIG_CMD_UBI is not set 150 | 151 | @@ -582,6 +593,7 @@ 152 | # CONFIG_AMIGA_PARTITION is not set 153 | # CONFIG_SPL_AMIGA_PARTITION is not set 154 | CONFIG_EFI_PARTITION=y 155 | +CONFIG_EFI_PARTITION_ENTRIES_NUMBERS=128 156 | CONFIG_EFI_PARTITION_ENTRIES_OFF=0 157 | CONFIG_SPL_EFI_PARTITION=y 158 | CONFIG_PARTITION_UUIDS=y 159 | @@ -594,12 +606,13 @@ 160 | # 161 | # CONFIG_OF_CONTROL is not set 162 | # CONFIG_OF_BOARD_FIXUP is not set 163 | +# CONFIG_MULTI_DTB_FIT is not set 164 | +CONFIG_MKIMAGE_DTC_PATH="dtc" 165 | 166 | # 167 | # Environment 168 | # 169 | # CONFIG_ENV_IS_NOWHERE is not set 170 | -# CONFIG_ENV_IS_IN_DATAFLASH is not set 171 | # CONFIG_ENV_IS_IN_EEPROM is not set 172 | CONFIG_ENV_IS_IN_FAT=y 173 | # CONFIG_ENV_IS_IN_FLASH is not set 174 | @@ -610,7 +623,6 @@ 175 | # CONFIG_ENV_IS_IN_REMOTE is not set 176 | # CONFIG_ENV_IS_IN_SPI_FLASH is not set 177 | # CONFIG_ENV_IS_IN_UBI is not set 178 | -# CONFIG_ENV_AES is not set 179 | CONFIG_ENV_FAT_INTERFACE="mmc" 180 | CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" 181 | CONFIG_ENV_FAT_FILE="uboot.env" 182 | @@ -631,6 +643,7 @@ 183 | CONFIG_DM=y 184 | CONFIG_SPL_DM=y 185 | CONFIG_DM_WARN=y 186 | +# CONFIG_DM_DEBUG is not set 187 | CONFIG_DM_DEVICE_REMOVE=y 188 | CONFIG_DM_STDIO=y 189 | CONFIG_DM_SEQ_ALIAS=y 190 | @@ -642,16 +655,29 @@ 191 | # CONFIG_ADC is not set 192 | # CONFIG_ADC_EXYNOS is not set 193 | # CONFIG_ADC_SANDBOX is not set 194 | +# CONFIG_SARADC_ROCKCHIP is not set 195 | # CONFIG_SATA is not set 196 | +# CONFIG_SCSI_AHCI is not set 197 | 198 | # 199 | # SATA/SCSI device support 200 | # 201 | +# CONFIG_DWC_AHSATA is not set 202 | +# CONFIG_FSL_SATA is not set 203 | +# CONFIG_MVSATA_IDE is not set 204 | +# CONFIG_SATA_MV is not set 205 | +# CONFIG_SATA_SIL is not set 206 | +# CONFIG_SATA_SIL3114 is not set 207 | # CONFIG_BLK is not set 208 | # CONFIG_BLOCK_CACHE is not set 209 | # CONFIG_IDE is not set 210 | 211 | # 212 | +# Boot count support 213 | +# 214 | +# CONFIG_BOOTCOUNT is not set 215 | + 216 | +# 217 | # Clock 218 | # 219 | # CONFIG_CLK is not set 220 | @@ -703,6 +729,7 @@ 221 | # CONFIG_INTEL_BROADWELL_GPIO is not set 222 | # CONFIG_INTEL_ICH6_GPIO is not set 223 | # CONFIG_IMX_RGPIO2P is not set 224 | +# CONFIG_HSDK_CREG_GPIO is not set 225 | # CONFIG_LPC32XX_GPIO is not set 226 | # CONFIG_MSM_GPIO is not set 227 | CONFIG_OMAP_GPIO=y 228 | @@ -769,6 +796,7 @@ 229 | # CONFIG_MMC_PCI is not set 230 | CONFIG_MMC_OMAP_HS=y 231 | # CONFIG_MMC_SDHCI is not set 232 | +# CONFIG_FTSDC010 is not set 233 | 234 | # 235 | # MTD Support 236 | @@ -811,6 +839,7 @@ 237 | # CONFIG_PHY_ET1011C is not set 238 | # CONFIG_PHY_LXT is not set 239 | # CONFIG_PHY_MARVELL is not set 240 | +# CONFIG_PHY_MESON_GXL is not set 241 | # CONFIG_PHY_MICREL is not set 242 | # CONFIG_PHY_MSCC is not set 243 | # CONFIG_PHY_NATSEMI is not set 244 | @@ -864,6 +893,7 @@ 245 | # Real Time Clock 246 | # 247 | # CONFIG_DM_RTC is not set 248 | +# CONFIG_RTC_S35392A is not set 249 | # CONFIG_SCSI is not set 250 | 251 | # 252 | @@ -883,6 +913,7 @@ 253 | # CONFIG_ATMEL_USART is not set 254 | # CONFIG_FSL_LPUART is not set 255 | # CONFIG_MVEBU_A3700_UART is not set 256 | +# CONFIG_NULLDEV_SERIAL is not set 257 | CONFIG_SYS_NS16550=y 258 | # CONFIG_MSM_SERIAL is not set 259 | # CONFIG_PXA_SERIAL is not set 260 | @@ -899,8 +930,9 @@ 261 | # CONFIG_SOFT_SPI is not set 262 | # CONFIG_FSL_ESPI is not set 263 | # CONFIG_FSL_QSPI is not set 264 | +# CONFIG_ATCSPI200_SPI is not set 265 | # CONFIG_TI_QSPI is not set 266 | -# CONFIG_OMAP3_SPI is not set 267 | +CONFIG_OMAP3_SPI=y 268 | 269 | # 270 | # SPMI support 271 | @@ -949,9 +981,12 @@ 272 | # 273 | # USB peripherals 274 | # 275 | -CONFIG_USB_STORAGE=y 276 | +# CONFIG_USB_STORAGE is not set 277 | # CONFIG_USB_KEYBOARD is not set 278 | CONFIG_USB_GADGET=y 279 | +CONFIG_USB_GADGET_MANUFACTURER="U-Boot" 280 | +CONFIG_USB_GADGET_VENDOR_NUM=0x0 281 | +CONFIG_USB_GADGET_PRODUCT_NUM=0x0 282 | # CONFIG_USB_GADGET_ATMEL_USBA is not set 283 | # CONFIG_USB_GADGET_BCM_UDC_OTG_PHY is not set 284 | # CONFIG_USB_GADGET_DWC2_OTG is not set 285 | @@ -960,10 +995,7 @@ 286 | CONFIG_USB_GADGET_DUALSPEED=y 287 | CONFIG_USB_GADGET_DOWNLOAD=y 288 | # CONFIG_USB_FUNCTION_SDP is not set 289 | -CONFIG_G_DNL_MANUFACTURER="Texas Instruments" 290 | -CONFIG_G_DNL_VENDOR_NUM=0x0451 291 | -CONFIG_G_DNL_PRODUCT_NUM=0xd022 292 | -CONFIG_USBNET_DEVADDR="de:ad:be:ef:00:01" 293 | +# CONFIG_USB_ETHER is not set 294 | # CONFIG_USB_HOST_ETHER is not set 295 | 296 | # 297 | @@ -971,6 +1003,7 @@ 298 | # 299 | # CONFIG_DM_VIDEO is not set 300 | # CONFIG_SYS_WHITE_ON_BLACK is not set 301 | +# CONFIG_NO_FB_CLEAR is not set 302 | 303 | # 304 | # TrueType Fonts 305 | @@ -981,7 +1014,10 @@ 306 | # CONFIG_VIDEO_MVEBU is not set 307 | # CONFIG_DISPLAY is not set 308 | # CONFIG_VIDEO_BRIDGE is not set 309 | +# CONFIG_VIDEO is not set 310 | # CONFIG_LCD is not set 311 | +# CONFIG_VIDEO_SIMPLE is not set 312 | +# CONFIG_VIDEO_DT_SIMPLEFB is not set 313 | 314 | # 315 | # Watchdog Timer Support 316 | @@ -996,6 +1032,7 @@ 317 | # 318 | # File systems 319 | # 320 | +# CONFIG_FS_BTRFS is not set 321 | # CONFIG_FS_CBFS is not set 322 | CONFIG_FS_FAT=y 323 | CONFIG_FAT_WRITE=y 324 | @@ -1013,10 +1050,12 @@ 325 | CONFIG_USE_PRIVATE_LIBGCC=y 326 | CONFIG_SYS_HZ=1000 327 | CONFIG_USE_TINY_PRINTF=y 328 | +# CONFIG_PANIC_HANG is not set 329 | CONFIG_REGEX=y 330 | # CONFIG_LIB_RAND is not set 331 | # CONFIG_SPL_TINY_MEMSET is not set 332 | # CONFIG_TPL_TINY_MEMSET is not set 333 | +# CONFIG_BITREVERSE is not set 334 | # CONFIG_CMD_DHRYSTONE is not set 335 | 336 | # 337 | @@ -1040,6 +1079,8 @@ 338 | # CONFIG_LZ4 is not set 339 | # CONFIG_LZMA is not set 340 | CONFIG_LZO=y 341 | +# CONFIG_SPL_LZO is not set 342 | +# CONFIG_SPL_GZIP is not set 343 | # CONFIG_ERRNO_STR is not set 344 | CONFIG_OF_LIBFDT=y 345 | CONFIG_OF_LIBFDT_OVERLAY=y 346 | @@ -1049,7 +1090,5 @@ 347 | # 348 | # System tables 349 | # 350 | -CONFIG_GENERATE_SMBIOS_TABLE=y 351 | -CONFIG_SMBIOS_MANUFACTURER="ti" 352 | # CONFIG_EFI_LOADER is not set 353 | # CONFIG_UNIT_TEST is not set 354 | diff -Naur uboot-2018.01/include/configs/am335x_evm.h uboot-2018.01-new/include/configs/am335x_evm.h 355 | --- uboot-2018.01/include/configs/am335x_evm.h 2018-02-08 22:49:28.236008103 -0600 356 | +++ uboot-2018.01-new/include/configs/am335x_evm.h 2018-01-27 20:23:55.018697150 -0600 357 | @@ -314,6 +314,10 @@ 358 | #define CONFIG_AM335X_USB1_MODE MUSB_HOST 359 | #endif 360 | 361 | +#ifdef CONFIG_USB_MUSB_GADGET 362 | +#define CONFIG_USB_FUNCTION_MASS_STORAGE 363 | +#endif 364 | + 365 | /* 366 | * Disable MMC DM for SPL build and can be re-enabled after adding 367 | * DM support in SPL 368 | -------------------------------------------------------------------------------- /RESOURCES/buildroot/post-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 2018, Michael Welling 3 | 4 | BOARD_DIR=$(dirname "$0") 5 | 6 | # copy the uEnv.txt to the output/images directory 7 | cp "${BOARD_DIR}/uEnv.txt" "${BINARIES_DIR}/uEnv.txt" 8 | 9 | GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg" 10 | GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" 11 | 12 | rm -rf "${GENIMAGE_TMP}" 13 | 14 | genimage \ 15 | --rootpath "${TARGET_DIR}" \ 16 | --tmppath "${GENIMAGE_TMP}" \ 17 | --inputpath "${BINARIES_DIR}" \ 18 | --outputpath "${BINARIES_DIR}" \ 19 | --config "${GENIMAGE_CFG}" 20 | -------------------------------------------------------------------------------- /RESOURCES/buildroot/uEnv.txt: -------------------------------------------------------------------------------- 1 | fdtfile=am335x-pocketbeagle.dtb 2 | bootpart=0:1 3 | bootdir= 4 | bootargs=console=ttyO0,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait 5 | uenvcmd=run loadimage;run loadfdt;printenv bootargs;bootz ${loadaddr} - ${fdtaddr}; 6 | -------------------------------------------------------------------------------- /RESOURCES/common/linux-headers-4.9.82-ti-r102_1stretch_armhf.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e-ale/Code/e2a201aa840b3da7e84a13661295db1965bc68e0/RESOURCES/common/linux-headers-4.9.82-ti-r102_1stretch_armhf.deb -------------------------------------------------------------------------------- /RESOURCES/debugging/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e-ale/Code/e2a201aa840b3da7e84a13661295db1965bc68e0/RESOURCES/debugging/Makefile -------------------------------------------------------------------------------- /RESOURCES/debugging/debug-labs.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e-ale/Code/e2a201aa840b3da7e84a13661295db1965bc68e0/RESOURCES/debugging/debug-labs.tar.gz -------------------------------------------------------------------------------- /RESOURCES/debugging/pocket-debs.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e-ale/Code/e2a201aa840b3da7e84a13661295db1965bc68e0/RESOURCES/debugging/pocket-debs.tar.gz -------------------------------------------------------------------------------- /RESOURCES/i2c-drivers/Makefile: -------------------------------------------------------------------------------- 1 | obj-m += lab1.o lab2.o 2 | 3 | export KROOT=/lib/modules/$(shell uname -r)/build 4 | 5 | all: modules 6 | 7 | modules modules_install clean:: 8 | @$(MAKE) -C $(KROOT) M=$(shell pwd) $@ 9 | 10 | clean:: 11 | rm -rf Module.symvers modules.order 12 | -------------------------------------------------------------------------------- /RESOURCES/i2c-drivers/README: -------------------------------------------------------------------------------- 1 | LAB 1 (demonstrating user-space instantiation) 2 | ---------------------------------------------- 3 | make 4 | sudo su 5 | echo foo 0x1c > /sys/bus/i2c/devices/i2c-2/new_device 6 | insmod lab1.ko 7 | dmesg | tail 8 | rmmod lab1 9 | echo 0x1c > /sys/bus/i2c/devices/i2c-2/delete_device 10 | exit 11 | 12 | LAB 2 (demonstrating devicetree instantiation) 13 | ---------------------------------------------- 14 | make 15 | sudo insmod lab2.ko 16 | cat i2c-foo.sh 17 | cat i2c-foo.dts 18 | sudo ./i2c-foo.sh 19 | dmesg | tail 20 | sudo rmdir /sys/kernel/config/device-tree/overlays/foo 21 | sudo rmmod lab2 22 | 23 | LAB 3 (loading the iio driver) 24 | ------------------------------ 25 | cat i2c-accel.sh 26 | cat i2c-accel.dts 27 | sudo ./i2c-accel.sh 28 | -------------------------------------------------------------------------------- /RESOURCES/i2c-drivers/i2c-accel.dts: -------------------------------------------------------------------------------- 1 | /* https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/iio/accel/mma8452.txt */ 2 | 3 | /dts-v1/; 4 | /plugin/; 5 | / { 6 | fragment@0 { 7 | target = <&ocp>; 8 | __overlay__ { 9 | P1_34_pinmux { 10 | status = "disabled"; 11 | }; 12 | P1_31_pinmux { 13 | status = "disabled"; 14 | }; 15 | }; 16 | }; 17 | 18 | fragment@1 { 19 | target = <&i2c2>; 20 | __overlay__ { 21 | #address-cells = <1>; 22 | #size-cells = <0>; 23 | mma8453@1c { 24 | status = "okay"; 25 | compatible = "fsl,mma8453"; 26 | reg = <0x1c>; 27 | }; 28 | }; 29 | }; 30 | }; 31 | -------------------------------------------------------------------------------- /RESOURCES/i2c-drivers/i2c-accel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ "$EUID" != "0" ]; 3 | then echo "Please run as root" 4 | exit 5 | fi 6 | [ -e /sys/kernel/config/device-tree/overlays/accel ] && rmdir /sys/kernel/config/device-tree/overlays/accel 7 | mkdir -p /sys/kernel/config/device-tree/overlays/accel 8 | dtc -W no-unit_address_vs_reg -@ -o /sys/kernel/config/device-tree/overlays/accel/dtbo i2c-accel.dts 9 | sleep 2 10 | cd "/sys/bus/iio/devices/iio:device1" 11 | watch -n0 cat in_accel_x_raw in_accel_y_raw in_accel_z_raw 12 | -------------------------------------------------------------------------------- /RESOURCES/i2c-drivers/i2c-foo.dts: -------------------------------------------------------------------------------- 1 | /dts-v1/; 2 | /plugin/; 3 | / { 4 | fragment@0 { 5 | target = <&ocp>; 6 | __overlay__ { 7 | P1_34_pinmux { 8 | status = "disabled"; 9 | }; 10 | P1_31_pinmux { 11 | status = "disabled"; 12 | }; 13 | }; 14 | }; 15 | 16 | fragment@1 { 17 | target = <&i2c2>; 18 | __overlay__ { 19 | #address-cells = <1>; 20 | #size-cells = <0>; 21 | foo@1c { 22 | status = "okay"; 23 | compatible = "foo,bar"; 24 | reg = <0x1c>; 25 | }; 26 | }; 27 | }; 28 | }; 29 | -------------------------------------------------------------------------------- /RESOURCES/i2c-drivers/i2c-foo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ "$EUID" != "0" ]; 3 | then echo "Please run as root" 4 | exit 5 | fi 6 | [ -e /sys/kernel/config/device-tree/overlays/foo ] && rmdir /sys/kernel/config/device-tree/overlays/foo 7 | mkdir -p /sys/kernel/config/device-tree/overlays/foo 8 | dtc -W no-unit_address_vs_reg -@ -o /sys/kernel/config/device-tree/overlays/foo/dtbo i2c-foo.dts 9 | -------------------------------------------------------------------------------- /RESOURCES/i2c-drivers/lab1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | static int foo_probe(struct i2c_client *client, const struct i2c_device_id *id) 6 | { 7 | pr_info("foo_probe called\n"); 8 | return 0; 9 | } 10 | 11 | static int foo_remove(struct i2c_client *client) 12 | { 13 | pr_info("foo_remove called\n"); 14 | return 0; 15 | } 16 | 17 | static struct i2c_device_id foo_idtable[] = { 18 | { "foo", 0 }, 19 | { } 20 | }; 21 | 22 | MODULE_DEVICE_TABLE(i2c, foo_idtable); 23 | 24 | static struct i2c_driver foo_driver = { 25 | .driver = { 26 | .name = "foo", 27 | }, 28 | .id_table = foo_idtable, 29 | .probe = foo_probe, 30 | .remove = foo_remove, 31 | }; 32 | 33 | module_i2c_driver(foo_driver); 34 | 35 | MODULE_AUTHOR("Frodo Looijaard "); 36 | MODULE_DESCRIPTION("Driver for Barf Inc. Foo I2C devices"); 37 | MODULE_LICENSE("GPL"); 38 | -------------------------------------------------------------------------------- /RESOURCES/i2c-drivers/lab2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static int foo_probe(struct i2c_client *client, const struct i2c_device_id *id) 6 | { 7 | int ret; 8 | 9 | pr_info("foo_probe called\n"); 10 | 11 | if (client->dev.of_node) { 12 | pr_info("device tree instantiated probe. data = %x\n", 13 | (unsigned int)of_device_get_match_data(&client->dev)); 14 | } 15 | 16 | ret = i2c_smbus_read_byte_data(client, 0x0d); 17 | pr_info("i2c read byte = %x\n", ret); 18 | if (ret < 0) 19 | return ret; 20 | 21 | return 0; 22 | } 23 | 24 | static int foo_remove(struct i2c_client *client) 25 | { 26 | pr_info("foo_remove called\n"); 27 | return 0; 28 | } 29 | 30 | static struct i2c_device_id foo_idtable[] = { 31 | { "foo", 0 }, 32 | { } 33 | }; 34 | 35 | MODULE_DEVICE_TABLE(i2c, foo_idtable); 36 | 37 | static const struct of_device_id foo_dt_ids[] = { 38 | { .compatible = "foo,bar", .data = (void *) 0xDEADBEEF }, 39 | { } 40 | }; 41 | MODULE_DEVICE_TABLE(of, foo_dt_ids); 42 | 43 | static struct i2c_driver foo_driver = { 44 | .driver = { 45 | .name = "foobar", 46 | .of_match_table = of_match_ptr(foo_dt_ids) 47 | }, 48 | .id_table = foo_idtable, 49 | .probe = foo_probe, 50 | .remove = foo_remove, 51 | }; 52 | 53 | module_i2c_driver(foo_driver); 54 | 55 | MODULE_AUTHOR("Frodo Looijaard "); 56 | MODULE_DESCRIPTION("Driver for Barf Inc. Foo I2C devices"); 57 | MODULE_LICENSE("GPL"); 58 | -------------------------------------------------------------------------------- /RESOURCES/modules-kbuild/Makefile: -------------------------------------------------------------------------------- 1 | obj-m += lab1.o lab2_1.o lab2_2.o 2 | 3 | export KROOT=/lib/modules/$(shell uname -r)/build 4 | 5 | all: modules 6 | 7 | modules modules_install clean:: 8 | @$(MAKE) -C $(KROOT) M=$(shell pwd) $@ 9 | 10 | clean:: 11 | rm -rf Module.symvers modules.order 12 | -------------------------------------------------------------------------------- /RESOURCES/modules-kbuild/lab1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * The code herein is: Copyright the Linux Foundation, 2018 3 | * 4 | * This Copyright is retained for the purpose of protecting free 5 | * redistribution of source. 6 | * 7 | * URL: http://training.linuxfoundation.org 8 | * email: trainingquestions@linuxfoundation.org 9 | * 10 | * This code is distributed under Version 2 of the GNU General Public 11 | * License, which you should have received with the source. 12 | * 13 | */ 14 | #include 15 | #include 16 | 17 | static int __init my_init(void) 18 | { 19 | pr_info("Hello: module loaded at 0x%p\n", my_init); 20 | return 0; 21 | } 22 | static void __exit my_exit(void) 23 | { 24 | pr_info("Bye: module unloaded from 0x%p\n", my_exit); 25 | } 26 | 27 | module_init(my_init); 28 | module_exit(my_exit); 29 | 30 | MODULE_AUTHOR("A GENIUS"); 31 | MODULE_LICENSE("GPL v2"); 32 | -------------------------------------------------------------------------------- /RESOURCES/modules-kbuild/lab2_1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * The code herein is: Copyright the Linux Foundation, 2018 3 | * 4 | * This Copyright is retained for the purpose of protecting free 5 | * redistribution of source. 6 | * 7 | * URL: http://training.linuxfoundation.org 8 | * email: trainingquestions@linuxfoundation.org 9 | * 10 | * This code is distributed under Version 2 of the GNU General Public 11 | * License, which you should have received with the source. 12 | * 13 | */ 14 | #include 15 | #include 16 | 17 | static void foo(void) 18 | { 19 | printk("Hello foo in lab2_1\n"); 20 | } 21 | EXPORT_SYMBOL(foo); 22 | 23 | static int __init my_init(void) 24 | { 25 | pr_info("Hello: module loaded at 0x%p\n", my_init); 26 | return 0; 27 | } 28 | static void __exit my_exit(void) 29 | { 30 | pr_info("Bye: module unloaded from 0x%p\n", my_exit); 31 | } 32 | 33 | module_init(my_init); 34 | module_exit(my_exit); 35 | 36 | MODULE_AUTHOR("A GENIUS"); 37 | MODULE_LICENSE("GPL v2"); 38 | -------------------------------------------------------------------------------- /RESOURCES/modules-kbuild/lab2_2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * The code herein is: Copyright the Linux Foundation, 2018 3 | * 4 | * This Copyright is retained for the purpose of protecting free 5 | * redistribution of source. 6 | * 7 | * URL: http://training.linuxfoundation.org 8 | * email: trainingquestions@linuxfoundation.org 9 | * 10 | * This code is distributed under Version 2 of the GNU General Public 11 | * License, which you should have received with the source. 12 | * 13 | */ 14 | #include 15 | #include 16 | 17 | void foo(void); 18 | 19 | static int __init my_init(void) 20 | { 21 | pr_info("Hello: module loaded at 0x%p\n", my_init); 22 | foo(); 23 | return 0; 24 | } 25 | static void __exit my_exit(void) 26 | { 27 | pr_info("Bye: module unloaded from 0x%p\n", my_exit); 28 | } 29 | 30 | module_init(my_init); 31 | module_exit(my_exit); 32 | 33 | MODULE_AUTHOR("A GENIUS"); 34 | MODULE_LICENSE("GPL v2"); 35 | -------------------------------------------------------------------------------- /RESOURCES/modules-kbuild/red-module.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static unsigned int gpioLED = 111; 7 | 8 | static int __init red_module_init(void) 9 | { 10 | printk(KERN_INFO "RED LED module loaded\n"); 11 | 12 | if (!gpio_is_valid(gpioLED)){ 13 | printk(KERN_INFO "GPIO_TEST: invalid LED GPIO\n"); 14 | return -ENODEV; 15 | } 16 | 17 | gpio_request(gpioLED, "LED"); 18 | gpio_direction_output(gpioLED, 1); 19 | 20 | return 0; 21 | } 22 | 23 | static void __exit red_module_exit(void) 24 | { 25 | gpio_direction_output(gpioLED, 0); 26 | gpio_free(gpioLED); 27 | 28 | printk(KERN_INFO "RED LED module unloaded\n"); 29 | } 30 | 31 | module_init(red_module_init); 32 | module_exit(red_module_exit); 33 | 34 | MODULE_LICENSE("GPL"); 35 | MODULE_AUTHOR("John Q. Coder"); 36 | MODULE_DESCRIPTION("RED LED module"); 37 | -------------------------------------------------------------------------------- /RESOURCES/pocketbeagle/BaconCapeLabs.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e-ale/Code/e2a201aa840b3da7e84a13661295db1965bc68e0/RESOURCES/pocketbeagle/BaconCapeLabs.pdf -------------------------------------------------------------------------------- /RESOURCES/pocketbeagle/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e-ale/Code/e2a201aa840b3da7e84a13661295db1965bc68e0/RESOURCES/pocketbeagle/Makefile -------------------------------------------------------------------------------- /RESOURCES/pocketbeagle/README.md: -------------------------------------------------------------------------------- 1 | These are some [PocketBeagle](https://beagleboard.org/pocket) + [BaconBits](https://github.com/e-ale/BaconBitsCapeHW) command-line examples 2 | 3 | The below examples were tested on the [BeagleBoard.org 2018-03-05 Debian Stretch IoT image](http://debian.beagleboard.org/images/bone-debian-9.3-iot-armhf-2018-03-05-4gb.img.xz). Find the latest images at https://beagleboard.org/latest-images. 4 | 5 | ``` 6 | debian@beaglebone:~$ sudo /opt/scripts/tools/version.sh 7 | git:/opt/scripts/:[e307a944e0be0610ff5296e0abe4ad31a6e70daa] 8 | eeprom:[A335PBGL00A21741GPB30158] 9 | model:[TI_AM335x_PocketBeagle] 10 | dogtag:[BeagleBoard.org Debian Image 2018-03-05] 11 | bootloader:[microSD]:[/dev/mmcblk0]:[U-Boot 2018.01-00002-ge9ff418fb8]:[location: dd MBR] 12 | kernel:[4.9.82-ti-r102] 13 | nodejs:[v6.13.0] 14 | uboot_overlay_options:[enable_uboot_overlays=1] 15 | uboot_overlay_options:[enable_uboot_cape_universal=1] 16 | pkg:[bb-cape-overlays]:[4.4.20180305.0-0rcnee0~stretch+20180305] 17 | pkg:[bb-wl18xx-firmware]:[1.20170829-0rcnee2~stretch+20180104] 18 | pkg:[firmware-ti-connectivity]:[20170823-1rcnee0~stretch+20170830] 19 | groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai] 20 | cmdline:[console=ttyO0,115200n8 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet] 21 | dmesg | grep pinctrl-single 22 | [ 1.424571] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568 23 | dmesg | grep gpio-of-helper 24 | [ 1.433009] gpio-of-helper ocp:cape-universal: ready 25 | END 26 | ``` 27 | 28 | # User button 29 | ```sh 30 | watch -n0 cat /sys/class/gpio/gpio45/value 31 | ``` 32 | 33 | # Potentiometer 34 | ```sh 35 | watch -n0 cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw 36 | ``` 37 | 38 | # SPI 7-segment LEDs 39 | ```sh 40 | echo -ne "\x40\x00\x00" | sudo tee /dev/spidev2.1 | xxd 41 | echo -ne "\x40\x01\x00" | sudo tee /dev/spidev2.1 | xxd 42 | echo -ne "\x40\x12\xc0" | sudo tee /dev/spidev2.1 | xxd 43 | echo -ne "\x40\x13\xc0" | sudo tee /dev/spidev2.1 | xxd 44 | ``` 45 | 46 | # I2C accelerometer (mma8453) 47 | ```sh 48 | sudo mkdir -p /sys/kernel/config/device-tree/overlays/accel 49 | sudo dtc -W no-unit_address_vs_reg -@ -o /sys/kernel/config/device-tree/overlays/accel/dtbo <; 55 | __overlay__ { 56 | #address-cells = <1>; 57 | #size-cells = <0>; 58 | accel@1c { 59 | compatible = "fsl,mma8453"; 60 | reg = <0x1c>; 61 | }; 62 | }; 63 | }; 64 | }; 65 | EOF 66 | sleep 2 67 | cd /sys/bus/iio/devices/iio\:device1 68 | watch -n0 sudo cat in_accel_x_raw in_accel_y_raw in_accel_z_raw 69 | ``` 70 | 71 | # PRU examples 72 | You'll need to start by enabling the PRU RPROC overlay. In future images, this should not be required and should actually just be part of the default device tree. 73 | 74 | ```sh 75 | sudo sed -i -e "s/#?uboot_overlay_pru=.*RPROC.*$/uboot_overlay_pru=\/lib\/firmware\/AM335X-PRU-RPROC-4-9-TI-00A0.dtbo/;" /boot/uEnv.txt 76 | sudo shutdown -r now 77 | ``` 78 | 79 | After rebooting, the version will look like the below. 80 | 81 | ``` 82 | debian@beaglebone:/var/lib/cloud9$ sudo /opt/scripts/tools/version.sh 83 | [sudo] password for debian: 84 | git:/opt/scripts/:[e307a944e0be0610ff5296e0abe4ad31a6e70daa] 85 | eeprom:[A335PBGL00A21741GPB30158] 86 | model:[TI_AM335x_PocketBeagle] 87 | dogtag:[BeagleBoard.org Debian Image 2018-03-05] 88 | bootloader:[microSD]:[/dev/mmcblk0]:[U-Boot 2018.01-00002-ge9ff418fb8]:[location: dd MBR] 89 | kernel:[4.9.82-ti-r102] 90 | nodejs:[v6.13.0] 91 | uboot_overlay_options:[enable_uboot_overlays=1] 92 | uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-9-TI-00A0.dtbo] 93 | uboot_overlay_options:[enable_uboot_cape_universal=1] 94 | pkg:[bb-cape-overlays]:[4.4.20180305.0-0rcnee0~stretch+20180305] 95 | pkg:[bb-wl18xx-firmware]:[1.20170829-0rcnee2~stretch+20180104] 96 | pkg:[firmware-ti-connectivity]:[20170823-1rcnee0~stretch+20170830] 97 | groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai] 98 | cmdline:[console=ttyO0,115200n8 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet] 99 | dmesg | grep pinctrl-single 100 | [ 1.425322] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568 101 | dmesg | grep gpio-of-helper 102 | [ 1.434029] gpio-of-helper ocp:cape-universal: ready 103 | ``` 104 | 105 | Then you can try to run the PRU examples. 106 | 107 | ```sh 108 | cd /var/lib/cloud9/examples/extras/pru 109 | make TARGET=hello-pru PRUN=pru0 110 | make TARGET=hello-pru PRUN=pru1 111 | ``` 112 | 113 | # I2C accelerometer (Old revision 0 board with mma8452) 114 | ```sh 115 | sudo mkdir -p /sys/kernel/config/device-tree/overlays/accel 116 | sudo dtc -W no-unit_address_vs_reg -@ -o /sys/kernel/config/device-tree/overlays/accel/dtbo <; 122 | __overlay__ { 123 | #address-cells = <1>; 124 | #size-cells = <0>; 125 | accel@1c { 126 | compatible = "fsl,mma8452"; 127 | reg = <0x1c>; 128 | }; 129 | }; 130 | }; 131 | }; 132 | EOF 133 | sleep 2 134 | cd /sys/bus/iio/devices/iio\:device1 135 | watch -n0 sudo cat in_accel_x_raw in_accel_y_raw in_accel_z_raw 136 | ``` 137 | 138 | -------------------------------------------------------------------------------- /RESOURCES/pocketbeagle/i2c-accel.dts: -------------------------------------------------------------------------------- 1 | /* https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/iio/accel/mma8452.txt */ 2 | 3 | /dts-v1/; 4 | /plugin/; 5 | / { 6 | fragment@0 { 7 | target = <&ocp>; 8 | __overlay__ { 9 | P1_34_pinmux { 10 | status = "disabled"; 11 | }; 12 | P1_31_pinmux { 13 | status = "disabled"; 14 | }; 15 | }; 16 | }; 17 | 18 | fragment@1 { 19 | target = <&i2c2>; 20 | __overlay__ { 21 | #address-cells = <1>; 22 | #size-cells = <0>; 23 | mma8453@1c { 24 | status = "okay"; 25 | compatible = "fsl,mma8453"; 26 | reg = <0x1c>; 27 | }; 28 | }; 29 | }; 30 | }; 31 | -------------------------------------------------------------------------------- /RESOURCES/pocketbeagle/i2c-accel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ "$EUID" != "0" ]; 3 | then echo "Please run as root" 4 | exit 5 | fi 6 | [ -e /sys/kernel/config/device-tree/overlays/accel ] && rmdir /sys/kernel/config/device-tree/overlays/accel 7 | mkdir -p /sys/kernel/config/device-tree/overlays/accel 8 | dtc -W no-unit_address_vs_reg -@ -o /sys/kernel/config/device-tree/overlays/accel/dtbo i2c-accel.dts 9 | sleep 2 10 | cd "/sys/bus/iio/devices/iio:device1" 11 | watch -n0 cat in_accel_x_raw in_accel_y_raw in_accel_z_raw 12 | -------------------------------------------------------------------------------- /RESOURCES/pocketbeagle/js-spi-write-digit/README.md: -------------------------------------------------------------------------------- 1 | by Todd Zebert, todd@toddzebert.com 2 | 3 | based on write-digit.sh 4 | 5 | GPL v3.0 6 | 7 | -------------------------------------------------------------------------------- /RESOURCES/pocketbeagle/js-spi-write-digit/write-digit.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var b = require('bonescript'); 3 | 4 | 5 | const theBits = { 6 | '0': '0111111', 7 | '1': '0000110', 8 | '2': '1011011', 9 | '3': '1001111', 10 | '4': '1100110', 11 | '5': '1101101', 12 | '6': '1111101', 13 | '7': '0000111', 14 | '8': '1111111', 15 | '9': '1101111', 16 | 'a': '1110111', 17 | 'b': '1111100', 18 | 'c': '0111001', 19 | 'd': '1110001', 20 | 'e': '1111001', 21 | 'f': '1110001', 22 | 'g': '0000000', 23 | 'h': '1010101', 24 | 'i': '0101010', 25 | } 26 | 27 | 28 | function getBits(c) { 29 | return theBits[c]; 30 | } 31 | 32 | 33 | function getFileName(gpio) { 34 | return '/sys/class/gpio/gpio' + gpio + '/direction'; 35 | } 36 | 37 | 38 | function writeBits(gpioBase, c) { 39 | const bits = getBits(c); 40 | 41 | for (let i = 0; i < 7; i++) { 42 | let fileName = getFileName(gpioBase + i); 43 | 44 | switch(bits[6 - i]) { 45 | case '0': 46 | b.writeTextFile(fileName, 'in'); 47 | break; 48 | case '1': 49 | b.writeTextFile(fileName, 'out'); 50 | break; 51 | } 52 | 53 | } 54 | } 55 | 56 | 57 | exports.writeChars = function(c1, c2 = 'g') { 58 | writeBits(496, c1); 59 | writeBits(504, c2); 60 | } 61 | -------------------------------------------------------------------------------- /RESOURCES/pocketbeagle/js-spi-write-digit/writeDigitTest.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var b = require('bonescript'); 3 | var wd = require('./write-digit.js'); 4 | 5 | // usage ex: sudo node e-ale/writeDigitTest.js a b 6 | 7 | wd.writeChars(process.argv[2], process.argv[3]) 8 | -------------------------------------------------------------------------------- /RESOURCES/pocketbeagle/pwm.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var b = require('bonescript'); 3 | 4 | // setup starting conditions 5 | var min = 0.05; 6 | var max = 0.95; 7 | var a = { 8 | red: { val: min, step: 0.05, pin: "P2_1" }, 9 | green: { val: min, step: 0.02, pin: "P1_33" }, 10 | blue: { val: min, step: 0.01, pin: "P1_36" } 11 | }; 12 | 13 | // configure pin 14 | b.pinMode(a.red.pin, b.ANALOG_OUTPUT); 15 | b.pinMode(a.green.pin, b.ANALOG_OUTPUT); 16 | b.pinMode(a.blue.pin, b.ANALOG_OUTPUT); 17 | 18 | // call function to update brightness every 10ms 19 | setTimeout(function() { 20 | setInterval(fade, 10); 21 | }, 500); 22 | 23 | 24 | // function to update brightness 25 | function fade() { 26 | for(var x in a) { 27 | b.analogWrite(a[x].pin, a[x].val); 28 | a[x].val += a[x].step; 29 | if(a[x].val >= max || a[x].val <= min) { 30 | a[x].step = -1 * a[x].step; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /RESOURCES/pocketbeagle/rgb.pru0c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jason Kridner , Texas Instruments Incorporated 3 | * 4 | * Source Modified by Zubeen Tolani < ZeekHuge - zeekhuge@gmail.com > 5 | * Based on the examples distributed by TI 6 | * 7 | * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ 8 | * 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 14 | * * Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * 17 | * * Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the 20 | * distribution. 21 | * 22 | * * Neither the name of Texas Instruments Incorporated nor the names of 23 | * its contributors may be used to endorse or promote products derived 24 | * from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #define INS_PER_US 200 // 5ns per instruction 46 | #define INS_PER_DELAY_LOOP 2 // two instructions per delay loop 47 | #define DELAY_CYCLES_US (INS_PER_US / INS_PER_DELAY_LOOP) 48 | 49 | #define GPIO1 0x4804C000 50 | #define GPIO_CLEARDATAOUT 0x190 51 | #define GPIO_SETDATAOUT 0x194 52 | 53 | /* GPIO1 */ 54 | #define P2_1 (1<<18) 55 | #define USR0 (1<<21) 56 | #define USR1 (1<<22) 57 | #define USR2 (1<<23) 58 | #define USR3 (1<<24) 59 | unsigned int volatile * const GPIO1_CLEAR = (unsigned int *) (GPIO1 + GPIO_CLEARDATAOUT); 60 | unsigned int volatile * const GPIO1_SET = (unsigned int *) (GPIO1 + GPIO_SETDATAOUT); 61 | 62 | /* PRU GPIO */ 63 | volatile register unsigned int __R30; 64 | volatile register unsigned int __R31; 65 | #define P1_36 (1<<0) 66 | #define P1_33 (1<<1) 67 | 68 | #define DECAY_RATE 75 69 | #define DELAY_CYCLES DELAY_CYCLES_US 70 | 71 | const int decay = DECAY_RATE; 72 | 73 | struct my_resource_table { 74 | struct resource_table base; 75 | 76 | uint32_t offset[1]; /* Should match 'num' in actual definition */ 77 | }; 78 | 79 | #pragma DATA_SECTION(pru_remoteproc_ResourceTable, ".resource_table") 80 | #pragma RETAIN(pru_remoteproc_ResourceTable) 81 | struct my_resource_table pru_remoteproc_ResourceTable = { 82 | 1, /* we're the first version that implements this */ 83 | 0, /* number of entries in the table */ 84 | 0, 0, /* reserved, must be zero */ 85 | 0, /* offset[0] */ 86 | }; 87 | 88 | void main(void) { 89 | int i, j; 90 | 91 | /* Clear SYSCFG[STANDBY_INIT] to enable OCP master port */ 92 | CT_CFG.SYSCFG_bit.STANDBY_INIT = 0; 93 | 94 | /* clear */ 95 | *GPIO1_CLEAR = (P2_1 | USR3); 96 | __R30 &= ~(P1_33 | P1_36); 97 | 98 | while(1) { 99 | /* red */ 100 | for(i = 1000000; i > 0; i = (i * decay) / 100) { 101 | *GPIO1_SET = (USR3); 102 | __R30 |= (P1_33); 103 | for(j=0;j 0; i = (i * decay) / 100) { 114 | *GPIO1_SET = (P2_1 | USR3); 115 | for(j=0;j 0; i = (i * decay) / 100) { 125 | *GPIO1_SET = (P2_1 | USR3); 126 | __R30 |= (P1_36); 127 | for(j=0;j 0; i = (i * decay) / 100) { 136 | *GPIO1_SET = (P2_1 | USR3); 137 | __R30 |= (P1_33 | P1_36); 138 | for(j=0;j "/sys/devices/platform/ocp/ocp:P1_36_pinmux/state" 4 | # green 5 | echo pruout > "/sys/devices/platform/ocp/ocp:P1_33_pinmux/state" 6 | # red 7 | echo gpio > "/sys/devices/platform/ocp/ocp:P2_01_pinmux/state" 8 | echo out > "/sys/class/gpio/gpio50/direction" 9 | echo 0 > "/sys/class/gpio/gpio50/value" 10 | make -f "/var/lib/cloud9/examples/extras/pru/Makefile" TARGET=rgb PRUN=pru0 11 | -------------------------------------------------------------------------------- /RESOURCES/pocketbeagle/shiftout.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // Based on https://groups.google.com/forum/#!category-topic/beagleboard/iT3JsATQIjI 3 | 4 | //# fekerr 20180227 5 | //# https://github.com/beagleboard/pocketbeagle/wiki/System-Reference-Manual#221_PocketBone 6 | 7 | // Writing to SPI GPIO to 7-segment LEDs per https://github.com/e-ale/BaconBitsCapeHW Rev 0/1 8 | 9 | var b = require('bonescript'); 10 | 11 | var LE = "P2_31" ; // nCS 12 | var SPI = "P2_25"; // MOSI 13 | var CLK = "P2_29"; // CLK 14 | 15 | var chip = [ 16 | [ 17 | 0x40, 0x12, // Write address 0x12 (GPIOA) 18 | 0xfe 19 | ], 20 | [ 21 | 0x40, 0x13, // Write address 0x13 (GPIOB) 22 | 0xfe 23 | ], 24 | [ 25 | 0x40, 0x00, // Write address 0 (IODIRA) 26 | 0x00 27 | ], 28 | [ 29 | 0x40, 0x01, // Write address 0x01 (IODIRB) 30 | 0x00 31 | ], 32 | [ 33 | 0x40, 0x12, // Write address 0x12 (GPIOA) 34 | 0xfd 35 | ], 36 | [ 37 | 0x40, 0x13, // Write address 0x13 (GPIOB) 38 | 0xfd 39 | ], 40 | [ 41 | 0x40, 0x12, // Write address 0x12 (GPIOA) 42 | 0xfb 43 | ], 44 | [ 45 | 0x40, 0x13, // Write address 0x13 (GPIOB) 46 | 0xfb 47 | ], 48 | [ 49 | 0x40, 0x12, // Write address 0x12 (GPIOA) 50 | 0xf7 51 | ], 52 | [ 53 | 0x40, 0x13, // Write address 0x13 (GPIOB) 54 | 0xf7 55 | ], 56 | [ 57 | 0x40, 0x12, // Write address 0x12 (GPIOA) 58 | 0xef 59 | ], 60 | [ 61 | 0x40, 0x13, // Write address 0x13 (GPIOB) 62 | 0xef 63 | ], 64 | [ 65 | 0x40, 0x12, // Write address 0x12 (GPIOA) 66 | 0xdf 67 | ], 68 | [ 69 | 0x40, 0x13, // Write address 0x13 (GPIOB) 70 | 0xdf 71 | ], 72 | [ 73 | 0x40, 0x12, // Write address 0x12 (GPIOA) 74 | 0xbf 75 | ], 76 | [ 77 | 0x40, 0x13, // Write address 0x13 (GPIOB) 78 | 0xbf 79 | ], 80 | ]; 81 | 82 | // Configure pins as outputs 83 | b.pinMode(LE, b.OUTPUT); 84 | b.pinMode(SPI, b.OUTPUT); 85 | b.pinMode(CLK, b.OUTPUT); 86 | 87 | // initial states 88 | b.digitalWrite(LE, b.LOW); 89 | b.digitalWrite(SPI, b.LOW); 90 | b.digitalWrite(CLK, b.LOW); 91 | 92 | doUpdate(); 93 | 94 | function doUpdate() 95 | { 96 | var i, j; 97 | for(j=0; j "/sys/devices/platform/ocp/ocp:P2_25_pinmux/state" 7 | echo spi_sclk > "/sys/devices/platform/ocp/ocp:P2_29_pinmux/state" 8 | echo spi_cs > "/sys/devices/platform/ocp/ocp:P2_31_pinmux/state" 9 | echo -ne "\x40\x00\x00" > /dev/spidev2.1 10 | echo -ne "\x40\x01\x00" > /dev/spidev2.1 11 | echo -ne "\x40\x12\xc0" > /dev/spidev2.1 12 | echo -ne "\x40\x13\xc0" > /dev/spidev2.1 13 | -------------------------------------------------------------------------------- /RESOURCES/spi-drivers/Makefile: -------------------------------------------------------------------------------- 1 | obj-m += lab1.o 2 | 3 | export KROOT=/lib/modules/$(shell uname -r)/build 4 | 5 | all: modules 6 | 7 | modules modules_install clean:: 8 | @$(MAKE) -C $(KROOT) M=$(shell pwd) $@ 9 | 10 | clean:: 11 | rm -rf Module.symvers modules.order 12 | -------------------------------------------------------------------------------- /RESOURCES/spi-drivers/lab1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static const struct of_device_id myspi_of_match[] = { 6 | { 7 | .compatible = "mycompany,myspi", 8 | .data = (void *) "some useful data", 9 | }, 10 | { }, 11 | }; 12 | MODULE_DEVICE_TABLE(of, myspi_of_match); 13 | 14 | static int myspi_probe(struct spi_device *spi) 15 | { 16 | const struct of_device_id *match; 17 | 18 | pr_info("myspi_probe called\n"); 19 | 20 | match = of_match_device(of_match_ptr(myspi_of_match), &spi->dev); 21 | if (match) { 22 | /* parse device tree options */ 23 | pr_info("devicetree match\n"); 24 | } 25 | 26 | /* get memory for driver's per-chip state */ 27 | // chip = devm_kzalloc(&spi->dev, sizeof *chip, GFP_KERNEL); 28 | // if (!chip) 29 | // return -ENOMEM; 30 | 31 | // spi_set_drvdata(spi, chip); 32 | 33 | return 0; 34 | } 35 | 36 | static const struct spi_device_id myspi_id_table[] = { 37 | { "myspi", 0 }, 38 | { }, 39 | }; 40 | MODULE_DEVICE_TABLE(spi, myspi_id_table); 41 | 42 | static struct spi_driver myspi_driver = { 43 | .driver = { 44 | .name = "myspi_spi", 45 | .of_match_table = of_match_ptr(myspi_of_match), 46 | }, 47 | .probe = myspi_probe, 48 | .id_table = myspi_id_table, 49 | }; 50 | module_spi_driver(myspi_driver); 51 | 52 | MODULE_AUTHOR("Codie McCoderson"); 53 | MODULE_DESCRIPTION("Driver for simple SPI device"); 54 | MODULE_LICENSE("GPL"); 55 | -------------------------------------------------------------------------------- /RESOURCES/spi-drivers/sparkle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | while true 4 | do 5 | ./write-digit.sh h h 6 | ./write-digit.sh i i 7 | done 8 | -------------------------------------------------------------------------------- /RESOURCES/spi-drivers/spi-gpio.dts: -------------------------------------------------------------------------------- 1 | /dts-v1/; 2 | /plugin/; 3 | / { 4 | fragment@0 { 5 | target = <&spi1>; 6 | __overlay__ { 7 | #address-cells = <1>; 8 | #size-cells = <0>; 9 | status = "okay"; 10 | 11 | channel@0 { 12 | status = "disabled"; 13 | }; 14 | channel@1 { 15 | status = "disabled"; 16 | }; 17 | 18 | 19 | mcp23s18@1 { 20 | #address-cells = <1>; 21 | #size-cells = <1>; 22 | compatible = "microchip,mcp23s18"; 23 | gpio-controller; 24 | microchip,spi-present-mask = <0x01>; 25 | reg = <1>; 26 | spi-max-frequency = <1000000>; 27 | }; 28 | }; 29 | }; 30 | }; 31 | -------------------------------------------------------------------------------- /RESOURCES/spi-drivers/spi-gpio.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ "$EUID" != "0" ]; 3 | then echo "Please run as root" 4 | exit 5 | fi 6 | #[ -e /sys/kernel/config/device-tree/overlays/spi-gpio ] && rmdir /sys/kernel/config/device-tree/overlays/spi-gpio 7 | #mkdir -p /sys/kernel/config/device-tree/overlays/spi-gpio 8 | #dtc -W no-unit_address_vs_reg -@ -o /sys/kernel/config/device-tree/overlays/spi-gpio/dtbo spi-gpio.dts 9 | dtc -W no-unit_address_vs_reg -@ -o /lib/firmware/spi-gpio.dtbo spi-gpio.dts 10 | sed -i -e "s/#?uboot_overlay_addr0=.*$/uboot_overlay_addr0=\/lib\/firmware\/spi-gpio.dtbo/;" /boot/uEnv.txt 11 | -------------------------------------------------------------------------------- /RESOURCES/spi-drivers/spi_test.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file spi_test.c 3 | * 4 | * Simple spidev testing program. 5 | * @author Michael Welling 6 | * 7 | * Copyright (C) 2015 QWERTY Embedded Design 8 | * 9 | * Based on a similar utility written for EMAC Inc. SPI class. 10 | * 11 | * Copyright (C) 2009 EMAC, Inc. 12 | */ 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU General Public License as published by * 17 | * the Free Software Foundation; either version 2 of the License, or * 18 | * (at your option) any later version. * 19 | * * 20 | ***************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #define MAX_LENGTH 64 34 | 35 | __u8 char2hex(char value) 36 | { 37 | __u8 retval; 38 | 39 | if (value >= '0' && value <= '9') 40 | retval = value - '0'; 41 | else if (value >= 'A' && value <= 'F') 42 | retval = value - 'A' + 0xA; 43 | else if (value >= 'a' && value <= 'f') 44 | retval = value - 'a' + 0xA; 45 | else 46 | retval = 0xF; 47 | 48 | return retval; 49 | } 50 | 51 | void string2hex(char *str, __u8 *hex, int length) 52 | { 53 | int i; 54 | __u8 nibble; 55 | 56 | for (i = 0; i < (length * 2); i++) { 57 | if (i < strlen(str)) 58 | nibble = char2hex(str[i]); 59 | else 60 | nibble = 0xf; 61 | if (i % 2 == 0) 62 | hex[i / 2] = nibble; 63 | else 64 | hex[i / 2] = (hex[i / 2] << 4) | nibble; 65 | } 66 | } 67 | 68 | void print_spi_transaction(__u8 *miso, __u8 *mosi, __u32 length) 69 | { 70 | int i; 71 | 72 | printf("MOSI MISO\n"); 73 | for (i = 0; i < length; i++) 74 | printf("%.2X : %.2X\n", mosi[i], miso[i]); 75 | } 76 | 77 | void print_usage(void) 78 | { 79 | printf("USAGE: spi_test -d dev -l len -m mosi -s speed\n" 80 | " -d,--device dev: name of the spi device node\n" 81 | " -l,--length len: length of spi transaction(bytes)\n" 82 | " -m,--mosi mosi: hex value to be transmitted\n" 83 | " -s,--speed speed: speed of the transaction in Hz\n\n" 84 | "EX: spi_test -d /dev/spidev0.0 -l 4 -m 12AB\n\n" 85 | "Note: mosi will be padded or truncated\n" 86 | " to the length speficied.\n" 87 | " %d bytes maximum length.\n", MAX_LENGTH); 88 | } 89 | 90 | 91 | int main(int argc, char *argv[]) 92 | { 93 | __u8 miso[MAX_LENGTH]; 94 | __u8 mosi[MAX_LENGTH]; 95 | struct spi_ioc_transfer tr = { 96 | .tx_buf = (unsigned long)mosi, 97 | .rx_buf = (unsigned long)miso, 98 | .delay_usecs = 1, 99 | .len = 1, 100 | }; 101 | char *device_name = NULL; 102 | char *mosi_str = "FF"; 103 | int opt_i = 0; 104 | int c; 105 | int fd; 106 | int ret; 107 | 108 | static struct option long_opts[] = { 109 | { "device", required_argument, 0, 'd' }, 110 | { "length", required_argument, 0, 'l' }, 111 | { "mosi", required_argument, 0, 'm' }, 112 | { "speed", required_argument, 0, 's' }, 113 | { "help", no_argument, 0, '?' }, 114 | { 0, 0, 0, 0 }, 115 | }; 116 | 117 | while ((c = getopt_long(argc, argv, "d:l:m:s:?", 118 | long_opts, &opt_i)) != -1) { 119 | switch (c) { 120 | case 'd': 121 | device_name = optarg; 122 | break; 123 | case 'l': 124 | tr.len = MIN(atoi(optarg), MAX_LENGTH); 125 | break; 126 | case 'm': 127 | mosi_str = optarg; 128 | break; 129 | case 's': 130 | tr.speed_hz = atoi(optarg); 131 | break; 132 | case '?': 133 | print_usage(); 134 | return 0; 135 | } 136 | } 137 | 138 | if (!device_name) { 139 | fprintf(stderr, "Missing required device argument.\n"); 140 | print_usage(); 141 | return -1; 142 | } 143 | 144 | fd = open(device_name, O_RDWR); 145 | if (fd == -1) { 146 | fprintf(stderr, "main: opening device file: %s: %s\n", 147 | device_name, strerror(errno)); 148 | return -1; 149 | } 150 | 151 | string2hex(mosi_str, mosi, tr.len); 152 | 153 | printf("Sending to %s at %ld Hz\n", device_name, tr.speed_hz); 154 | 155 | ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr); 156 | if (ret == -1) 157 | fprintf(stderr, "main: ioctl SPI_IOC_MESSAGE: %s: %s\n", 158 | device_name, strerror(errno)); 159 | else 160 | print_spi_transaction(miso, mosi, tr.len); 161 | 162 | close(fd); 163 | 164 | return ret; 165 | } 166 | -------------------------------------------------------------------------------- /RESOURCES/spi-drivers/write-digit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for i in $(seq 496 1 511) 4 | do 5 | if [[ ! -d "/sys/class/gpio/gpio$i" ]] 6 | then 7 | echo "$i" > /sys/class/gpio/export 8 | fi 9 | done 10 | 11 | getbits () { 12 | case $1 in 13 | 0) bits="0 1 1 1 1 1 1" ;; 14 | 1) bits="0 0 0 0 1 1 0" ;; 15 | 2) bits="1 0 1 1 0 1 1" ;; 16 | 3) bits="1 0 0 1 1 1 1" ;; 17 | 4) bits="1 1 0 0 1 1 0" ;; 18 | 5) bits="1 1 0 1 1 0 1" ;; 19 | 6) bits="1 1 1 1 1 0 1" ;; 20 | 7) bits="0 0 0 0 1 1 1" ;; 21 | 8) bits="1 1 1 1 1 1 1" ;; 22 | 9) bits="1 1 0 1 1 1 1" ;; 23 | a) bits="1 1 1 0 1 1 1" ;; 24 | b) bits="1 1 1 1 1 0 0" ;; 25 | c) bits="0 1 1 1 0 0 1" ;; 26 | d) bits="1 0 1 1 1 1 0" ;; 27 | e) bits="1 1 1 1 0 0 1" ;; 28 | f) bits="1 1 1 0 0 0 1" ;; 29 | g) bits="0 0 0 0 0 0 0" ;; 30 | h) bits="1 0 1 0 1 0 1" ;; 31 | i) bits="0 1 0 1 0 1 0" ;; 32 | esac 33 | 34 | echo "$bits" 35 | } 36 | bits=$(getbits "$2") 37 | i=510 38 | 39 | for j in $bits 40 | do 41 | if [[ $j == "1" ]] 42 | then 43 | echo out > /sys/class/gpio/gpio$i/direction 44 | else 45 | echo in > /sys/class/gpio/gpio$i/direction 46 | fi 47 | i=$((i-1)) 48 | done 49 | 50 | bits=$(getbits "$1") 51 | i=502 52 | 53 | for j in $bits 54 | do 55 | if [[ $j == "1" ]] 56 | then 57 | echo out > /sys/class/gpio/gpio$i/direction 58 | else 59 | echo in > /sys/class/gpio/gpio$i/direction 60 | fi 61 | i=$((i-1)) 62 | done 63 | -------------------------------------------------------------------------------- /RESOURCES/u-boot/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e-ale/Code/e2a201aa840b3da7e84a13661295db1965bc68e0/RESOURCES/u-boot/Makefile -------------------------------------------------------------------------------- /RESOURCES/usb-subsystem/lab_1/acm_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | 3 | modprobe libcomposite 4 | 5 | # Mount configfs locally 6 | mkdir -p config 7 | mount none config -t configfs 8 | 9 | # Create the USB gadget configuration 10 | mkdir -p config/usb_gadget/ 11 | cd config/usb_gadget/ 12 | 13 | # Remove the existing (distro-created) gadget from the hardware 14 | if [ -d g_multi ]; then 15 | echo "" >g_multi/UDC 16 | fi 17 | 18 | # Create a gadget called g1 19 | mkdir g1 20 | cd g1 21 | 22 | # Set the VID/PID/Strings 23 | echo 0x1a0a >idVendor 24 | echo 0xbadd >idProduct 25 | mkdir strings/0x409 26 | 27 | # Set the VID/PID/Strings (cont'd) 28 | echo 12345 >strings/0x409/serialnumber 29 | echo "Signal 11" >strings/0x409/manufacturer 30 | echo "Test" >strings/0x409/product 31 | 32 | # Create a configuration called c.1 33 | mkdir configs/c.1 34 | mkdir configs/c.1/strings/0x409 35 | echo "Config1" >configs/c.1/strings/0x409/configuration 36 | 37 | # Create a function (tty CDC/ACM) named usb0 38 | mkdir functions/acm.usb0 39 | 40 | # Link that function to configuration c.1 41 | ln -s functions/acm.usb0 configs/c.1 42 | 43 | # Enable the USB device. Find the device 44 | # name in /sys/class/udc/ . 45 | echo musb-hdrc.0 >UDC 46 | -------------------------------------------------------------------------------- /RESOURCES/usb-subsystem/lab_2/ffs-test/Makefile: -------------------------------------------------------------------------------- 1 | ffs-test: ffs-test.c 2 | cc -Wall -Wextra -g -o ffs-test ffs-test.c -lpthread 3 | 4 | clean: 5 | rm -f ffs-test 6 | 7 | .PHONY: clean 8 | -------------------------------------------------------------------------------- /RESOURCES/usb-subsystem/lab_2/ffs-test/ffs-test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ffs-test.c -- user mode filesystem api for usb composite function 3 | * 4 | * Copyright (C) 2010 Samsung Electronics 5 | * Author: Michal Nazarewicz 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | /* $(CROSS_COMPILE)cc -Wall -Wextra -g -o ffs-test ffs-test.c -lpthread */ 23 | 24 | 25 | #define _BSD_SOURCE /* for endian.h */ 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include "le_byteshift.h" 41 | 42 | //#include "../../include/uapi/linux/usb/functionfs.h" 43 | #include 44 | 45 | 46 | /******************** Little Endian Handling ********************************/ 47 | 48 | #define cpu_to_le16(x) htole16(x) 49 | #define cpu_to_le32(x) htole32(x) 50 | #define le32_to_cpu(x) le32toh(x) 51 | #define le16_to_cpu(x) le16toh(x) 52 | 53 | 54 | /******************** Messages and Errors ***********************************/ 55 | 56 | static const char argv0[] = "ffs-test"; 57 | 58 | static unsigned verbosity = 7; 59 | 60 | static void _msg(unsigned level, const char *fmt, ...) 61 | { 62 | if (level < 2) 63 | level = 2; 64 | else if (level > 7) 65 | level = 7; 66 | 67 | if (level <= verbosity) { 68 | static const char levels[8][6] = { 69 | [2] = "crit:", 70 | [3] = "err: ", 71 | [4] = "warn:", 72 | [5] = "note:", 73 | [6] = "info:", 74 | [7] = "dbg: " 75 | }; 76 | 77 | int _errno = errno; 78 | va_list ap; 79 | 80 | fprintf(stderr, "%s: %s ", argv0, levels[level]); 81 | va_start(ap, fmt); 82 | vfprintf(stderr, fmt, ap); 83 | va_end(ap); 84 | 85 | if (fmt[strlen(fmt) - 1] != '\n') { 86 | char buffer[128]; 87 | strerror_r(_errno, buffer, sizeof buffer); 88 | fprintf(stderr, ": (-%d) %s\n", _errno, buffer); 89 | } 90 | 91 | fflush(stderr); 92 | } 93 | } 94 | 95 | #define die(...) (_msg(2, __VA_ARGS__), exit(1)) 96 | #define err(...) _msg(3, __VA_ARGS__) 97 | #define warn(...) _msg(4, __VA_ARGS__) 98 | #define note(...) _msg(5, __VA_ARGS__) 99 | #define info(...) _msg(6, __VA_ARGS__) 100 | #define debug(...) _msg(7, __VA_ARGS__) 101 | 102 | #define die_on(cond, ...) do { \ 103 | if (cond) \ 104 | die(__VA_ARGS__); \ 105 | } while (0) 106 | 107 | 108 | /******************** Descriptors and Strings *******************************/ 109 | 110 | static const struct { 111 | struct usb_functionfs_descs_head_v2 header; 112 | __le32 fs_count; 113 | __le32 hs_count; 114 | struct { 115 | struct usb_interface_descriptor intf; 116 | struct usb_endpoint_descriptor_no_audio sink; 117 | struct usb_endpoint_descriptor_no_audio source; 118 | } __attribute__((packed)) fs_descs, hs_descs; 119 | } __attribute__((packed)) descriptors = { 120 | .header = { 121 | .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2), 122 | .flags = cpu_to_le32(FUNCTIONFS_HAS_FS_DESC | 123 | FUNCTIONFS_HAS_HS_DESC), 124 | .length = cpu_to_le32(sizeof descriptors), 125 | }, 126 | .fs_count = cpu_to_le32(3), 127 | .fs_descs = { 128 | .intf = { 129 | .bLength = sizeof descriptors.fs_descs.intf, 130 | .bDescriptorType = USB_DT_INTERFACE, 131 | .bNumEndpoints = 2, 132 | .bInterfaceClass = USB_CLASS_VENDOR_SPEC, 133 | .iInterface = 1, 134 | }, 135 | .sink = { 136 | .bLength = sizeof descriptors.fs_descs.sink, 137 | .bDescriptorType = USB_DT_ENDPOINT, 138 | .bEndpointAddress = 1 | USB_DIR_IN, 139 | .bmAttributes = USB_ENDPOINT_XFER_BULK, 140 | /* .wMaxPacketSize = autoconfiguration (kernel) */ 141 | }, 142 | .source = { 143 | .bLength = sizeof descriptors.fs_descs.source, 144 | .bDescriptorType = USB_DT_ENDPOINT, 145 | .bEndpointAddress = 2 | USB_DIR_OUT, 146 | .bmAttributes = USB_ENDPOINT_XFER_BULK, 147 | /* .wMaxPacketSize = autoconfiguration (kernel) */ 148 | }, 149 | }, 150 | .hs_count = cpu_to_le32(3), 151 | .hs_descs = { 152 | .intf = { 153 | .bLength = sizeof descriptors.fs_descs.intf, 154 | .bDescriptorType = USB_DT_INTERFACE, 155 | .bNumEndpoints = 2, 156 | .bInterfaceClass = USB_CLASS_VENDOR_SPEC, 157 | .iInterface = 1, 158 | }, 159 | .sink = { 160 | .bLength = sizeof descriptors.hs_descs.sink, 161 | .bDescriptorType = USB_DT_ENDPOINT, 162 | .bEndpointAddress = 1 | USB_DIR_IN, 163 | .bmAttributes = USB_ENDPOINT_XFER_BULK, 164 | .wMaxPacketSize = cpu_to_le16(512), 165 | }, 166 | .source = { 167 | .bLength = sizeof descriptors.hs_descs.source, 168 | .bDescriptorType = USB_DT_ENDPOINT, 169 | .bEndpointAddress = 2 | USB_DIR_OUT, 170 | .bmAttributes = USB_ENDPOINT_XFER_BULK, 171 | .wMaxPacketSize = cpu_to_le16(512), 172 | .bInterval = 1, /* NAK every 1 uframe */ 173 | }, 174 | }, 175 | }; 176 | 177 | static size_t descs_to_legacy(void **legacy, const void *descriptors_v2) 178 | { 179 | const unsigned char *descs_end, *descs_start; 180 | __u32 length, fs_count = 0, hs_count = 0, count; 181 | 182 | /* Read v2 header */ 183 | { 184 | const struct { 185 | const struct usb_functionfs_descs_head_v2 header; 186 | const __le32 counts[]; 187 | } __attribute__((packed)) *const in = descriptors_v2; 188 | const __le32 *counts = in->counts; 189 | __u32 flags; 190 | 191 | if (le32_to_cpu(in->header.magic) != 192 | FUNCTIONFS_DESCRIPTORS_MAGIC_V2) 193 | return 0; 194 | length = le32_to_cpu(in->header.length); 195 | if (length <= sizeof in->header) 196 | return 0; 197 | length -= sizeof in->header; 198 | flags = le32_to_cpu(in->header.flags); 199 | if (flags & ~(FUNCTIONFS_HAS_FS_DESC | FUNCTIONFS_HAS_HS_DESC | 200 | FUNCTIONFS_HAS_SS_DESC)) 201 | return 0; 202 | 203 | #define GET_NEXT_COUNT_IF_FLAG(ret, flg) do { \ 204 | if (!(flags & (flg))) \ 205 | break; \ 206 | if (length < 4) \ 207 | return 0; \ 208 | ret = le32_to_cpu(*counts); \ 209 | length -= 4; \ 210 | ++counts; \ 211 | } while (0) 212 | 213 | GET_NEXT_COUNT_IF_FLAG(fs_count, FUNCTIONFS_HAS_FS_DESC); 214 | GET_NEXT_COUNT_IF_FLAG(hs_count, FUNCTIONFS_HAS_HS_DESC); 215 | GET_NEXT_COUNT_IF_FLAG(count, FUNCTIONFS_HAS_SS_DESC); 216 | 217 | count = fs_count + hs_count; 218 | if (!count) 219 | return 0; 220 | descs_start = (const void *)counts; 221 | 222 | #undef GET_NEXT_COUNT_IF_FLAG 223 | } 224 | 225 | /* 226 | * Find the end of FS and HS USB descriptors. SS descriptors 227 | * are ignored since legacy format does not support them. 228 | */ 229 | descs_end = descs_start; 230 | do { 231 | if (length < *descs_end) 232 | return 0; 233 | length -= *descs_end; 234 | descs_end += *descs_end; 235 | } while (--count); 236 | 237 | /* Allocate legacy descriptors and copy the data. */ 238 | { 239 | #pragma GCC diagnostic push 240 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 241 | struct { 242 | struct usb_functionfs_descs_head header; 243 | __u8 descriptors[]; 244 | } __attribute__((packed)) *out; 245 | #pragma GCC diagnostic pop 246 | 247 | length = sizeof out->header + (descs_end - descs_start); 248 | out = malloc(length); 249 | out->header.magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC); 250 | out->header.length = cpu_to_le32(length); 251 | out->header.fs_count = cpu_to_le32(fs_count); 252 | out->header.hs_count = cpu_to_le32(hs_count); 253 | memcpy(out->descriptors, descs_start, descs_end - descs_start); 254 | *legacy = out; 255 | } 256 | 257 | return length; 258 | } 259 | 260 | 261 | #define STR_INTERFACE_ "Source/Sink" 262 | 263 | static const struct { 264 | struct usb_functionfs_strings_head header; 265 | struct { 266 | __le16 code; 267 | const char str1[sizeof STR_INTERFACE_]; 268 | } __attribute__((packed)) lang0; 269 | } __attribute__((packed)) strings = { 270 | .header = { 271 | .magic = cpu_to_le32(FUNCTIONFS_STRINGS_MAGIC), 272 | .length = cpu_to_le32(sizeof strings), 273 | .str_count = cpu_to_le32(1), 274 | .lang_count = cpu_to_le32(1), 275 | }, 276 | .lang0 = { 277 | cpu_to_le16(0x0409), /* en-us */ 278 | STR_INTERFACE_, 279 | }, 280 | }; 281 | 282 | #define STR_INTERFACE strings.lang0.str1 283 | 284 | 285 | /******************** Files and Threads Handling ****************************/ 286 | 287 | struct thread; 288 | 289 | static ssize_t read_wrap(struct thread *t, void *buf, size_t nbytes); 290 | static ssize_t write_wrap(struct thread *t, const void *buf, size_t nbytes); 291 | static ssize_t ep0_consume(struct thread *t, const void *buf, size_t nbytes); 292 | static ssize_t fill_in_buf(struct thread *t, void *buf, size_t nbytes); 293 | static ssize_t empty_out_buf(struct thread *t, const void *buf, size_t nbytes); 294 | 295 | 296 | static struct thread { 297 | const char *const filename; 298 | size_t buf_size; 299 | 300 | ssize_t (*in)(struct thread *, void *, size_t); 301 | const char *const in_name; 302 | 303 | ssize_t (*out)(struct thread *, const void *, size_t); 304 | const char *const out_name; 305 | 306 | int fd; 307 | pthread_t id; 308 | void *buf; 309 | ssize_t status; 310 | } threads[] = { 311 | { 312 | "ep0", 4 * sizeof(struct usb_functionfs_event), 313 | read_wrap, NULL, 314 | ep0_consume, "", 315 | 0, 0, NULL, 0 316 | }, 317 | { 318 | "ep1", 512, 319 | fill_in_buf, "", 320 | write_wrap, NULL, 321 | 0, 0, NULL, 0 322 | }, 323 | { 324 | "ep2", 512, 325 | read_wrap, NULL, 326 | empty_out_buf, "", 327 | 0, 0, NULL, 0 328 | }, 329 | }; 330 | 331 | 332 | static void init_thread(struct thread *t) 333 | { 334 | t->buf = malloc(t->buf_size); 335 | die_on(!t->buf, "malloc"); 336 | 337 | t->fd = open(t->filename, O_RDWR); 338 | die_on(t->fd < 0, "%s", t->filename); 339 | } 340 | 341 | static void cleanup_thread(void *arg) 342 | { 343 | struct thread *t = arg; 344 | int ret, fd; 345 | 346 | fd = t->fd; 347 | if (t->fd < 0) 348 | return; 349 | t->fd = -1; 350 | 351 | /* test the FIFO ioctls (non-ep0 code paths) */ 352 | if (t != threads) { 353 | ret = ioctl(fd, FUNCTIONFS_FIFO_STATUS); 354 | if (ret < 0) { 355 | /* ENODEV reported after disconnect */ 356 | if (errno != ENODEV) 357 | err("%s: get fifo status", t->filename); 358 | } else if (ret) { 359 | warn("%s: unclaimed = %d\n", t->filename, ret); 360 | if (ioctl(fd, FUNCTIONFS_FIFO_FLUSH) < 0) 361 | err("%s: fifo flush", t->filename); 362 | } 363 | } 364 | 365 | if (close(fd) < 0) 366 | err("%s: close", t->filename); 367 | 368 | free(t->buf); 369 | t->buf = NULL; 370 | } 371 | 372 | static void *start_thread_helper(void *arg) 373 | { 374 | const char *name, *op, *in_name, *out_name; 375 | struct thread *t = arg; 376 | ssize_t ret; 377 | 378 | info("%s: starts\n", t->filename); 379 | in_name = t->in_name ? t->in_name : t->filename; 380 | out_name = t->out_name ? t->out_name : t->filename; 381 | 382 | pthread_cleanup_push(cleanup_thread, arg); 383 | 384 | for (;;) { 385 | pthread_testcancel(); 386 | 387 | ret = t->in(t, t->buf, t->buf_size); 388 | if (ret > 0) { 389 | ret = t->out(t, t->buf, ret); 390 | name = out_name; 391 | op = "write"; 392 | } else { 393 | name = in_name; 394 | op = "read"; 395 | } 396 | 397 | if (ret > 0) { 398 | /* nop */ 399 | } else if (!ret) { 400 | debug("%s: %s: EOF", name, op); 401 | break; 402 | } else if (errno == EINTR || errno == EAGAIN) { 403 | debug("%s: %s", name, op); 404 | } else { 405 | warn("%s: %s", name, op); 406 | break; 407 | } 408 | } 409 | 410 | pthread_cleanup_pop(1); 411 | 412 | t->status = ret; 413 | info("%s: ends\n", t->filename); 414 | return NULL; 415 | } 416 | 417 | static void start_thread(struct thread *t) 418 | { 419 | debug("%s: starting\n", t->filename); 420 | 421 | die_on(pthread_create(&t->id, NULL, start_thread_helper, t) < 0, 422 | "pthread_create(%s)", t->filename); 423 | } 424 | 425 | static void join_thread(struct thread *t) 426 | { 427 | int ret = pthread_join(t->id, NULL); 428 | 429 | if (ret < 0) 430 | err("%s: joining thread", t->filename); 431 | else 432 | debug("%s: joined\n", t->filename); 433 | } 434 | 435 | 436 | static ssize_t read_wrap(struct thread *t, void *buf, size_t nbytes) 437 | { 438 | return read(t->fd, buf, nbytes); 439 | } 440 | 441 | static ssize_t write_wrap(struct thread *t, const void *buf, size_t nbytes) 442 | { 443 | return write(t->fd, buf, nbytes); 444 | } 445 | 446 | 447 | /******************** Empty/Fill buffer routines ****************************/ 448 | 449 | /* 0 -- stream of zeros, 1 -- i % 63, 2 -- pipe */ 450 | enum pattern { PAT_ZERO, PAT_SEQ, PAT_PIPE }; 451 | static enum pattern pattern = PAT_SEQ; 452 | 453 | static ssize_t 454 | fill_in_buf(struct thread *ignore, void *buf, size_t nbytes) 455 | { 456 | size_t i; 457 | __u8 *p; 458 | 459 | (void)ignore; 460 | 461 | switch (pattern) { 462 | case PAT_ZERO: 463 | memset(buf, 0, nbytes); 464 | break; 465 | 466 | case PAT_SEQ: 467 | for (p = buf, i = 0; i < nbytes; ++i, ++p) 468 | *p = i % 63; 469 | break; 470 | 471 | case PAT_PIPE: 472 | return fread(buf, 1, nbytes, stdin); 473 | } 474 | 475 | return nbytes; 476 | } 477 | 478 | static ssize_t 479 | empty_out_buf(struct thread *ignore, const void *buf, size_t nbytes) 480 | { 481 | size_t len = nbytes; 482 | 483 | (void)ignore; 484 | 485 | printf("Received transfer...\n"); 486 | size_t i; 487 | for (i = 0; i < nbytes; i++) { 488 | printf("%02hhx ", ((__u8*)buf)[i]); 489 | if ((i+1) % 8 == 0) 490 | printf(" "); 491 | if ((i+1) % 16 == 0) 492 | printf("\n"); 493 | } 494 | printf("\n\n"); 495 | fflush(stdout); 496 | 497 | #if 0 //////////////// 498 | const __u8 *p; 499 | __u8 expected; 500 | ssize_t ret; 501 | size_t len; 502 | 503 | switch (pattern) { 504 | case PAT_ZERO: 505 | expected = 0; 506 | for (p = buf, len = 0; len < nbytes; ++p, ++len) 507 | if (*p) 508 | goto invalid; 509 | break; 510 | 511 | case PAT_SEQ: 512 | for (p = buf, len = 0; len < nbytes; ++p, ++len) 513 | if (*p != len % 63) { 514 | expected = len % 63; 515 | goto invalid; 516 | } 517 | break; 518 | 519 | case PAT_PIPE: 520 | ret = fwrite(buf, nbytes, 1, stdout); 521 | if (ret > 0) 522 | fflush(stdout); 523 | break; 524 | 525 | invalid: 526 | err("bad OUT byte %zd, expected %02x got %02x\n", 527 | len, expected, *p); 528 | for (p = buf, len = 0; len < nbytes; ++p, ++len) { 529 | if (0 == (len % 32)) 530 | fprintf(stderr, "%4zd:", len); 531 | fprintf(stderr, " %02x", *p); 532 | if (31 == (len % 32)) 533 | fprintf(stderr, "\n"); 534 | } 535 | fflush(stderr); 536 | errno = EILSEQ; 537 | return -1; 538 | } 539 | #endif ////////////////// 540 | return len; 541 | } 542 | 543 | 544 | /******************** Endpoints routines ************************************/ 545 | 546 | static void handle_setup(const struct usb_ctrlrequest *setup) 547 | { 548 | printf("bRequestType = %d\n", setup->bRequestType); 549 | printf("bRequest = %d\n", setup->bRequest); 550 | printf("wValue = %d\n", le16_to_cpu(setup->wValue)); 551 | printf("wIndex = %d\n", le16_to_cpu(setup->wIndex)); 552 | printf("wLength = %d\n", le16_to_cpu(setup->wLength)); 553 | } 554 | 555 | static ssize_t 556 | ep0_consume(struct thread *ignore, const void *buf, size_t nbytes) 557 | { 558 | static const char *const names[] = { 559 | [FUNCTIONFS_BIND] = "BIND", 560 | [FUNCTIONFS_UNBIND] = "UNBIND", 561 | [FUNCTIONFS_ENABLE] = "ENABLE", 562 | [FUNCTIONFS_DISABLE] = "DISABLE", 563 | [FUNCTIONFS_SETUP] = "SETUP", 564 | [FUNCTIONFS_SUSPEND] = "SUSPEND", 565 | [FUNCTIONFS_RESUME] = "RESUME", 566 | }; 567 | 568 | const struct usb_functionfs_event *event = buf; 569 | size_t n; 570 | 571 | (void)ignore; 572 | 573 | for (n = nbytes / sizeof *event; n; --n, ++event) 574 | switch (event->type) { 575 | case FUNCTIONFS_BIND: 576 | case FUNCTIONFS_UNBIND: 577 | case FUNCTIONFS_ENABLE: 578 | case FUNCTIONFS_DISABLE: 579 | case FUNCTIONFS_SETUP: 580 | case FUNCTIONFS_SUSPEND: 581 | case FUNCTIONFS_RESUME: 582 | printf("Event %s\n", names[event->type]); 583 | if (event->type == FUNCTIONFS_SETUP) 584 | handle_setup(&event->u.setup); 585 | break; 586 | 587 | default: 588 | printf("Event %03u (unknown)\n", event->type); 589 | } 590 | 591 | return nbytes; 592 | } 593 | 594 | static void ep0_init(struct thread *t, bool legacy_descriptors) 595 | { 596 | void *legacy; 597 | ssize_t ret; 598 | size_t len; 599 | 600 | if (legacy_descriptors) { 601 | info("%s: writing descriptors\n", t->filename); 602 | goto legacy; 603 | } 604 | 605 | info("%s: writing descriptors (in v2 format)\n", t->filename); 606 | ret = write(t->fd, &descriptors, sizeof descriptors); 607 | 608 | if (ret < 0 && errno == EINVAL) { 609 | warn("%s: new format rejected, trying legacy\n", t->filename); 610 | legacy: 611 | len = descs_to_legacy(&legacy, &descriptors); 612 | if (len) { 613 | ret = write(t->fd, legacy, len); 614 | free(legacy); 615 | } 616 | } 617 | die_on(ret < 0, "%s: write: descriptors", t->filename); 618 | 619 | info("%s: writing strings\n", t->filename); 620 | ret = write(t->fd, &strings, sizeof strings); 621 | die_on(ret < 0, "%s: write: strings", t->filename); 622 | } 623 | 624 | 625 | /******************** Main **************************************************/ 626 | 627 | int main(int argc, char **argv) 628 | { 629 | bool legacy_descriptors; 630 | unsigned i; 631 | 632 | legacy_descriptors = argc > 2 && !strcmp(argv[1], "-l"); 633 | 634 | init_thread(threads); 635 | ep0_init(threads, legacy_descriptors); 636 | 637 | for (i = 1; i < sizeof threads / sizeof *threads; ++i) 638 | init_thread(threads + i); 639 | 640 | for (i = 1; i < sizeof threads / sizeof *threads; ++i) 641 | start_thread(threads + i); 642 | 643 | start_thread_helper(threads); 644 | 645 | for (i = 1; i < sizeof threads / sizeof *threads; ++i) 646 | join_thread(threads + i); 647 | 648 | return 0; 649 | } 650 | -------------------------------------------------------------------------------- /RESOURCES/usb-subsystem/lab_2/ffs-test/le_byteshift.h: -------------------------------------------------------------------------------- 1 | #ifndef _TOOLS_LE_BYTESHIFT_H 2 | #define _TOOLS_LE_BYTESHIFT_H 3 | 4 | #include 5 | 6 | static inline uint16_t __get_unaligned_le16(const uint8_t *p) 7 | { 8 | return p[0] | p[1] << 8; 9 | } 10 | 11 | static inline uint32_t __get_unaligned_le32(const uint8_t *p) 12 | { 13 | return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24; 14 | } 15 | 16 | static inline uint64_t __get_unaligned_le64(const uint8_t *p) 17 | { 18 | return (uint64_t)__get_unaligned_le32(p + 4) << 32 | 19 | __get_unaligned_le32(p); 20 | } 21 | 22 | static inline void __put_unaligned_le16(uint16_t val, uint8_t *p) 23 | { 24 | *p++ = val; 25 | *p++ = val >> 8; 26 | } 27 | 28 | static inline void __put_unaligned_le32(uint32_t val, uint8_t *p) 29 | { 30 | __put_unaligned_le16(val >> 16, p + 2); 31 | __put_unaligned_le16(val, p); 32 | } 33 | 34 | static inline void __put_unaligned_le64(uint64_t val, uint8_t *p) 35 | { 36 | __put_unaligned_le32(val >> 32, p + 4); 37 | __put_unaligned_le32(val, p); 38 | } 39 | 40 | static inline uint16_t get_unaligned_le16(const void *p) 41 | { 42 | return __get_unaligned_le16((const uint8_t *)p); 43 | } 44 | 45 | static inline uint32_t get_unaligned_le32(const void *p) 46 | { 47 | return __get_unaligned_le32((const uint8_t *)p); 48 | } 49 | 50 | static inline uint64_t get_unaligned_le64(const void *p) 51 | { 52 | return __get_unaligned_le64((const uint8_t *)p); 53 | } 54 | 55 | static inline void put_unaligned_le16(uint16_t val, void *p) 56 | { 57 | __put_unaligned_le16(val, p); 58 | } 59 | 60 | static inline void put_unaligned_le32(uint32_t val, void *p) 61 | { 62 | __put_unaligned_le32(val, p); 63 | } 64 | 65 | static inline void put_unaligned_le64(uint64_t val, void *p) 66 | { 67 | __put_unaligned_le64(val, p); 68 | } 69 | 70 | #endif /* _TOOLS_LE_BYTESHIFT_H */ 71 | -------------------------------------------------------------------------------- /RESOURCES/usb-subsystem/lab_2/ffs_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | 3 | modprobe libcomposite 4 | 5 | # Mount configfs locally 6 | mkdir -p config 7 | mount none config -t configfs 8 | 9 | # Create the USB gadget configuration 10 | mkdir -p config/usb_gadget/ 11 | cd config/usb_gadget/ 12 | 13 | # Remove the existing (distro-created) gadget from the hardware 14 | if [ -d g_multi ]; then 15 | echo "" >g_multi/UDC 16 | fi 17 | 18 | # Create a gadget called g1 19 | mkdir g1 20 | cd g1 21 | 22 | # Set the VID/PID/Strings 23 | echo 0x1a0a >idVendor 24 | echo 0xbadd >idProduct 25 | mkdir strings/0x409 26 | 27 | # Set the VID/PID/Strings (cont'd) 28 | echo 12345 >strings/0x409/serialnumber 29 | echo "Signal 11" >strings/0x409/manufacturer 30 | echo "Test" >strings/0x409/product 31 | 32 | # Create a configuration called c.1 33 | mkdir configs/c.1 34 | mkdir configs/c.1/strings/0x409 35 | echo "Config1" >configs/c.1/strings/0x409/configuration 36 | 37 | # Setup the function, FunctionFS (named usb0) 38 | mkdir functions/ffs.usb0 39 | ln -s functions/ffs.usb0 configs/c.1 40 | 41 | # Mount the function filesystem for usb0 42 | cd ../../../ 43 | mkdir -p ffs 44 | mount usb0 ffs -t functionfs 45 | 46 | # From inside the mounted ffs directory, run your 47 | # user space program and wait until it's started. 48 | cd ffs 49 | ../ffs-test/ffs-test & # from the Linux kernel 50 | sleep 3 51 | cd .. 52 | 53 | # Enable the USB device 54 | echo musb-hdrc.0 >config/usb_gadget/g1/UDC 55 | -------------------------------------------------------------------------------- /RESOURCES/usb-subsystem/lab_3/libusb_test/Makefile: -------------------------------------------------------------------------------- 1 | # M-Stack Host Test Software Makefile 2 | # 3 | # This file may be used by anyone for any purpose and may be used as a 4 | # starting point making your own application using M-Stack. 5 | # 6 | # It is worth noting that M-Stack itself is not under the same license as 7 | # this file. See the top-level README.txt for more information. 8 | # 9 | # Alan Ott 10 | # Signal 11 Software 11 | 12 | all: test 13 | 14 | test: test.c 15 | gcc -Wall -g -o test test.c `pkg-config libusb-1.0 --cflags --libs` 16 | 17 | clean: 18 | rm test 19 | -------------------------------------------------------------------------------- /RESOURCES/usb-subsystem/lab_3/libusb_test/test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Libusb Bulk Endpoint Test for M-Stack 3 | * 4 | * This file may be used by anyone for any purpose and may be used as a 5 | * starting point making your own application using M-Stack. 6 | * 7 | * It is worth noting that M-Stack itself is not under the same license as 8 | * this file. See the top-level README.txt for more information. 9 | * 10 | * M-Stack is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. For details, see sections 7, 8, and 9 13 | * of the Apache License, version 2.0 which apply to this file. If you have 14 | * purchased a commercial license for this software from Signal 11 Software, 15 | * your commerical license superceeds the information in this header. 16 | * 17 | * Alan Ott 18 | * Signal 11 Software 19 | * 2013-04-09 20 | 21 | */ 22 | 23 | /* C */ 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | /* Unix */ 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | /* GNU / LibUSB */ 43 | #include "libusb.h" 44 | 45 | #include 46 | #include 47 | 48 | int buflen = 512; 49 | 50 | static libusb_context *usb_context = NULL; 51 | 52 | int main(int argc, char **argv) 53 | { 54 | libusb_device_handle *handle; 55 | int i; 56 | int res = 0; 57 | 58 | /* Init Libusb */ 59 | if (libusb_init(&usb_context)) 60 | return -1; 61 | 62 | handle = libusb_open_device_with_vid_pid(NULL, 0x1a0a, 0xbadd); 63 | if (!handle) { 64 | fprintf(stderr, "libusb_open failed\n"); 65 | return 1; 66 | } 67 | 68 | printf("Device Opened\n"); 69 | 70 | #if 0 71 | libusb_set_configuration(handle, 1); 72 | if (res < 0) { 73 | fprintf(stderr, "set_configuration(): %s\n", libusb_error_name(res)); 74 | return 1; 75 | } 76 | #endif 77 | 78 | res = libusb_claim_interface(handle, 0); 79 | if (res < 0) { 80 | perror("claim interface"); 81 | return 1; 82 | } 83 | 84 | printf("Interface Claimed\n"); 85 | 86 | /* Synchronous */ 87 | unsigned char *buf = calloc(1, buflen); 88 | int actual_length; 89 | 90 | memset(buf, 0xa0, buflen); 91 | 92 | printf("Sending one transfer\n"); 93 | 94 | /* Send one transfer to the device */ 95 | res = libusb_bulk_transfer(handle, 0x01, 96 | buf, buflen, &actual_length, 1000); 97 | if (res < 0) { 98 | fprintf(stderr, "bulk transfer (out): %s\n", libusb_error_name(res)); 99 | return 1; 100 | } 101 | 102 | printf("Receiving one transfer\n"); 103 | 104 | /* Receive one transfer from the device */ 105 | res = libusb_bulk_transfer(handle, 0x81, 106 | buf, buflen, &actual_length, 1000); 107 | if (res < 0) { 108 | fprintf(stderr, "bulk transfer (in): %s\n", libusb_error_name(res)); 109 | return 1; 110 | } 111 | 112 | printf("Received data:\n"); 113 | for (i = 0; i < actual_length; i++) { 114 | printf("%02hhx ", buf[i]); 115 | if ((i+1) % 8 == 0) 116 | printf(" "); 117 | if ((i+1) % 16 == 0) 118 | printf("\n"); 119 | } 120 | printf("\n\n"); 121 | 122 | return 0; 123 | } 124 | -------------------------------------------------------------------------------- /RESOURCES/yocto-images/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e-ale/Code/e2a201aa840b3da7e84a13661295db1965bc68e0/RESOURCES/yocto-images/Makefile -------------------------------------------------------------------------------- /RESOURCES/yocto-intro/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e-ale/Code/e2a201aa840b3da7e84a13661295db1965bc68e0/RESOURCES/yocto-intro/Makefile --------------------------------------------------------------------------------