tegra: add support for CompuLab TrimSlice
authorTomasz Maciej Nowak <tomek_n@o2.pl>
Mon, 1 Apr 2019 17:25:43 +0000 (19:25 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 6 Apr 2019 12:48:46 +0000 (14:48 +0200)
It is a small form factor computer with rich amount of expansion ports.
Some hardware specs and supported features in this commit:

CPU: NVIDIA Tegra 2 @ 1GHz
RAM: 1GB DDR2-667
Storage: SDHC card slot
         µSDHC card slot
         USB to SATA bridge (depends on model)
         1MB SPI NOR flash for bootloader (single partition)
LAN: RTL8111DL GbE
WIFI: RT3070 b/g/n with external antenna (depends on model)
RTC: EM3027 (mapped as rtc0; with battery backup)
     Tegra 2 built-in (mapped as rtc1)
Sound: Analog/Digital (TLV320AIC23b; S/PDIF not tested)
Connectors: 4x USB 2.0
            RS232 (mini serial)
            HDMI
            DVI-D (depends on model, not supported atm)
            Extension connector (24 pin ZIF, 0.5mm pitch):
            2X UART
            SPI
            JTAG (1.8V)
Other: power button with green led (not functional for early revisions
       without programmed PMIC)
       2x GPIO configurable green led

TrimSlice uses U-Boot placed in NOR flash. Boots Linux from any media
connected to USB, SATA or SD card inserted in slot. Can also boot from
TFTP. To run OpenWrt one needs to update U-Boot to fairly recent version
(the versions, pre-dts/dts provided by CompuLab won't suffice):

 1. Boot TrimSlice into Your current linux distro,
 2. Download trimslice-spi.img from u-boot-trimslice subdir,
 3. Install mtd-utils,
 4. Run following commands:
     flash_erase /dev/mtd0 0 256
     nandwrite /dev/mtd0 trimslice-spi.img
 5. Poweroff, insert SD card with OpenWrt, boot and enjoy.

If by some obstacle You can't follow those instructions, it is possible
to flash U-Boot using serial console.

 1. Insert FAT or EXT2/EXT3 formatted SD card with trimslice-spi.img,
 2. Interrupt boot process to enter U-Boot command line,
 3. Run following commands:
     ${fs}load mmc 0 0x04080000 trimslice-spi.img
     sf probe 0
     sf erase 0 0x100000
     sf write 0x04080000 0x0 ${filesize}
     reset
 4. Poweroff, insert SD card with OpenWrt, boot and enjoy.

If something went wrong with one of above steps, there is simple
recovery option:

 1. Open the µSD slot security door to access the recovery-boot button,
 2. Insert SD card with OpenWrt to the front slot while unpowered,
 3. Power on the TrimSlice while pressing the recovery-boot button,
 4. With this it should boot straigth to OpenWrt, from there download
    trimslice-spi.img and execute following commands:
     mtd erase /dev/mtd0
     mtd write trimslice-spi.img /dev/mtd0
 5. Reboot, now it should boot straigth to OpenWrt, without pressing the
    recovery-boot button, with proper U-Boot flashed.

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
target/linux/tegra/config-4.14
target/linux/tegra/image/Makefile
target/linux/tegra/patches-4.14/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch [new file with mode: 0644]

index 3df360d1fc873ab98fc7f4cf91627d72cbb6ba38..42547da301ea89cdc0ca9eea0ca6391ebf821ef7 100644 (file)
@@ -482,10 +482,12 @@ CONFIG_SND_SOC_TEGRA20_SPDIF=y
 # CONFIG_SND_SOC_TEGRA_RT5640 is not set
 # CONFIG_SND_SOC_TEGRA_RT5677 is not set
 # CONFIG_SND_SOC_TEGRA_SGTL5000 is not set
-# CONFIG_SND_SOC_TEGRA_TRIMSLICE is not set
+CONFIG_SND_SOC_TEGRA_TRIMSLICE=y
 # CONFIG_SND_SOC_TEGRA_WM8753 is not set
 # CONFIG_SND_SOC_TEGRA_WM8903 is not set
 # CONFIG_SND_SOC_TEGRA_WM9712 is not set
+CONFIG_SND_SOC_TLV320AIC23=y
+CONFIG_SND_SOC_TLV320AIC23_I2C=y
 # CONFIG_SND_USB is not set
 CONFIG_SOC_BUS=y
 CONFIG_SOC_TEGRA_FLOWCTRL=y
index 5e3427ad2772b9e574a221486a3f9a5e587889de..706cc65d92e86a91212c3c71b7c9f2e80bf47078 100644 (file)
@@ -46,4 +46,14 @@ define Device/Default
   PROFILES := Default
 endef
 
+define Device/trimslice
+  DEVICE_TITLE := CompuLab TrimSlice
+  DEVICE_DTS := tegra20-trimslice
+  DEVICE_PACKAGES := kmod-r8169 kmod-rt2800-usb kmod-rtc-em3027 \
+       kmod-usb-storage wpad-mini
+  SUPPORTED_DEVICES := compulab,trimslice
+  UBOOT := trimslice-mmc
+endef
+TARGET_DEVICES += trimslice
+
 $(eval $(call BuildImage))
diff --git a/target/linux/tegra/patches-4.14/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch b/target/linux/tegra/patches-4.14/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch
new file mode 100644 (file)
index 0000000..ae48e8d
--- /dev/null
@@ -0,0 +1,46 @@
+--- a/arch/arm/boot/dts/tegra20-trimslice.dts
++++ b/arch/arm/boot/dts/tegra20-trimslice.dts
+@@ -200,16 +200,17 @@
+                       conf_ata {
+                               nvidia,pins = "ata", "atc", "atd", "ate",
+                                       "crtp", "dap2", "dap3", "dap4", "dta",
+-                                      "dtb", "dtc", "dtd", "dte", "gmb",
+-                                      "gme", "i2cp", "pta", "slxc", "slxd",
+-                                      "spdi", "spdo", "uda";
++                                      "dtb", "dtc", "dtd", "gmb", "gme",
++                                      "i2cp", "pta", "slxc", "slxd", "spdi",
++                                      "spdo", "uda";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                       };
+                       conf_atb {
+                               nvidia,pins = "atb", "cdev1", "cdev2", "dap1",
+-                                      "gma", "gmc", "gmd", "gpu", "gpu7",
+-                                      "gpv", "sdio1", "slxa", "slxk", "uac";
++                                      "dte", "gma", "gmc", "gmd", "gpu",
++                                      "gpu7", "gpv", "sdio1", "slxa", "slxk",
++                                      "uac";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+@@ -402,6 +403,20 @@
+               };
+       };
++      gpio-leds {
++              compatible = "gpio-leds";
++
++              ds2 {
++                      label = "trimslice:green:right";
++                      gpios = <&gpio TEGRA_GPIO(D, 2) GPIO_ACTIVE_LOW>;
++              };
++
++              ds3 {
++                      label = "trimslice:green:left";
++                      gpios = <&gpio TEGRA_GPIO(BB, 5) GPIO_ACTIVE_LOW>;
++              };
++      };
++
+       poweroff {
+               compatible = "gpio-poweroff";
+               gpios = <&gpio TEGRA_GPIO(X, 7) GPIO_ACTIVE_LOW>;