diff options
author | John Klug <john.klug@multitech.com> | 2020-11-11 16:17:52 -0600 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2020-11-11 16:17:52 -0600 |
commit | 4bb6f26b05450777d14aa96e10783066c2503dc2 (patch) | |
tree | 3ed6c4bb86736d28926fd37a3c2b4eb81de44c82 /recipes-bsp | |
download | meta-multitech-atmel-9a18c55f1807e0f981d9b3a1ce0df954c0bb5fb9.tar.gz meta-multitech-atmel-9a18c55f1807e0f981d9b3a1ce0df954c0bb5fb9.tar.bz2 meta-multitech-atmel-9a18c55f1807e0f981d9b3a1ce0df954c0bb5fb9.zip |
Diffstat (limited to 'recipes-bsp')
65 files changed, 5380 insertions, 0 deletions
diff --git a/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/at91bootstrap-3.8-mtcdt.patch b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/at91bootstrap-3.8-mtcdt.patch new file mode 100644 index 0000000..8710ee5 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/at91bootstrap-3.8-mtcdt.patch @@ -0,0 +1,82 @@ +diff -aNru orig/board/at91sam9x5ek/at91sam9x5ek.c new/board/at91sam9x5ek/at91sam9x5ek.c +--- orig/board/at91sam9x5ek/at91sam9x5ek.c 2019-04-16 14:20:15.036823256 -0500 ++++ new/board/at91sam9x5ek/at91sam9x5ek.c 2019-04-16 14:26:10.648812728 -0500 +@@ -44,6 +44,37 @@ + #include "at91sam9x5ek.h" + #include "board_hw_info.h" + ++ ++static void initialize_mt_gpio(void) ++{ ++ /* Configure DBGU pins */ ++ const struct pio_desc mt_gpio_pins[] = { ++ /* Misc. pins -- Pins PD15-PD18 belong to PERIPH ++ * B A20-A25 until bootstrap shuts them down. ++ * This code prevents these pins from being used ++ * during boot, since we do not ++ * need these pins to boot the system and we ++ * do not want resets to toggle needlessly. ++ * GNSS-RESET is held low because the EXAR ++ * rarely will display the wrong VID/PID on the ++ * USB bus, which prevents the vizzini driver ++ * from loading. Once the VID/PID is bad, a ++ * reboot will preserve the bad VID/PID, so ++ * a power cycle is then required. ++ */ ++ {"GNSS-RESET",AT91C_PIN_PD(15), 0, PIO_PULLUP, PIO_OUTPUT}, ++ {"SECURE-RESET",AT91C_PIN_PD(16), 1, PIO_PULLUP, PIO_OUTPUT}, ++ {"MTQ-RESET",AT91C_PIN_PD(17), 1, PIO_PULLUP, PIO_OUTPUT}, ++ {"USBHUB-RESET",AT91C_PIN_PD(18), 1, PIO_PULLUP, PIO_OUTPUT}, ++ {"GNSS-INT",AT91C_PIN_PD(19), 1, PIO_PULLUP, PIO_OUTPUT}, ++ {"WIFI-BT-LPMODE",AT91C_PIN_PD(20), 0, PIO_PULLUP, PIO_INPUT}, ++ {(char *)0, 0, 0, PIO_DEFAULT, PIO_PERIPH_A}, ++ }; ++ ++ pio_configure(mt_gpio_pins); ++} ++ ++ + static void at91_dbgu_hw_init(void) + { + /* Configure DBGU pins */ +@@ -185,6 +210,9 @@ + /* Init timer */ + timer_init(); + ++ /* Initialize MT GPIO */ ++ initialize_mt_gpio(); ++ + /* Initialize dbgu */ + initialize_dbgu(); + +@@ -298,10 +326,14 @@ + + reg = readl(AT91C_BASE_CCFG + CCFG_EBICSA); + reg |= AT91C_EBI_CS3A_SM; ++#ifdef NOTMTCDT + if (get_cm_rev() == 'A') + reg &= ~AT91C_EBI_NFD0_ON_D16; + else + reg |= (AT91C_EBI_DDR_MP_EN | AT91C_EBI_NFD0_ON_D16); ++#endif /* NOTMTCDT */ ++ /* MTCDT */ ++ reg |= (AT91C_EBI_DDR_MP_EN | AT91C_EBI_NFD0_ON_D16); + + reg &= ~AT91C_EBI_DRV; + writel(reg, AT91C_BASE_CCFG + CCFG_EBICSA); +@@ -331,11 +363,15 @@ + AT91C_BASE_SMC + SMC_CTRL3); + + /* Configure the PIO controller */ ++#ifdef NOTMTCDT + if (get_cm_rev() == 'A') + pio_configure(nand_pins_lo); + else ++#endif /* NOTMTCDT */ ++ /* MTCDT */ + pio_configure(nand_pins_hi); + ++ + pmc_enable_periph_clock(AT91C_ID_PIOC_D); + } + #endif /* #ifdef CONFIG_NANDFLASH */ diff --git a/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/at91bootstrap-3.8-mtr.patch b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/at91bootstrap-3.8-mtr.patch new file mode 100644 index 0000000..2993323 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/at91bootstrap-3.8-mtr.patch @@ -0,0 +1,414 @@ +diff -aNru orig/board/at91sam9x5ek/at91sam9x5ek.c new/board/at91sam9x5ek/at91sam9x5ek.c +--- orig/board/at91sam9x5ek/at91sam9x5ek.c 2019-04-16 14:20:15.036823256 -0500 ++++ new/board/at91sam9x5ek/at91sam9x5ek.c 2019-04-16 14:42:16.920784122 -0500 +@@ -44,6 +44,31 @@ + #include "at91sam9x5ek.h" + #include "board_hw_info.h" + ++ ++static void initialize_mt_gpio(void) ++{ ++ /* Configure DBGU pins */ ++ const struct pio_desc mt_gpio_pins[] = { ++ /* Misc. pins -- Pins PD15-PD18 belong to PERIPH ++ * B A20-A25 until bootstrap shuts them down. ++ * This code prevents these pins from being used ++ * during boot, since we do not ++ * need these pins to boot the system and we ++ * do not want resets to toggle needlessly. ++ */ ++ {"PD15",AT91C_PIN_PD(15), 1, PIO_PULLUP, PIO_OUTPUT}, ++ {"PD16",AT91C_PIN_PD(16), 1, PIO_PULLUP, PIO_OUTPUT}, ++ {"PD17",AT91C_PIN_PD(17), 1, PIO_PULLUP, PIO_OUTPUT}, ++ {"PD18",AT91C_PIN_PD(18), 1, PIO_PULLUP, PIO_OUTPUT}, ++ {"PD19",AT91C_PIN_PD(19), 1, PIO_PULLUP, PIO_OUTPUT}, ++ {"PD20IN",AT91C_PIN_PD(20), 0, PIO_PULLUP, PIO_INPUT}, ++ {(char *)0, 0, 0, PIO_DEFAULT, PIO_PERIPH_A}, ++ }; ++ ++ pio_configure(mt_gpio_pins); ++} ++ ++ + static void at91_dbgu_hw_init(void) + { + /* Configure DBGU pins */ +@@ -185,6 +210,9 @@ + /* Init timer */ + timer_init(); + ++ /* Initialize MT GPIO */ ++ initialize_mt_gpio(); ++ + /* Initialize dbgu */ + initialize_dbgu(); + +@@ -298,10 +326,8 @@ + + reg = readl(AT91C_BASE_CCFG + CCFG_EBICSA); + reg |= AT91C_EBI_CS3A_SM; +- if (get_cm_rev() == 'A') +- reg &= ~AT91C_EBI_NFD0_ON_D16; +- else +- reg |= (AT91C_EBI_DDR_MP_EN | AT91C_EBI_NFD0_ON_D16); ++ /* MTR */ ++ reg |= (AT91C_EBI_DDR_MP_EN | AT91C_EBI_NFD0_ON_D16); + + reg &= ~AT91C_EBI_DRV; + writel(reg, AT91C_BASE_CCFG + CCFG_EBICSA); +@@ -331,9 +357,7 @@ + AT91C_BASE_SMC + SMC_CTRL3); + + /* Configure the PIO controller */ +- if (get_cm_rev() == 'A') +- pio_configure(nand_pins_lo); +- else ++ /* MTR2 */ + pio_configure(nand_pins_hi); + + pmc_enable_periph_clock(AT91C_ID_PIOC_D); +diff -aNru orig/board/at91sam9x5ek/at91sam9x5ek.c.orig new/board/at91sam9x5ek/at91sam9x5ek.c.orig +--- orig/board/at91sam9x5ek/at91sam9x5ek.c.orig 1969-12-31 18:00:00.000000000 -0600 ++++ new/board/at91sam9x5ek/at91sam9x5ek.c.orig 2019-04-16 14:20:15.036823256 -0500 +@@ -0,0 +1,341 @@ ++/* ---------------------------------------------------------------------------- ++ * ATMEL Microcontroller Software Support ++ * ---------------------------------------------------------------------------- ++ * Copyright (c) 2008, Atmel Corporation ++ * ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * ++ * - Redistributions of source code must retain the above copyright notice, ++ * this list of conditions and the disclaimer below. ++ * ++ * Atmel's name may not be used to endorse or promote products derived from ++ * this software without specific prior written permission. ++ * ++ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR ++ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE ++ * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, ++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, ++ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ++ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++#include "common.h" ++#include "hardware.h" ++#include "arch/at91_ccfg.h" ++#include "arch/at91_rstc.h" ++#include "arch/at91_pmc.h" ++#include "arch/at91_smc.h" ++#include "arch/at91_pio.h" ++#include "arch/at91_ddrsdrc.h" ++#include "gpio.h" ++#include "pmc.h" ++#include "usart.h" ++#include "debug.h" ++#include "ddramc.h" ++#include "timer.h" ++#include "watchdog.h" ++#include "string.h" ++#include "at91sam9x5ek.h" ++#include "board_hw_info.h" ++ ++static void at91_dbgu_hw_init(void) ++{ ++ /* Configure DBGU pins */ ++ const struct pio_desc dbgu_pins[] = { ++ {"RXD", AT91C_PIN_PA(9), 0, PIO_DEFAULT, PIO_PERIPH_A}, ++ {"TXD", AT91C_PIN_PA(10), 0, PIO_DEFAULT, PIO_PERIPH_A}, ++ {(char *)0, 0, 0, PIO_DEFAULT, PIO_PERIPH_A}, ++ }; ++ ++ pmc_enable_periph_clock(AT91C_ID_PIOA_B); ++ pio_configure(dbgu_pins); ++} ++ ++static void initialize_dbgu(void) ++{ ++ at91_dbgu_hw_init(); ++ usart_init(BAUDRATE(MASTER_CLOCK, BAUD_RATE)); ++} ++ ++#ifdef CONFIG_DDR2 ++/* Using the Micron MT47H64M16HR-3 */ ++static void ddramc_reg_config(struct ddramc_register *ddramc_config) ++{ ++ ddramc_config->mdr = (AT91C_DDRC2_DBW_16_BITS ++ | AT91C_DDRC2_MD_DDR2_SDRAM); ++ ++ ddramc_config->cr = (AT91C_DDRC2_NC_DDR10_SDR9 /* 10 column bits(1K) */ ++ | AT91C_DDRC2_NR_13 /* 13 row bits (8K) */ ++ | AT91C_DDRC2_CAS_3 /* CAS Latency 3 */ ++ | AT91C_DDRC2_NB_BANKS_8 /* 8 banks */ ++ | AT91C_DDRC2_DISABLE_RESET_DLL ++ | AT91C_DDRC2_DECOD_INTERLEAVED);/*Interleaved decode*/ ++ ++ /* ++ * Make sure to uncomment the following line if the DDR controller ++ * shares the EBI with another memory controller (SMC, NAND,..). ++ * For instance, AT91C_DDRC2_EBISHARE shall be set if NAND flash ++ * data line 0 is positioned on EBI data line 0 (AT91C_EBI_NFD0_ON_D16 bit ++ * cleared in CCFG_EBICSA register). ++ * ++ * For Atmel AT91SAM9x5-EK revision B onwards, this AT91C_DDRC2_EBISHARE bit ++ * is cleared because the NAND flash data line 0 is positioned on EBI ++ * data line number 16 (AT91C_EBI_NFD0_ON_D16 bit set in CCFG_EBICSA ++ * register). Only the DDR controller function is thus used on lower ++ * EBI data lines. ++ */ ++ //ddramc_config->cr |= AT91C_DDRC2_EBISHARE; /* DQM is shared with other controller */ ++ ++ ++ /* ++ * The DDR2-SDRAM device requires a refresh every 15.625 us or 7.81 us. ++ * With a 133 MHz frequency, the refresh timer count register must to be ++ * set with (15.625 x 133 MHz) ~ 2084 i.e. 0x824 ++ * or (7.81 x 133 MHz) ~ 1040 i.e. 0x410. ++ */ ++ ddramc_config->rtr = 0x411; /* Refresh timer: 7.8125us */ ++ ++ /* One clock cycle @ 133 MHz = 7.5 ns */ ++ ddramc_config->t0pr = (AT91C_DDRC2_TRAS_(6) /* 6 * 7.5 = 45 ns */ ++ | AT91C_DDRC2_TRCD_(2) /* 2 * 7.5 = 22.5 ns */ ++ | AT91C_DDRC2_TWR_(2) /* 2 * 7.5 = 15 ns */ ++ | AT91C_DDRC2_TRC_(8) /* 8 * 7.5 = 75 ns */ ++ | AT91C_DDRC2_TRP_(2) /* 2 * 7.5 = 15 ns */ ++ | AT91C_DDRC2_TRRD_(2) /* 2 * 7.5 = 15 ns */ ++ | AT91C_DDRC2_TWTR_(2) /* 2 clock cycles min */ ++ | AT91C_DDRC2_TMRD_(2)); /* 2 clock cycles */ ++ ++ ddramc_config->t1pr = (AT91C_DDRC2_TXP_(2) /* 2 clock cycles */ ++ | AT91C_DDRC2_TXSRD_(200) /* 200 clock cycles */ ++ | AT91C_DDRC2_TXSNR_(19) /* 19 * 7.5 = 142.5 ns*/ ++ | AT91C_DDRC2_TRFC_(18)); /* 18 * 7.5 = 135 ns */ ++ ++ ddramc_config->t2pr = (AT91C_DDRC2_TFAW_(7) /* 7 * 7.5 = 52.5 ns */ ++ | AT91C_DDRC2_TRTP_(2) /* 2 clock cycles min */ ++ | AT91C_DDRC2_TRPA_(3) /* 3 * 7.5 = 22.5 ns */ ++ | AT91C_DDRC2_TXARDS_(7) /* 7 clock cycles */ ++ | AT91C_DDRC2_TXARD_(2)); /* 2 clock cycles */ ++} ++ ++static void ddramc_init(void) ++{ ++ unsigned long csa; ++ struct ddramc_register ddramc_reg; ++ ++ ddramc_reg_config(&ddramc_reg); ++ ++ /* ENABLE DDR2 clock */ ++ pmc_enable_system_clock(AT91C_PMC_DDR); ++ ++ /* Chip select 1 is for DDR2/SDRAM */ ++ csa = readl(AT91C_BASE_CCFG + CCFG_EBICSA); ++ csa |= AT91C_EBI_CS1A_SDRAMC; ++ csa &= ~AT91C_EBI_DBPUC; ++ csa |= AT91C_EBI_DBPDC; ++ csa |= AT91C_EBI_DRV_HD; ++ ++ writel(csa, AT91C_BASE_CCFG + CCFG_EBICSA); ++ ++ /* DDRAM2 Controller initialize */ ++ ddram_initialize(AT91C_BASE_DDRSDRC, AT91C_BASE_CS1, &ddramc_reg); ++} ++#endif /* #ifdef CONFIG_DDR2 */ ++ ++static void one_wire_hw_init(void) ++{ ++ const struct pio_desc wire_pio[] = { ++ {"1-Wire", AT91C_PIN_PB(18), 1, PIO_DEFAULT, PIO_OUTPUT}, ++ {(char *)0, 0, 0, PIO_DEFAULT, PIO_PERIPH_A}, ++ }; ++ ++ pmc_enable_periph_clock(AT91C_ID_PIOA_B); ++ pio_configure(wire_pio); ++} ++ ++#ifdef CONFIG_HW_INIT ++void hw_init(void) ++{ ++ /* Disable watchdog */ ++ at91_disable_wdt(); ++ ++ /* ++ * At this stage the main oscillator is ++ * supposed to be enabled PCK = MCK = MOSC ++ */ ++ pmc_init_pll(0); ++ ++ /* Configure PLLA = MOSC * (PLL_MULA + 1) / PLL_DIVA */ ++ pmc_cfg_plla(PLLA_SETTINGS); ++ ++ /* Switch PCK/MCK on Main clock output */ ++ pmc_cfg_mck(BOARD_PRESCALER_MAIN_CLOCK); ++ ++ /* Switch PCK/MCK on PLLA output */ ++ pmc_cfg_mck(BOARD_PRESCALER_PLLA); ++ ++ /* Enable External Reset */ ++ writel(AT91C_RSTC_KEY_UNLOCK | AT91C_RSTC_URSTEN, AT91C_BASE_RSTC + RSTC_RMR); ++ ++ /* Init timer */ ++ timer_init(); ++ ++ /* Initialize dbgu */ ++ initialize_dbgu(); ++ ++#ifdef CONFIG_DDR2 ++ /* Initialize DDRAM Controller */ ++ ddramc_init(); ++#endif ++ /* one wire pin init */ ++ one_wire_hw_init(); ++} ++#endif /* #ifdef CONFIG_HW_INIT */ ++ ++#ifdef CONFIG_DATAFLASH ++void at91_spi0_hw_init(void) ++{ ++ /* Configure PINs for SPI0 */ ++ const struct pio_desc spi0_pins[] = { ++ {"MISO", AT91C_PIN_PA(11), 0, PIO_DEFAULT, PIO_PERIPH_A}, ++ {"MOSI", AT91C_PIN_PA(12), 0, PIO_DEFAULT, PIO_PERIPH_A}, ++ {"SPCK", AT91C_PIN_PA(13), 0, PIO_DEFAULT, PIO_PERIPH_A}, ++ {"NPCS", CONFIG_SYS_SPI_PCS, 1, PIO_DEFAULT, PIO_OUTPUT}, ++ {(char *)0, 0, 0, PIO_DEFAULT, PIO_PERIPH_A}, ++ }; ++ ++ pmc_enable_periph_clock(AT91C_ID_PIOA_B); ++ pio_configure(spi0_pins); ++ ++ pmc_enable_periph_clock(AT91C_ID_SPI0); ++} ++#endif /* #ifdef CONFIG_DATAFLASH */ ++ ++#ifdef CONFIG_SDCARD ++#ifdef CONFIG_OF_LIBFDT ++void at91_board_set_dtb_name(char *of_name) ++{ ++ unsigned int cpu_board_id = get_cm_sn(); ++ unsigned int disp_board_id = get_dm_sn(); ++ ++ if (cpu_board_id == BOARD_ID_SAM9G15_CM) ++ strcpy(of_name, "at91sam9g15ek"); ++ else if (cpu_board_id == BOARD_ID_SAM9G25_CM) ++ strcpy(of_name, "at91sam9g25ek"); ++ else if (cpu_board_id == BOARD_ID_SAM9G35_CM) ++ strcpy(of_name, "at91sam9g35ek"); ++ else if (cpu_board_id == BOARD_ID_SAM9X25_CM) ++ strcpy(of_name, "at91sam9x25ek"); ++ else if (cpu_board_id == BOARD_ID_SAM9X35_CM) ++ strcpy(of_name, "at91sam9x35ek"); ++ else ++ dbg_info("WARNING: Not correct CPU board ID\n"); ++ ++ if (disp_board_id == BOARD_ID_PDA_DM) ++ strcat(of_name, "_pda"); ++ ++ strcat(of_name, ".dtb"); ++} ++#endif ++ ++void at91_mci0_hw_init(void) ++{ ++ const struct pio_desc mci_pins[] = { ++ {"MCCK", AT91C_PIN_PA(17), 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"MCCDA", AT91C_PIN_PA(16), 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"MCDA0", AT91C_PIN_PA(15), 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"MCDA1", AT91C_PIN_PA(18), 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"MCDA2", AT91C_PIN_PA(19), 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"MCDA3", AT91C_PIN_PA(20), 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {(char *)0, 0, 0, PIO_DEFAULT, PIO_PERIPH_A}, ++ }; ++ ++ /* Configure the PIO controller */ ++ pmc_enable_periph_clock(AT91C_ID_PIOA_B); ++ pio_configure(mci_pins); ++ ++ /* Enable the clock */ ++ pmc_enable_periph_clock(AT91C_ID_HSMCI0); ++} ++#endif /* #ifdef CONFIG_SDCARD */ ++ ++#ifdef CONFIG_NANDFLASH ++void nandflash_hw_init(void) ++{ ++ unsigned int reg; ++ ++ /* Configure Nand PINs */ ++ const struct pio_desc nand_pins_hi[] = { ++ {"NANDOE", CONFIG_SYS_NAND_OE_PIN, 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"NANDWE", CONFIG_SYS_NAND_WE_PIN, 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"NANDALE", CONFIG_SYS_NAND_ALE_PIN, 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"NANDCLE", CONFIG_SYS_NAND_CLE_PIN, 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"NANDCS", CONFIG_SYS_NAND_ENABLE_PIN, 1, PIO_PULLUP, PIO_OUTPUT}, ++ {"D0", AT91C_PIN_PD(6), 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"D1", AT91C_PIN_PD(7), 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"D2", AT91C_PIN_PD(8), 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"D3", AT91C_PIN_PD(9), 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"D4", AT91C_PIN_PD(10), 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"D5", AT91C_PIN_PD(11), 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"D6", AT91C_PIN_PD(12), 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"D7", AT91C_PIN_PD(13), 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {(char *)0, 0, 0, PIO_DEFAULT, PIO_PERIPH_A}, ++ }; ++ ++ const struct pio_desc nand_pins_lo[] = { ++ {"NANDOE", CONFIG_SYS_NAND_OE_PIN, 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"NANDWE", CONFIG_SYS_NAND_WE_PIN, 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"NANDALE", CONFIG_SYS_NAND_ALE_PIN, 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"NANDCLE", CONFIG_SYS_NAND_CLE_PIN, 0, PIO_PULLUP, PIO_PERIPH_A}, ++ {"NANDCS", CONFIG_SYS_NAND_ENABLE_PIN, 1, PIO_PULLUP, PIO_OUTPUT}, ++ {(char *)0, 0, 0, PIO_DEFAULT, PIO_PERIPH_A}, ++ }; ++ ++ reg = readl(AT91C_BASE_CCFG + CCFG_EBICSA); ++ reg |= AT91C_EBI_CS3A_SM; ++ if (get_cm_rev() == 'A') ++ reg &= ~AT91C_EBI_NFD0_ON_D16; ++ else ++ reg |= (AT91C_EBI_DDR_MP_EN | AT91C_EBI_NFD0_ON_D16); ++ ++ reg &= ~AT91C_EBI_DRV; ++ writel(reg, AT91C_BASE_CCFG + CCFG_EBICSA); ++ ++ /* Configure SMC CS3 */ ++ writel((AT91C_SMC_NWESETUP_(1) ++ | AT91C_SMC_NCS_WRSETUP_(0) ++ | AT91C_SMC_NRDSETUP_(2) ++ | AT91C_SMC_NCS_RDSETUP_(0)), ++ AT91C_BASE_SMC + SMC_SETUP3); ++ ++ writel((AT91C_SMC_NWEPULSE_(3) ++ | AT91C_SMC_NCS_WRPULSE_(5) ++ | AT91C_SMC_NRDPULSE_(4) ++ | AT91C_SMC_NCS_RDPULSE_(6)), ++ AT91C_BASE_SMC + SMC_PULSE3); ++ ++ writel((AT91C_SMC_NWECYCLE_(5) ++ | AT91C_SMC_NRDCYCLE_(7)), ++ AT91C_BASE_SMC + SMC_CYCLE3); ++ ++ writel((AT91C_SMC_READMODE ++ | AT91C_SMC_WRITEMODE ++ | AT91C_SMC_NWAITM_NWAIT_DISABLE ++ | AT91C_SMC_DBW_WIDTH_BITS_8 ++ | AT91_SMC_TDF_(1)), ++ AT91C_BASE_SMC + SMC_CTRL3); ++ ++ /* Configure the PIO controller */ ++ if (get_cm_rev() == 'A') ++ pio_configure(nand_pins_lo); ++ else ++ pio_configure(nand_pins_hi); ++ ++ pmc_enable_periph_clock(AT91C_ID_PIOC_D); ++} ++#endif /* #ifdef CONFIG_NANDFLASH */ diff --git a/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/at91sam9x5_4bit_pmecc_header.bin b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/at91sam9x5_4bit_pmecc_header.bin new file mode 100644 index 0000000..f8d6073 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/at91sam9x5_4bit_pmecc_header.bin @@ -0,0 +1 @@ +$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
\ No newline at end of file diff --git a/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/create_4bit_pmecc_header.rb b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/create_4bit_pmecc_header.rb new file mode 100755 index 0000000..780d728 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/create_4bit_pmecc_header.rb @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby + +52.times do + print ["052490c0"].pack('H*') +end diff --git a/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/defconfig b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/defconfig new file mode 100644 index 0000000..ba0a902 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/defconfig @@ -0,0 +1,228 @@ +# +# In defiance, this file was edited for +# Multitech systems. +# 2018 Jan 3 18:15CST +# +HAVE_DOT_CONFIG=y +# CONFIG_AT91SAM9260EK is not set +# CONFIG_AT91SAM9261EK is not set +# CONFIG_AT91SAM9263EK is not set +# CONFIG_AT91SAM9RLEK is not set +# CONFIG_AT91SAM9XEEK is not set +# CONFIG_AT91SAM9G10EK is not set +# CONFIG_AT91SAM9G20EK is not set +# CONFIG_AT91SAM9M10G45EK is not set +CONFIG_AT91SAM9X5EK=y +# CONFIG_AT91SAM9N12EK is not set +# CONFIG_SAMA5D3XEK is not set +# CONFIG_SAMA5D3_XPLAINED is not set +# CONFIG_SAMA5D3X_CMP is not set +# CONFIG_SAMA5D4EK is not set +# CONFIG_SAMA5D4_XPLAINED is not set +# CONFIG_SAMA5D2_PTC is not set +# CONFIG_SAMA5D2_XPLAINED is not set +# CONFIG_SAMA5D27_SOM1_EK is not set +# CONFIG_VINCO is not set +# CONFIG_AT91SAM9X5_ARIA is not set +# CONFIG_AT91SAM9X5_ARIETTA is not set +# CONFIG_SAMA5D3_ACQUA is not set +# CONFIG_SAMA5D2_ROADRUNNER is not set +# CONFIG_CORE9G25 is not set +# CONFIG_SAMA5D3_LINEA is not set +CONFIG_BOARDNAME="at91sam9x5ek" +AT91SAM9X5=y +CONFIG_MACH_TYPE="3373" +CONFIG_LINK_ADDR="0x300000" +CONFIG_TOP_OF_MEMORY="0x308000" +CONFIG_CRYSTAL_12_000MHZ=y +# CONFIG_CRYSTAL_16_000MHZ is not set +# CONFIG_CRYSTAL_16_36766MHZ is not set +# CONFIG_CRYSTAL_18_432MHZ is not set +# CONFIG_CRYSTAL_24_000MHZ is not set +ALLOW_CRYSTAL_12_000MHZ=y +CONFIG_CRYSTAL="CRYSTAL_12_000MHZ" +# CONFIG_CPU_CLK_166MHZ is not set +# CONFIG_CPU_CLK_180MHZ is not set +# CONFIG_CPU_CLK_200MHZ is not set +# CONFIG_CPU_CLK_240MHZ is not set +# CONFIG_CPU_CLK_266MHZ is not set +# CONFIG_CPU_CLK_332MHZ is not set +# CONFIG_CPU_CLK_348MHZ is not set +# CONFIG_CPU_CLK_396MHZ is not set +CONFIG_CPU_CLK_400MHZ=y +# CONFIG_CPU_CLK_444MHZ is not set +# CONFIG_CPU_CLK_492MHZ is not set +# CONFIG_CPU_CLK_498MHZ is not set +# CONFIG_CPU_CLK_510MHZ is not set +# CONFIG_CPU_CLK_528MHZ is not set +# CONFIG_CPU_CLK_594MHZ is not set +# CONFIG_CPU_CLK_600MHZ is not set +ALLOW_CPU_CLK_400MHZ=y +# DISABLE_CPU_CLK_240MHZ is not set +# CONFIG_BUS_SPEED_83MHZ is not set +# CONFIG_BUS_SPEED_90MHZ is not set +# CONFIG_BUS_SPEED_100MHZ is not set +# CONFIG_BUS_SPEED_116MHZ is not set +# CONFIG_BUS_SPEED_124MHZ is not set +CONFIG_BUS_SPEED_133MHZ=y +# CONFIG_BUS_SPEED_148MHZ is not set +# CONFIG_BUS_SPEED_164MHZ is not set +# CONFIG_BUS_SPEED_166MHZ is not set +# CONFIG_BUS_SPEED_170MHZ is not set +# CONFIG_BUS_SPEED_176MHZ is not set +# CONFIG_BUS_SPEED_200MHZ is not set +SUPPORT_BUS_SPEED_133MHZ=y +# CPU_HAS_TRUSTZONE is not set +# CONFIG_CPU_V7 is not set +# CONFIG_HAS_PMIC_ACT8865 is not set +# CONFIG_SUPPORT_PM is not set +# CONFIG_HAS_ONE_WIRE is not set +# CONFIG_HAS_EEPROM is not set +# CONFIG_HAS_EHT0_PHY is not set +# CONFIG_HAS_EHT1_PHY is not set +# CONFIG_HAS_AUDIO_CODEC is not set +# CONFIG_HAS_HDMI is not set +CORE_ARM926EJS=y +# CORE_CORTEX_A5 is not set +CPU_HAS_SCKC=y +# CPU_HAS_H32MXDIV is not set +CPU_HAS_HSMCI0=y +CPU_HAS_HSMCI1=y +# CPU_HAS_HSMCI2 is not set +# CPU_HAS_MCI0 is not set +# CPU_HAS_MCI1 is not set +# CPU_HAS_SDHC0 is not set +# CPU_HAS_SDHC1 is not set +CPU_HAS_SPI0=y +CPU_HAS_SPI1=y +# CPU_HAS_SPI0_IOSET1 is not set +# CPU_HAS_SPI0_IOSET2 is not set +# CPU_HAS_SPI1_IOSET1 is not set +# CPU_HAS_SPI1_IOSET2 is not set +# CPU_HAS_SPI1_IOSET3 is not set +# CPU_HAS_QSPI0 is not set +# CPU_HAS_QSPI1 is not set +# CPU_HAS_QSPI0_IOSET1 is not set +# CPU_HAS_QSPI0_IOSET2 is not set +# CPU_HAS_QSPI0_IOSET3 is not set +# CPU_HAS_QSPI1_IOSET1 is not set +# CPU_HAS_QSPI1_IOSET2 is not set +# CPU_HAS_QSPI1_IOSET3 is not set +CPU_HAS_PIO3=y +# CPU_HAS_L2CC is not set +CPU_HAS_PMECC=y +CONFIG_HAS_HW_INFO=y +# CONFIG_TWI is not set +# CONFIG_TWI0 is not set +# CONFIG_TWI1 is not set +# CONFIG_TWI2 is not set +# CONFIG_TWI3 is not set +# CONFIG_MACB is not set +# CONFIG_AES is not set +CONFIG_LOAD_HW_INFO=y +CPU_HAS_TWI0=y +CPU_HAS_TWI1=y +CPU_HAS_TWI2=y +# CPU_HAS_TWI3 is not set +# CPU_HAS_AES is not set +# CPU_HAS_PIO4 is not set + +# +# Memory selection +# +# CONFIG_SDRAM is not set +# CONFIG_SDDRC is not set +CONFIG_DDRC=y +ALLOW_DATAFLASH=y +# ALLOW_FLASH is not set +ALLOW_NANDFLASH=y +ALLOW_SDCARD=y +# ALLOW_PSRAM is not set +# ALLOW_SDRAM_16BIT is not set + +# +# RAM Configuration +# +# CONFIG_RAM_32MB is not set +# CONFIG_RAM_64MB is not set +# CONFIG_RAM_128MB is not set +CONFIG_RAM_256MB=y +# CONFIG_RAM_512MB is not set +# CONFIG_LPDDR1 is not set +# CONFIG_LPDDR2 is not set +# CONFIG_LPDDR3 is not set +CONFIG_DDR2=y +# CONFIG_DDR3 is not set +# CONFIG_SAMA5D2_LPDDR2 is not set +# CONFIG_DATAFLASH is not set +# CONFIG_FLASH is not set +CONFIG_NANDFLASH=y +# CONFIG_SDCARD is not set +CONFIG_MEMORY="nandflash" +ALLOW_BOOT_FROM_DATAFLASH_CS0=y + +# +# NAND flash configuration +# +# CONFIG_ENABLE_SW_ECC is not set +CONFIG_USE_PMECC=y +# CONFIG_ON_DIE_ECC is not set + +# +# PMECC Configuration +# +CONFIG_PMECC_AUTO_DETECT=y +# CONFIG_PMECC_CORRECT_BITS_2 is not set +# CONFIG_PMECC_CORRECT_BITS_4 is not set +# CONFIG_PMECC_CORRECT_BITS_8 is not set +# CONFIG_PMECC_CORRECT_BITS_12 is not set +# CONFIG_PMECC_CORRECT_BITS_24 is not set +CONFIG_PMECC_SECTOR_SIZE_512=y +# CONFIG_PMECC_SECTOR_SIZE_1024 is not set +# CONFIG_NANDFLASH_SMALL_BLOCKS is not set +CONFIG_ONFI_DETECT_SUPPORT=y +CONFIG_USE_ON_DIE_ECC_SUPPORT=y +# ALLOW_NANDFLASH_RECOVERY is not set +CONFIG_BOOTSTRAP_MAXSIZE="23000" +CONFIG_PROJECT="nandflash" +CONFIG_LOAD_UBOOT=y +# CONFIG_LOAD_LINUX is not set +# CONFIG_LOAD_ANDROID is not set +# CONFIG_LOAD_1MB is not set +# CONFIG_LOAD_4MB is not set +# CONFIG_LOAD_64KB is not set +CONFIG_IMG_ADDRESS="0x00040000" +CONFIG_JUMP_ADDR="0x2EF00000" + +# +# U-Boot Image Storage Setup +# +CONFIG_IMG_SIZE="0x00080000" +CONFIG_IMAGE_NAME="u-boot.bin" +CONFIG_DEBUG=y +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_LOUD is not set +CONFIG_DEBUG_VERY_LOUD=y is not set +CONFIG_THUMB=y +# CONFIG_DISABLE_WATCHDOG is not set + +# +# Hardware Initialization Options +# +CONFIG_HW_DISPLAY_BANNER=y +# Indicate ONFI Usage +CONFIG_HW_BANNER="\"\\n\\nAT91Bootstrap \" AT91BOOTSTRAP_VERSION \" (\" COMPILE_TIME \")/MTechONFI\\n\\n\"" +CONFIG_HW_INIT=y +# CONFIG_USER_HW_INIT is not set + +# +# Slow Clock Configuration Options +# +CONFIG_SCLK=y +# CONFIG_SCLK_BYPASS is not set +# CONFIG_BACKUP_MODE is not set + +# +# Board Hardware Information Options +# +# CONFIG_LOAD_ONE_WIRE is not set diff --git a/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/defconfig.mtr b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/defconfig.mtr new file mode 100644 index 0000000..b79a0ee --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/defconfig.mtr @@ -0,0 +1,228 @@ +# +# In defiance, this file was edited for +# Multitech systems. +# 2018 Jan 3 18:15CST +# +HAVE_DOT_CONFIG=y +# CONFIG_AT91SAM9260EK is not set +# CONFIG_AT91SAM9261EK is not set +# CONFIG_AT91SAM9263EK is not set +# CONFIG_AT91SAM9RLEK is not set +# CONFIG_AT91SAM9XEEK is not set +# CONFIG_AT91SAM9G10EK is not set +# CONFIG_AT91SAM9G20EK is not set +# CONFIG_AT91SAM9M10G45EK is not set +CONFIG_AT91SAM9X5EK=y +# CONFIG_AT91SAM9N12EK is not set +# CONFIG_SAMA5D3XEK is not set +# CONFIG_SAMA5D3_XPLAINED is not set +# CONFIG_SAMA5D3X_CMP is not set +# CONFIG_SAMA5D4EK is not set +# CONFIG_SAMA5D4_XPLAINED is not set +# CONFIG_SAMA5D2_PTC is not set +# CONFIG_SAMA5D2_XPLAINED is not set +# CONFIG_SAMA5D27_SOM1_EK is not set +# CONFIG_VINCO is not set +# CONFIG_AT91SAM9X5_ARIA is not set +# CONFIG_AT91SAM9X5_ARIETTA is not set +# CONFIG_SAMA5D3_ACQUA is not set +# CONFIG_SAMA5D2_ROADRUNNER is not set +# CONFIG_CORE9G25 is not set +# CONFIG_SAMA5D3_LINEA is not set +CONFIG_BOARDNAME="at91sam9x5ek" +AT91SAM9X5=y +CONFIG_MACH_TYPE="3373" +CONFIG_LINK_ADDR="0x300000" +CONFIG_TOP_OF_MEMORY="0x308000" +CONFIG_CRYSTAL_12_000MHZ=y +# CONFIG_CRYSTAL_16_000MHZ is not set +# CONFIG_CRYSTAL_16_36766MHZ is not set +# CONFIG_CRYSTAL_18_432MHZ is not set +# CONFIG_CRYSTAL_24_000MHZ is not set +ALLOW_CRYSTAL_12_000MHZ=y +CONFIG_CRYSTAL="CRYSTAL_12_000MHZ" +# CONFIG_CPU_CLK_166MHZ is not set +# CONFIG_CPU_CLK_180MHZ is not set +# CONFIG_CPU_CLK_200MHZ is not set +# CONFIG_CPU_CLK_240MHZ is not set +# CONFIG_CPU_CLK_266MHZ is not set +# CONFIG_CPU_CLK_332MHZ is not set +# CONFIG_CPU_CLK_348MHZ is not set +# CONFIG_CPU_CLK_396MHZ is not set +CONFIG_CPU_CLK_400MHZ=y +# CONFIG_CPU_CLK_444MHZ is not set +# CONFIG_CPU_CLK_492MHZ is not set +# CONFIG_CPU_CLK_498MHZ is not set +# CONFIG_CPU_CLK_510MHZ is not set +# CONFIG_CPU_CLK_528MHZ is not set +# CONFIG_CPU_CLK_594MHZ is not set +# CONFIG_CPU_CLK_600MHZ is not set +ALLOW_CPU_CLK_400MHZ=y +# DISABLE_CPU_CLK_240MHZ is not set +# CONFIG_BUS_SPEED_83MHZ is not set +# CONFIG_BUS_SPEED_90MHZ is not set +# CONFIG_BUS_SPEED_100MHZ is not set +# CONFIG_BUS_SPEED_116MHZ is not set +# CONFIG_BUS_SPEED_124MHZ is not set +CONFIG_BUS_SPEED_133MHZ=y +# CONFIG_BUS_SPEED_148MHZ is not set +# CONFIG_BUS_SPEED_164MHZ is not set +# CONFIG_BUS_SPEED_166MHZ is not set +# CONFIG_BUS_SPEED_170MHZ is not set +# CONFIG_BUS_SPEED_176MHZ is not set +# CONFIG_BUS_SPEED_200MHZ is not set +SUPPORT_BUS_SPEED_133MHZ=y +# CPU_HAS_TRUSTZONE is not set +# CONFIG_CPU_V7 is not set +# CONFIG_HAS_PMIC_ACT8865 is not set +# CONFIG_SUPPORT_PM is not set +# CONFIG_HAS_ONE_WIRE is not set +# CONFIG_HAS_EEPROM is not set +# CONFIG_HAS_EHT0_PHY is not set +# CONFIG_HAS_EHT1_PHY is not set +# CONFIG_HAS_AUDIO_CODEC is not set +# CONFIG_HAS_HDMI is not set +CORE_ARM926EJS=y +# CORE_CORTEX_A5 is not set +CPU_HAS_SCKC=y +# CPU_HAS_H32MXDIV is not set +CPU_HAS_HSMCI0=y +CPU_HAS_HSMCI1=y +# CPU_HAS_HSMCI2 is not set +# CPU_HAS_MCI0 is not set +# CPU_HAS_MCI1 is not set +# CPU_HAS_SDHC0 is not set +# CPU_HAS_SDHC1 is not set +CPU_HAS_SPI0=y +CPU_HAS_SPI1=y +# CPU_HAS_SPI0_IOSET1 is not set +# CPU_HAS_SPI0_IOSET2 is not set +# CPU_HAS_SPI1_IOSET1 is not set +# CPU_HAS_SPI1_IOSET2 is not set +# CPU_HAS_SPI1_IOSET3 is not set +# CPU_HAS_QSPI0 is not set +# CPU_HAS_QSPI1 is not set +# CPU_HAS_QSPI0_IOSET1 is not set +# CPU_HAS_QSPI0_IOSET2 is not set +# CPU_HAS_QSPI0_IOSET3 is not set +# CPU_HAS_QSPI1_IOSET1 is not set +# CPU_HAS_QSPI1_IOSET2 is not set +# CPU_HAS_QSPI1_IOSET3 is not set +CPU_HAS_PIO3=y +# CPU_HAS_L2CC is not set +CPU_HAS_PMECC=y +CONFIG_HAS_HW_INFO=y +# CONFIG_TWI is not set +# CONFIG_TWI0 is not set +# CONFIG_TWI1 is not set +# CONFIG_TWI2 is not set +# CONFIG_TWI3 is not set +# CONFIG_MACB is not set +# CONFIG_AES is not set +CONFIG_LOAD_HW_INFO=y +CPU_HAS_TWI0=y +CPU_HAS_TWI1=y +CPU_HAS_TWI2=y +# CPU_HAS_TWI3 is not set +# CPU_HAS_AES is not set +# CPU_HAS_PIO4 is not set + +# +# Memory selection +# +# CONFIG_SDRAM is not set +# CONFIG_SDDRC is not set +CONFIG_DDRC=y +ALLOW_DATAFLASH=y +# ALLOW_FLASH is not set +ALLOW_NANDFLASH=y +ALLOW_SDCARD=y +# ALLOW_PSRAM is not set +# ALLOW_SDRAM_16BIT is not set + +# +# RAM Configuration +# +# CONFIG_RAM_32MB is not set +# CONFIG_RAM_64MB is not set +CONFIG_RAM_128MB=y +# CONFIG_RAM_256MB is not set +# CONFIG_RAM_512MB is not set +# CONFIG_LPDDR1 is not set +# CONFIG_LPDDR2 is not set +# CONFIG_LPDDR3 is not set +CONFIG_DDR2=y +# CONFIG_DDR3 is not set +# CONFIG_SAMA5D2_LPDDR2 is not set +# CONFIG_DATAFLASH is not set +# CONFIG_FLASH is not set +CONFIG_NANDFLASH=y +# CONFIG_SDCARD is not set +CONFIG_MEMORY="nandflash" +ALLOW_BOOT_FROM_DATAFLASH_CS0=y + +# +# NAND flash configuration +# +# CONFIG_ENABLE_SW_ECC is not set +CONFIG_USE_PMECC=y +# CONFIG_ON_DIE_ECC is not set + +# +# PMECC Configuration +# +CONFIG_PMECC_AUTO_DETECT=y +# CONFIG_PMECC_CORRECT_BITS_2 is not set +# CONFIG_PMECC_CORRECT_BITS_4 is not set +# CONFIG_PMECC_CORRECT_BITS_8 is not set +# CONFIG_PMECC_CORRECT_BITS_12 is not set +# CONFIG_PMECC_CORRECT_BITS_24 is not set +CONFIG_PMECC_SECTOR_SIZE_512=y +# CONFIG_PMECC_SECTOR_SIZE_1024 is not set +# CONFIG_NANDFLASH_SMALL_BLOCKS is not set +CONFIG_ONFI_DETECT_SUPPORT=y +CONFIG_USE_ON_DIE_ECC_SUPPORT=y +# ALLOW_NANDFLASH_RECOVERY is not set +CONFIG_BOOTSTRAP_MAXSIZE="23000" +CONFIG_PROJECT="nandflash" +CONFIG_LOAD_UBOOT=y +# CONFIG_LOAD_LINUX is not set +# CONFIG_LOAD_ANDROID is not set +# CONFIG_LOAD_1MB is not set +# CONFIG_LOAD_4MB is not set +# CONFIG_LOAD_64KB is not set +CONFIG_IMG_ADDRESS="0x00040000" +CONFIG_JUMP_ADDR="0x26F00000" + +# +# U-Boot Image Storage Setup +# +CONFIG_IMG_SIZE="0x00080000" +CONFIG_IMAGE_NAME="u-boot.bin" +CONFIG_DEBUG=y +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_LOUD is not set +CONFIG_DEBUG_VERY_LOUD=y is not set +CONFIG_THUMB=y +# CONFIG_DISABLE_WATCHDOG is not set + +# +# Hardware Initialization Options +# +CONFIG_HW_DISPLAY_BANNER=y +# Indicate ONFI Usage +CONFIG_HW_BANNER="\"\\n\\nAT91Bootstrap \" AT91BOOTSTRAP_VERSION \" (\" COMPILE_TIME \")/MTechONFI\\n\\n\"" +CONFIG_HW_INIT=y +# CONFIG_USER_HW_INIT is not set + +# +# Slow Clock Configuration Options +# +CONFIG_SCLK=y +# CONFIG_SCLK_BYPASS is not set +# CONFIG_BACKUP_MODE is not set + +# +# Board Hardware Information Options +# +# CONFIG_LOAD_ONE_WIRE is not set diff --git a/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/disable-rtc-interrupts.patch b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/disable-rtc-interrupts.patch new file mode 100644 index 0000000..d262972 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/disable-rtc-interrupts.patch @@ -0,0 +1,32 @@ +diff -Naru orig/board/at91sam9x5ek/at91sam9x5ek.c new/board/at91sam9x5ek/at91sam9x5ek.c +--- orig/board/at91sam9x5ek/at91sam9x5ek.c 2018-01-04 18:06:52.533763774 -0600 ++++ new/board/at91sam9x5ek/at91sam9x5ek.c 2018-01-04 18:32:57.905717432 -0600 +@@ -44,6 +44,18 @@ + #include "at91sam9x5ek.h" + #include "board_hw_info.h" + ++#define RTC_SCCR 0x1C ++#define RTC_IDR 0x24 ++ ++static void at91_disable_rtc(void) ++{ ++ /* disable all RTC interrupts and clear status register. ++ * Prevents possible Linux lockup due to unexpected RTC interrupt ++ */ ++ writel(0xFF, RTC_IDR + AT91C_BASE_RTC); ++ writel(0xFF, RTC_SCCR + AT91C_BASE_RTC); ++} ++ + static void at91_dbgu_hw_init(void) + { + /* Configure DBGU pins */ +@@ -161,6 +173,9 @@ + #ifdef CONFIG_HW_INIT + void hw_init(void) + { ++ /* 1st chance to disable RTC */ ++ at91_disable_rtc(); ++ + /* Disable watchdog */ + at91_disable_wdt(); + diff --git a/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/mtrv1-DDRlowDriveStrength.patch b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/mtrv1-DDRlowDriveStrength.patch new file mode 100644 index 0000000..e57ba89 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/mtrv1-DDRlowDriveStrength.patch @@ -0,0 +1,22 @@ +diff -Naru at91bootstrap-3.8.12.orig/board/at91sam9x5ek/at91sam9x5ek.c at91bootstrap-3.8.12/board/at91sam9x5ek/at91sam9x5ek.c +--- at91bootstrap-3.8.12.orig/board/at91sam9x5ek/at91sam9x5ek.c 2019-03-19 16:57:01.976164610 -0500 ++++ at91bootstrap-3.8.12/board/at91sam9x5ek/at91sam9x5ek.c 2019-03-19 16:58:01.688162842 -0500 +@@ -75,6 +75,7 @@ + | AT91C_DDRC2_CAS_3 /* CAS Latency 3 */ + | AT91C_DDRC2_NB_BANKS_8 /* 8 banks */ + | AT91C_DDRC2_DISABLE_RESET_DLL ++ | AT91C_DDRC2_DIC_DS /* Low DDR Drive Strength */ + | AT91C_DDRC2_DECOD_INTERLEAVED);/*Interleaved decode*/ + + /* +diff -Naru at91bootstrap-3.8.12.orig/driver/common.c at91bootstrap-3.8.12/driver/common.c +--- at91bootstrap-3.8.12.orig/driver/common.c 2019-03-19 16:46:52.532182652 -0500 ++++ at91bootstrap-3.8.12/driver/common.c 2019-03-19 16:48:42.144179407 -0500 +@@ -143,6 +143,7 @@ + usart_puts(media); + + if (retval == 0) { ++ usart_puts("DDR Drive Strength: low\n"); + #if defined(CONFIG_LOAD_NONE) + usart_puts("AT91Bootstrap completed. Can load application via JTAG and jump.\n"); + #else diff --git a/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/onetime-slow-clock-switch.patch b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/onetime-slow-clock-switch.patch new file mode 100644 index 0000000..ebd007f --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/onetime-slow-clock-switch.patch @@ -0,0 +1,89 @@ +diff -Naru orig/driver/at91_slowclk.c new/driver/at91_slowclk.c +--- orig/driver/at91_slowclk.c 2019-03-18 16:56:37.362723190 -0500 ++++ new/driver/at91_slowclk.c 2019-03-18 17:06:16.138706056 -0500 +@@ -35,12 +35,15 @@ + #if !defined(SAMA5D4) && !defined(SAMA5D2) + unsigned int reg; + +- /* +- * Enable the 32768 Hz oscillator by setting the bit OSC32EN to 1 +- */ + reg = readl(AT91C_BASE_SCKCR); +- reg |= AT91C_SLCKSEL_OSC32EN; +- writel(reg, AT91C_BASE_SCKCR); ++ /* Only enable 32768 Hz oscillator if needed */ ++ if ( !(reg & AT91C_SLCKSEL_OSC32EN) ) { ++ /* ++ * Enable the 32768 Hz oscillator by setting the bit OSC32EN to 1 ++ */ ++ reg |= AT91C_SLCKSEL_OSC32EN; ++ writel(reg, AT91C_BASE_SCKCR); ++ } + #endif /* #if !defined(SAMA5D4) && !defined(SAMA5D2) */ + + /* start a internal timer */ +@@ -67,12 +70,15 @@ + { + unsigned int reg; + +- /* +- * Disable the 32kHz RC oscillator by setting the bit RCEN to 0 +- */ ++ /* Only disable internal RC oscillator if needed */ + reg = readl(AT91C_BASE_SCKCR); +- reg &= ~AT91C_SLCKSEL_RCEN; +- writel(reg, AT91C_BASE_SCKCR); ++ if (reg | AT91C_SLCKSEL_RCEN) { ++ /* ++ * Disable the 32kHz RC oscillator by setting the bit RCEN to 0 ++ */ ++ reg &= ~AT91C_SLCKSEL_RCEN; ++ writel(reg, AT91C_BASE_SCKCR); ++ } + } + #endif /* #if !defined(SAMA5D4) && !defined(SAMA5D2) */ + +@@ -90,22 +96,32 @@ + if (reg & AT91C_SLCKSEL_OSCSEL) + return 0; + +- reg |= AT91C_SLCKSEL_OSCSEL; +- writel(reg, AT91C_BASE_SCKCR); +- +- /* +- * Waiting 5 slow clock cycles for internal resynchronization +- * 5 slow clock cycles = ~153 us (5 / 32768) +- */ +- udelay(153); +- ++ if ( !(reg & AT91C_SLCKSEL_OSCSEL) ) { ++ dbg_printf("Switching slow clock to external oscillator...\n"); ++ /* ++ * Wait 32768 Hz Startup Time for clock stabilization (software loop) ++ * wait about ~1s (1300ms) ++ */ ++ slowclk_wait_osc32_stable(); ++ ++ /* ++ * Switching from internal 32kHz RC oscillator to 32768 Hz oscillator ++ * by setting the bit OSCSEL to 1 ++ */ ++ reg |= AT91C_SLCKSEL_OSCSEL; ++ writel(reg, AT91C_BASE_SCKCR); ++ ++ /* ++ * Waiting 5 slow clock cycles for internal resynchronization ++ * 5 slow clock cycles = ~153 us (5 / 32768) ++ */ ++ udelay(153); ++ } + return 0; + } + + int slowclk_switch_osc32(void) + { +- slowclk_wait_osc32_stable(); +- + slowclk_select_osc32(); + + #if !defined(SAMA5D4) && !defined(SAMA5D2) diff --git a/recipes-bsp/at91bootstrap/at91bootstrap.inc b/recipes-bsp/at91bootstrap/at91bootstrap.inc new file mode 100644 index 0000000..e887ffe --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap.inc @@ -0,0 +1,124 @@ +SUMMARY = "Initial bootstrap for AT91 ARM MPUs" +DESCRIPTION = " \ + at91bootstrap is the second-level bootloader for Atmel AT91 \ + SoCs. It provides a set of algorithms to manage the hardware \ + initialization and to download the main application (or a \ + third-level bootloader) from specified boot media to \ + main memory and start it. \ + " +AUTHOR = "Atmel Corporation" +HOMEPAGE = "http://www.at91.com/linux4sam/bin/view/Linux4SAM/AT91Bootstrap" +BUGTRACKER = "https://github.com/linux4sam/at91bootstrap/issues" +SECTION = "bootloaders" +LICENSE = "ATMEL" +LIC_FILES_CHKSUM = "file://main.c;endline=27;md5=42f86d2f6fd17d1221c5c651b487a07f" + + +inherit cml1 deploy + +SRC_URI_append = " \ + file://defconfig \ + file://onetime-slow-clock-switch.patch \ + file://disable-rtc-interrupts.patch \ + file://at91sam9x5_4bit_pmecc_header.bin \ +" +SRC_URI_append_mtrv1 = " file://mtrv1-DDRlowDriveStrength.patch \ + file://defconfig.mtr \ + file://at91bootstrap-3.8-mtr.patch \ +" +SRC_URI_append_mtr = " file://defconfig.mtr \ + file://at91bootstrap-3.8-mtr.patch \ +" + +SRC_URI_append_mtcdt = " file://at91bootstrap-3.8-mtcdt.patch " +SRC_URI_append_mtcap = " file://at91bootstrap-3.8-mtcdt.patch " + +DEPENDS += "bc-native" + +AT91BOOTSTRAP_MACHINE ??= "${MACHINE}" + +AT91BOOTSTRAP_CONFIG ??= "${AT91BOOTSTRAP_MACHINE}nf_uboot" +AT91BOOTSTRAP_CONFIG_at91sam9x5ek-sd ??= "${AT91BOOTSTRAP_MACHINE}sd_uboot" +AT91BOOTSTRAP_CONFIG_sama5d3-xplained-sd ??= "${AT91BOOTSTRAP_MACHINE}sd_uboot" +AT91BOOTSTRAP_CONFIG_sama5d4ek ??= "${AT91BOOTSTRAP_MACHINE}nf_uboot_secure" +AT91BOOTSTRAP_CONFIG_sama5d4-xplained ??= "${AT91BOOTSTRAP_MACHINE}nf_uboot_secure" +AT91BOOTSTRAP_CONFIG_sama5d4-xplained-sd ??= "${AT91BOOTSTRAP_MACHINE}sd_uboot_secure" +AT91BOOTSTRAP_CONFIG_sama5d2-xplained ??= "${AT91BOOTSTRAP_MACHINE}-bsrdf_uboot" +AT91BOOTSTRAP_CONFIG_sama5d2-xplained-sd ??= "${AT91BOOTSTRAP_MACHINE}-bsrsd_uboot" +AT91BOOTSTRAP_CONFIG_sama5d27-som1-ek ??= "${AT91BOOTSTRAP_MACHINE}qspi_uboot" +AT91BOOTSTRAP_CONFIG_sama5d27-som1-ek-sd ??= "${AT91BOOTSTRAP_MACHINE}sd_uboot" + +AT91BOOTSTRAP_TARGET ??= "${AT91BOOTSTRAP_CONFIG}_defconfig" +AT91BOOTSTRAP_LOAD ??= "nandflashboot-uboot" +AT91BOOTSTRAP_LOAD_at91sam9x5ek-sd ??= "sdboot-uboot" +AT91BOOTSTRAP_LOAD_sama5d2-xplained ??= "dataflashboot-uboot" +AT91BOOTSTRAP_LOAD_sama5d2-xplained-sd ??= "sdboot-uboot" +AT91BOOTSTRAP_LOAD_sama5d27-som1-ek ??= "qspiboot-uboot" +AT91BOOTSTRAP_LOAD_sama5d27-som1-ek-sd ??= "sdboot-uboot" +AT91BOOTSTRAP_LOAD_sama5d3-xplained-sd ??= "sdboot-uboot" +AT91BOOTSTRAP_LOAD_sama5d4-xplained-sd ??= "sdboot-uboot" + +AT91BOOTSTRAP_SUFFIX ?= "bin" +AT91BOOTSTRAP_IMAGE ?= "${AT91BOOTSTRAP_MACHINE}-${AT91BOOTSTRAP_LOAD}-${PV}.${PR}.${AT91BOOTSTRAP_SUFFIX}" +AT91BOOTSTRAP_BINARY ?= "at91bootstrap.${AT91BOOTSTRAP_SUFFIX}" +AT91BOOTSTRAP_SYMLINK ?= "at91bootstrap-${AT91BOOTSTRAP_MACHINE}.${AT91BOOTSTRAP_SUFFIX}" + +EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} REVISION=${PR} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}"' + +do_configure() { + # Copy board defconfig to .config if .config does not exist. This + # allows recipes to manage the .config themselves in + # do_configure_prepend(). + if [ -f "${S}/board/${AT91BOOTSTRAP_MACHINE}/${AT91BOOTSTRAP_TARGET}" ] && [ ! -f "${B}/.config" ]; then + cp "${S}/board/${AT91BOOTSTRAP_MACHINE}/${AT91BOOTSTRAP_TARGET}" "${B}/.config" + fi + + # Copy defconfig to .config if .config does not exist. This allows + # recipes to manage the .config themselves in do_configure_prepend() + # and to override default settings with a custom file. + if [[ ${MACHINE} == mtr ]] || [[ ${MACHINE} == mtrv1 ]] ; then + CTYPE=".mtr" + fi + + if [ -f "${WORKDIR}/defconfig${CTYPE}" ] && [ ! -f "${B}/.config" ]; then + cp "${WORKDIR}/defconfig${CTYPE}" "${B}/.config" + fi + + if [ ! -f "${S}/.config" ]; then + bbfatal "No config files found" + fi + + cml1_do_configure +} + +do_compile() { + if [ "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then + sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' ${S}/Makefile + fi + + unset CFLAGS CPPFLAGS LDFLAGS + oe_runmake +} + +do_deploy () { + install -d ${DEPLOYDIR} + install ${S}/binaries/${AT91BOOTSTRAP_BINARY} ${DEPLOYDIR}/${AT91BOOTSTRAP_IMAGE} + + cd ${DEPLOYDIR} + rm -f ${AT91BOOTSTRAP_BINARY} ${AT91BOOTSTRAP_SYMLINK} + ln -sf ${AT91BOOTSTRAP_IMAGE} ${AT91BOOTSTRAP_SYMLINK} + ln -sf ${AT91BOOTSTRAP_IMAGE} ${AT91BOOTSTRAP_BINARY} + + # Create a symlink ready for file copy on SD card + rm -f boot.bin BOOT.BIN + ln -sf ${AT91BOOTSTRAP_IMAGE} BOOT.BIN + + # Create padded version. Padded version is to be eliminated later. + cp -f ${WORKDIR}/at91sam9x5_4bit_pmecc_header.bin ${DEPLOYDIR}/at91bootstrap_pmecc_padded.bin + cat ${DEPLOYDIR}/${AT91BOOTSTRAP_IMAGE} >> ${DEPLOYDIR}/at91bootstrap_pmecc_padded.bin +} + +addtask deploy before do_build after do_compile + +PACKAGE_ARCH = "${MACHINE_ARCH}" + diff --git a/recipes-bsp/at91bootstrap/at91bootstrap_3.8.12.bb b/recipes-bsp/at91bootstrap/at91bootstrap_3.8.12.bb new file mode 100644 index 0000000..dcbb649 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap_3.8.12.bb @@ -0,0 +1,10 @@ +require at91bootstrap.inc +PR = "m2" + +LIC_FILES_CHKSUM = "file://main.c;endline=27;md5=a2a70db58191379e2550cbed95449fbd" + +SRC_URI = "https://github.com/linux4sam/at91bootstrap/archive/v${PV}.tar.gz;name=tarball" + +SRC_URI[tarball.md5sum] = "9cdcd5b427a7998315e9a0cad4488ffd" +SRC_URI[tarball.sha256sum] = "871140177e2cab7eeed572556025f9fdc5e82b2bb18302445d13db0f95e21694" + diff --git a/recipes-bsp/at91bootstrap/files/Creating-symlink-to-binary.patch b/recipes-bsp/at91bootstrap/files/Creating-symlink-to-binary.patch new file mode 100644 index 0000000..7103d60 --- /dev/null +++ b/recipes-bsp/at91bootstrap/files/Creating-symlink-to-binary.patch @@ -0,0 +1,30 @@ +From 35f4ab2ed71cd3fc13ccf14525e7de2c27348c61 Mon Sep 17 00:00:00 2001 +From: Mathieu Anquetin <mathieu.anquetin@groupe-cahors.com> +Date: Fri, 13 Dec 2013 10:20:03 +0100 +Subject: [PATCH 2/2] Creating symlink to binary + +Since the name of the flashable image is config-dependant, we create a +symlink to this file to have a standard name to the last built flashable +image. + +Signed-off-by: Mathieu Anquetin <mathieu.anquetin@groupe-cahors.com> +Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> +--- + Makefile | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Makefile b/Makefile +index 0b1cae6..11062f0 100644 +--- a/Makefile ++++ b/Makefile +@@ -287,6 +287,7 @@ $(AT91BOOTSTRAP): $(OBJS) + @$(LD) $(LDFLAGS) -n -o $(BINDIR)/$(BOOT_NAME).elf $(OBJS) + # @$(OBJCOPY) --strip-debug --strip-unneeded $(BINDIR)/$(BOOT_NAME).elf -O binary $(BINDIR)/$(BOOT_NAME).bin + @$(OBJCOPY) --strip-all $(BINDIR)/$(BOOT_NAME).elf -O binary $@ ++ @ln -sf $(BOOT_NAME).bin ${BINDIR}/${SYMLINK} + + %.o : %.c .config + @echo " CC "$< +-- +1.8.2.2 + diff --git a/recipes-bsp/at91bootstrap/files/Remove-standard-includes.patch b/recipes-bsp/at91bootstrap/files/Remove-standard-includes.patch new file mode 100644 index 0000000..01fa9d4 --- /dev/null +++ b/recipes-bsp/at91bootstrap/files/Remove-standard-includes.patch @@ -0,0 +1,59 @@ +From b1e85d514d24edf45bbb8a6b647238d00194f369 Mon Sep 17 00:00:00 2001 +From: Mathieu Anquetin <mathieu.anquetin@groupe-cahors.com> +Date: Thu, 12 Dec 2013 11:57:27 +0100 +Subject: [PATCH 1/2] Remove standard includes + +These includes are not needed and fail the build when using a custom +built toolchain from OpenEmbedded. + +Signed-off-by: Mathieu Anquetin <mathieu.anquetin@groupe-cahors.com> +Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> +--- + Makefile | 4 +++- + driver/debug.c | 1 - + driver/flash.c | 2 -- + 3 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/Makefile b/Makefile +index 03dd9df..0b1cae6 100644 +--- a/Makefile ++++ b/Makefile +@@ -211,7 +211,9 @@ OBJS:= $(SOBJS-y) $(COBJS-y) + INCL=board/$(BOARDNAME) + GC_SECTIONS=--gc-sections + +-CPPFLAGS=-ffunction-sections -g -Os -Wall \ ++NOSTDINC_FLAGS=-nostdinc -isystem $(shell $(CC) -print-file-name=include) ++ ++CPPFLAGS=$(NOSTDINC_FLAGS) -ffunction-sections -g -Os -Wall \ + -fno-stack-protector -fno-common \ + -I$(INCL) -Iinclude -Ifs/include \ + -DAT91BOOTSTRAP_VERSION=\"$(VERSION)$(REV)$(SCMINFO)\" -DCOMPILE_TIME="\"$(DATE)\"" +diff --git a/driver/debug.c b/driver/debug.c +index 9f83e4b..352c34f 100644 +--- a/driver/debug.c ++++ b/driver/debug.c +@@ -27,7 +27,6 @@ + */ + #include "usart.h" + #include "debug.h" +-#include <stdio.h> + #include <stdarg.h> + + #define MAX_BUFFER 128 +diff --git a/driver/flash.c b/driver/flash.c +index 11615c7..ebc5d5a 100644 +--- a/driver/flash.c ++++ b/driver/flash.c +@@ -26,8 +26,6 @@ + #include "../include/part.h" + #include "../include/main.h" + #include "../include/flash.h" +-#include <stdlib.h> +- + + int load_norflash(unsigned int img_addr, + unsigned int img_size, +-- +1.8.2.2 + diff --git a/recipes-bsp/multitech/get-eeprom-device-config/get-eeprom-device-config.sh b/recipes-bsp/multitech/get-eeprom-device-config/get-eeprom-device-config.sh new file mode 100755 index 0000000..ab47d31 --- /dev/null +++ b/recipes-bsp/multitech/get-eeprom-device-config/get-eeprom-device-config.sh @@ -0,0 +1,281 @@ +#!/bin/bash +# Radio ID loop count +TRY_COUNT=30 + +CONFIG_PATH=/var/run/config + +#system capabilities +CAPABILITY_ADC="false" +CAPABILITY_BLUETOOTH="false" +CAPABILITY_DIN="false" +CAPABILITY_DOUT="false" +#CAPABILITY_EXTERNAL_SERIAL_PORT="false" +#CAPABILITY_FLEXIBLE_SERIAL_PORT="false" +CAPABILITY_GPS="false" +CAPABILITY_WIFI="false" +CAPABILITY_CELL="false" +CAPABILITY_LORA="false" +CAPABILITY_GPIO="false" +CAPABILITY_SERIAL="false" +CAPABILITY_RS232="false" +CAPABILITY_RS422="false" +CAPABILITY_RS485="false" +CAPABILITY_NODE_RED="false" +CAPABILITY_LORA_NETWORK_SERVER="false" + + +# accessory cards constans +TEMP_AC_PATH="/var/volatile/tmp" +TEMP_AC_JSON="$TEMP_AC_PATH/ac_data.json" +# Number of accessory card places - size of array +AC_CARD_COUNT=4 + +function usage { + echo 'get-eeprom-device-info [-t TRY_COUNT]' + echo ' Where TRY_COUNT is the number of half' + echo ' second waits for the cellular radio' + echo ' to be ready for identification' + exit 1 +} + +# Reads accessory cards data +# WARNING: Make sure function called after CAPABILITIY_* variables is set with initial values. +ReadAcData() { + # Doing the same as mts-io-sysfs, but with one step, without unnesesary parsing. + MTS_IO_DIR="/sys/devices/platform/mts-io" + AC_PRFIX="ap" + TEMP_AC_FILE_PREFIX="/card" + TEMP_AC_PREFIX="$TEMP_AC_PATH$TEMP_AC_FILE_PREFIX" + # Fill property data for each accessory card + rm -f $TEMP_AC_PREFIX* + for f in `find $MTS_IO_DIR/$AC_PRFIX* -follow -maxdepth 1 -type f -follow -maxdepth 1 -type f 2>/dev/null`; + do + FILENAME=${f##*$MTS_IO_DIR/$AC_PRFIX} + case $FILENAME in + modalias ) + ;; + power ) + ;; + subsystem* ) + ;; + uevent ) + ;; + * ) + AC_NUMBER=$(echo "$FILENAME" | cut -d "/" -f1) + AC_PROP=$(echo "$FILENAME" | cut -d "/" -f2) + # Do camel casing + # Because {sed -r '{s/-([a-z])/\U\1/g;}'} did not work for Not GNU sed 4.0 use awk + tr + # Removing next 2 lines gives about 50% function speed-up + AC_PROP=$( echo $AC_PROP | awk -F"-" '{for(j=1;j<=NF;j++){$j=toupper(substr($j,1,1))substr($j,2)}}1' | sed -r '{s/ //g;}' ) + AC_PROP=`echo ${AC_PROP:0:1} | tr '[A-Z]' '[a-z]'`${AC_PROP:1} + #Output to temp file + AC_FILE="$TEMP_AC_PREFIX$AC_NUMBER" + printf "\"$AC_PROP\" : \"%s\",\n" `cat $f` >> $AC_FILE + ;; + esac + done + # Compose accessory cards data to array + echo "\"accessoryCards\" : [ " > $TEMP_AC_JSON + for ((I=1; I<=$AC_CARD_COUNT; ++I)) ; + do + AC_FILE="$TEMP_AC_PREFIX$I" + if [ -f "$AC_FILE" ];then + sed -i '$s/,$//' $AC_FILE # remove last comma + echo "{" >> $TEMP_AC_JSON + cat $AC_FILE >> $TEMP_AC_JSON + echo "}," >> $TEMP_AC_JSON + + # Map product-id with capabilities. + if $(grep -q '"productId" : "MTAC-MFSER-DTE"' $AC_FILE) || $(grep -q '"productId" : "MTAC-MFSER-DCE"' $AC_FILE); then + CAPABILITY_SERIAL="true" + CAPABILITY_RS232="true" + CAPABILITY_RS422="true" + CAPABILITY_RS485="true" + elif $(grep -q '"productId" : "MTAC-GPIOB"' $AC_FILE) || $(grep -q '"productId" : "MTAC-GPIOI"' $AC_FILE); then + CAPABILITY_GPIO="true" + CAPABILITY_ADC="true" + CAPABILITY_DIN="true" + CAPABILITY_DOUT="true" + elif $(grep -q '"productId" : "MTAC-LORA-.*"' $AC_FILE); then + CAPABILITY_LORA="true" + fi + else + echo "null," >> $TEMP_AC_JSON + fi + done + sed -i '$s/,$//' $TEMP_AC_JSON # remove last comma + echo "]," >> $TEMP_AC_JSON +} + +#check if LORA is present onboard a device. +#Lora capability from an MTAC card is determined by ReadAcData() +isNativeLoraPresent() { + LORA_ID_PREFIX="MTCAP-LORA-" + LORA_ID=$(mts-io-sysfs show lora/product-id 2> /dev/null) + if [[ $LORA_ID == $LORA_ID_PREFIX* ]]; then + return 0 + else + return 1 + fi +} + +TEMP=$(getopt -o t: -n 'get-eeprom-device-info' -- "$@") +eval set -- "$TEMP" +# extract options and their arguments into variables. +while true ; do + case "$1" in + -t) + case "$2" in + "") usage ;; + *) TRY_COUNT=$2 ; shift 2 ;; + esac ;; + --) shift ; break ;; + *) echo "usage" ;; + esac +done + +# Read device information from eeprom device + +mts-id-eeprom --in-file /sys/bus/i2c/devices/i2c-0/0-0056/eeprom > ${CONFIG_PATH}/device_info + +DEVICE_CAPA=${CONFIG_PATH}/device_capa +DEVICE_INFO_JSON=${CONFIG_PATH}/device_info.json + +# Create json data files +echo "{" > $DEVICE_CAPA +echo "{" > ${CONFIG_PATH}/device_info.json + + +# Read each line and parse the device data +while read line +do + +if [[ $line =~ ^vendor-id:\ \"(.*)\" ]]; then + echo ${BASH_REMATCH[1]} > ${CONFIG_PATH}/vendor_id + echo \"vendorId\": \"${BASH_REMATCH[1]}\", >> $DEVICE_INFO_JSON +elif [[ $line =~ ^product-id:\ \"(.*)\" ]]; then + echo ${BASH_REMATCH[1]} > ${CONFIG_PATH}/device_type + echo \"productId\": \"${BASH_REMATCH[1]}\", >> $DEVICE_INFO_JSON +elif [[ $line =~ ^device-id:\ \"(.*)\" ]]; then + echo ${BASH_REMATCH[1]} > ${CONFIG_PATH}/device_id + echo \"deviceId\": \"${BASH_REMATCH[1]}\", >> $DEVICE_INFO_JSON +elif [[ $line =~ ^hw-version:\ \"(.*)\" ]]; then + echo ${BASH_REMATCH[1]} > ${CONFIG_PATH}/hw_version + echo \"hardwareVersion\": \"${BASH_REMATCH[1]}\", >> $DEVICE_INFO_JSON +elif [[ $line =~ ^mac-addr:\ \"(.*)\" ]]; then + echo ${BASH_REMATCH[1]} > ${CONFIG_PATH}/mac_addr + echo \"macAddress\": \"${BASH_REMATCH[1]}\", >> $DEVICE_INFO_JSON +elif [[ $line =~ ^mac-bluetooth:\ \"(.*)\" ]]; then + echo ${BASH_REMATCH[1]} > ${CONFIG_PATH}/mac_bluetooth + echo \"macBluetooth\": \"${BASH_REMATCH[1]}\", >> $DEVICE_INFO_JSON +elif [[ $line =~ ^mac-wifi:\ \"(.*)\" ]]; then + echo ${BASH_REMATCH[1]} > ${CONFIG_PATH}/mac_wifi + echo \"macWifi\": \"${BASH_REMATCH[1]}\", >> $DEVICE_INFO_JSON +elif [[ $line =~ ^uuid:\ \"(.*)\" ]]; then + echo ${BASH_REMATCH[1]} > ${CONFIG_PATH}/uuid + echo \"uuid\": \"${BASH_REMATCH[1]}\", >> $DEVICE_INFO_JSON +elif [[ $line =~ ^imei:\ \"(.*)\" ]]; then + echo ${BASH_REMATCH[1]} > ${CONFIG_PATH}/modem_imei + echo \"imei\": \"${BASH_REMATCH[1]}\", >> $DEVICE_INFO_JSON +elif [[ $line =~ capa-gps:\ (.*) ]]; then + CAPABILITY_GPS=$(echo ${BASH_REMATCH[1]}) +elif [[ $line =~ capa-din:\ (.*) ]]; then + CAPABILITY_DIN=$(echo ${BASH_REMATCH[1]}) +elif [[ $line =~ capa-dout:\ (.*) ]]; then + CAPABILITY_DOUT=$(echo ${BASH_REMATCH[1]}) +elif [[ $line =~ capa-adc:\ (.*) ]]; then + CAPABILITY_ADC=$(echo ${BASH_REMATCH[1]}) +elif [[ $line =~ capa-wifi:\ (.*) ]]; then + CAPABILITY_WIFI=$(echo ${BASH_REMATCH[1]}) +elif [[ $line =~ capa-bluetooth:\ (.*) ]]; then + CAPABILITY_BLUETOOTH=$(echo ${BASH_REMATCH[1]}) +elif [[ $line =~ capa:\ \"(.*)\" ]]; then + echo \"mask\": \"${BASH_REMATCH[1]}\", >> $DEVICE_CAPA +fi + +done <${CONFIG_PATH}/device_info + +HASRADIO=$(cat /sys/devices/platform/mts-io/has-radio) +if ((HASRADIO == 1)) ; then + echo "Finding cellular module..." + for ((i=0; i < TRY_COUNT; i++)) + do + # Check cellular module + echo "Try #"$i + if [[ -L "/dev/modem_at0" && -L "/dev/modem_at1" ]]; then + CAPABILITY_CELL="true" + break + fi + if ((TRY_COUNT > 1)) ; then + sleep 0.5 + fi + done +fi + +if isNativeLoraPresent; then + CAPABILITY_LORA="true" +fi + +# +# Check if NODE-RED and Lora Network Server packages are installed +# +OPKG_FILE=/tmp/opkg_inst.tmp +opkg list-installed > $OPKG_FILE + +cat $OPKG_FILE | grep node-red > /dev/null +[ $? -eq 0 ] && CAPABILITY_NODE_RED="true" + +cat $OPKG_FILE | grep lora-network-server > /dev/null +[ $? -eq 0 ] && CAPABILITY_LORA_NETWORK_SERVER="true" + +rm -f $OPKG_FILE + + +# Read firmware info from /etc/issue +cat /etc/issue | +( +while read line +do + +if [[ $line =~ Version:\ (.*) ]]; then + echo \"firmware\": \"${BASH_REMATCH[1]}\", >> $DEVICE_INFO_JSON +elif [[ $line =~ Date:\ (.*) ]]; then + echo \"firmwareDate\": \"${BASH_REMATCH[1]}\", >> $DEVICE_INFO_JSON +fi + +done +) +# Add accessory cards +echo "Reading accessory cards data" +ReadAcData +echo "Adding accessory cards data" +cat $TEMP_AC_JSON >> $DEVICE_INFO_JSON + +# Complete the json files +echo \"adc\": $CAPABILITY_ADC, >> $DEVICE_CAPA +echo \"bluetooth\": $CAPABILITY_BLUETOOTH, >> $DEVICE_CAPA +echo \"din\": $CAPABILITY_DIN, >> $DEVICE_CAPA +echo \"dout\": $CAPABILITY_DOUT, >> $DEVICE_CAPA +echo \"gps\": $CAPABILITY_GPS, >> $DEVICE_CAPA +echo \"wifi\": $CAPABILITY_WIFI, >> $DEVICE_CAPA +echo \"cell\": $CAPABILITY_CELL, >> $DEVICE_CAPA +echo \"lora\": $CAPABILITY_LORA, >> $DEVICE_CAPA +echo \"gpio\": $CAPABILITY_GPIO, >> $DEVICE_CAPA +echo \"serial\": $CAPABILITY_SERIAL, >> $DEVICE_CAPA +echo \"rs232\": $CAPABILITY_RS232, >> $DEVICE_CAPA +echo \"rs422\": $CAPABILITY_RS422, >> $DEVICE_CAPA +echo \"rs485\": $CAPABILITY_RS485, >> $DEVICE_CAPA +echo \"nodeRed\": $CAPABILITY_NODE_RED, >> $DEVICE_CAPA +echo \"loraNetworkServer\": $CAPABILITY_LORA_NETWORK_SERVER >> $DEVICE_CAPA +echo "}" >> $DEVICE_CAPA +echo \"capabilities\": >> $DEVICE_INFO_JSON +cat $DEVICE_CAPA >> $DEVICE_INFO_JSON +echo "}" >> $DEVICE_INFO_JSON + +# Clean up temp files +rm $DEVICE_CAPA +rm ${CONFIG_PATH}/device_info + +#echo device_info.json ---------- +#cat /var/run/config/device_info.json +#echo --------------------------- diff --git a/recipes-bsp/multitech/get-eeprom-device-config/init b/recipes-bsp/multitech/get-eeprom-device-config/init new file mode 100755 index 0000000..0ba5075 --- /dev/null +++ b/recipes-bsp/multitech/get-eeprom-device-config/init @@ -0,0 +1,50 @@ +#! /bin/bash + +### BEGIN INIT INFO +# Provides: eeprom-config +# Required-Start: mts-io +# Default-Start: 2 3 4 5 +# Default-Stop: +# Short-Description: Create /run/config with eeprom configuration +### END INIT INFO + +GETCONFIG=/sbin/get-eeprom-device-config +JASONFILE=/run/config/device_info.json + +case "$1" in + start) + if ! [[ -f /run/config/device_info.json ]] ; then + [[ -d /run/config ]] || mkdir -m 755 -p /run/config + if [[ -x ${GETCONFIG} ]] ; then + ${GETCONFIG} -t1 # Radio might not be found yet. + fi + fi + ;; + stop) + ;; + force-reload) + rm -rf /run/config/* + ${GETCONFIG} + ;; + restart) + ${GETCONFIG} + ;; + reload) + ${GETCONFIG} + ;; + status) + if [[ -f ${JASONFILE} ]] ; then + echo EEPROM Config is populated + exit 0 + else + echo EEPROM Config is not populated + exit 3 + fi + ;; + *) + echo "Usage: ntpd { start | stop | status | restart | reload | force-reload }" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/recipes-bsp/multitech/get-eeprom-device-config_1.2.1.bb b/recipes-bsp/multitech/get-eeprom-device-config_1.2.1.bb new file mode 100644 index 0000000..c2330c3 --- /dev/null +++ b/recipes-bsp/multitech/get-eeprom-device-config_1.2.1.bb @@ -0,0 +1,32 @@ +# Script to copy the EEPROM to /run/config and +# init script to populate /run/config +inherit update-rc.d +PR = "r1" +DESCRIPTION = "EEPROM copyting tool" +HOMEPAGE = "http://www.multitech.net/" +SECTION = "console/utils" +PRIORITY = "optional" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe" +RDEPENDS_${PN} =+ "bash" + +SRCREV = "${PV}" + +SRC_URI = "file://${PN}.sh \ + file://init" + +PARALLEL_MAKE = "" + + +fakeroot do_install_append() { + # install MTCAP mts-io init script + install -d 0755 ${D}${base_sbindir} + install -d 0755 ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/${PN}.sh ${D}${base_sbindir}/${PN} + install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/eeprom-config +} + + +INITSCRIPT_NAME = "eeprom-config" +# Must start after MTS-IO to read the accessory cards. +INITSCRIPT_PARAMS = "start 40 S ." diff --git a/recipes-bsp/multitech/mt-dt-overlay_1.0.0.bb b/recipes-bsp/multitech/mt-dt-overlay_1.0.0.bb new file mode 100644 index 0000000..2714705 --- /dev/null +++ b/recipes-bsp/multitech/mt-dt-overlay_1.0.0.bb @@ -0,0 +1,53 @@ +DESCRIPTION = "Compile MT board device tree overlays" +LICENSE = "(GPLv2+)" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" +PACKAGE_ARCH = "${MACHINE_ARCH}" + +# By using an overlay, we should be able to support multiple pinouts +# using the same image. The overlays go into /lib/dtoverlays. +# There names are: [hw-version]-driver.dtbo +# e.g. /lib/dtoverlays/MTRV1-0.0-pps.dtbo +# The idea is that mts-io will search for the overlays, and install the +# appropriate device tree overlay for the current hw-version. + +dt_dir = "/lib/dtoverlays" + +PR = "r1" + +SRC_URI = "git://git.multitech.net/mt-dt-overlay.git;protocol=git" + +SRCREV = "${PV}" + +DEPENDS = "virtual/kernel u-boot-mkimage-native" + +S = "${WORKDIR}/git" + +do_compile[depends] += "virtual/kernel:do_deploy virtual/kernel:do_shared_workdir" +do_compile[nostamp] = "1" + +do_compile () { + echo MACHINE is ${MACHINE} + oe_runmake DTC=/usr/bin/dtc KERNEL_DIR=${STAGING_KERNEL_DIR} KERNEL_BUILD_DIR=${KERNEL_PATH} ${MACHINE}_dtbos +} + +FILES_${PN} = "${dt_dir}" + +addtask install after do_compile + +do_install () { + # Copy files to /lib/dt-overlay/main (mtac cards will be in mtac) + if [ -e ${AT91BOOTSTRAP_MACHINE} ]; then + install -d ${D}/${dt_dir} + ( + cd ${MACHINE} + for f in *.dtbo ; do + if [[ -h $f ]] ; then + cp -df ${f} ${D}/${dt_dir} + else + install ${f} ${D}/${dt_dir} + fi + done + ) + fi; +} + diff --git a/recipes-bsp/multitech/mt-dt-overlay_1.0.1.bb b/recipes-bsp/multitech/mt-dt-overlay_1.0.1.bb new file mode 100644 index 0000000..2714705 --- /dev/null +++ b/recipes-bsp/multitech/mt-dt-overlay_1.0.1.bb @@ -0,0 +1,53 @@ +DESCRIPTION = "Compile MT board device tree overlays" +LICENSE = "(GPLv2+)" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" +PACKAGE_ARCH = "${MACHINE_ARCH}" + +# By using an overlay, we should be able to support multiple pinouts +# using the same image. The overlays go into /lib/dtoverlays. +# There names are: [hw-version]-driver.dtbo +# e.g. /lib/dtoverlays/MTRV1-0.0-pps.dtbo +# The idea is that mts-io will search for the overlays, and install the +# appropriate device tree overlay for the current hw-version. + +dt_dir = "/lib/dtoverlays" + +PR = "r1" + +SRC_URI = "git://git.multitech.net/mt-dt-overlay.git;protocol=git" + +SRCREV = "${PV}" + +DEPENDS = "virtual/kernel u-boot-mkimage-native" + +S = "${WORKDIR}/git" + +do_compile[depends] += "virtual/kernel:do_deploy virtual/kernel:do_shared_workdir" +do_compile[nostamp] = "1" + +do_compile () { + echo MACHINE is ${MACHINE} + oe_runmake DTC=/usr/bin/dtc KERNEL_DIR=${STAGING_KERNEL_DIR} KERNEL_BUILD_DIR=${KERNEL_PATH} ${MACHINE}_dtbos +} + +FILES_${PN} = "${dt_dir}" + +addtask install after do_compile + +do_install () { + # Copy files to /lib/dt-overlay/main (mtac cards will be in mtac) + if [ -e ${AT91BOOTSTRAP_MACHINE} ]; then + install -d ${D}/${dt_dir} + ( + cd ${MACHINE} + for f in *.dtbo ; do + if [[ -h $f ]] ; then + cp -df ${f} ${D}/${dt_dir} + else + install ${f} ${D}/${dt_dir} + fi + done + ) + fi; +} + diff --git a/recipes-bsp/multitech/mtac-eth_1.1.0.bb b/recipes-bsp/multitech/mtac-eth_1.1.0.bb new file mode 100644 index 0000000..f05fc19 --- /dev/null +++ b/recipes-bsp/multitech/mtac-eth_1.1.0.bb @@ -0,0 +1,47 @@ +DESCRIPTION = "MTAC ETH (Ethernet) Card" +HOMEPAGE = "http://www.multitech.net/developer/products/multiconnect-conduit-platform/accessory-cards/mtac-eth/" +SECTION = "base" +PRIORITY = "optional" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" +do_fetch[depends]+="virtual/kernel:do_shared_workdir" +DEPENDS = "virtual/kernel mtac mts-io" +RDEPENDS_${PN} = "kernel-module-mtac" +INC_PR = "r0" + +SRCREV = "${PV}" + +PR = "${INC_PR}.1${KERNEL_MODULE_PACKAGE_SUFFIX}" + +SRC_URI = " \ + git://git.multitech.net/mtac-eth.git;protocol=git \ +" +S = "${WORKDIR}/git" + +inherit module + +EXTRA_OEMAKE = " -C ${STAGING_KERNEL_DIR} \ + EXTRA_CFLAGS='-I${STAGING_INCDIR}/mts-kernel-headers' \ + KBUILD_VERBOSE=1 \ + M=${S} \ + modules \ + " + +do_compile () { + bbnote make "$@" + make "$@" + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS + oe_runmake +} + +PACKAGES = "kernel-module-${PN}" + +FILES_kernel-module-${PN} = "${base_libdir}/modules/${KERNEL_VERSION}/extra/mtac_eth.ko" + +PARALLEL_MAKE = "" + +fakeroot do_install () { + install -m 0755 -d ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra + # use cp instead of install so the driver doesn't get stripped + cp ${S}/mtac_eth.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra +} diff --git a/recipes-bsp/multitech/mtac-gpiob_1.1.2.bb b/recipes-bsp/multitech/mtac-gpiob_1.1.2.bb new file mode 100644 index 0000000..d00c5fa --- /dev/null +++ b/recipes-bsp/multitech/mtac-gpiob_1.1.2.bb @@ -0,0 +1,47 @@ +DESCRIPTION = "MTAC GPIOB Card" +HOMEPAGE = "http://www.multitech.net/developer/products/multiconnect-conduit-platform/accessory-cards/mtac-gpiob/" +SECTION = "base" +PRIORITY = "optional" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" +do_fetch[depends]+="virtual/kernel:do_shared_workdir" +DEPENDS = "virtual/kernel mtac mts-io" +RDEPENDS_${PN} = "kernel-module-mtac" +INC_PR = "r0" + +SRCREV = "${AUTOREV}" + +PR = "${INC_PR}.1${KERNEL_MODULE_PACKAGE_SUFFIX}" + +SRC_URI = " \ + git://git.multitech.net/mtac-gpiob.git;protocol=git \ +" +S = "${WORKDIR}/git" + +inherit module + +EXTRA_OEMAKE = " -C ${STAGING_KERNEL_DIR} \ + EXTRA_CFLAGS='-I${STAGING_INCDIR}/mts-kernel-headers' \ + KBUILD_VERBOSE=1 \ + M=${S} \ + modules \ + " + +do_compile () { + bbnote make "$@" + make "$@" + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS + oe_runmake +} + +PACKAGES = "kernel-module-${PN}" + +FILES_kernel-module-${PN} = "${base_libdir}/modules/${KERNEL_VERSION}/extra/mtac_gpiob.ko" + +PARALLEL_MAKE = "" + +fakeroot do_install () { + install -m 0755 -d ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra + # use cp instead of install so the driver doesn't get stripped + cp ${S}/mtac_gpiob.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra +} diff --git a/recipes-bsp/multitech/mtac-lora_1.1.4.bb b/recipes-bsp/multitech/mtac-lora_1.1.4.bb new file mode 100644 index 0000000..ec4dd21 --- /dev/null +++ b/recipes-bsp/multitech/mtac-lora_1.1.4.bb @@ -0,0 +1,47 @@ +DESCRIPTION = "MTAC LoRa Card" +HOMEPAGE = "http://www.multitech.net/developer/products/multiconnect-conduit-platform/accessory-cards/mtac-lora/" +SECTION = "base" +PRIORITY = "optional" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" +do_fetch[depends]+="virtual/kernel:do_shared_workdir" +DEPENDS = "virtual/kernel mtac mts-io" +RDEPENDS_${PN} = "kernel-module-mtac" +INC_PR = "r0" + +SRCREV = "${PV}" + +PR = "${INC_PR}.1${KERNEL_MODULE_PACKAGE_SUFFIX}" + +SRC_URI = " \ + git://git.multitech.net/mtac-lora.git;protocol=git \ +" +S = "${WORKDIR}/git" + +inherit module + +EXTRA_OEMAKE = " -C ${STAGING_KERNEL_DIR} \ + EXTRA_CFLAGS='-I${STAGING_INCDIR}/mts-kernel-headers' \ + KBUILD_VERBOSE=1 \ + M=${S} \ + modules \ + " + +do_compile () { + bbnote make "$@" + make "$@" + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS + oe_runmake +} + +PACKAGES = "kernel-module-${PN}" + +FILES_kernel-module-${PN} = "${base_libdir}/modules/${KERNEL_VERSION}/extra/mtac_lora.ko" + +PARALLEL_MAKE = "" + +fakeroot do_install () { + install -m 0755 -d ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra + # use cp instead of install so the driver doesn't get stripped + cp ${S}/mtac_lora.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra +} diff --git a/recipes-bsp/multitech/mtac-mfser_1.1.0.bb b/recipes-bsp/multitech/mtac-mfser_1.1.0.bb new file mode 100644 index 0000000..42640f5 --- /dev/null +++ b/recipes-bsp/multitech/mtac-mfser_1.1.0.bb @@ -0,0 +1,47 @@ +DESCRIPTION = "MTAC Multi-Function Serial Card" +HOMEPAGE = "http://www.multitech.net/developer/products/multiconnect-conduit-platform/accessory-cards/mtac-mfser/" +SECTION = "base" +PRIORITY = "optional" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" +do_fetch[depends]+="virtual/kernel:do_shared_workdir" +DEPENDS = "virtual/kernel mtac mts-io" +RDEPENDS_${PN} = "kernel-module-mtac" +INC_PR = "r0" + +SRCREV = "${PV}" + +PR = "${INC_PR}.1${KERNEL_MODULE_PACKAGE_SUFFIX}" + +SRC_URI = " \ + git://git.multitech.net/mtac-mfser.git;protocol=git \ +" +S = "${WORKDIR}/git" + +inherit module + +EXTRA_OEMAKE = " -C ${STAGING_KERNEL_DIR} \ + EXTRA_CFLAGS='-I${STAGING_INCDIR}/mts-kernel-headers' \ + KBUILD_VERBOSE=1 \ + M=${S} \ + modules \ + " + +do_compile () { + bbnote make "$@" + make "$@" + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS + oe_runmake +} + +PACKAGES = "kernel-module-${PN}" + +FILES_kernel-module-${PN} = "${base_libdir}/modules/${KERNEL_VERSION}/extra/mtac_mfser.ko" + +PARALLEL_MAKE = "" + +fakeroot do_install () { + install -m 0755 -d ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra + # use cp instead of install so the driver doesn't get stripped + cp ${S}/mtac_mfser.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra +} diff --git a/recipes-bsp/multitech/mtac-pulse_1.1.0.bb b/recipes-bsp/multitech/mtac-pulse_1.1.0.bb new file mode 100644 index 0000000..4b0195f --- /dev/null +++ b/recipes-bsp/multitech/mtac-pulse_1.1.0.bb @@ -0,0 +1,47 @@ +DESCRIPTION = "MTAC PULSE Card" +HOMEPAGE = "http://www.multitech.net/developer/products/multiconnect-conduit-platform/accessory-cards/mtac-pulse/" +SECTION = "base" +PRIORITY = "optional" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" +do_fetch[depends]+="virtual/kernel:do_shared_workdir" +DEPENDS = "virtual/kernel mtac mts-io" +RDEPENDS_${PN} = "kernel-module-mtac" +INC_PR = "r0" + +SRCREV = "${PV}" + +PR = "${INC_PR}.1${KERNEL_MODULE_PACKAGE_SUFFIX}" + +SRC_URI = " \ + git://git.multitech.net/mtac-pulse.git;protocol=git \ +" +S = "${WORKDIR}/git" + +inherit module + +EXTRA_OEMAKE = " -C ${STAGING_KERNEL_DIR} \ + EXTRA_CFLAGS='-I${STAGING_INCDIR}/mts-kernel-headers' \ + KBUILD_VERBOSE=1 \ + M=${S} \ + modules \ + " + +do_compile () { + bbnote make "$@" + make "$@" + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS + oe_runmake +} + +PACKAGES = "kernel-module-${PN}" + +FILES_kernel-module-${PN} = "${base_libdir}/modules/${KERNEL_VERSION}/extra/mtac_pulse.ko" + +PARALLEL_MAKE = "" + +fakeroot do_install () { + install -m 0755 -d ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra + # use cp instead of install so the driver doesn't get stripped + cp ${S}/mtac_pulse.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra +} diff --git a/recipes-bsp/multitech/mtac-xdot/xdot-util b/recipes-bsp/multitech/mtac-xdot/xdot-util new file mode 100755 index 0000000..f805305 --- /dev/null +++ b/recipes-bsp/multitech/mtac-xdot/xdot-util @@ -0,0 +1,72 @@ +#!/bin/bash + +function detect_hw { + if [ ! -d /sys/devices/platform/mts-io/xdot ]; then + echo "XDOT hardware not found" + exit + fi +} + +function detect_hw_dev { + if [ ! -h /dev/disk/by-label/XDOT ]; then + echo "XDOT dev hardware not found" + exit + fi +} + +function flash { + echo "Flashing new firmware" + cp $FIRMWARE_FILE $TEMP_DIR +} + +function mount_xdot { + TEMP_DIR=`mktemp -d` + mount /dev/disk/by-label/XDOT $TEMP_DIR +} + +function reset { + mts-io-sysfs store xdot/reset 0 + mts-io-sysfs store xdot/reset 1 + mts-io-sysfs store xdot/reset -- -1 &>/dev/null +} + +function usb_reset { + echo 0 > /sys/bus/usb/devices/1-2.1/authorized + sleep 1 + echo 1 > /sys/bus/usb/devices/1-2.1/authorized +} + +function clean_up { + umount $TEMP_DIR + rm -fr $TEMP_DIR +} + +case "$1" in +"flash") + detect_hw_dev + FIRMWARE_FILE=$2 + mts-io-sysfs store xdot/reset -- -1 &>/dev/null + mount_xdot + flash + clean_up + sleep 1 + reset + echo done + ;; +"mount") + detect_hw_dev + mount_xdot + echo Mounted at $TEMP_DIR + ;; +"reset") + detect_hw + reset + ;; +"usb-reset") + detect_hw + usb_reset + ;; +*) ## If no parameters are given, print which are avaiable. + echo "Usage: $0 {flash|mount|reset|usb-reset}" + ;; +esac diff --git a/recipes-bsp/multitech/mtac-xdot_1.1.0.bb b/recipes-bsp/multitech/mtac-xdot_1.1.0.bb new file mode 100644 index 0000000..988a491 --- /dev/null +++ b/recipes-bsp/multitech/mtac-xdot_1.1.0.bb @@ -0,0 +1,54 @@ +DESCRIPTION = "MTAC XDOT (LoRa) Card" +HOMEPAGE = "http://www.multitech.net/developer/products/multiconnect-conduit-platform/accessory-cards/mtac-xdot/" +SECTION = "base" +PRIORITY = "optional" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" +do_fetch[depends]+="virtual/kernel:do_shared_workdir" +DEPENDS = "virtual/kernel mtac mts-io" +RDEPENDS_${PN} = "kernel-module-mtac" +INC_PR = "r2" + +SRCREV = "${PV}" + +PR = "${INC_PR}.1${KERNEL_MODULE_PACKAGE_SUFFIX}" + +SRC_URI = " \ + git://git.multitech.net/mtac-xdot.git;protocol=git \ + file://xdot-util \ +" +S = "${WORKDIR}/git" + +inherit module + +EXTRA_OEMAKE = " -C ${STAGING_KERNEL_DIR} \ + EXTRA_CFLAGS='-I${STAGING_INCDIR}/mts-kernel-headers' \ + KBUILD_VERBOSE=1 \ + M=${S} \ + modules \ + " + +do_compile () { + bbnote make "$@" + make "$@" + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS + oe_runmake +} + + +PACKAGES = "kernel-module-${PN} ${PN}-util" + +FILES_kernel-module-${PN} = "${base_libdir}/modules/${KERNEL_VERSION}/extra/mtac_xdot.ko" + +FILES_${PN}-util += "${sbindir}/xdot-util" + +PARALLEL_MAKE = "" + +fakeroot do_install () { + install -m 0755 -d ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra + # use cp instead of install so the driver doesn't get stripped + cp ${S}/mtac_xdot.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra + + install -m 0755 -d ${D}${sbindir} + install -m 0755 ${WORKDIR}/xdot-util ${D}${sbindir}/xdot-util +} diff --git a/recipes-bsp/multitech/mtac_4.0.3.bb b/recipes-bsp/multitech/mtac_4.0.3.bb new file mode 100644 index 0000000..376dfa1 --- /dev/null +++ b/recipes-bsp/multitech/mtac_4.0.3.bb @@ -0,0 +1,53 @@ +DESCRIPTION = "mtac drivers" +HOMEPAGE = "http://www.multitech.net/" +SECTION = "base" +PRIORITY = "optional" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" +do_fetch[depends]+="virtual/kernel:do_shared_workdir" +DEPENDS = "virtual/kernel mts-io" +INC_PR = "r0" + +# SRCREV = "${PV}" +SRCREV = "${AUTOREV}" + +# Some packages depend on mtac +RPROVIDES_kernel-module-${PN} = "mtac" + +PR = "${INC_PR}.1${KERNEL_MODULE_PACKAGE_SUFFIX}" + +SRC_URI = " \ + git://git.multitech.net/mtac.git;protocol=git \ +" +S = "${WORKDIR}/git" + +inherit module + +EXTRA_OEMAKE = " -C ${STAGING_KERNEL_DIR} \ + EXTRA_CFLAGS='-I${STAGING_INCDIR}/mts-kernel-headers' \ + KBUILD_VERBOSE=1 \ + M=${S} \ + modules \ + " + +do_compile () { + bbnote make "$@" + make "$@" + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS + oe_runmake +} + +PACKAGES = "kernel-module-${PN} ${PN}-dev" + +FILES_kernel-module-${PN} = "${base_libdir}/modules/${KERNEL_VERSION}/extra/mtac.ko" + +PARALLEL_MAKE = "" + +fakeroot do_install () { + install -m 0755 -d ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra + # use cp instead of install so the driver doesn't get stripped + cp ${S}/mtac.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra + + install -d ${D}${includedir}/mts-kernel-headers/linux + install -m 0644 ${S}/mtac.h ${D}${includedir}/mts-kernel-headers/linux +} diff --git a/recipes-bsp/multitech/mts-io.inc b/recipes-bsp/multitech/mts-io.inc new file mode 100644 index 0000000..5b1dccc --- /dev/null +++ b/recipes-bsp/multitech/mts-io.inc @@ -0,0 +1,118 @@ +DESCRIPTION = "mts-io controller and sysfs wrapper" +HOMEPAGE = "http://www.multitech.net/" +SECTION = "base" +PRIORITY = "optional" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://io-module/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ + file://io-tool/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ +" +DEPENDS = "virtual/kernel" +INC_PR = "r1" + +SRCREV = "${PV}" + +PR = "${INC_PR}.1-${KERNEL_MODULE_PACKAGE_SUFFIX}" + +SRC_URI = " \ + git://git.multitech.net/mts-io.git;protocol=git \ + file://led-status_heartbeat_trigger \ + file://lora-led-updater \ + file://mts-io.init \ + file://mts-io.blacklist \ + file://mts-io.mtcap.init \ + file://mts-io.conf \ +" +S = "${WORKDIR}/git" + +inherit module +inherit update-rc.d +inherit autotools + +# add this since we aren't using module.bbclass +addtask make_scripts after do_patch before do_compile +do_make_scripts[lockfiles] = "${TMPDIR}/kernel-scripts.lock" +do_make_scripts[deptask] = "do_populate_sysroot" + +EXTRA_OEMAKE = " -C ${STAGING_KERNEL_DIR} \ + KBUILD_VERBOSE=1 \ + M=${S}/io-module \ + modules \ + " + +do_compile () { + bbnote make "$@" + make "$@" + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS + oe_runmake +} + + +PACKAGES = "${PN}-noarch kernel-module-${PN} ${PN}-util ${PN}-util-dbg ${PN}-dev" + +FILES_kernel-module-${PN} = " \ + ${base_libdir}/modules/${KERNEL_VERSION}/extra/mts_io.ko \ + ${sysconfdir}/modprobe.d/mts-io.conf \ +" + +FILES_${PN}-noarch = "${sysconfdir}/init.d/mts-io \ + ${sysconfdir}/rc5.d/S95led-status_heartbeat_trigger \ + ${sysconfdir}/default/mts-io \ + ${sysconfdir}/init.d/led-status_heartbeat_trigger" + + +FILES_${PN}-noarch += "${libdir}/mts-io-sysfs*" +FILES_${PN}-noarch += "${sbindir}/mts-io-sysfs" +FILES_${PN}-noarch_append_mtcap += "${sbindir}/lora-led-updater" +FILES_${PN}-util += "${sbindir}/mts-util-lora2-reset" +FILES_${PN}-util-dbg += "/usr/src /usr/sbin/.debug" +FILES_${PN}-dev += "${includedir}/linux ${includedir}/mts-kernel-headers" + +INITSCRIPT_NAME = "mts-io" +INITSCRIPT_PARAMS = "start 39 S ." + +PARALLEL_MAKE = "" + +fakeroot do_install () { + make DESTDIR=${D} install + install -m 0755 -d ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra + # use cp instead of install so the driver doesn't get stripped + cp ${S}/io-module/mts_io.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra + + # install headers for kernel modules + install -d ${D}${includedir}/mts-kernel-headers/linux + install -m 0644 ${S}/io-module/mts_io.h ${D}${includedir}/mts-kernel-headers/linux + install -m 0644 ${S}/io-module/mts_eeprom.h ${D}${includedir}/mts-kernel-headers/linux + install -m 0644 ${S}/io-module/at91gpio.h ${D}${includedir}/mts-kernel-headers/linux + + # install same headers for userspace applications + # Note this dupication can be avoided by adding the following into the recipes + # CFLAGS += ${STAGING_INCDIR}/mts-kernel-headers + # + install -d ${D}${includedir}/linux + install -m 0644 ${S}/io-module/mts_io.h ${D}${includedir}/linux + install -m 0644 ${S}/io-module/mts_eeprom.h ${D}${includedir}/linux + install -m 0644 ${S}/io-module/at91gpio.h ${D}${includedir}/linux + + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/mts-io.init ${D}${sysconfdir}/init.d/mts-io + install -m 0755 ${WORKDIR}/led-status_heartbeat_trigger ${D}/${sysconfdir}/init.d/ + install -d ${D}${sysconfdir}/default + install -m 0755 ${WORKDIR}/mts-io.conf ${D}${sysconfdir}/default/mts-io + install -d ${D}${sysconfdir}/modprobe.d + install -m 0644 ${WORKDIR}/mts-io.blacklist ${D}${sysconfdir}/modprobe.d/mts-io.conf + + # blink status LED after booted + install -d ${D}${sysconfdir}/rc5.d + ln -sf ${sysconfdir}/init.d/led-status_heartbeat_trigger ${D}/${sysconfdir}/rc5.d/S95led-status_heartbeat_trigger + + install -m 0755 -d ${D}${sbindir} + install -d ${D}${libdir}/mts-io-sysfs + install -m 0755 ${S}/io-tool/mts-io-sysfs-inc.sh ${D}${libdir}/mts-io-sysfs + install -m 0755 ${S}/io-tool/mts-io-sysfs ${D}${sbindir}/mts-io-sysfs +} + +fakeroot do_install_append_mtcap() { + # install MTCAP mts-io init script + install -m 0755 ${WORKDIR}/mts-io.mtcap.init ${D}${sysconfdir}/init.d/mts-io + install -m 0755 ${WORKDIR}/lora-led-updater ${D}${sbindir}/lora-led-updater +} diff --git a/recipes-bsp/multitech/mts-io/led-status_heartbeat_trigger b/recipes-bsp/multitech/mts-io/led-status_heartbeat_trigger new file mode 100755 index 0000000..88910df --- /dev/null +++ b/recipes-bsp/multitech/mts-io/led-status_heartbeat_trigger @@ -0,0 +1,6 @@ +#!/bin/bash + +TRIGGER="/sys/class/leds/led-status/trigger" + +echo "setting $TRIGGER to heartbeat" +echo "heartbeat" > $TRIGGER diff --git a/recipes-bsp/multitech/mts-io/lora-led-updater b/recipes-bsp/multitech/mts-io/lora-led-updater new file mode 100755 index 0000000..0e38310 --- /dev/null +++ b/recipes-bsp/multitech/mts-io/lora-led-updater @@ -0,0 +1,14 @@ +#!/bin/bash + +while true; do + # If driver is unloaded, stop. + [[ -d /sys/devices/platform/mts-io ]] || exit 0 + fuser /dev/spidev0.0 > /dev/null + if [ $? == 0 ]; then + mts-io-sysfs store led-lora 1 >/dev/null 2>&1 + else + mts-io-sysfs store led-lora 0 >/dev/null 2>&1 + fi + sleep 5 +done + diff --git a/recipes-bsp/multitech/mts-io/mts-io.blacklist b/recipes-bsp/multitech/mts-io/mts-io.blacklist new file mode 100644 index 0000000..7421ac4 --- /dev/null +++ b/recipes-bsp/multitech/mts-io/mts-io.blacklist @@ -0,0 +1 @@ +blacklist mts-io diff --git a/recipes-bsp/multitech/mts-io/mts-io.conf b/recipes-bsp/multitech/mts-io/mts-io.conf new file mode 100644 index 0000000..b5b4275 --- /dev/null +++ b/recipes-bsp/multitech/mts-io/mts-io.conf @@ -0,0 +1,9 @@ +# GPS GNSS reset when loading driver +# 1 Reset the GPS on driver load (default) +# 0 Do not reset +GPSGNSSRESET=1 + +# DEBUG +# 0 is off +# 1 is on +DEBUG=0 diff --git a/recipes-bsp/multitech/mts-io/mts-io.init b/recipes-bsp/multitech/mts-io/mts-io.init new file mode 100755 index 0000000..966d5ae --- /dev/null +++ b/recipes-bsp/multitech/mts-io/mts-io.init @@ -0,0 +1,405 @@ +#!/bin/bash +### BEGIN INIT INFO +# Provides: mts-io +# Default-Start: S +# Default-Stop: +# Short-Description: load the mts-io driver +# Description: mts-io driver initializes the Conduit hardware and +# provides user mode access through the driver to the +# Conduit features. +### END INIT INFO + +. /etc/default/mts-io + +i2c=/sys/bus/i2c/devices/ +GPSCONFIGTYPE="/var/run/config/gpstype" +DEVTREE="/sys/kernel/config/device-tree/overlays/" + +((fail=0)) +# To log debug, set LOGDBG to /usr/bin/LOGGER +if ((DEBUG)) ; then + LOGDBG=/usr/bin/logger + ${LOGDBG} -t "mts-io" -p daemon.info -s "LOGDBG turned on" +else + LOGDBG=":" +fi + +hw="" +hw_name="" +MTAC_MODULES="" +((HASAP=0)) + +sethwtype() { + # mts-io must be loaded before trying this + hw=$(${SYSFS} show hw-version) + hw_name=(${hw//-/ }) + + # Only MTCDT and MTCDTIP have accessory cards, and + # MTCDTIPHP does not have accessory cards. + ((HASAP==0)) + case $hw_name in + MTCDTIPHP) + ;; + MTCDT|MTCDTIP) + ((HASAP = 1)) + ;; + *) + ;; + esac + MTAC_MODULES=$(cd /lib/modules/$(uname -r)/extra/;ls mtac_* 2>/dev/null) +} + +setdevtree() { + # add device tree overlays, if they exist. + [[ -d /lib/dtoverlays ]] || return 1 + ( + cd /lib/dtoverlays + for f in $(ls ${hw}*) ; do + if ! [[ -d ${DEVTREE} ]] ; then + mount configfs + fi + f1=${f/#${hw}-/} + f2=${f1/%.dtbo} + # f2 is the extracted device name + /bin/mkdir ${DEVTREE}/$f2 + /bin/cat $f >${DEVTREE}/$f2/dtbo + done + ) +} + + +SYSFS="/usr/sbin/mts-io-sysfs" +LRST="/usr/sbin/mts-util-lora2-reset" + +${LOGDBG} -p daemon.info 'mts-io script' +sysdir=/sys/devices/platform/mts-io +gpiodir=/sys/class/gpio +port1=${sysdir}/ap1 +port2=${sysdir}/ap2 + +USBRST=${sysdir}/usbhub-reset +NEED_I2C_RESET=0 +HWVER="" +HWNAME="" +HWLVL="" + + +RST[0]="${sysdir}/wifi-bt-reset" +RST[1]="${sysdir}/mtq-reset" +RST[2]="${sysdir}/ap1/reset" +RST[3]="${sysdir}/ap1/creset" +RST[4]="${sysdir}/ap2/reset" +RST[5]="${sysdir}/ap2/creset" +RST[6]="${sysdir}/secure-reset" +RST[7]="${sysdir}/eth-reset" +RST[8]="${sysdir}/sm1-reset" + +# GPSGNSSRESET is now set low during boot and is special cased. +#if ((GPSGNSSRESET)) ; then +# RST[9]="${sysdir}/gnss-reset" +#fi + +WPIN[0]="${sysdir}/ap1/cdone" +WPIN[1]="${sysdir}/ap2/cdone" + +USLPTIME=60000 # 30 milliseconds from Redpine Signals Reset Spec +WAIT="/bin/busybox usleep ${USLPTIME}" + +# Wait 10 WAIT intervals for pins to come high +waitpins() { + ((i=0)) + while((i < ${#WPIN[@]})) ; do + ((j=0)) + while [[ -r ${WPIN[$i]} ]] && ! (($(cat ${WPIN[$i]}))) ; do + logger -t "mts-io" -p daemon.error -s "Wait on ${WPIN[$i]}" + ${WAIT} + ((j++)) + if ((j > 10)) ; then + ((fail++)) + ${LOGDBG} -t "mts-io" -p daemon.error -s "Ready failure on ${WPIN[$i]}" + break + fi + done + ((i++)) + done +} + +reset_path() { + pin=$1 + ${LOGDBG} -t "mts-io" -p daemon.info Reset $pin + if [[ -f ${pin} ]] ; then + if ! ( (echo 1 >${pin}) && ${WAIT} && (echo 0 >${pin}) && ${WAIT} && (echo 1 >${pin}) ) ; then + /usr/bin/logger -t "mts-io" -p daemon.error -s "Failed write to ${pin}" + return 1 + fi + sleep 2 + + ${LOGDBG} -t "mts-io" -p daemon.info Completeed reset $pin + else + ${LOGDBG} -t "mts-io" -p daemon.info "${pin} does not exist" + fi + return 0 +} +reset_array() { + ((i=${#RST[@]}-1)) + while ((i>=0)) ; do + if [[ -f ${RST[$i]} ]] ; then + if ! ( (echo 1 >${RST[i]}) ) ; then + /usr/bin/logger -t "mts-io" -p daemon.error -s "Failed write to ${RST[$i]}" + fail=1 + else + ${LOGDBG} -t "mts-io" -p daemon.error -s "Wrote 1 to ${RST[$i]}" + fi + else + ${LOGDBG} -t "mts-io" -p daemon.info "${RST[$i]} does not exist" + RST[$i]="" + fi + ((i--)) + done + ((DBG)) && (cd $sysdir ; head gnss-reset eth-reset wifi-bt-reset usbhub-reset | logger -p daemon.info) + ((i=${#RST[@]}-1)) + while ((i>=0)) ; do + ${LOGDBG} -s -p daemon.info "i value is $i RST is ${RST[$i]} count is ${#RST[$i]}" + if ((${#RST[$i]} > 0)) && [[ -f ${RST[$i]} ]] ; then + if ! ( (echo 0 >${RST[i]}) ) ; then + /usr/bin/logger -t "mts-io" -p daemon.error -s "Failed write to ${RST[$i]}" + fail=1 + else + ${LOGDBG} -t "mts-io" -p daemon.error -s "Wrote 0 to ${RST[$i]}" + : + fi + else + ${LOGDBG} -t "mts-io" -p daemon.info "${RST[$i]} does not exist" + fi + ((i--)) + done + ${WAIT} + ((DBG)) && (cd $sysdir ; head gnss-reset eth-reset wifi-bt-reset usbhub-reset | logger -p daemon.info) + ((i=${#RST[@]}-1)) + while ((i>=0)) ; do + if ((${#RST[$i]} > 0)) && [[ -f ${RST[$i]} ]] ; then + if ! ( (echo 1 >${RST[$i]}) ) ; then + /usr/bin/logger -t "mts-io" -p daemon.error -s "Failed write to ${RST[$i]}" + fail=1 + else + ${LOGDBG} -t "mts-io" -p daemon.error -s "Wrote 1 to ${RST[$i]}" + fi + else + ${LOGDBG} -t "mts-io" -p daemon.info "${RST[$i]} does not exist" + fi + ((i--)) + done + ((DBG)) && (cd $sysdir ; head gnss-reset eth-reset wifi-bt-reset usbhub-reset | logger -p daemon.info) + return $fail +} +read_card_info() { + ap1_product_id="" + ap2_product_id="" + + if [[ -d $sysdir/ap1 ]]; then + ap1_product_id=$(cat $sysdir/ap1/product-id) + fi + if [[ -d $sysdir/ap2 ]]; then + ap2_product_id=$(cat $sysdir/ap2/product-id) + fi + + lora_hw=$(${SYSFS} show lora/hw-version 2> /dev/null) + + if [ -d $port1 ] && [[ $(cat $port1/hw-version) = $lora_hw ]]; then + modprobe spidev + ln -sf /dev/spidev32766.2 /dev/spidev0.0 + elif [ -d $port2 ] && [[ $(cat $port2/hw-version) = $lora_hw ]]; then + modprobe spidev + ln -sf /dev/spidev32765.2 /dev/spidev0.0 + elif [[ ${hw_name} == MTCAP ]]; then + modprobe spidev + elif [[ ${hw_name} == MTCDTIPHP ]]; then + modprobe spidev + ln -sf /dev/spidev32766.2 /dev/spidev0.0 + fi +} + +mfser_init() { + found_ap1=0 + + if [[ $ap1_product_id =~ ^MTAC-MFSER- ]]; then + /usr/bin/logger -t "mts-io" -p daemon.info -s "Linking /dev/mfser to /dev/ttyAP1" + ln -sf /dev/ttyAP1 /dev/mfser + found_ap1=1 + fi + + if [[ $ap2_product_id =~ ^MTAC-MFSER- ]]; then + if [[ $found_ap1 = 1 ]]; then + /usr/bin/logger -t "mts-io" -p daemon.info -s "Linking /dev/mfser-2 to /dev/ttyAP2" + ln -sf /dev/ttyAP2 /dev/mfser-2 + else + /usr/bin/logger -t "mts-io" -p daemon.info -s "Linking /dev/mfser to /dev/ttyAP2" + ln -sf /dev/ttyAP2 /dev/mfser + fi + fi + +} + +set_gpslink() { + [[ -d /var/run/config ]] || mkdir /var/run/config + gpscap=$(cat ${sysdir}/capability/gps) + + # For all hardware except MTCDTIPHP, the gpscapability + # flag indicates whether or not we have a GPS. + if ! [[ ${hw_name} =~ ^MTCDTIPHP$ ]] && ((gpscap == 0)) ; then + return + fi + + # Oldest MTRV1 uses venuse on ttyS1. + if [[ ${hw_name} == MTRV1 ]] && [[ ${hw} != MTRV1-0.0 ]] ; then + ln -sf /dev/ttyXRUSB0 /dev/gps0 + echo "u-blox" >"$GPSCONFIGTYPE" + return + fi + + if [[ ${hw_name} == MTR ]] || [[ ${hw_name} == MTRV1 ]] || [[ ${hw_name} == MTHS ]] ; then + ln -sf /dev/ttyS1 /dev/gps0 + echo "venus" >"$GPSCONFIGTYPE" + return + fi + + if [[ ${hw} == MTCDT ]] && [[ ${HWLVL} == 0.0 ]] ; then + # No GPS + return + fi + if [[ ${hw_name} == MTCDTIPHP ]] ; then + NEED_I2C_RESET=1 + ln -sf /dev/ttyXRUSB0 /dev/gps0 + return + fi + # Default MTCDT-0.1 + echo "u-blox" >"$GPSCONFIGTYPE" + ln -sf /dev/ttyXRUSB2 /dev/gps0 +} + +case $1 in + start) + # Point the firmware API at our i2c EEPROMs + echo -n ${i2c} > /sys/module/firmware_class/parameters/path + + /usr/bin/logger -t "mts-io" -p daemon.info -s "Loading mts-io module" + if ! modprobe mts_io ; then + ((fail++)) + fi + + sethwtype + setdevtree + + if ((HASAP == 1)) ; then + # install mtac explicitly or any unused modules will cause + # junk to the log as mtac is loaded and unloaded each time. + modprobe mtac + for f in ${MTAC_MODULES} ; do + modprobe ${f//.ko} 2>&1 | grep -v 'No such device or address' + done + fi + set_gpslink # Set GPS symlink. + /usr/bin/logger -t "mts-io" -p daemon.info -s "Resetting system modules" + read_card_info + has_gnss_reset=0 + # On boot, gnss-reset will be low + if [[ -f ${sysdir}/gnss-reset ]] ; then + if (($(mts-io-sysfs show gnss-reset) == 1)) ; then + mts-io-sysfs store gnss-reset 0 + fi + has_gnss_reset=1 + fi + /bin/busybox usleep $USLPTIME + reset_array + if ((has_gnss_reset)) ; then + mts-io-sysfs store gnss-reset 1 + fi + # use radio-reset init script for radio-reset + mfser_init + + waitpins + # Fix Telit error -62 and Redpine wrong USB speed detection on reset. + sleep 1 + if ! reset_path $USBRST ; then + ((fail++)) + fi + + if ((${#lora_hw} > 0)) && [[ ${lora_hw} =~ ^MTCDTIPHP-LORA-2\.1 ]] ; then + if [[ -x ${LRST} ]] ; then + ${LRST} -g -f + else + /usr/bin/logger -t "mts-io" -p daemon.err -s "ERROR: Missing ${LRST} -- Cannot initialize LoRa." + fi + fi + + if [[ -d ${DEVTREE} ]] ; then + /bin/umount configfs + fi + + if ((fail == 0)) ; then + echo "OK" + else + echo "FAIL" + fi + exit $fail + ;; + + stop) + /usr/bin/logger -t "mts-io" -p daemon.info -s "Unloading mtac modules and mts-io module" + MTAC_MODULES=$(lsmod | grep '^mtac_' | sed -e 's/_/-/' -e 's/ .*//') + + for f in ${MTAC_MODULES} ; do + if ! modprobe -r "$f" ; then + rmmod "$f" + fi + done + if ! modprobe -r mtac ; then + rmmod mtac + fi + + if ! modprobe -r mts-io ; then + rmmod mtsio + fi + RETVAL=$? + if ((RETVAL == 0)) ; then + echo "OK" + else + echo "FAIL" + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + reload) + /usr/bin/logger -t "mts-io" -p daemon.info -s "Resetting system modules" + if ! reset_path $USBRST ; then + ((fail++)) + fi + /bin/busybox usleep $USLPTIME + reset_array + # Use radio-reset init script for radio-reset + mfser_init + if ((fail == 0)) ; then + echo "OK" + else + echo "FAIL" + fi + exit $fail + ;; + status) + if [[ -d ${sysdir} ]] ; then + echo Driver is loaded + exit 0 + else + echo Driver is not loaded + exit 3 + fi + ;; + *) + echo "Usage: $0 {start|stop|status|restart}" + exit 2 + ;; +esac + diff --git a/recipes-bsp/multitech/mts-io/mts-io.mtcap.init b/recipes-bsp/multitech/mts-io/mts-io.mtcap.init new file mode 100644 index 0000000..2642de9 --- /dev/null +++ b/recipes-bsp/multitech/mts-io/mts-io.mtcap.init @@ -0,0 +1,122 @@ +#!/bin/bash + +sysdir=/sys/devices/platform/mts-io + +i2c=/sys/bus/i2c/devices/ + +DEVTREE="/sys/kernel/config/device-tree/overlays/" +SYSFS="/usr/sbin/mts-io-sysfs" + +setwificap() { + WIFICAP=0 + if [[ -f ${sysdir}/capability/wifi ]] && (($(cat ${sysdir}/capability/wifi) == 1)) ; then + WIFICAP=1 + fi +} + +lora_init() { + # reset lora chip + mts-io-sysfs store lora/reset 1 + mts-io-sysfs store lora/reset 0 + usleep 100000 + mts-io-sysfs store lora/reset 1 +} + +eth_init() { + # reset eth phy + mts-io-sysfs store eth-reset 1 + mts-io-sysfs store eth-reset 0 + usleep 100000 + mts-io-sysfs store eth-reset 1 +} + +# Normal state when powered up +wifi_init1() { + (($WIFICAP)) || return 0 + # reset wlan + mts-io-sysfs store wlan-rst 0 + # disable wlan + mts-io-sysfs store wlan-en 0 +} + +wifi_init2() { + (($WIFICAP)) || return 0 + mts-io-sysfs store wlan-en 1 + usleep 30000 # 30mS according to WILC1000 spec. + mts-io-sysfs store wlan-rst 1 +} + + +cell_init() { + # remove /dev/modem_at[0,1] symlinks + rm -f /dev/modem_at[0,1] + + if [ -w /sys/devices/platform/mts-io/radio-power ] ; then + # power down the cellular chip gracefully + mts-io-sysfs store radio-power 0 + # power up the cellular chip + mts-io-sysfs store radio-power 1 + fi +} + +start_lora_led_updater() { + lora-led-updater & +} + +setdevtree() { + hw=$(${SYSFS} show hw-version) + + # add device tree overlays, if they exist. + [[ -d /lib/dtoverlays ]] || return 1 + ( + cd /lib/dtoverlays + for f in $(ls ${hw}*) ; do + if ! [[ -d ${DEVTREE} ]] ; then + mount configfs + fi + f1=${f/#${hw}-/} + f2=${f1/%.dtbo} + # f2 is the extracted device name + /bin/mkdir ${DEVTREE}/$f2 + /bin/cat $f >${DEVTREE}/$f2/dtbo + done + ) +} + +case $1 in + start) + # SPI driver for LoRa + modprobe spidev + # Point the firmware API at our i2c EEPROMs + echo -n ${i2c} > /sys/module/firmware_class/parameters/path + echo "Loading mts-io module" + modprobe -r atmel_mci + # Point the firmware API at our i2c EEPROMs + echo -n ${i2c} > /sys/module/firmware_class/parameters/path + modprobe mts_io + setdevtree + setwificap + wifi_init1 + lora_init + eth_init + cell_init & + start_lora_led_updater + wifi_init2 + modprobe atmel_mci + (($WIFICAP)) && modprobe wilc1000 + (($WIFICAP)) && modprobe wilc1000-sdio + ;; + + stop) + echo "Unloading mts-io module" + wifi_init1 # Power down wifi + modprobe -r wilc1000 >/dev/null 2>&1 + modprobe -r wilc1000-sdio >/dev/null 2>&1 + modprobe -r mts_io >/dev/null 2>&1 + ;; + + *) + echo "Usage: $0 {start|stop}" + exit 2 + ;; +esac diff --git a/recipes-bsp/multitech/mts-io_4.1.4.bb.save b/recipes-bsp/multitech/mts-io_4.1.4.bb.save new file mode 100644 index 0000000..92937cd --- /dev/null +++ b/recipes-bsp/multitech/mts-io_4.1.4.bb.save @@ -0,0 +1,4 @@ +require mts-io.inc + +PR = "${INC_PR}.0-${MLINUX_KERNEL_VERSION}${MLINUX_KERNEL_EXTRA_VERSION}" + diff --git a/recipes-bsp/multitech/mts-io_4.3.2.bb.save b/recipes-bsp/multitech/mts-io_4.3.2.bb.save new file mode 100644 index 0000000..92937cd --- /dev/null +++ b/recipes-bsp/multitech/mts-io_4.3.2.bb.save @@ -0,0 +1,4 @@ +require mts-io.inc + +PR = "${INC_PR}.0-${MLINUX_KERNEL_VERSION}${MLINUX_KERNEL_EXTRA_VERSION}" + diff --git a/recipes-bsp/multitech/u-boot-linux-utils/DEFAULT_ENV.cfg b/recipes-bsp/multitech/u-boot-linux-utils/DEFAULT_ENV.cfg new file mode 100644 index 0000000..261fc86 --- /dev/null +++ b/recipes-bsp/multitech/u-boot-linux-utils/DEFAULT_ENV.cfg @@ -0,0 +1 @@ +"ethact=macb0\0" "stderr=serial\0" "stdin=serial\0" "stdout=serial\0" diff --git a/recipes-bsp/multitech/u-boot-linux-utils_0.2.1.bb b/recipes-bsp/multitech/u-boot-linux-utils_0.2.1.bb new file mode 100644 index 0000000..65ea852 --- /dev/null +++ b/recipes-bsp/multitech/u-boot-linux-utils_0.2.1.bb @@ -0,0 +1,25 @@ +DESCRIPTION = "U-Boot Linux Utilities" +HOMEPAGE = "http://www.multitech.net/" +SECTION = "console/utils" +PRIORITY = "optional" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" + +# Defaults are different depending on machine type. +PACKAGE_ARCH = "${MACHINE_ARCH}" + +PR = "r1" + +DEPENDS = "mtd-utils u-boot" + +# tag 0.2.1 +SRCREV = "fce83ee60201d82ec22f14baac9fd7382a0ad4ac" + +SRC_URI = "git://git.multitech.net/u-boot-linux-utils.git;protocol=git \ + file://DEFAULT_ENV.cfg" + +S = "${WORKDIR}/git" +CFLAGS += "-idirafter ${STAGING_DIR_TARGET}/usr/include/u-boot" +inherit autotools + +PARALLEL_MAKE = "" diff --git a/recipes-bsp/ti-wifi-utils/ti-wifi-utils/plt_drop_insmod_rmmod.patch b/recipes-bsp/ti-wifi-utils/ti-wifi-utils/plt_drop_insmod_rmmod.patch new file mode 100644 index 0000000..5bdafef --- /dev/null +++ b/recipes-bsp/ti-wifi-utils/ti-wifi-utils/plt_drop_insmod_rmmod.patch @@ -0,0 +1,35 @@ +--- a/plt.c 2016-05-31 17:23:45.000000000 +0300 ++++ b/plt.c 2016-05-31 18:04:25.022788401 +0300 +@@ -1158,10 +1158,10 @@ + } + + /* Load module */ +- res = insmod(modpath); +- if (res) { +- goto out_removenvs; +- } ++// res = insmod(modpath); ++// if (res) { ++// goto out_removenvs; ++// } + + res = plt_do_power_on(state, devname); + if (res < 0) +@@ -1188,7 +1188,7 @@ + + /* we can ignore the return value, because we rmmod anyway */ + plt_do_power_off(state, devname); +- rmmod(modpath); ++// rmmod(modpath); + + printf("Calibration done. "); + if (cmn.fem0_bands) { +@@ -1214,7 +1214,7 @@ + /* we can ignore the return value, because we rmmod anyway */ + plt_do_power_off(state, devname); + out_rmmod: +- rmmod(modpath); ++// rmmod(modpath); + + out_removenvs: + fprintf(stderr, "Calibration not complete. Removing half-baked nvs\n"); diff --git a/recipes-bsp/ti-wifi-utils/ti-wifi-utils/upgrade_libnl_to_32.patch b/recipes-bsp/ti-wifi-utils/ti-wifi-utils/upgrade_libnl_to_32.patch new file mode 100644 index 0000000..c5b6efa --- /dev/null +++ b/recipes-bsp/ti-wifi-utils/ti-wifi-utils/upgrade_libnl_to_32.patch @@ -0,0 +1,28 @@ +--- a/Makefile 2016-05-31 17:23:45.000000000 +0300 ++++ b/Makefile 2016-05-31 17:36:55.582844952 +0300 +@@ -1,21 +1,12 @@ + CC = $(CROSS_COMPILE)gcc + CFLAGS = -O2 -Wall +-CFLAGS += -I$(NFSROOT)/usr/include -I$(NFSROOT)/include ++CFLAGS += -I=/usr/include -I=/include -I=/usr/include/libnl3 + +-ifdef NLROOT +-CFLAGS += -I${NLROOT} +-endif +- +-LDFLAGS += -L$(NFSROOT)/lib ++LDFLAGS += -L=/lib + LIBS += -lm + +-ifeq ($(NLVER),3) +- CFLAGS+=-DCONFIG_LIBNL32 +- LIBS += -lnl-3 -lnl-genl-3 +-else +- CFLAGS+=-DCONFIG_LIBNL20 +- LIBS += -lnl -lnl-genl +-endif ++CFLAGS+=-DCONFIG_LIBNL32 ++LIBS += -lnl-3 -lnl-genl-3 + + OBJS = nvs.o misc_cmds.o calibrator.o plt.o wl18xx_plt.o ini.o + diff --git a/recipes-bsp/ti-wifi-utils/ti-wifi-utils_R8.7.bb b/recipes-bsp/ti-wifi-utils/ti-wifi-utils_R8.7.bb new file mode 100644 index 0000000..ee3ca65 --- /dev/null +++ b/recipes-bsp/ti-wifi-utils/ti-wifi-utils_R8.7.bb @@ -0,0 +1,51 @@ +DESCRIPTION = "The calibrator and other useful utilities for TI wireless solution based on wl12xx driver" +HOMEPAGE = "http://software-dl.ti.com/ecs/WiLink8/latest/index_FDS.html" +SECTION = "console/utils" +PRIORITY = "optional" +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD;md5=3775480a712fc46a69647678acb234cb" +DEPENDS = "libnl" +# ti-compat-wireless-wl12xx +RDEPENDS_${PN} = "wl12xx-firmware" + +inherit autotools-brokensep + +do_compile () { + unset CFLAGS LDFLAGS CXXFLAGS CPPFLAGS + # For Newer Yocto/Bitbake, CC does not + # include the staging directory + # by default + CC="${CC} --sysroot=${STAGING_DIR_HOST}" + LD="${LD} --sysroot=${STAGING_DIR_HOST}" + oe_runmake CC="${CC}" LD="${LD}" +} + +PR = "r2" +# tag R8.7 +SRCREV = "39542357111d1f24e866c2857d561a348c04cce4" + +SRC_URI = " \ + git://git.ti.com/wilink8-wlan/18xx-ti-utils.git;protocol=git;branch=master \ + file://upgrade_libnl_to_32.patch \ + file://plt_drop_insmod_rmmod.patch " + + + +S = "${WORKDIR}/git" + +export CROSS_COMPILE = "${TARGET_PREFIX}" + +do_install() { + install -d ${D}${bindir} + install -d ${D}${datadir}/ti/wifi-utils/ini_files/127x + install -d ${D}${datadir}/ti/wifi-utils/ini_files/128x + + install -m 0755 calibrator ${D}${bindir}/ + install -m 0755 ${S}/hw/ini_files/127x/* ${D}${datadir}/ti/wifi-utils/ini_files/127x + install -m 0755 ${S}/hw/ini_files/128x/* ${D}${datadir}/ti/wifi-utils/ini_files/128x +} + +FILES_${PN} += " \ + ${datadir}/ti/wifi-utils/ini_files/127x \ + ${datadir}/ti/wifi-utils/ini_files/128x \ +" diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/config.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/config.patch new file mode 100644 index 0000000..658fdec --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/config.patch @@ -0,0 +1,42 @@ +diff -Naru old/configs/at91sam9x5ek_nandflash_defconfig new/configs/at91sam9x5ek_nandflash_defconfig +--- old/configs/at91sam9x5ek_nandflash_defconfig 2019-04-09 18:00:13.342337484 -0500 ++++ new/configs/at91sam9x5ek_nandflash_defconfig 2019-04-15 12:06:49.171618119 -0500 +@@ -1,9 +1,9 @@ + CONFIG_ARM=y + CONFIG_ARCH_AT91=y + CONFIG_TARGET_AT91SAM9X5EK=y +-CONFIG_SPL=y ++CONFIG_SPL=n + CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9X5,SYS_USE_NANDFLASH" +-CONFIG_BOOTDELAY=3 ++CONFIG_BOOTDELAY=0 + CONFIG_HUSH_PARSER=y + CONFIG_SYS_PROMPT="U-Boot> " + CONFIG_CMD_BOOTZ=y +@@ -12,7 +12,7 @@ + # CONFIG_CMD_FLASH is not set + CONFIG_CMD_MMC=y + CONFIG_CMD_SF=y +-CONFIG_CMD_USB=y ++CONFIG_CMD_USB=n + # CONFIG_CMD_FPGA is not set + # CONFIG_CMD_SETEXPR is not set + CONFIG_CMD_DHCP=y +@@ -23,3 +23,17 @@ + CONFIG_USB=y + CONFIG_USB_STORAGE=y + CONFIG_OF_LIBFDT=y ++ ++CONFIG_OF_CONTROL=n ++CONFIG_CMD_TFTPPUT=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_NAND=y ++CONFIG_CMD_BOOTZ=y ++CONFIG_CMD_MII=y ++CONFIG_CMD_I2C=y ++ ++# The config option CONFIG_SILENT_CONSOLE can be used to quiet messages ++# on the console. If the option has been enabled, the output can be ++# silenced by setting the environment variable "silent" ++CONFIG_SILENT_CONSOLE=y ++CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC=y diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/fix_2_6.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/fix_2_6.patch new file mode 100644 index 0000000..43ca78f --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/fix_2_6.patch @@ -0,0 +1,40 @@ +From 91314dd05aa6848049501a10266f2cf4e530f904 Mon Sep 17 00:00:00 2001 +From: Serhii Voloshynov <serhii.voloshynov@globallogic.com> +Date: Fri, 17 Jan 2020 16:47:26 +0200 +Subject: [PATCH] fix compile error in Yocto-2.6 + +--- + include/libfdt.h | 4 ++-- + include/libfdt_env.h | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/include/libfdt.h b/include/libfdt.h +index b6a400a..310d571 100644 +--- a/include/libfdt.h ++++ b/include/libfdt.h +@@ -1,5 +1,5 @@ +-#ifndef _LIBFDT_H +-#define _LIBFDT_H ++#ifndef LIBFDT_H ++#define LIBFDT_H + /* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2006 David Gibson, IBM Corporation. +diff --git a/include/libfdt_env.h b/include/libfdt_env.h +index 6c6845f..638ea69 100644 +--- a/include/libfdt_env.h ++++ b/include/libfdt_env.h +@@ -6,8 +6,8 @@ + * SPDX-License-Identifier: LGPL-2.1+ + */ + +-#ifndef _LIBFDT_ENV_H +-#define _LIBFDT_ENV_H ++#ifndef LIBFDT_ENV_H ++#define LIBFDT_ENV_H + + #include "compiler.h" + #include "linux/types.h" +-- +2.7.4 + diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/fix_net.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/fix_net.patch new file mode 100644 index 0000000..3d9a986 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/fix_net.patch @@ -0,0 +1,136 @@ +From 9436a1e4dfcc7d6f0cbf9511f84c8164e49f23c6 Mon Sep 17 00:00:00 2001 +From: Serhii Voloshynov <serhii.voloshynov@globallogic.com> +Date: Mon, 10 Feb 2020 13:10:58 +0200 +Subject: [PATCH] based on https://patchwork.ozlabs.org/patch/792238/ Core + reason is usage of structures for network headers without packed attribute. + +--- + include/net.h | 14 +++++++------- + net/bootp.h | 2 +- + net/dns.h | 2 +- + net/nfs.h | 2 +- + net/sntp.h | 2 +- + 5 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/include/net.h b/include/net.h +index 06320c6..60baf6b 100644 +--- a/include/net.h ++++ b/include/net.h +@@ -296,7 +296,7 @@ struct ethernet_hdr { + u8 et_dest[6]; /* Destination node */ + u8 et_src[6]; /* Source node */ + u16 et_protlen; /* Protocol or length */ +-}; ++} __attribute__((packed)); + + /* Ethernet header size */ + #define ETHER_HDR_SIZE (sizeof(struct ethernet_hdr)) +@@ -314,7 +314,7 @@ struct e802_hdr { + u8 et_snap2; + u8 et_snap3; + u16 et_prot; /* 802 protocol */ +-}; ++} __attribute__((packed)); + + /* 802 + SNAP + ethernet header size */ + #define E802_HDR_SIZE (sizeof(struct e802_hdr)) +@@ -328,7 +328,7 @@ struct vlan_ethernet_hdr { + u16 vet_vlan_type; /* PROT_VLAN */ + u16 vet_tag; /* TAG of VLAN */ + u16 vet_type; /* protocol type */ +-}; ++} __attribute__((packed)); + + /* VLAN Ethernet header size */ + #define VLAN_ETHER_HDR_SIZE (sizeof(struct vlan_ethernet_hdr)) +@@ -357,7 +357,7 @@ struct ip_hdr { + u16 ip_sum; /* checksum */ + struct in_addr ip_src; /* Source IP address */ + struct in_addr ip_dst; /* Destination IP address */ +-}; ++} __attribute__((packed)); + + #define IP_OFFS 0x1fff /* ip offset *= 8 */ + #define IP_FLAGS 0xe000 /* first 3 bits */ +@@ -385,7 +385,7 @@ struct ip_udp_hdr { + u16 udp_dst; /* UDP destination port */ + u16 udp_len; /* Length of UDP packet */ + u16 udp_xsum; /* Checksum */ +-}; ++} __attribute__((packed)); + + #define IP_UDP_HDR_SIZE (sizeof(struct ip_udp_hdr)) + #define UDP_HDR_SIZE (IP_UDP_HDR_SIZE - IP_HDR_SIZE) +@@ -424,7 +424,7 @@ struct arp_hdr { + u8 ar_tha[]; /* Target hardware address */ + u8 ar_tpa[]; /* Target protocol address */ + #endif /* 0 */ +-}; ++} __attribute__((packed)); + + #define ARP_HDR_SIZE (8+20) /* Size assuming ethernet */ + +@@ -459,7 +459,7 @@ struct icmp_hdr { + } frag; + u8 data[0]; + } un; +-}; ++} __attribute__((packed)); + + #define ICMP_HDR_SIZE (sizeof(struct icmp_hdr)) + #define IP_ICMP_HDR_SIZE (IP_HDR_SIZE + ICMP_HDR_SIZE) +diff --git a/net/bootp.h b/net/bootp.h +index fcb0a64..567340e 100644 +--- a/net/bootp.h ++++ b/net/bootp.h +@@ -49,7 +49,7 @@ struct bootp_hdr { + char bp_sname[64]; /* Server host name */ + char bp_file[128]; /* Boot file name */ + char bp_vend[OPT_FIELD_SIZE]; /* Vendor information */ +-}; ++} __attribute__((packed)); + + #define BOOTP_HDR_SIZE sizeof(struct bootp_hdr) + +diff --git a/net/dns.h b/net/dns.h +index c4e96af..c55a5c1 100644 +--- a/net/dns.h ++++ b/net/dns.h +@@ -29,7 +29,7 @@ struct header { + uint16_t nauth; /* Authority PRs */ + uint16_t nother; /* Other PRs */ + unsigned char data[1]; /* Data, variable length */ +-}; ++} __attribute__((packed)); + + void dns_start(void); /* Begin DNS */ + +diff --git a/net/nfs.h b/net/nfs.h +index 45da246..70a1a6d 100644 +--- a/net/nfs.h ++++ b/net/nfs.h +@@ -79,7 +79,7 @@ struct rpc_t { + uint32_t data[NFS_READ_SIZE]; + } reply; + } u; +-}; ++} __attribute__((packed)); + void nfs_start(void); /* Begin NFS */ + + +diff --git a/net/sntp.h b/net/sntp.h +index 6a9c6bb..c38bcee 100644 +--- a/net/sntp.h ++++ b/net/sntp.h +@@ -51,7 +51,7 @@ struct sntp_pkt_t { + unsigned long long originate_timestamp; + unsigned long long receive_timestamp; + unsigned long long transmit_timestamp; +-}; ++} __attribute__((packed)); + + void sntp_start(void); /* Begin SNTP */ + +-- +2.7.4 + diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/hide_uboot_version.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/hide_uboot_version.patch new file mode 100644 index 0000000..a59dcc1 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/hide_uboot_version.patch @@ -0,0 +1,11 @@ +diff -raNu old/lib/display_options.c new/lib/display_options.c +--- old/lib/display_options.c 2016-09-19 17:45:12.000000000 +0300 ++++ new/lib/display_options.c 2019-02-08 15:40:16.566717983 +0200 +@@ -15,6 +15,7 @@ + + int display_options (void) + { ++ return 0; + #if defined(BUILD_TAG) + printf ("\n\n%s, Build: %s\n\n", version_string, BUILD_TAG); + #else diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/i2c.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/i2c.patch new file mode 100644 index 0000000..a5087ea --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/i2c.patch @@ -0,0 +1,114 @@ +diff -raNu old/include/i2c.h new/include/i2c.h +--- old/include/i2c.h 2017-04-28 17:26:27.854898005 -0500 ++++ new/include/i2c.h 2017-05-01 17:27:32.673437788 -0500 +@@ -17,6 +17,27 @@ + #ifndef _I2C_H_ + #define _I2C_H_ + ++#define U_BOOT_I2C_MKENT_COMPLETE(_init, _probe, _read, _write, \ ++ _set_speed, _speed, _slaveaddr, _hwadapnr, _name) \ ++ { \ ++ .init = _init, \ ++ .probe = _probe, \ ++ .read = _read, \ ++ .write = _write, \ ++ .set_bus_speed = _set_speed, \ ++ .speed = _speed, \ ++ .slaveaddr = _slaveaddr, \ ++ .init_done = 0, \ ++ .hwadapnr = _hwadapnr, \ ++ .name = #_name \ ++}; ++ ++#define U_BOOT_I2C_ADAP_COMPLETE(_name, _init, _probe, _read, _write, \ ++ _set_speed, _speed, _slaveaddr, _hwadapnr) \ ++ ll_entry_declare(struct i2c_adapter, _name, i2c) = \ ++ U_BOOT_I2C_MKENT_COMPLETE(_init, _probe, _read, _write, \ ++ _set_speed, _speed, _slaveaddr, _hwadapnr, _name); ++ + /* + * For now there are essentially two parts to this file - driver model + * here at the top, and the older code below (with CONFIG_SYS_I2C being +@@ -538,6 +559,26 @@ + */ + void i2c_dump_msgs(struct i2c_msg *msg, int nmsgs); + ++ ++struct i2c_adapter { ++ void (*init)(struct i2c_adapter *adap, int speed, ++ int slaveaddr); ++ int (*probe)(struct i2c_adapter *adap, uint8_t chip); ++ int (*read)(struct i2c_adapter *adap, uint8_t chip, ++ uint addr, int alen, uint8_t *buffer, ++ int len); ++ int (*write)(struct i2c_adapter *adap, uint8_t chip, ++ uint addr, int alen, uint8_t *buffer, ++ int len); ++ uint (*set_bus_speed)(struct i2c_adapter *adap, ++ uint speed); ++ int speed; ++ int waitdelay; ++ int slaveaddr; ++ int init_done; ++ int hwadapnr; ++ char *name; ++}; + #ifndef CONFIG_DM_I2C + + /* +@@ -578,46 +619,6 @@ + #define CONFIG_SYS_SPD_BUS_NUM 0 + #endif + +-struct i2c_adapter { +- void (*init)(struct i2c_adapter *adap, int speed, +- int slaveaddr); +- int (*probe)(struct i2c_adapter *adap, uint8_t chip); +- int (*read)(struct i2c_adapter *adap, uint8_t chip, +- uint addr, int alen, uint8_t *buffer, +- int len); +- int (*write)(struct i2c_adapter *adap, uint8_t chip, +- uint addr, int alen, uint8_t *buffer, +- int len); +- uint (*set_bus_speed)(struct i2c_adapter *adap, +- uint speed); +- int speed; +- int waitdelay; +- int slaveaddr; +- int init_done; +- int hwadapnr; +- char *name; +-}; +- +-#define U_BOOT_I2C_MKENT_COMPLETE(_init, _probe, _read, _write, \ +- _set_speed, _speed, _slaveaddr, _hwadapnr, _name) \ +- { \ +- .init = _init, \ +- .probe = _probe, \ +- .read = _read, \ +- .write = _write, \ +- .set_bus_speed = _set_speed, \ +- .speed = _speed, \ +- .slaveaddr = _slaveaddr, \ +- .init_done = 0, \ +- .hwadapnr = _hwadapnr, \ +- .name = #_name \ +-}; +- +-#define U_BOOT_I2C_ADAP_COMPLETE(_name, _init, _probe, _read, _write, \ +- _set_speed, _speed, _slaveaddr, _hwadapnr) \ +- ll_entry_declare(struct i2c_adapter, _name, i2c) = \ +- U_BOOT_I2C_MKENT_COMPLETE(_init, _probe, _read, _write, \ +- _set_speed, _speed, _slaveaddr, _hwadapnr, _name); + + struct i2c_adapter *i2c_get_adapter(int index); + +@@ -803,7 +804,7 @@ + void i2c_soft_scl(int bit); + void i2c_soft_delay(void); + #endif +-#else ++#elif !defined(CONFIG_DM_I2C_COMPAT) + + /* + * Probe the given I2C chip address. Returns 0 if a chip responded, diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/kconfig_common.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/kconfig_common.patch new file mode 100644 index 0000000..db6773a --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/kconfig_common.patch @@ -0,0 +1,65 @@ +# +# MD: based on the following change: +# +# http://git.denx.de/?p=u-boot.git;a=commit;h=98af87997670af840ef178f76b4d6888534a6700 +# author Simon Glass <sjg@chromium.org> +# Tue, 18 Oct 2016 04:12:35 +0200 (20:12 -0600) +# committer Tom Rini <trini@konsulko.com> +# Mon, 24 Oct 2016 00:33:18 +0200 (18:33 -0400) +# +# Convert SILENT_CONSOLE options to Kconfig +# +# Move these option to Kconfig and tidy up existing uses. +# +# The Power PC boards don't have a suitable common element: the common header +# files don't appear to line up with the Kconfig files as far as I can tell. +# This results in a lot of defconfig changes. +# +diff -raNu old/common/Kconfig new/common/Kconfig +--- old/common/Kconfig 2016-09-19 17:45:12.000000000 +0300 ++++ new/common/Kconfig 2019-02-08 13:41:54.925466228 +0200 +@@ -213,3 +213,44 @@ + version as printed by the "version" command. + Any change to this variable will be reverted at the + next reset. ++ ++config SILENT_CONSOLE ++ bool "Support a silent console" ++ help ++ This option allows the console to be silenced, meaning that no ++ output will appear on the console devices. This is controlled by ++ setting the environment variable 'silent' to a non-empty value. ++ Note this also silences the console when booting Linux. ++ ++ When the console is set up, the variable is checked, and the ++ GD_FLG_SILENT flag is set. Changing the environment variable later ++ will update the flag. ++ ++config SILENT_U_BOOT_ONLY ++ bool "Only silence the U-Boot console" ++ depends on SILENT_CONSOLE ++ help ++ Normally when the U-Boot console is silenced, Linux's console is ++ also silenced (assuming the board boots into Linux). This option ++ allows the linux console to operate normally, even if U-Boot's ++ is silenced. ++ ++config SILENT_CONSOLE_UPDATE_ON_SET ++ bool "Changes to the 'silent' environment variable update immediately" ++ depends on SILENT_CONSOLE ++ default y if SILENT_CONSOLE ++ help ++ When the 'silent' environment variable is changed, update the ++ console silence flag immediately. This allows 'setenv' to be used ++ to silence or un-silence the console. ++ ++ The effect is that any change to the variable will affect the ++ GD_FLG_SILENT flag. ++ ++config SILENT_CONSOLE_UPDATE_ON_RELOC ++ bool "Allow flags to take effect on relocation" ++ depends on SILENT_CONSOLE ++ help ++ In some cases the environment is not available until relocation ++ (e.g. NAND). This option makes the value of the 'silent' ++ environment variable take effect at relocation. diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/macb.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/macb.patch new file mode 100644 index 0000000..5869628 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/macb.patch @@ -0,0 +1,54 @@ +diff -raNu old/drivers/net/macb.c new/drivers/net/macb.c +--- old/drivers/net/macb.c 2017-05-11 16:08:48.747255895 -0500 ++++ new/drivers/net/macb.c 2017-05-12 09:55:17.331129433 -0500 +@@ -49,7 +49,7 @@ + #define MACB_RX_RING_SIZE (MACB_RX_BUFFER_SIZE / 128) + #define MACB_TX_RING_SIZE 16 + #define MACB_TX_TIMEOUT 1000 +-#define MACB_AUTONEG_TIMEOUT 5000000 ++#define MACB_AUTONEG_TIMEOUT 3000000 + + struct macb_dma_desc { + u32 addr; +@@ -419,7 +419,8 @@ + static void macb_phy_reset(struct macb_device *macb, const char *name) + { + int i; +- u16 status, adv; ++ u16 status = 0; ++ u16 adv; + + adv = ADVERTISE_CSMA | ADVERTISE_ALL; + macb_mdio_write(macb, MII_ADVERTISE, adv); +@@ -439,6 +440,7 @@ + else + printf("%s: Autonegotiation timed out (status=0x%04x)\n", + name, status); ++ + } + + #ifdef CONFIG_MACB_SEARCH_PHY +@@ -479,7 +481,6 @@ + u32 ncfgr; + u16 phy_id, status, adv, lpa; + int media, speed, duplex; +- int i; + + arch_get_mdio_control(name); + #ifdef CONFIG_MACB_SEARCH_PHY +@@ -515,14 +516,7 @@ + status = macb_mdio_read(macb, MII_BMSR); + if (!(status & BMSR_LSTATUS)) { + /* Try to re-negotiate if we don't have link already. */ +- macb_phy_reset(macb, name); +- +- for (i = 0; i < MACB_AUTONEG_TIMEOUT / 100; i++) { +- status = macb_mdio_read(macb, MII_BMSR); +- if (status & BMSR_LSTATUS) +- break; +- udelay(100); +- } ++ macb_phy_reset(macb,name); + } + + if (!(status & BMSR_LSTATUS)) { diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdt.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdt.patch new file mode 100644 index 0000000..4f265df --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdt.patch @@ -0,0 +1,292 @@ +diff -raNu old/include/configs/at91sam9x5ek.h new/include/configs/at91sam9x5ek.h +--- old/include/configs/at91sam9x5ek.h 2017-05-04 13:59:37.381346896 -0500 ++++ new/include/configs/at91sam9x5ek.h 2017-05-11 08:31:30.258358272 -0500 +@@ -9,9 +9,11 @@ + #ifndef __CONFIG_H__ + #define __CONFIG_H__ + ++#include <linux/kconfig.h> + #include <asm/hardware.h> + +-#define CONFIG_SYS_TEXT_BASE 0x26f00000 ++#define USE_MTCDT ++#define CONFIG_SYS_TEXT_BASE 0x2ef00000 + + /* ARM asynchronous clock */ + #define CONFIG_SYS_AT91_SLOW_CLOCK 32768 +@@ -26,6 +28,8 @@ + #define CONFIG_BOARD_EARLY_INIT_F + #define CONFIG_DISPLAY_CPUINFO + ++#define CONFIG_MISC_INIT_R /* enable platform-dependent misc_init_r() */ ++ + /* general purpose I/O */ + #define CONFIG_ATMEL_LEGACY /* required until (g)pio is fixed */ + #define CONFIG_AT91_GPIO +@@ -36,6 +40,8 @@ + #define CONFIG_USART_ID ATMEL_ID_SYS + + /* LCD */ ++/* MTCDT has no LCD */ ++#if !defined(MTCDT) + #define CONFIG_LCD + #define LCD_BPP LCD_COLOR16 + #define LCD_OUTPUT_BPP 24 +@@ -46,7 +52,13 @@ + #define CONFIG_ATMEL_HLCD + #define CONFIG_ATMEL_LCD_RGB565 + #define CONFIG_SYS_CONSOLE_IS_IN_ENV ++#endif /* !defined(MTCDT) */ ++ ++/* check for keypress even if bootdelay is 0 */ ++#define CONFIG_ZERO_BOOTDELAY_CHECK + ++/*STATUS LED*/ ++#define BOOT_STATUS_LED AT91_PIN_PA24 + + /* + * BOOTP options +@@ -60,10 +72,10 @@ + #define CONFIG_SYS_NO_FLASH + + /* +- * Command line configuration. ++ * Defined by .config (configs/at91sam9x5ek) ++ * #define CONFIG_CMD_I2C + */ +-#define CONFIG_CMD_NAND +- ++#define CONFIG_SYS_I2C + /* + * define CONFIG_USB_EHCI to enable USB Hi-Speed (aka 2.0) + * NB: in this case, USB 1.1 devices won't be recognized. +@@ -72,7 +84,7 @@ + /* SDRAM */ + #define CONFIG_NR_DRAM_BANKS 1 + #define CONFIG_SYS_SDRAM_BASE 0x20000000 +-#define CONFIG_SYS_SDRAM_SIZE 0x08000000 /* 128 megs */ ++#define CONFIG_SYS_SDRAM_SIZE 0x10000000 /* 256 megs */ + + #define CONFIG_SYS_INIT_SP_ADDR \ + (CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE) +@@ -94,13 +106,30 @@ + /* our CLE is AD22 */ + #define CONFIG_SYS_NAND_MASK_CLE (1 << 22) + #define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PD4 +-#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PD5 ++/* MTCDT nand ready is PC31 */ ++#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PC31 + + /* PMECC & PMERRLOC */ + #define CONFIG_ATMEL_NAND_HWECC 1 + #define CONFIG_ATMEL_NAND_HW_PMECC 1 +-#define CONFIG_PMECC_CAP 2 ++ ++/* MTCDT: 4-bit PMECC */ ++#define CONFIG_PMECC_CAP 4 + #define CONFIG_PMECC_SECTOR_SIZE 512 ++/* ++ * CONFIG_PMECC_INDEX_TABLE_OFFSET has been replaced by: ++ * ATMEL_PMECC_INDEX_OFFSET_512 and ++ * ATMEL_PMECC_INDEX_OFFSET_1024 ++ * ++ * Which as used depends on: ++ * host->pmecc_sector_size == 512 ++ * ++ * 2012.10: ++ * #define CONFIG_PMECC_INDEX_TABLE_OFFSET 0x8000 ++ * 2016.03 (at91sam9x5.h): ++ * 182:#define ATMEL_PMECC_INDEX_OFFSET_512 0x8000 ++ */ ++ + + #define CONFIG_CMD_NAND_TRIMFFS + +@@ -147,20 +176,36 @@ + #endif + #endif + ++#define CONFIG_SYS_I2C_SOFT ++#define CONFIG_SOFT_I2C ++#define CONFIG_SOFT_I2C_GPIO_SCL AT91_PIN_PA31 ++#define CONFIG_SOFT_I2C_GPIO_SDA AT91_PIN_PA30 ++#define CONFIG_SYS_I2C_SOFT_SPEED 50000 ++#define CONFIG_SYS_I2C_SPEED CONFIG_SYS_I2C_SOFT_SPEED ++/* Values from previous levels of Conduit U-Boot */ ++#define CONFIG_SYS_I2C_SLAVE 0xfe ++#define I2C_RXTX_LEN 128 ++ ++/* I2C eeprom support */ ++#define CONFIG_CMD_EEPROM ++#define CONFIG_SYS_I2C_EEPROM_ADDR 0x56 /* at24c04 */ ++#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* Bytes of address */ ++#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3 ++ + #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* load address */ + + #define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE +-#define CONFIG_SYS_MEMTEST_END 0x26e00000 ++#define CONFIG_SYS_MEMTEST_END 0x2ee00000 + + #ifdef CONFIG_SYS_USE_NANDFLASH + /* bootstrap + u-boot + env + linux in nandflash */ + #define CONFIG_ENV_IS_IN_NAND + #define CONFIG_ENV_OFFSET 0xc0000 +-#define CONFIG_ENV_OFFSET_REDUND 0x100000 ++#define CONFIG_ENV_OFFSET_REDUND 0x160000 + #define CONFIG_ENV_SIZE 0x20000 /* 1 sector = 128 kB */ +-#define CONFIG_BOOTCOMMAND "nand read " \ +- "0x22000000 0x200000 0x300000; " \ +- "bootm 0x22000000" ++/* MTCDT: read from env variables for boot */ ++#define CONFIG_BOOTCOMMAND "nboot.jffs2 ${loadaddr} 0 ${kernel_addr}; bootm ${loadaddr}" ++ + #elif defined(CONFIG_SYS_USE_SPIFLASH) + /* bootstrap + u-boot + env + linux in spi flash */ + #define CONFIG_ENV_IS_IN_SPI_FLASH +@@ -197,6 +242,9 @@ + "8M(bootstrap/uboot/kernel)ro,-(rootfs) " \ + "root=/dev/mmcblk0p2 " \ + "rw rootfstype=ext4 rootwait" ++#elif defined(USE_MTCDT) ++/* MTCDT uses jffs2 */ ++#define CONFIG_BOOTARGS "mem=256M console=ttyS0,115200 root=/dev/mtdblock8 ro rootfstype=jffs2" + #else + #define CONFIG_BOOTARGS \ + "console=ttyS0,115200 earlyprintk " \ +@@ -274,4 +322,21 @@ + + #endif + ++/* MTCDT defaults */ ++#define CONFIG_ENV_OVERWRITE 1 /* Allow Overwrite of serial# & ethaddr */ ++#define CONFIG_ETHADDR 00:08:00:87:00:02 ++#define CONFIG_IPADDR 192.168.2.1 ++#define CONFIG_NETMASK 255.255.255.0 ++#define CONFIG_SERVERIP 192.168.2.2 ++#define CONFIG_HOSTNAME AT91SAM9G25 ++#define CONFIG_LOADADDR 0x22000000 ++ ++/* MTCDT - enable watchdog */ ++#define CONFIG_AT91SAM9_WATCHDOG 1 ++#define CONFIG_HW_WATCHDOG 1 ++#define CONFIG_AT91_HW_WDT_TIMEOUT 16 ++#define CONFIG_EXTRA_ENV_SETTINGS \ ++ "kernel_addr=0x200000\0" \ ++ "" ++ + #endif +diff -raNu old/board/atmel/at91sam9x5ek/at91sam9x5ek.c new/board/atmel/at91sam9x5ek/at91sam9x5ek.c +--- old/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2017-05-05 11:09:53.668926301 -0500 ++++ new/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2017-05-05 17:35:53.342774065 -0500 +@@ -44,7 +44,8 @@ + csa = readl(&matrix->ebicsa); + csa |= AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA; + /* NAND flash on D16 */ +- csa |= AT91_MATRIX_NFD0_ON_D16; ++ /* MTCDT: nand flash is set up by bootstrap, so leave it alone here */ ++ /* csa |= AT91_MATRIX_NFD0_ON_D16; */ + + /* Configure IO drive */ + csa &= ~AT91_MATRIX_EBI_EBI_IOSR_NORMAL; +@@ -256,6 +257,9 @@ + + int board_init(void) + { ++ /* Set Status LED High */ ++ at91_set_gpio_output(BOOT_STATUS_LED, 0); ++ + /* arch number of AT91SAM9X5EK-Board */ + gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9X5EK; + +@@ -267,6 +271,7 @@ + #endif + + #ifdef CONFIG_ATMEL_SPI ++ at91_spi0_hw_init(1 << 0); + at91_spi0_hw_init(1 << 4); + #endif + +@@ -283,12 +288,6 @@ + return 0; + } + +-int dram_init(void) +-{ +- gd->ram_size = get_ram_size((void *) CONFIG_SYS_SDRAM_BASE, +- CONFIG_SYS_SDRAM_SIZE); +- return 0; +-} + + #if defined(CONFIG_SPL_BUILD) + #include <spl.h> +@@ -362,4 +361,69 @@ + /* DDRAM2 Controller initialize */ + ddr2_init(ATMEL_BASE_DDRSDRC, ATMEL_BASE_CS1, &ddr2); + } ++ + #endif ++ ++/* on-board EEPROM */ ++struct mts_id_eeprom_layout { ++ char vendor_id[32]; ++ char product_id[32]; ++ char device_id[32]; ++ char hw_version[32]; ++ uint8_t mac_addr[6]; ++ char imei[32]; ++ uint8_t capa[32]; ++ uint8_t mac_bluetooth[6]; ++ uint8_t mac_wifi[6]; ++ uint8_t reserved[302]; ++}; ++ ++int board_get_enetaddr(uchar *enetaddr) ++{ ++ struct mts_id_eeprom_layout eeprom_buffer = {0}; ++ ++ if (eeprom_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, &eeprom_buffer, sizeof(eeprom_buffer))) { ++ printf("EEPROM: read error\n"); ++ return 0; ++ } ++ ++ if (eeprom_buffer.vendor_id[0] == 0x00 || eeprom_buffer.vendor_id[0] == 0xFF) { ++ printf("EEPROM: uninitialized\n"); ++ return 0; ++ } ++ ++ printf("vendor-id: %s\n", eeprom_buffer.vendor_id); ++ printf("product-id: %s\n", eeprom_buffer.product_id); ++ printf("device-id: %s\n", eeprom_buffer.device_id); ++ printf("hw-version: %s\n", eeprom_buffer.hw_version); ++ printf("mac-addr: %02x:%02x:%02x:%02x:%02x:%02x\n", eeprom_buffer.mac_addr[0], ++ eeprom_buffer.mac_addr[1], ++ eeprom_buffer.mac_addr[2], ++ eeprom_buffer.mac_addr[3], ++ eeprom_buffer.mac_addr[4], ++ eeprom_buffer.mac_addr[5]); ++ ++ memcpy(enetaddr, eeprom_buffer.mac_addr, 6); ++ ++ return 1; ++} ++ ++int misc_init_r(void) ++{ ++ uchar enetaddr[6]; ++ ++ /* set MAC address from EEPROM if read successful */ ++ if (board_get_enetaddr(enetaddr)) { ++ eth_setenv_enetaddr("ethaddr", enetaddr); ++ } ++ ++ return 0; ++} ++ ++int dram_init(void) ++{ ++ gd->ram_size = get_ram_size((void *) CONFIG_SYS_SDRAM_BASE, ++ CONFIG_SYS_SDRAM_SIZE); ++ return 0; ++} ++ diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdt_flush_console_autoboot.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdt_flush_console_autoboot.patch new file mode 100644 index 0000000..d08843a --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdt_flush_console_autoboot.patch @@ -0,0 +1,43 @@ +# This change sets the bootdelay to 2 seconds. On old devices +# the bootdelay may be in the environment variable partitions. +# When updating a system, u-boot setenv command must be used +# to set the bootdelay to 2 in the environment. A bootdelay +# of zero will make it nearly impossible to enter U-Boot, +# and zero is the old default, and may be in the environment. +# For MTCDT only the unpowered EXAR serial to USB convertor +# leaks the output of the console back to the input in some +# cases. Therefore it is necessary to flush the UART before +# attempting to monitor keystrokes. The output of the +# console must be quiet, or in the case of the normal +# boot where the EXAR part is unpowered, the read of the +# keyboard may be reading output to the console screen. +# This problem never occurs if the EXAR part is connected +# to a PC, and is powered. +diff -Naru orig/common/autoboot.c new/common/autoboot.c +--- orig/common/autoboot.c 2019-08-15 10:56:58.183468370 -0500 ++++ new/common/autoboot.c 2019-08-15 10:30:11.363515940 -0500 +@@ -219,6 +219,12 @@ + printf("Hit any key to stop autoboot: %2d ", bootdelay); + #endif + ++ /* Flush input -- must be done because of loopback ++ * issue on MTCDT models with unpowered EXAR part ++ * which do loopback unintentionally by default. ++ */ ++ while (tstc()) ++ getc(); + /* + * Check if key already pressed + */ +diff -Naru orig/configs/at91sam9x5ek_nandflash_defconfig new/configs/at91sam9x5ek_nandflash_defconfig +--- orig/configs/at91sam9x5ek_nandflash_defconfig 2019-08-15 10:49:30.223481632 -0500 ++++ new/configs/at91sam9x5ek_nandflash_defconfig 2019-08-15 10:50:10.703480433 -0500 +@@ -3,7 +3,7 @@ + CONFIG_TARGET_AT91SAM9X5EK=y + CONFIG_SPL=n + CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9X5,SYS_USE_NANDFLASH" +-CONFIG_BOOTDELAY=0 ++CONFIG_BOOTDELAY=2 + CONFIG_HUSH_PARSER=y + CONFIG_SYS_PROMPT="U-Boot> " + CONFIG_CMD_BOOTZ=y diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/mtpwd.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/mtpwd.patch new file mode 100644 index 0000000..fb07372 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/mtpwd.patch @@ -0,0 +1,300 @@ +diff -raNu old/common/autoboot.c new/common/autoboot.c +--- old/common/autoboot.c 2017-05-19 10:43:49.378496833 -0500 ++++ new/common/autoboot.c 2017-05-19 10:52:10.561509423 -0500 +@@ -362,4 +362,5 @@ + run_command_list(s, -1, 0); + } + #endif /* CONFIG_MENUKEY */ ++ mts_run_passwd_loop(); + } +diff -raNu old/common/Makefile new/common/Makefile +--- old/common/Makefile 2017-05-11 18:07:26.904563771 -0500 ++++ new/common/Makefile 2017-05-11 18:09:05.514736126 -0500 +@@ -164,5 +164,6 @@ + obj-y += command.o + obj-y += s_record.o + obj-y += xyzModem.o ++obj-$(CONFIG_MTS_PASSWD) += mts_passwd.o + + CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null) +diff -raNu old/common/mts_passwd.c new/common/mts_passwd.c +--- old/common/mts_passwd.c 1969-12-31 18:00:00.000000000 -0600 ++++ new/common/mts_passwd.c 2017-05-12 13:15:54.928180929 -0500 +@@ -0,0 +1,248 @@ ++#include <common.h> ++#include <linux/ctype.h> ++#include <watchdog.h> ++#include <u-boot/sha256.h> ++#include <mts_passwd.h> ++ ++#define MTS_PASSWD_ATTEMPTS (3) ++#define MTS_PASSWD_MAX_LEN (30) ++#define MTS_PASSWD_HASH_VAR "mtsp" ++#define MTS_PASSWD_SALT_VAR "mtss" ++#define MTS_PASSWD_PROMPT "Enter password : " ++ ++static ++void mts_do_reset(unsigned long delay) ++{ ++ mdelay(delay); ++ do_reset(NULL, 0, 0, NULL); ++} ++ ++/* ++ * ++ * Figure out if device is locked or not ++ * ++ */ ++static ++int mts_get_protection_status(void) ++{ ++ int rc = 0; /* UNLOCKED */ ++ char *var = NULL; ++ int len; ++ ++ var = getenv(MTS_PASSWD_HASH_VAR); ++ ++ do { ++ /* Variable is not set */ ++ if (!var) break; ++ ++ len = strlen(var); ++ ++ /* Variable is empty */ ++ if (len == 0) break; ++ ++ /* ++ * Length should be correct. Otherwise, do not unlock the device, just show the message and reset. ++ */ ++ if (len != 2*SHA256_SUM_LEN) { ++ puts("WARNING: password is corrupted\n"); ++ mts_do_reset(1000); ++ } ++ ++ /* LOCKED */ ++ rc = 1; ++ ++ } while (0); ++ ++ return rc; ++} ++ ++ ++/* ++ * ++ * Helper function for the password reading ++ * ++ */ ++static ++char *mts_password_delete_char(char *buffer, char *p, int *colp, int *np, int plen) ++{ ++ static char erase_seq[] = "\b \b"; ++ ++ if (*np == 0) { ++ return (p); ++ } ++ ++ --p; ++ puts(erase_seq); ++ (*colp)--; ++ ++ (*np)--; ++ return (p); ++} ++ ++/* ++ * ++ * Read password helper ++ * ++ */ ++static ++int mts_password_into_buffer(const char *const prompt, char *buf, size_t buflen) ++{ ++ char *p = buf; ++ char *p_buf = p; ++ int n = 0; /* buffer index */ ++ int plen = 0; /* prompt length */ ++ int col; /* output column cnt */ ++ char c; ++ ++ /* print prompt */ ++ if (prompt) { ++ plen = strlen(prompt); ++ puts (prompt); ++ } ++ ++ col = plen; ++ ++ for (;;) { ++ ++ WATCHDOG_RESET(); ++ ++ c = getc(); ++ ++ /* ++ * Special character handling ++ */ ++ switch (c) { ++ case '\r': /* Enter */ ++ case '\n': ++ *p = '\0'; ++ puts("\r\n"); ++ return (p - p_buf); ++ ++ case '\0': /* nul */ ++ case '\t': ++ continue; ++ ++ case 0x03: /* ^C - break */ ++ p_buf[0] = '\0'; /* discard input */ ++ puts("\r\n"); ++ return (-1); ++ ++ case 0x08: /* ^H - backspace */ ++ case 0x7F: /* DEL - backspace */ ++ p = mts_password_delete_char(p_buf, p, &col, &n, plen); ++ continue; ++ ++ default: ++ /* ++ * Must be a normal character then ++ */ ++ if (n < buflen - 2) { ++ ++col; /* echo input */ ++ *p++ = c; ++ ++n; ++ } ++ putc('*'); ++ } ++ } ++} ++ ++/* ++ * ++ * Read the password from input ++ * ++ */ ++static ++int read_password(char *buf, size_t buflen) ++{ ++ return mts_password_into_buffer(MTS_PASSWD_PROMPT, buf, buflen); ++} ++ ++/* ++ * ++ * Verify if the entered password is correct. ++ * ++ */ ++static ++int verify_password(char *pwd, size_t pwdlen) ++{ ++ char *hash_env = getenv(MTS_PASSWD_HASH_VAR);; ++ char *salt_env = getenv(MTS_PASSWD_SALT_VAR); ++ ++ if (pwd && pwdlen > 0 && hash_env && (strlen(hash_env) == 2*SHA256_SUM_LEN)) { ++ uint8_t hash[SHA256_SUM_LEN]; ++ uint8_t prefix[]={'0','3','e','3'}; ++ sha256_context ctx; ++ char tmp[3]; ++ int i; ++ ++ sha256_starts(&ctx); ++ sha256_update(&ctx, prefix, 4); ++ sha256_update(&ctx, (uint8_t *) pwd, pwdlen); ++ if (salt_env) { ++ size_t saltlen = strlen(salt_env); ++ sha256_update(&ctx, (uint8_t *) salt_env, saltlen); ++ } ++ sha256_finish(&ctx, hash); ++ memset(&ctx, 0, sizeof(sha256_context)); ++ ++ for (i = 0; i < SHA256_SUM_LEN; i++) { ++ snprintf(tmp, sizeof tmp, "%02x", hash[i]); ++ if (tolower(tmp[0]) != tolower(hash_env[2*i]) || ++ tolower(tmp[1]) != tolower(hash_env[2*i + 1])) { ++ break; ++ } ++ } ++ ++ if (i == SHA256_SUM_LEN) { ++ return 1; ++ } ++ } ++ ++ return 0; ++} ++ ++/* ++ * ++ * Check is the device is locked and ask the password. ++ * ++ */ ++void mts_run_passwd_loop(void) ++{ ++ char buf[MTS_PASSWD_MAX_LEN] = "\0"; ++ unsigned long delay = 1000; /* 1 second initially */ ++ int len; ++ int trynr = 0; ++ ++ /* Do not delete */ ++ printf("", "mts password protected"); ++ ++ if (mts_get_protection_status() == 0) { ++ return; ++ } ++ ++ while (1) { ++ if (trynr == MTS_PASSWD_ATTEMPTS) { ++ mts_do_reset(1000); ++ } ++ ++ len = read_password(buf, MTS_PASSWD_MAX_LEN); ++ if (len > 0) { ++ if (verify_password(buf, len)) { ++ /* zero out */ ++ memset(buf, 0, sizeof(buf)); ++ return; ++ } ++ puts("Permission denied\n"); ++ } ++ ++ trynr++; ++ ++ /* progressive delay */ ++ mdelay(delay); ++ delay *= 2; ++ if (delay > 4000) delay = 4000; ++ } ++ /* zero out */ ++ memset(buf, 0, sizeof(buf)); ++ return; ++} +diff -raNu old/include/common.h new/include/common.h +--- old/include/common.h 2017-05-12 10:49:29.391203966 -0500 ++++ new/include/common.h 2017-05-12 10:49:13.170842438 -0500 +@@ -25,6 +25,7 @@ + #include <asm/ptrace.h> + #include <stdarg.h> + #include <linux/kernel.h> ++#include <mts_passwd.h> + #if defined(CONFIG_PCI) && defined(CONFIG_4xx) + #include <pci.h> + #endif +diff -raNu old/include/mts_passwd.h new/include/mts_passwd.h +--- old/include/mts_passwd.h 1969-12-31 18:00:00.000000000 -0600 ++++ new/include/mts_passwd.h 2017-05-12 10:46:40.459437214 -0500 +@@ -0,0 +1,13 @@ ++#ifndef _MTS_PASSWD_H ++#define _MTS_PASSWD_H ++ ++#define CONFIG_MTS_PASSWD ++ ++#if defined(CONFIG_MTS_PASSWD) ++#define CONFIG_SHA256 ++void mts_run_passwd_loop(void); ++#else ++#define mts_run_passwd_loop() {} ++#endif ++ ++#endif +\ No newline at end of file diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/mtr.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/mtr.patch new file mode 100644 index 0000000..176e590 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/mtr.patch @@ -0,0 +1,272 @@ +diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c b/board/atmel/at91sam9x5ek/at91sam9x5ek.c +index b0d440d..13cc9a3 100644 +--- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c ++++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c +@@ -44,7 +44,8 @@ static void at91sam9x5ek_nand_hw_init(void) + csa = readl(&matrix->ebicsa); + csa |= AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA; + /* NAND flash on D16 */ +- csa |= AT91_MATRIX_NFD0_ON_D16; ++ /* MTR: nand flash is set up by bootstrap, so leave it alone here */ ++ /* csa |= AT91_MATRIX_NFD0_ON_D16; */ + + /* Configure IO drive */ + csa &= ~AT91_MATRIX_EBI_EBI_IOSR_NORMAL; +@@ -256,6 +257,9 @@ int board_early_init_f(void) + + int board_init(void) + { ++ /* Set Status LED High */ ++ at91_set_gpio_output(BOOT_STATUS_LED, 0); ++ + /* arch number of AT91SAM9X5EK-Board */ + gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9X5EK; + +@@ -363,3 +367,60 @@ void mem_init(void) + ddr2_init(ATMEL_BASE_DDRSDRC, ATMEL_BASE_CS1, &ddr2); + } + #endif ++ ++/* on-board EEPROM */ ++struct mts_id_eeprom_layout { ++ char vendor_id[32]; ++ char product_id[32]; ++ char device_id[32]; ++ char hw_version[32]; ++ uint8_t mac_addr[6]; ++ char imei[32]; ++ uint8_t capa[32]; ++ uint8_t mac_bluetooth[6]; ++ uint8_t mac_wifi[6]; ++ uint8_t reserved[302]; ++}; ++ ++int board_get_enetaddr(uchar *enetaddr) ++{ ++ struct mts_id_eeprom_layout eeprom_buffer = {0}; ++ ++ if (eeprom_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, &eeprom_buffer, sizeof(eeprom_buffer))) { ++ printf("EEPROM: read error\n"); ++ return 0; ++ } ++ ++ if (eeprom_buffer.vendor_id[0] == 0x00 || eeprom_buffer.vendor_id[0] == 0xFF) { ++ printf("EEPROM: uninitialized\n"); ++ return 0; ++ } ++ ++ printf("vendor-id: %s\n", eeprom_buffer.vendor_id); ++ printf("product-id: %s\n", eeprom_buffer.product_id); ++ printf("device-id: %s\n", eeprom_buffer.device_id); ++ printf("hw-version: %s\n", eeprom_buffer.hw_version); ++ printf("mac-addr: %02x:%02x:%02x:%02x:%02x:%02x\n", eeprom_buffer.mac_addr[0], ++ eeprom_buffer.mac_addr[1], ++ eeprom_buffer.mac_addr[2], ++ eeprom_buffer.mac_addr[3], ++ eeprom_buffer.mac_addr[4], ++ eeprom_buffer.mac_addr[5]); ++ ++ memcpy(enetaddr, eeprom_buffer.mac_addr, 6); ++ ++ return 1; ++} ++ ++int misc_init_r(void) ++{ ++ uchar enetaddr[6]; ++ ++ /* set MAC address from EEPROM if read successful */ ++ if (board_get_enetaddr(enetaddr)) { ++ eth_setenv_enetaddr("ethaddr", enetaddr); ++ } ++ ++ return 0; ++} ++ +diff -Naru a/configs/at91sam9x5ek_nandflash_defconfig b/configs/at91sam9x5ek_nandflash_defconfig +--- a/configs/at91sam9x5ek_nandflash_defconfig 2019-02-13 11:21:57.000000000 -0600 ++++ b/configs/at91sam9x5ek_nandflash_defconfig 2019-02-13 11:27:11.463114488 -0600 +@@ -31,7 +31,6 @@ + CONFIG_CMD_NAND=y + CONFIG_CMD_BOOTZ=y + CONFIG_CMD_MII=y +-CONFIG_CMD_I2C=y + + # The config option CONFIG_SILENT_CONSOLE can be used to quiet messages + # on the console. If the option has been enabled, the output can be +diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h +index 637c403..693feee 100644 +--- a/include/configs/at91sam9x5ek.h ++++ b/include/configs/at91sam9x5ek.h +@@ -9,8 +9,10 @@ + #ifndef __CONFIG_H__ + #define __CONFIG_H__ + ++#include <linux/kconfig.h> + #include <asm/hardware.h> + ++#define USE_MTR + #define CONFIG_SYS_TEXT_BASE 0x26f00000 + + /* ARM asynchronous clock */ +@@ -26,6 +28,8 @@ + #define CONFIG_BOARD_EARLY_INIT_F + #define CONFIG_DISPLAY_CPUINFO + ++#define CONFIG_MISC_INIT_R /* enable platform-dependent misc_init_r() */ ++ + /* general purpose I/O */ + #define CONFIG_ATMEL_LEGACY /* required until (g)pio is fixed */ + #define CONFIG_AT91_GPIO +@@ -36,6 +40,8 @@ + #define CONFIG_USART_ID ATMEL_ID_SYS + + /* LCD */ ++/* MTR has no LCD */ ++#if !defined(MTR) + #define CONFIG_LCD + #define LCD_BPP LCD_COLOR16 + #define LCD_OUTPUT_BPP 24 +@@ -46,7 +52,13 @@ + #define CONFIG_ATMEL_HLCD + #define CONFIG_ATMEL_LCD_RGB565 + #define CONFIG_SYS_CONSOLE_IS_IN_ENV ++#endif /* !defined(MTR) */ ++ ++/* check for keypress even if bootdelay is 0 */ ++#define CONFIG_ZERO_BOOTDELAY_CHECK + ++/*STATUS LED*/ ++#define BOOT_STATUS_LED AT91_PIN_PC21 + + /* + * BOOTP options +@@ -59,10 +71,7 @@ + /* no NOR flash */ + #define CONFIG_SYS_NO_FLASH + +-/* +- * Command line configuration. +- */ +-#define CONFIG_CMD_NAND ++#define CONFIG_SYS_I2C + + /* + * define CONFIG_USB_EHCI to enable USB Hi-Speed (aka 2.0) +@@ -94,13 +103,30 @@ + /* our CLE is AD22 */ + #define CONFIG_SYS_NAND_MASK_CLE (1 << 22) + #define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PD4 +-#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PD5 ++/* MTR nand ready is PC31 */ ++#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PC31 + + /* PMECC & PMERRLOC */ + #define CONFIG_ATMEL_NAND_HWECC 1 + #define CONFIG_ATMEL_NAND_HW_PMECC 1 +-#define CONFIG_PMECC_CAP 2 ++ ++/* MTR: 4-bit PMECC */ ++#define CONFIG_PMECC_CAP 4 + #define CONFIG_PMECC_SECTOR_SIZE 512 ++/* ++ * CONFIG_PMECC_INDEX_TABLE_OFFSET has been replaced by: ++ * ATMEL_PMECC_INDEX_OFFSET_512 and ++ * ATMEL_PMECC_INDEX_OFFSET_1024 ++ * ++ * Which as used depends on: ++ * host->pmecc_sector_size == 512 ++ * ++ * 2012.10: ++ * #define CONFIG_PMECC_INDEX_TABLE_OFFSET 0x8000 ++ * 2016.03 (at91sam9x5.h): ++ * 182:#define ATMEL_PMECC_INDEX_OFFSET_512 0x8000 ++ */ ++ + + #define CONFIG_CMD_NAND_TRIMFFS + +@@ -127,9 +153,11 @@ + + /* Ethernet */ + #define CONFIG_MACB +-#define CONFIG_RMII ++#undef CONFIG_RMII + #define CONFIG_NET_RETRY_COUNT 20 + #define CONFIG_MACB_SEARCH_PHY ++/* enable MII command */ ++#define CONFIG_CMD_MII 1 + + /* USB */ + #ifdef CONFIG_CMD_USB +@@ -147,6 +175,22 @@ + #endif + #endif + ++#define CONFIG_SYS_I2C_SOFT ++#define CONFIG_SOFT_I2C ++#define CONFIG_SOFT_I2C_GPIO_SCL AT91_PIN_PA31 ++#define CONFIG_SOFT_I2C_GPIO_SDA AT91_PIN_PA30 ++#define CONFIG_SYS_I2C_SOFT_SPEED 50000 ++#define CONFIG_SYS_I2C_SPEED CONFIG_SYS_I2C_SOFT_SPEED ++/* Values from previous levels of Conduit U-Boot */ ++#define CONFIG_SYS_I2C_SLAVE 0xfe ++#define I2C_RXTX_LEN 128 ++ ++/* I2C eeprom support */ ++#define CONFIG_CMD_EEPROM ++#define CONFIG_SYS_I2C_EEPROM_ADDR 0x56 /* at24c04 */ ++#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* Bytes of address<---><------>*/ ++#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3 ++ + #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* load address */ + + #define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE +@@ -156,11 +200,11 @@ + /* bootstrap + u-boot + env + linux in nandflash */ + #define CONFIG_ENV_IS_IN_NAND + #define CONFIG_ENV_OFFSET 0xc0000 +-#define CONFIG_ENV_OFFSET_REDUND 0x100000 ++#define CONFIG_ENV_OFFSET_REDUND 0x160000 + #define CONFIG_ENV_SIZE 0x20000 /* 1 sector = 128 kB */ +-#define CONFIG_BOOTCOMMAND "nand read " \ +- "0x22000000 0x200000 0x300000; " \ +- "bootm 0x22000000" ++/* MTR: read from env variables for boot */ ++#define CONFIG_BOOTCOMMAND "nboot.jffs2 ${loadaddr} 0 ${kernel_addr}; bootm ${loadaddr}" ++ + #elif defined(CONFIG_SYS_USE_SPIFLASH) + /* bootstrap + u-boot + env + linux in spi flash */ + #define CONFIG_ENV_IS_IN_SPI_FLASH +@@ -197,6 +241,9 @@ + "8M(bootstrap/uboot/kernel)ro,-(rootfs) " \ + "root=/dev/mmcblk0p2 " \ + "rw rootfstype=ext4 rootwait" ++#elif defined(USE_MTR) ++/* MTR uses jffs2 */ ++#define CONFIG_BOOTARGS "mem=128M console=ttyS0,115200 root=/dev/mtdblock8 ro rootfstype=jffs2" + #else + #define CONFIG_BOOTARGS \ + "console=ttyS0,115200 earlyprintk " \ +@@ -274,4 +321,21 @@ + + #endif + ++/* MTR defaults */ ++#define CONFIG_ENV_OVERWRITE 1 /* Allow Overwrite of serial# & ethaddr */ ++#define CONFIG_ETHADDR 00:08:00:87:00:02 ++#define CONFIG_IPADDR 192.168.2.1 ++#define CONFIG_NETMASK 255.255.255.0 ++#define CONFIG_SERVERIP 192.168.2.2 ++#define CONFIG_HOSTNAME AT91SAM9G25 ++#define CONFIG_LOADADDR 0x22000000 ++ ++/* MTR - enable watchdog */ ++#define CONFIG_AT91SAM9_WATCHDOG 1 ++#define CONFIG_HW_WATCHDOG 1 ++#define CONFIG_AT91_HW_WDT_TIMEOUT 16 ++#define CONFIG_EXTRA_ENV_SETTINGS \ ++ "kernel_addr=0x200000\0" \ ++ "" ++ + #endif diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/mtrv1.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/mtrv1.patch new file mode 100644 index 0000000..49cb435 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/mtrv1.patch @@ -0,0 +1,261 @@ +diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c b/board/atmel/at91sam9x5ek/at91sam9x5ek.c +index b0d440d..5640cef 100644 +--- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c ++++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c +@@ -44,7 +44,8 @@ static void at91sam9x5ek_nand_hw_init(void) + csa = readl(&matrix->ebicsa); + csa |= AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA; + /* NAND flash on D16 */ +- csa |= AT91_MATRIX_NFD0_ON_D16; ++ /* MTR: nand flash is set up by bootstrap, so leave it alone here */ ++ /* csa |= AT91_MATRIX_NFD0_ON_D16; */ + + /* Configure IO drive */ + csa &= ~AT91_MATRIX_EBI_EBI_IOSR_NORMAL; +@@ -256,6 +257,9 @@ int board_early_init_f(void) + + int board_init(void) + { ++ /* Set Status LED High */ ++ at91_set_gpio_output(BOOT_STATUS_LED, 0); ++ + /* arch number of AT91SAM9X5EK-Board */ + gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9X5EK; + +@@ -362,4 +366,61 @@ void mem_init(void) + /* DDRAM2 Controller initialize */ + ddr2_init(ATMEL_BASE_DDRSDRC, ATMEL_BASE_CS1, &ddr2); + } ++ + #endif ++ ++/* on-board EEPROM */ ++struct mts_id_eeprom_layout { ++ char vendor_id[32]; ++ char product_id[32]; ++ char device_id[32]; ++ char hw_version[32]; ++ uint8_t mac_addr[6]; ++ char imei[32]; ++ uint8_t capa[32]; ++ uint8_t mac_bluetooth[6]; ++ uint8_t mac_wifi[6]; ++ uint8_t reserved[302]; ++}; ++ ++int board_get_enetaddr(uchar *enetaddr) ++{ ++ struct mts_id_eeprom_layout eeprom_buffer = {0}; ++ ++ if (eeprom_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, &eeprom_buffer, sizeof(eeprom_buffer))) { ++ printf("EEPROM: read error\n"); ++ return 0; ++ } ++ ++ if (eeprom_buffer.vendor_id[0] == 0x00 || eeprom_buffer.vendor_id[0] == 0xFF) { ++ printf("EEPROM: uninitialized\n"); ++ return 0; ++ } ++ ++ printf("vendor-id: %s\n", eeprom_buffer.vendor_id); ++ printf("product-id: %s\n", eeprom_buffer.product_id); ++ printf("device-id: %s\n", eeprom_buffer.device_id); ++ printf("hw-version: %s\n", eeprom_buffer.hw_version); ++ printf("mac-addr: %02x:%02x:%02x:%02x:%02x:%02x\n", eeprom_buffer.mac_addr[0], ++ eeprom_buffer.mac_addr[1], ++ eeprom_buffer.mac_addr[2], ++ eeprom_buffer.mac_addr[3], ++ eeprom_buffer.mac_addr[4], ++ eeprom_buffer.mac_addr[5]); ++ ++ memcpy(enetaddr, eeprom_buffer.mac_addr, 6); ++ ++ return 1; ++} ++ ++int misc_init_r(void) ++{ ++ uchar enetaddr[6]; ++ ++ /* set MAC address from EEPROM if read successful */ ++ if (board_get_enetaddr(enetaddr)) { ++ eth_setenv_enetaddr("ethaddr", enetaddr); ++ } ++ ++ return 0; ++} +diff -Naru a/configs/at91sam9x5ek_nandflash_defconfig b/configs/at91sam9x5ek_nandflash_defconfig +--- a/configs/at91sam9x5ek_nandflash_defconfig 2019-02-13 11:21:57.000000000 -0600 ++++ b/configs/at91sam9x5ek_nandflash_defconfig 2019-02-13 11:27:11.463114488 -0600 +@@ -31,7 +31,6 @@ + CONFIG_CMD_NAND=y + CONFIG_CMD_BOOTZ=y + CONFIG_CMD_MII=y +-CONFIG_CMD_I2C=y + + # The config option CONFIG_SILENT_CONSOLE can be used to quiet messages + # on the console. If the option has been enabled, the output can be +diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h +index 637c403..eff48d6 100644 +--- a/include/configs/at91sam9x5ek.h ++++ b/include/configs/at91sam9x5ek.h +@@ -9,8 +9,10 @@ + #ifndef __CONFIG_H__ + #define __CONFIG_H__ + ++#include <linux/kconfig.h> + #include <asm/hardware.h> + ++#define USE_MTR + #define CONFIG_SYS_TEXT_BASE 0x26f00000 + + /* ARM asynchronous clock */ +@@ -26,6 +28,8 @@ + #define CONFIG_BOARD_EARLY_INIT_F + #define CONFIG_DISPLAY_CPUINFO + ++#define CONFIG_MISC_INIT_R /* enable platform-dependent misc_init_r() */ ++ + /* general purpose I/O */ + #define CONFIG_ATMEL_LEGACY /* required until (g)pio is fixed */ + #define CONFIG_AT91_GPIO +@@ -36,6 +40,8 @@ + #define CONFIG_USART_ID ATMEL_ID_SYS + + /* LCD */ ++/* MTR has no LCD */ ++#if !defined(MTR) + #define CONFIG_LCD + #define LCD_BPP LCD_COLOR16 + #define LCD_OUTPUT_BPP 24 +@@ -46,7 +52,13 @@ + #define CONFIG_ATMEL_HLCD + #define CONFIG_ATMEL_LCD_RGB565 + #define CONFIG_SYS_CONSOLE_IS_IN_ENV ++#endif /* !defined(MTR) */ ++ ++/* check for keypress even if bootdelay is 0 */ ++#define CONFIG_ZERO_BOOTDELAY_CHECK + ++/*STATUS LED*/ ++#define BOOT_STATUS_LED AT91_PIN_PC21 + + /* + * BOOTP options +@@ -59,10 +71,7 @@ + /* no NOR flash */ + #define CONFIG_SYS_NO_FLASH + +-/* +- * Command line configuration. +- */ +-#define CONFIG_CMD_NAND ++#define CONFIG_SYS_I2C + + /* + * define CONFIG_USB_EHCI to enable USB Hi-Speed (aka 2.0) +@@ -94,13 +103,30 @@ + /* our CLE is AD22 */ + #define CONFIG_SYS_NAND_MASK_CLE (1 << 22) + #define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PD4 +-#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PD5 ++/* MTR nand ready is PC31 */ ++#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PC31 + + /* PMECC & PMERRLOC */ + #define CONFIG_ATMEL_NAND_HWECC 1 + #define CONFIG_ATMEL_NAND_HW_PMECC 1 +-#define CONFIG_PMECC_CAP 2 ++ ++/* MTR: 4-bit PMECC */ ++#define CONFIG_PMECC_CAP 4 + #define CONFIG_PMECC_SECTOR_SIZE 512 ++/* ++ * CONFIG_PMECC_INDEX_TABLE_OFFSET has been replaced by: ++ * ATMEL_PMECC_INDEX_OFFSET_512 and ++ * ATMEL_PMECC_INDEX_OFFSET_1024 ++ * ++ * Which as used depends on: ++ * host->pmecc_sector_size == 512 ++ * ++ * 2012.10: ++ * #define CONFIG_PMECC_INDEX_TABLE_OFFSET 0x8000 ++ * 2016.03 (at91sam9x5.h): ++ * 182:#define ATMEL_PMECC_INDEX_OFFSET_512 0x8000 ++ */ ++ + + #define CONFIG_CMD_NAND_TRIMFFS + +@@ -147,6 +173,23 @@ + #endif + #endif + ++#define CONFIG_SYS_I2C_SOFT ++#define CONFIG_SOFT_I2C ++#define CONFIG_SOFT_I2C_GPIO_SCL AT91_PIN_PA31 ++#define CONFIG_SOFT_I2C_GPIO_SDA AT91_PIN_PA30 ++#define CONFIG_SYS_I2C_SOFT_SPEED 50000 ++#define CONFIG_SYS_I2C_SPEED CONFIG_SYS_I2C_SOFT_SPEED ++/* Values from previous levels of Conduit U-Boot */ ++#define CONFIG_SYS_I2C_SLAVE 0xfe ++#define I2C_RXTX_LEN 128 ++ ++/* I2C eeprom support */ ++#define CONFIG_CMD_EEPROM ++#define CONFIG_SYS_I2C_EEPROM_ADDR 0x56 /* at24c04 */ ++#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* Bytes of address<---><------>*/ ++#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3 ++ ++ + #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* load address */ + + #define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE +@@ -156,11 +199,11 @@ + /* bootstrap + u-boot + env + linux in nandflash */ + #define CONFIG_ENV_IS_IN_NAND + #define CONFIG_ENV_OFFSET 0xc0000 +-#define CONFIG_ENV_OFFSET_REDUND 0x100000 ++#define CONFIG_ENV_OFFSET_REDUND 0x160000 + #define CONFIG_ENV_SIZE 0x20000 /* 1 sector = 128 kB */ +-#define CONFIG_BOOTCOMMAND "nand read " \ +- "0x22000000 0x200000 0x300000; " \ +- "bootm 0x22000000" ++/* MTR: read from env variables for boot */ ++#define CONFIG_BOOTCOMMAND "nboot.jffs2 ${loadaddr} 0 ${kernel_addr}; bootm ${loadaddr}" ++ + #elif defined(CONFIG_SYS_USE_SPIFLASH) + /* bootstrap + u-boot + env + linux in spi flash */ + #define CONFIG_ENV_IS_IN_SPI_FLASH +@@ -197,6 +240,9 @@ + "8M(bootstrap/uboot/kernel)ro,-(rootfs) " \ + "root=/dev/mmcblk0p2 " \ + "rw rootfstype=ext4 rootwait" ++#elif defined(USE_MTR) ++/* MTR uses jffs2 */ ++#define CONFIG_BOOTARGS "mem=128M console=ttyS0,115200 root=/dev/mtdblock8 ro rootfstype=jffs2" + #else + #define CONFIG_BOOTARGS \ + "console=ttyS0,115200 earlyprintk " \ +@@ -274,4 +320,21 @@ + + #endif + ++/* MTR defaults */ ++#define CONFIG_ENV_OVERWRITE 1 /* Allow Overwrite of serial# & ethaddr */ ++#define CONFIG_ETHADDR 00:08:00:87:00:02 ++#define CONFIG_IPADDR 192.168.2.1 ++#define CONFIG_NETMASK 255.255.255.0 ++#define CONFIG_SERVERIP 192.168.2.2 ++#define CONFIG_HOSTNAME AT91SAM9G25 ++#define CONFIG_LOADADDR 0x22000000 ++ ++/* MTR - enable watchdog */ ++#define CONFIG_AT91SAM9_WATCHDOG 1 ++#define CONFIG_HW_WATCHDOG 1 ++#define CONFIG_AT91_HW_WDT_TIMEOUT 16 ++#define CONFIG_EXTRA_ENV_SETTINGS \ ++ "kernel_addr=0x200000\0" \ ++ "" ++ + #endif diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/printeepromcrc.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/printeepromcrc.patch new file mode 100644 index 0000000..19fca02 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/printeepromcrc.patch @@ -0,0 +1,56 @@ +diff -raNu old/common/env_nand.c new/common/env_nand.c +--- old/common/env_nand.c 2017-05-11 16:27:26.160067136 -0500 ++++ new/common/env_nand.c 2017-05-11 16:44:12.134434145 -0500 +@@ -68,15 +68,22 @@ + #if defined(ENV_IS_EMBEDDED) || defined(CONFIG_NAND_ENV_DST) + int crc1_ok = 0, crc2_ok = 0; + env_t *tmp_env1; ++ uint32_t calc_crc; + + #ifdef CONFIG_ENV_OFFSET_REDUND + env_t *tmp_env2; + + tmp_env2 = (env_t *)((ulong)env_ptr + CONFIG_ENV_SIZE); +- crc2_ok = crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc; ++ calc_crc = crc32(0, tmp_env2->data, ENV_SIZE); ++ crc2_ok = (calc_crc == tmp_env2->crc); ++ printf("env_relocate_spec: crc2_ok=%d saved crc=0x%x calculated crc=0x%x flags=%d\n", ++ crc2_ok,tmp_env2->crc,calc_crc,tmp_env2->flags); + #endif + tmp_env1 = env_ptr; +- crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc; ++ calc_crc = crc32(0, tmp_env1->data, ENV_SIZE); ++ crc1_ok = (calc_crc == tmp_env1->crc); ++ printf("env_relocate_spec: crc1_ok=%d saved crc=0x%x calculated crc=0x%x flags=%d\n", ++ crc1_ok,tmp_env1->crc,calc_crc,tmp_env1->flags); + + if (!crc1_ok && !crc2_ok) { + gd->env_addr = 0; +@@ -317,6 +324,7 @@ + int read1_fail = 0, read2_fail = 0; + int crc1_ok = 0, crc2_ok = 0; + env_t *ep, *tmp_env1, *tmp_env2; ++ uint32_t calc_crc; + + tmp_env1 = (env_t *)malloc(CONFIG_ENV_SIZE); + tmp_env2 = (env_t *)malloc(CONFIG_ENV_SIZE); +@@ -334,11 +342,16 @@ + else if (read1_fail || read2_fail) + puts("*** Warning - some problems detected " + "reading environment; recovered successfully\n"); +- ++ calc_crc = crc32(0, tmp_env1->data, ENV_SIZE); + crc1_ok = !read1_fail && +- (crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc); ++ (calc_crc == tmp_env1->crc); ++ printf("env_relocate_spec: crc1_ok=%d saved crc=0x%x calculated crc=0x%x flags=%d\n", ++ crc1_ok,tmp_env1->crc,calc_crc,tmp_env1->flags); ++ calc_crc = crc32(0, tmp_env2->data, ENV_SIZE); + crc2_ok = !read2_fail && +- (crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc); ++ (calc_crc == tmp_env2->crc); ++ printf("env_relocate_spec: crc2_ok=%d saved crc=0x%x calculated crc=0x%x flags=%d\n", ++ crc2_ok,tmp_env2->crc,calc_crc,tmp_env2->flags); + + if (!crc1_ok && !crc2_ok) { + set_default_env("!bad CRC"); diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/tftpput.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/tftpput.patch new file mode 100644 index 0000000..b5e419f --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/tftpput.patch @@ -0,0 +1,28 @@ +/* + * tftpput in u-boot has two issues. It never resets the timeout, so + * tftpput must complete within the timeout perious (by defaut 5 seconds) + * and it does not properly handle the block wrap at 65535 back to zero, + * so it will transmit data forever, or at least a very long time, if + * the timeout is set long enough, or the timeout issue is patched by + * itself. + */ +diff -Naru old/net/tftp.c new/net/tftp.c +--- old/net/tftp.c 2017-07-05 15:52:28.865818329 -0500 ++++ new/net/tftp.c 2017-07-11 16:15:27.870430395 -0500 +@@ -499,10 +499,15 @@ + int block = ntohs(*s); + int ack_ok = (tftp_cur_block == block); + ++ /* update_block_number needs tftp_prev_block */ ++ tftp_prev_block = tftp_cur_block; + tftp_cur_block = (unsigned short)(block + 1); + update_block_number(); +- if (ack_ok) ++ if (ack_ok) { ++ /* We got the ACK, so reset the timeout */ ++ net_set_timeout_handler(timeout_ms, tftp_timeout_handler); + tftp_send(); /* Send next data block */ ++ } + } + } + #endif diff --git a/recipes-bsp/u-boot/u-boot.inc b/recipes-bsp/u-boot/u-boot.inc new file mode 100644 index 0000000..8854181 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot.inc @@ -0,0 +1,316 @@ +SUMMARY = "Universal Boot Loader for embedded devices" +HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome" +SECTION = "bootloaders" +PROVIDES = "virtual/bootloader" + +# New U-Boot with suppressed version. +PR="m3" + +LICENSE = "GPLv2+" +LIC_FILES_CHKSUM = "file://Licenses/README;md5=a2c678cfd4a4d97135585cad908541c6" + +SRC_URI = "git://git.denx.de/u-boot.git;branch=master" + +S = "${WORKDIR}/git" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit uboot-config deploy + +EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" V=1' +EXTRA_OEMAKE += 'HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}"' + +PACKAGECONFIG ??= "openssl" +# u-boot will compile its own tools during the build, with specific +# configurations (aka when CONFIG_FIT_SIGNATURE is enabled) openssl is needed as +# a host build dependency. +PACKAGECONFIG[openssl] = ",,openssl-native" + +# Allow setting an additional version string that will be picked up by the +# u-boot build system and appended to the u-boot version. If the .scmversion +# file already exists it will not be overwritten. +UBOOT_LOCALVERSION ?= "" + +# Some versions of u-boot use .bin and others use .img. By default use .bin +# but enable individual recipes to change this value. +UBOOT_SUFFIX ??= "bin" +UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}" +UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}" +UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}" +UBOOT_MAKE_TARGET ?= "all" + +# Output the ELF generated. Some platforms can use the ELF file and directly +# load it (JTAG booting, QEMU) additionally the ELF can be used for debugging +# purposes. +UBOOT_ELF ?= "" +UBOOT_ELF_SUFFIX ?= "elf" +UBOOT_ELF_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}" +UBOOT_ELF_BINARY ?= "u-boot.${UBOOT_ELF_SUFFIX}" +UBOOT_ELF_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_ELF_SUFFIX}" + +# Some versions of u-boot build an SPL (Second Program Loader) image that +# should be packaged along with the u-boot binary as well as placed in the +# deploy directory. For those versions they can set the following variables +# to allow packaging the SPL. +#SPL_BINARY ?= "" +#SPL_BINARYNAME ?= "${@os.path.basename(d.getVar("SPL_BINARY", True))}" +#SPL_IMAGE ?= "${SPL_BINARYNAME}-${MACHINE}-${PV}-${PR}" +#SPL_SYMLINK ?= "${SPL_BINARYNAME}-${MACHINE}" + +# Additional environment variables or a script can be installed alongside +# u-boot to be used automatically on boot. This file, typically 'uEnv.txt' +# or 'boot.scr', should be packaged along with u-boot as well as placed in the +# deploy directory. Machine configurations needing one of these files should +# include it in the SRC_URI and set the UBOOT_ENV parameter. +UBOOT_ENV_SUFFIX ?= "txt" +UBOOT_ENV ?= "" +UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}" +UBOOT_ENV_IMAGE ?= "${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}" +UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}" +FILES_${PN}-dev += "${includedir}/u-boot/* ${includedir}/u-boot/configs/* ${includedir}/u-boot/asm/*" + +# Put the PR into the U-Boot image. u-boot allows a local +# version in a file called localversion.* +# For some reason, this must be written in python. +do_patch_append () { + try: + S = d.getVar("S",True) + except TypeError: + bb.fatal("S is missing from recipe") + + f = open(S + "/localversion.mt","w") + + try: + PR = d.getVar("PR",True) + except TypeError: + bb.fatal("PR is missing from recipe") + f.write(PR + os.linesep) +} + + +do_compile () { + if [ "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then + sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk + fi + + unset LDFLAGS + unset CFLAGS + unset CPPFLAGS + + if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ] + then + echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion + echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion + fi + + if [ "x${UBOOT_CONFIG}" != "x" ] + then + for config in ${UBOOT_MACHINE}; do + i=`expr $i + 1`; + for type in ${UBOOT_CONFIG}; do + j=`expr $j + 1`; + if [ $j -eq $i ] + then + oe_runmake O=${config} ${config} --defconfig mtconfig + oe_runmake O=${config} ${UBOOT_MAKE_TARGET} + cp ${S}/${config}/${UBOOT_BINARY} ${S}/${config}/u-boot-${type}.${UBOOT_SUFFIX} + fi + done + unset j + done + unset i + else + oe_runmake ${UBOOT_MACHINE} + oe_runmake ${UBOOT_MAKE_TARGET} + fi + +} + +do_install () { + if [ "x${UBOOT_CONFIG}" != "x" ] + then + for config in ${UBOOT_MACHINE}; do + i=`expr $i + 1`; + for type in ${UBOOT_CONFIG}; do + j=`expr $j + 1`; + if [ $j -eq $i ] + then + install -d ${D}/boot + install ${S}/${config}/u-boot-${type}.${UBOOT_SUFFIX} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY} + fi + done + unset j + done + unset i + else + install -d ${D}/boot + install ${S}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE} + ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY} + fi + + if [ "x${UBOOT_ELF}" != "x" ] + then + if [ "x${UBOOT_CONFIG}" != "x" ] + then + for config in ${UBOOT_MACHINE}; do + i=`expr $i + 1`; + for type in ${UBOOT_CONFIG}; do + j=`expr $j + 1`; + if [ $j -eq $i ] + then + install ${S}/${config}/${UBOOT_ELF} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY} + fi + done + unset j + done + unset i + else + install ${S}/${UBOOT_ELF} ${D}/boot/${UBOOT_ELF_IMAGE} + ln -sf ${UBOOT_ELF_IMAGE} ${D}/boot/${UBOOT_ELF_BINARY} + fi + fi + + if [ -e ${WORKDIR}/fw_env.config ] ; then + install -d ${D}${sysconfdir} + install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config + fi + + if [ "x${SPL_BINARY}" != "x" ] + then + if [ "x${UBOOT_CONFIG}" != "x" ] + then + for config in ${UBOOT_MACHINE}; do + i=`expr $i + 1`; + for type in ${UBOOT_CONFIG}; do + j=`expr $j + 1`; + if [ $j -eq $i ] + then + install ${S}/${config}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}-${type}-${PV}-${PR} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARYNAME}-${type} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARYNAME} + fi + done + unset j + done + unset i + else + install ${S}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE} + ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARYNAME} + fi + fi + + if [ "x${UBOOT_ENV}" != "x" ] + then + install ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE} + ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY} + fi + mkdir -p ${D}/usr/include/u-boot || true + (cd ${S}/include;find . | cpio -pdum ${D}/usr/include/u-boot) + (cd ${S}/arch/arm;rm -f ${D}/usr/include/mach-at91;find mach-at91 | cpio -pdum ${D}/usr/include/) + (cd ${S} ; rm -f ${D}/usr/include/u-boot/asm ; cd arch/arm/include ; find asm | cpio -pdum ${D}/usr/include/u-boot) +} + +FILES_${PN} = "/boot ${sysconfdir}" + +do_deploy () { + if [ "x${UBOOT_CONFIG}" != "x" ] + then + for config in ${UBOOT_MACHINE}; do + i=`expr $i + 1`; + for type in ${UBOOT_CONFIG}; do + j=`expr $j + 1`; + if [ $j -eq $i ] + then + install -d ${DEPLOYDIR} + install ${S}/${config}/u-boot-${type}.${UBOOT_SUFFIX} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} + cd ${DEPLOYDIR} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY} + fi + done + unset j + done + unset i + else + install -d ${DEPLOYDIR} + install ${S}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE} + cd ${DEPLOYDIR} + rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK} + ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK} + ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY} + fi + + if [ "x${UBOOT_ELF}" != "x" ] + then + if [ "x${UBOOT_CONFIG}" != "x" ] + then + for config in ${UBOOT_MACHINE}; do + i=`expr $i + 1`; + for type in ${UBOOT_CONFIG}; do + j=`expr $j + 1`; + if [ $j -eq $i ] + then + install ${S}/${config}/${UBOOT_ELF} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK} + fi + done + unset j + done + unset i + else + install ${S}/${UBOOT_ELF} ${DEPLOYDIR}/${UBOOT_ELF_IMAGE} + ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_BINARY} + ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK} + fi + fi + + + if [ "x${SPL_BINARY}" != "x" ] + then + if [ "x${UBOOT_CONFIG}" != "x" ] + then + for config in ${UBOOT_MACHINE}; do + i=`expr $i + 1`; + for type in ${UBOOT_CONFIG}; do + j=`expr $j + 1`; + if [ $j -eq $i ] + then + install ${S}/${config}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}-${type}-${PV}-${PR} + rm -f ${DEPLOYDIR}/${SPL_BINARYNAME} ${DEPLOYDIR}/${SPL_SYMLINK}-${type} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARYNAME}-${type} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARYNAME} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK}-${type} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK} + fi + done + unset j + done + unset i + else + install ${S}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE} + rm -f ${DEPLOYDIR}/${SPL_BINARYNAME} ${DEPLOYDIR}/${SPL_SYMLINK} + ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_BINARYNAME} + ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_SYMLINK} + fi + fi + + + if [ "x${UBOOT_ENV}" != "x" ] + then + install ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE} + rm -f ${DEPLOYDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK} + ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY} + ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK} + fi +} + +addtask deploy before do_build after do_compile diff --git a/recipes-bsp/u-boot/u-boot_2016.09.01.bb b/recipes-bsp/u-boot/u-boot_2016.09.01.bb new file mode 100644 index 0000000..59b3c4c --- /dev/null +++ b/recipes-bsp/u-boot/u-boot_2016.09.01.bb @@ -0,0 +1,34 @@ +require u-boot.inc + +DEPENDS += "dtc-native" +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-2016.09.01:" + +SRC_URI = "ftp://ftp.denx.de/pub/u-boot/u-boot-${PV}.tar.bz2 \ + file://kconfig_common.patch \ + file://config.patch \ + file://i2c.patch \ + file://printeepromcrc.patch \ + file://mtpwd.patch \ + file://tftpput.patch \ + file://hide_uboot_version.patch \ + file://fix_2_6.patch \ + file://fix_net.patch" + +SRC_URI_append_mtcdt = " \ + file://mtcdt.patch \ + file://mtcdt_flush_console_autoboot.patch" + +SRC_URI_append_mtcap = " \ + file://mtcdt.patch" + +SRC_URI_append_mtr = "\ + file://mtr.patch \ +" +SRC_URI_append_mtrv1 = "\ + file://mtrv1.patch \ +" + +SRC_URI[md5sum] = "61c628f8034477c946e173ed174efeb4" +SRC_URI[sha256sum] = "95728e89dd476d17428f94080752ab48884be477b6a678941582aeef618b70bb" + +S = "${WORKDIR}/${PN}-${PV}" diff --git a/recipes-bsp/usbutils/usbutils_%.bbappend b/recipes-bsp/usbutils/usbutils_%.bbappend new file mode 100644 index 0000000..6311910 --- /dev/null +++ b/recipes-bsp/usbutils/usbutils_%.bbappend @@ -0,0 +1,3 @@ +PR.=".mts1" + +RRECOMMENDS_${PN}_remove += "udev-hwdb"
\ No newline at end of file diff --git a/recipes-bsp/wl12xx-firmware/wl12xx-firmware/LICENSE b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/LICENSE new file mode 100644 index 0000000..29ed482 --- /dev/null +++ b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/LICENSE @@ -0,0 +1,72 @@ +TEXAS INSTRUMENTS TEXT FILE LICENSE
+
+
+Copyright (c) 2008 – 2013 Texas Instruments Incorporated
+
+All rights reserved not granted herein.
+
+Limited License.
+
+If you download and use any version of this software from www.github.com, you
+acknowledge and agree that the terms and conditions of this license control and any
+previous licenses under which this software may have been provided on www.github.com
+are superseded and replaced by the terms and conditions of this license.
+
+Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
+license under copyrights and patents it now or hereafter owns or controls to make,
+have made, use, import, offer to sell and sell ("Utilize") this software subject
+to the terms herein. With respect to the foregoing patent license, such license
+is granted solely to the extent that any such patent is necessary to Utilize the
+software alone. The patent license shall not apply to any combinations which
+include this software, other than combinations with devices manufactured by or
+for TI (“TI Devices”). No hardware patent is licensed hereunder.
+
+Redistributions must preserve existing copyright notices and reproduce this license
+(including the above copyright notice and the disclaimer and (if applicable) source
+code license limitations below) in the documentation and/or other materials provided
+with the distribution
+
+Redistribution and use in binary form, without modification, are permitted provided
+that the following conditions are met:
+
+* No reverse engineering, decompilation, or disassembly of this software is permitted
+ with respect to any software provided in binary form.
+
+* any redistribution and use are licensed by TI for use only with TI Devices.
+
+* Nothing shall obligate TI to provide you with source code for the software
+ licensed and provided to you in object code.
+
+If software source code is provided to you, modification and redistribution of the
+source code are permitted provided that the following conditions are met:
+
+* any redistribution and use of the source code, including any resulting
+ derivative works, are licensed by TI for use only with TI Devices.
+
+* any redistribution and use of any object code compiled from the source
+ code and any resulting derivative works, are licensed by TI for use only
+ with TI Devices.
+
+Neither the name of Texas Instruments Incorporated nor the names of its suppliers
+may be used to endorse or promote products derived from this software without specific
+prior written permission.
+
+DISCLAIMER.
+
+THIS SOFTWARE IS PROVIDED BY TI AND TI’S LICENSORS "AS IS" AND ANY EXPRESS
+OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+NO EVENT SHALL TI AND TI’S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+BY UTILIZING THIS SOFTWARE TO ENABLE ANT CODE EMBEDDED ON TI DEVICES, YOU
+AGREE THAT NOTHING IN THIS LICENSE GIVES RISE TO ANY WARRANTY OR OTHER
+OBLIGATIONS BY TI OR ITS LICENSORS WITH RESPECT TO THE ANT CODE EMBEDDED
+ON TI DEVICES AND ENABLED BY THE SOFTWARE UNDER THIS LICENSE. FURTHER, YOU
+AGREE THAT NOTHING IN THIS LICENSE GIVES RISE TO ANY RIGHT TO REVERSE ENGINEER,
+DECOMPILE OR DISASSEMBLE THE ANT CODE EMBEDDED ON THE TI DEVICES.
diff --git a/recipes-bsp/wl12xx-firmware/wl12xx-firmware/TIInit_7.6.15.bts b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/TIInit_7.6.15.bts Binary files differnew file mode 100644 index 0000000..ed733bc --- /dev/null +++ b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/TIInit_7.6.15.bts diff --git a/recipes-bsp/wl12xx-firmware/wl12xx-firmware/calibrate-wifi b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/calibrate-wifi new file mode 100755 index 0000000..319e481 --- /dev/null +++ b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/calibrate-wifi @@ -0,0 +1,159 @@ +#!/bin/bash +#Calibrates wl1271 Wifi Chip and Sets Power Levels + +OEM_DIR="/var/oem" +NVS_DIR="mts" +NVS_OEM_FILE="$OEM_DIR/$NVS_DIR/wl1271-nvs.bin" +NVS_OEM_INI="$OEM_DIR/$NVS_DIR/TQS_S_2.6.ini" +NVS_FILE="/lib/firmware/ti-connectivity/wl1271-nvs.bin" +NVS_DEFAULT_FILE="$NVS_FILE.factory" +NVS_DEFAULT_INI="/usr/share/ti/wifi-utils/ini_files/127x/TQS_S_2.6.ini" +WIFI_PWR_LINE_B="FEM1_TxPerChannelPowerLimits_2_4G_11b =" +WIFI_PWR_LINE_OFDM="FEM1_TxPerChannelPowerLimits_2_4G_OFDM =" +WIFI_PWR_ARR_SIZE=14 +WIFI_PWR_INDEX_START=2 +WIFI_PWR_INDEX_END=$(( $WIFI_PWR_INDEX_START + $WIFI_PWR_ARR_SIZE)) +WIFIMAC=$(mts-io-sysfs show mac-wifi) +CHANNEL="ALL" + +# Reset in case getopts has been used previously in the shell. +OPTIND=1 + +function show_help() { + echo "Usage: $0 -m <WIFI MAC> -c <CHANNEL> <POWER LIMIT mBm>" + echo " Example: $0 -c 1 1250" + echo " Sets max transmit power to 12.5 dBm on channel 1" + echo "Note: Using no options will calibrate to factory settings" +} + +while getopts "h?c:m:" opt; do + case "$opt" in + h|\?) + show_help + exit 0 + ;; + c) CHANNEL=$OPTARG + ;; + m) WIFIMAC=$OPTARG + ;; + esac +done + +shift $((OPTIND-1)) +[ "$1" = "--" ] && shift + +POWER=$1 + +regexIsNumber='^[0-9]+$' + +if [ "$POWER" != "" ]; then + if ! [[ $POWER =~ $regexIsNumber ]] ; then + echo "Error: Power is Not a Number" >&2; exit 1 + fi + if [ $POWER -lt 0 ]; then + echo "Error: Minimum power lvl is 0 mBm" >&2; exit 1 + fi + if [ $POWER -gt 3000 ]; then + echo "Error: Maximum power lvl is 3000 mBm" >&2; exit 1 + fi +fi + +if [ "$CHANNEL" != "ALL" ]; then + if ! [[ $CHANNEL =~ $regexIsNumber ]] ; then + echo "Error: Channel is Not a Number" >&2; exit 1 + fi + if [ $CHANNEL -gt 14 ] || [ $CHANNEL -lt 1 ]; then + echo "Error: Valid Channels are 1-14" >&2; exit 1 + fi +fi + +echo "starting wifi calibration..." + +/etc/init.d/wifi stop >/dev/null 2>&1 + +mts-io-sysfs store wlan-enabled 0 +sleep 1 +mts-io-sysfs store wlan-enabled 1 +sleep 1 + +modprobe atmel_mci +sleep 5 + +mount -o remount,rw /var/oem +echo "removing $NVS_OEM_FILE" +# WARNING: need remove file after 'modprobe atmel_mci' +rm -f $NVS_OEM_FILE +mkdir -p $OEM_DIR/$NVS_DIR + +if [ ! -f $NVS_OEM_INI ]; then + cp $NVS_DEFAULT_INI $NVS_OEM_INI +fi + +#Pull Applicable Fields +lineB=$(grep "$WIFI_PWR_LINE_B" $NVS_OEM_INI) #GET B TX PWR LMT LINE +lineOFDM=$(grep "$WIFI_PWR_LINE_OFDM" $NVS_OEM_INI) #GET OFDM TX PWR LMT LINE +lineB=${lineB%%#*} #REMOVE TRAILING COMMENT LINE +lineOFDM=${lineOFDM%%#*} #REMOVE TRAILING COMMENT LINE + +if [ "$POWER" != "" ]; then + POWER=$((($POWER * 2) / 100 )) #POWER NEEDS TO BE IN 1/2 dB + + if [ "$CHANNEL" == "ALL" ]; then + echo "setting power levels on all channels..." + for ((i=$WIFI_PWR_INDEX_START; i < $WIFI_PWR_INDEX_END; i++)); do + pwrLine="$pwrLine $POWER" + done + else + echo "setting power level on channel $CHANNEL..." + channelIndex=$(( $WIFI_PWR_INDEX_START + $CHANNEL - 1 )) + IFS=', ' read -a array <<< "$lineB" + for ((i=$WIFI_PWR_INDEX_START; i < $WIFI_PWR_INDEX_END; i++)); do + if [ "$i" == "$channelIndex" ]; then + pwr=$POWER + else + pwr=${array[$i]} + fi + pwrLine="$pwrLine $pwr" + done + fi + newLineB="$WIFI_PWR_LINE_B $pwrLine" + newLineOFDM="$WIFI_PWR_LINE_OFDM $pwrLine" + sed -i "s/$lineB/$newLineB/g" "$NVS_OEM_INI" + sed -i "s/$lineOFDM/$newLineOFDM/g" "$NVS_OEM_INI" +else + #FACTORY SETTINGS + #960 mBm WAS MEASURED IN LAB TO PRODUCE 12.5 dBm on DEC2013 + #960 mBm => 19 steps in 1/2 dB + POWER=19 + echo "setting power levels to factory settings..." + channel=1 + for ((i=$WIFI_PWR_INDEX_START; i < $WIFI_PWR_INDEX_END; i++)); do + if [ $channel -gt 11 ]; then + #Set Channels 12 - 14 to zero power output + pwrLine="$pwrLine 0" + else + pwrLine="$pwrLine $POWER" + fi + let channel=channel+1 + done + newLineB="$WIFI_PWR_LINE_B $pwrLine" + newLineOFDM="$WIFI_PWR_LINE_OFDM $pwrLine" + sed -i "s/$lineB/$newLineB/g" "$NVS_OEM_INI" + sed -i "s/$lineOFDM/$newLineOFDM/g" "$NVS_OEM_INI" +fi + +sync + +echo "calibrating..." +calibrator plt autocalibrate wlan0 \ + /lib/modules/$(uname -r)/kernel/drivers/net/wireless/ti/wlcore/wlcore_sdio.ko \ + $NVS_OEM_INI \ + $NVS_FILE $WIFIMAC + +sync + +/etc/init.d/wifi restart >/dev/null 2>&1 + +mount -o remount,ro /var/oem + +echo "...calibration finished" diff --git a/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl1271-nvs.bin b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl1271-nvs.bin Binary files differnew file mode 100644 index 0000000..91978f9 --- /dev/null +++ b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl1271-nvs.bin diff --git a/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-mr.bin b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-mr.bin Binary files differnew file mode 100644 index 0000000..a6279ed --- /dev/null +++ b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-mr.bin diff --git a/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-plt.bin b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-plt.bin Binary files differnew file mode 100644 index 0000000..1f6249f --- /dev/null +++ b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-plt.bin diff --git a/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-sr.bin b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-sr.bin Binary files differnew file mode 100644 index 0000000..ffc9594 --- /dev/null +++ b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-sr.bin diff --git a/recipes-bsp/wl12xx-firmware/wl12xx-firmware_r6.bb b/recipes-bsp/wl12xx-firmware/wl12xx-firmware_r6.bb new file mode 100644 index 0000000..ed7fe36 --- /dev/null +++ b/recipes-bsp/wl12xx-firmware/wl12xx-firmware_r6.bb @@ -0,0 +1,52 @@ +DESCRIPTION = "TI wl1271 firmware" +HOMEPAGE = "http://processors.wiki.ti.com/index.php/ARM_Processor_Open_Source_Wireless_Connectivity" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=1c9961176d6529283e0d0c983be41b45" +PR="r9" + +# bluetooth firmware from TI-ECS on github.com: +# https://github.com/TI-ECS/bt-firmware.git +# revision 3c0e4752ba91be195ac05226725428dfdc1a4759 +# Last file log message: "Updated to service pack 2.14" +# file: am335x/TIInit_7.6.15.bts +# md5sum: a46c46104c7fab23bb9ebfae1633a3af +# wifi firmware from Wkennington on github.com +# https://github.com/wkennington/linux-firmware/tree/master/ti-connectivity +# revision 6d3bc8886517d171068fd1263176b8b5c51df204 +# Last file log message: "Fix permissions on ti-connectivity firmware from 05e9fe5 Signed-off-by: Kyle McMartin <kyle@kernel.org>" +# file: ti-connectivity/wl127x-fw-5-sr.bin +# file: ti-connectivity/wl127x-fw-5-mr.bin +# file: ti-connectivity/wl127x-fw-5-plt.bin + +SRC_URI = "file://wl127x-fw-5-mr.bin \ + file://wl127x-fw-5-plt.bin \ + file://wl127x-fw-5-sr.bin \ + file://TIInit_7.6.15.bts \ + file://wl1271-nvs.bin \ + file://calibrate-wifi \ + file://LICENSE " + +# nothing to compile +do_configure() { +} + +do_compile() { +} + +do_install() { + install -d ${D}/lib/firmware + install -d ${D}/sbin + install -d ${D}/lib/firmware/ti-connectivity + # wifi firmware + install ${WORKDIR}/wl127x-fw-*-*.bin ${D}/lib/firmware/ti-connectivity + # uncalibrated nvs file + # use local copy since the one in hw/firmware dir is *wrong* + install ${WORKDIR}/wl1271-nvs.bin ${D}/lib/firmware/ti-connectivity/wl1271-nvs.bin.factory + # link to nvs file with mac address set + ln -sf /var/oem/mts/wl1271-nvs.bin ${D}/lib/firmware/ti-connectivity/wl127x-nvs.bin + install ${WORKDIR}/calibrate-wifi ${D}/sbin + # bluetooth firmware + install ${WORKDIR}/TIInit_7.6.15.bts ${D}/lib/firmware/ti-connectivity/TIInit_7.6.15.bts +} + +FILES_${PN} = "/lib/firmware /sbin" |