mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2026-03-14 21:10:27 +01:00
AU_LINUX_QSDK_GINGER_TARGET_ALL.12.4.5.1584.099
-----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQTxBDvDjyiEYwLkeGuhSA9lgKkB8QUCZL4R3wAKCRChSA9lgKkB 8WONAKDCfmik9ovYAddgUncz8NGLA560uACg6Gu5woW1k7NHCXXhEnnAugiYo7M= =BeOL -----END PGP SIGNATURE----- Merge AU_LINUX_QSDK_GINGER_TARGET_ALL.12.4.5.1584.099 on remote branch Change-Id: Icf46975535461bd7d2ab0c0e71dcd60006201d11 Signed-off-by: Linux Build Service Account <lnxbuild@localhost>
This commit is contained in:
commit
743522164c
49 changed files with 486 additions and 188 deletions
|
|
@ -91,6 +91,7 @@ dtb-$(CONFIG_ARCH_IPQ5018) += ipq5018-db-mp02.1.dtb \
|
|||
ipq5018-db-mp03.1.dtb
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_IPQ_TINY),y)
|
||||
dtb-$(CONFIG_ARCH_IPQ5332) += ipq5332-emulation.dtb \
|
||||
ipq5332-mi01.2.dtb \
|
||||
ipq5332-mi01.2-qcn9160-c1.dtb \
|
||||
|
|
@ -103,6 +104,11 @@ dtb-$(CONFIG_ARCH_IPQ5332) += ipq5332-emulation.dtb \
|
|||
ipq5332-db-mi01.1.dtb \
|
||||
ipq5332-db-mi02.1.dtb \
|
||||
ipq5332-db-mi03.1.dtb
|
||||
else
|
||||
dtb-$(CONFIG_ARCH_IPQ5332) += ipq5332-mi01.3.dtb \
|
||||
ipq5332-mi04.1.dtb \
|
||||
ipq5332-db-mi02.1.dtb
|
||||
endif
|
||||
|
||||
dtb-$(CONFIG_ARCH_IPQ6018) += ipq6018-cp01-c1.dtb \
|
||||
ipq6018-cp02-c1.dtb \
|
||||
|
|
@ -124,6 +130,8 @@ dtb-$(CONFIG_ARCH_IPQ9574) += ipq9574-al01-c1.dtb \
|
|||
ipq9574-al02-c17.dtb \
|
||||
ipq9574-al02-c18.dtb \
|
||||
ipq9574-al02-c19.dtb \
|
||||
ipq9574-al05.dtb \
|
||||
ipq9574-al06.dtb \
|
||||
ipq9574-db-al01-c1.dtb \
|
||||
ipq9574-db-al01-c2.dtb \
|
||||
ipq9574-db-al01-c3.dtb \
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@
|
|||
};
|
||||
|
||||
sdx-gpio {
|
||||
ap2mdm = <25>;
|
||||
ap2mdm = <26>;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "ipq5332-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x1060001>;
|
||||
config_name = "config@db-mi01.1";
|
||||
config_name = "config@db-mi01.1", "config-db-mi01.1";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78AF000";
|
||||
|
|
|
|||
|
|
@ -17,16 +17,14 @@
|
|||
#include "ipq5332-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x1060003>;
|
||||
config_name = "config@db-mi02.1";
|
||||
config_name = "config@db-mi02.1", "config-db-mi02.1";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78AF000";
|
||||
nand = "/nand-controller@79B0000";
|
||||
mmc = "/sdhci@7804000";
|
||||
usb0 = "/xhci@8a00000";
|
||||
pci0 = "/pci@20000000";
|
||||
pci1 = "/pci@18000000";
|
||||
pci2 = "/pci@10000000";
|
||||
i2c0 = "/i2c@78B6000";
|
||||
};
|
||||
|
||||
|
|
@ -150,19 +148,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
pci0: pci@20000000 {
|
||||
status = "ok";
|
||||
perst_gpio = <38>;
|
||||
lane = <1>;
|
||||
pci_gpio {
|
||||
pci_rst {
|
||||
gpio = <38>;
|
||||
pull = <GPIO_PULL_UP>;
|
||||
oe = <GPIO_OE_ENABLE>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
pci1: pci@18000000 {
|
||||
status = "ok";
|
||||
perst_gpio = <47>;
|
||||
|
|
@ -176,19 +161,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
pci2: pci@10000000 {
|
||||
status = "ok";
|
||||
perst_gpio = <44>;
|
||||
lane = <1>;
|
||||
pci_gpio {
|
||||
pci_rst {
|
||||
gpio = <44>;
|
||||
pull = <GPIO_PULL_UP>;
|
||||
oe = <GPIO_OE_ENABLE>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
ess-switch {
|
||||
switch_mac_mode0 = <PORT_WRAPPER_10GBASE_R>;
|
||||
switch_mac_mode1 = <PORT_WRAPPER_10GBASE_R>;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "ipq5332-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x1060002>;
|
||||
config_name = "config@db-mi03.1";
|
||||
config_name = "config@db-mi03.1", "config-db-mi03.1";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78AF000";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "ipq5332-mi01.2.dts"
|
||||
/ {
|
||||
machid = <0x8060101>;
|
||||
config_name = "config@mi01.2-qcn9160-c1", "config@rdp472";
|
||||
config_name = "config@mi01.2-qcn9160-c1", "config@rdp472", "config-rdp472";
|
||||
|
||||
aliases {
|
||||
/delete-property/pci0;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "ipq5332-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x8060001>;
|
||||
config_name = "config@mi01.2", "config@rdp441";
|
||||
config_name = "config@mi01.2", "config@rdp441", "config-rdp441";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78AF000";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "ipq5332-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x8060002>;
|
||||
config_name = "config@mi01.3", "config@rdp442";
|
||||
config_name = "config@mi01.3", "config@rdp442", "config-rdp442";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78AF000";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "ipq5332-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x8060003>;
|
||||
config_name = "config@mi01.4", "config@rdp444";
|
||||
config_name = "config@mi01.4", "config@rdp444", "config-rdp444";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78AF000";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "ipq5332-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x8060000>;
|
||||
config_name = "config@mi01.6", "config@rdp468";
|
||||
config_name = "config@mi01.6", "config@rdp468", "config-rdp468";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78AF000";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "ipq5332-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x8060006>;
|
||||
config_name = "config@mi01.9";
|
||||
config_name = "config@mi01.9", "config@rdp474", "config-rdp474";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78AF000";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "ipq5332-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x8060005>;
|
||||
config_name = "config@mi03.1", "config@rdp447";
|
||||
config_name = "config@mi03.1", "config@rdp447", "config-rdp447";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78AF000";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "ipq5332-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x8060004>;
|
||||
config_name = "config@mi04.1", "config@rdp446";
|
||||
config_name = "config@mi04.1", "config@rdp446", "config-rdp446";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78AF000";
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#include "ipq9574-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x8050000>;
|
||||
config_name = "config@al01-c1", "config@rdp417";
|
||||
config_name = "config@al01-c1", "config@rdp417", "config-rdp417";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78B1000";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "ipq9574-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x8050001>;
|
||||
config_name = "config@al02-c1", "config@rdp418";
|
||||
config_name = "config@al02-c1", "config@rdp418", "config-rdp418";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78B1000";
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "ipq9574-al02-c8.dts"
|
||||
/ {
|
||||
machid = <0x8050901>;
|
||||
config_name = "config@al02-c10", "config@rdp433-mht";
|
||||
config_name = "config@al02-c10", "config@rdp433-mht-switch", "config-rdp433-mht-switch";
|
||||
|
||||
ess-switch {
|
||||
/* Overriding config to support QCA8084 Switch instead of
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "ipq9574-al02-c4.dts"
|
||||
/ {
|
||||
machid = <0x8050C01>;
|
||||
config_name = "config@al02-c13", "config@459";
|
||||
config_name = "config@al02-c13", "config@rdp459", "config-rdp459";
|
||||
|
||||
aliases {
|
||||
pci0 = "/pci@28000000";
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "ipq9574-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x8051001>;
|
||||
config_name = "config@al02-c17", "config@469";
|
||||
config_name = "config@al02-c17", "config@rdp469", "config-rdp469";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78B1000";
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "ipq9574-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x8051201>;
|
||||
config_name = "config@al02-c19", "config@rdp461";
|
||||
config_name = "config@al02-c19", "config@rdp461", "config-rdp461";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78B1000";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "ipq9574-al02-c1.dts"
|
||||
/ {
|
||||
machid = <0x8050101>;
|
||||
config_name = "config@al02-c2", "config@rdp418-emmc";
|
||||
config_name = "config@al02-c2", "config@rdp418", "config-rdp418";
|
||||
|
||||
aliases {
|
||||
mmc = "/sdhci@7804000";
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "ipq9574-al02-c2.dts"
|
||||
/ {
|
||||
machid = <0x8050201>;
|
||||
config_name = "config@al02-c3", "config@rdp437";
|
||||
config_name = "config@al02-c3", "config@rdp437", "config-rdp437";
|
||||
|
||||
aliases {
|
||||
pci0 = "/pci@28000000";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "ipq9574-al02-c1.dts"
|
||||
/ {
|
||||
machid = <0x8050301>;
|
||||
config_name = "config@al02-c4","config@rdp433";
|
||||
config_name = "config@al02-c4","config@rdp433", "config-rdp433";
|
||||
|
||||
aliases {
|
||||
pci1 = "/pci@10000000";
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "ipq9574-al02-c4.dts"
|
||||
/ {
|
||||
machid = <0x8050601>;
|
||||
config_name = "config@al02-c7", "config@rdp433-emmc-mht";
|
||||
config_name = "config@al02-c7", "config@rdp433-mht-phy", "config-rdp433-mht-phy";
|
||||
|
||||
aliases {
|
||||
mmc = "/sdhci@7804000";
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "ipq9574-al02-c4.dts"
|
||||
/ {
|
||||
machid = <0x8050701>;
|
||||
config_name = "config@al02-c8", "config@rdp453";
|
||||
config_name = "config@al02-c8", "config@rdp453", "config-rdp453";
|
||||
|
||||
ess-switch {
|
||||
/* Overriding config to support QCA8084 PHY instead of
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "ipq9574-al01-c1.dts"
|
||||
/ {
|
||||
machid = <0x8050801>;
|
||||
config_name = "config@al02-c9", "config@454";
|
||||
config_name = "config@al02-c9", "config@rdp454", "config-rdp454";
|
||||
|
||||
aliases {
|
||||
pci0 = "/pci@28000000";
|
||||
|
|
|
|||
20
arch/arm/dts/ipq9574-al05.dts
Normal file
20
arch/arm/dts/ipq9574-al05.dts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
#include "ipq9574-al02-c4.dts"
|
||||
/ {
|
||||
machid = <0x8050003>;
|
||||
config_name = "config@al05";
|
||||
};
|
||||
20
arch/arm/dts/ipq9574-al06.dts
Normal file
20
arch/arm/dts/ipq9574-al06.dts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
#include "ipq9574-al02-c4.dts"
|
||||
/ {
|
||||
machid = <0x8050004>;
|
||||
config_name = "config@al06";
|
||||
};
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
#include "ipq9574-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x1050000>;
|
||||
config_name = "config@db-al01-c1";
|
||||
config_name = "config@db-al01-c1", "config-db-al01-c1";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78B1000";
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#include "ipq9574-db-al01-c1.dts"
|
||||
/ {
|
||||
machid = <0x1050100>;
|
||||
config_name = "config@db-al01-c2";
|
||||
config_name = "config@db-al01-c2", "config-db-al01-c2";
|
||||
|
||||
aliases {
|
||||
mmc = "/sdhci@7804000";
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#include "ipq9574-db-al01-c1.dts"
|
||||
/ {
|
||||
machid = <0x1050200>;
|
||||
config_name = "config@db-al01-c3";
|
||||
config_name = "config@db-al01-c3", "config-db-al01-c3";
|
||||
|
||||
ess-switch {
|
||||
/* Overriding port6 configuration to support AQ instead
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#include "ipq9574-soc.dtsi"
|
||||
/ {
|
||||
machid = <0x1050001>;
|
||||
config_name = "config@db-al02-c1";
|
||||
config_name = "config@db-al02-c1", "config-db-al02-c1";
|
||||
|
||||
aliases {
|
||||
console = "/serial@78B1000";
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#include "ipq9574-db-al02-c1.dts"
|
||||
/ {
|
||||
machid = <0x1050101>;
|
||||
config_name = "config@db-al02-c2";
|
||||
config_name = "config@db-al02-c2", "config-db-al02-c2";
|
||||
|
||||
aliases {
|
||||
mmc = "/sdhci@7804000";
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#include "ipq9574-db-al02-c1.dts"
|
||||
/ {
|
||||
machid = <0x1050201>;
|
||||
config_name = "config@db-al02-c3";
|
||||
config_name = "config@db-al02-c3", "config-db-al02-c3";
|
||||
|
||||
aliases {
|
||||
i2c0 = "/i2c@78B9000";
|
||||
|
|
|
|||
|
|
@ -1174,6 +1174,10 @@ extern unsigned int __machine_arch_type;
|
|||
#define MACH_TYPE_IPQ9574_AP_AL03_C1 0x8050002
|
||||
#define MACH_TYPE_IPQ9574_AP_AL03_C2 0x8050102
|
||||
#define MACH_TYPE_IPQ5332_EMULATION 0xF060000
|
||||
#define MACH_TYPE_IPQ5332_AP_MI01_3 0x8060002
|
||||
#define MACH_TYPE_IPQ5332_AP_MI01_3_C2 0x8060102
|
||||
#define MACH_TYPE_IPQ5332_AP_MI04_1 0x8060004
|
||||
#define MACH_TYPE_IPQ5332_AP_MI04_1_C2 0x8060007
|
||||
|
||||
#ifdef CONFIG_ARCH_EBSA110
|
||||
# ifdef machine_arch_type
|
||||
|
|
|
|||
|
|
@ -387,10 +387,10 @@ int board_fix_fdt(void *rw_fdt_blob)
|
|||
#ifdef CONFIG_FLASH_PROTECT
|
||||
void board_flash_protect(void)
|
||||
{
|
||||
#ifdef CONFIG_QCA_MMC
|
||||
int num_part;
|
||||
int i;
|
||||
int ret;
|
||||
#ifdef CONFIG_QCA_MMC
|
||||
block_dev_desc_t *mmc_dev;
|
||||
disk_partition_t info;
|
||||
|
||||
|
|
|
|||
|
|
@ -172,7 +172,8 @@ void ipq_fdt_fixup_version(void *blob)
|
|||
}
|
||||
#endif /* RPM_VERSION */
|
||||
}
|
||||
#ifdef CONFIG_IPQ_TINY
|
||||
|
||||
#if defined (CONFIG_IPQ_TINY) && !defined(CONFIG_NAND_FLASH)
|
||||
#define OFFSET_NOT_SPECIFIED (~0llu)
|
||||
struct reg_cell {
|
||||
unsigned int r0;
|
||||
|
|
@ -1063,7 +1064,7 @@ int ft_board_setup(void *blob, bd_t *bd)
|
|||
int len = sizeof(parts_str), ret;
|
||||
qca_smem_flash_info_t *sfi = &qca_smem_flash_info;
|
||||
int activepart = 0;
|
||||
#ifdef CONFIG_IPQ_TINY
|
||||
#if defined (CONFIG_IPQ_TINY) && !defined(CONFIG_NAND_FLASH)
|
||||
struct flash_node_info nodes[] = {
|
||||
{ "n25q128a11", MTD_DEV_TYPE_NAND,
|
||||
CONFIG_IPQ_SPI_NOR_INFO_IDX }
|
||||
|
|
@ -1134,7 +1135,7 @@ int ft_board_setup(void *blob, bd_t *bd)
|
|||
|
||||
set_mtdids();
|
||||
debug("MTDIDS: %s\n", getenv("mtdids"));
|
||||
#ifdef CONFIG_IPQ_TINY
|
||||
#if defined (CONFIG_IPQ_TINY) && !defined(CONFIG_NAND_FLASH)
|
||||
ipq_nor_fdt_fixup(blob, nodes);
|
||||
#else
|
||||
ipq_fdt_fixup_mtdparts(blob, nodes);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@
|
|||
#include <asm/arch-ipq5332/clk.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/errno.h>
|
||||
#include <fdtdec.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
static void uart_configure_mux(u8 id)
|
||||
{
|
||||
|
|
@ -509,6 +512,7 @@ void cfg_clock_init(void)
|
|||
void mdio_clock_init(void)
|
||||
{
|
||||
unsigned int reg_val;
|
||||
int node = fdt_path_offset(gd->fdt_blob, "/ess-switch");
|
||||
|
||||
/* MDIO Master Clock init */
|
||||
reg_val = readl(GCC_MDIO_MASTER_AHB_CBCR);
|
||||
|
|
@ -519,10 +523,12 @@ void mdio_clock_init(void)
|
|||
reg_val |= BIT(0);
|
||||
writel(reg_val, MDIO_50MHZ_CLK_BASE);
|
||||
|
||||
reg_val = readl(MDIO_50MHZ_CLK_BASE + 0x10000);
|
||||
reg_val |= BIT(0);
|
||||
writel(reg_val, MDIO_50MHZ_CLK_BASE + 0x10000);
|
||||
|
||||
if (!(fdtdec_get_uint(gd->fdt_blob, node,
|
||||
"qca8084_bypass_enable", 0))) {
|
||||
reg_val = readl(MDIO_50MHZ_CLK_BASE + 0x10000);
|
||||
reg_val |= BIT(0);
|
||||
writel(reg_val, MDIO_50MHZ_CLK_BASE + 0x10000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -712,10 +712,10 @@ static void usb_init_hsphy(void __iomem *phybase, int ssphy)
|
|||
writel(XCFG_COARSE_TUNE_NUM | XCFG_FINE_TUNE_NUM,
|
||||
phybase + USB2PHY_USB_PHY_M31_XCFGI_11);
|
||||
|
||||
/* Adjust HSTX slew rate to 565 ps*/
|
||||
/* Adjust HSTX slew rate to 400 ps*/
|
||||
/* Adjust PLL lock Time counter for release clock to 35uA */
|
||||
/* Adjust Manual control ODT value to 38.02 Ohm */
|
||||
writel(HSTX_SLEW_RATE_565PS | PLL_CHARGING_PUMP_CURRENT_35UA |
|
||||
writel(HSTX_SLEW_RATE_400PS | PLL_CHARGING_PUMP_CURRENT_35UA |
|
||||
ODT_VALUE_38_02_OHM, phybase + USB2PHY_USB_PHY_M31_XCFGI_4);
|
||||
|
||||
/*
|
||||
|
|
@ -724,11 +724,18 @@ static void usb_init_hsphy(void __iomem *phybase, int ssphy)
|
|||
*/
|
||||
writel(USB2_0_TX_ENABLE, phybase + USB2PHY_USB_PHY_M31_XCFGI_1);
|
||||
|
||||
/* Adjust Manual control ODT value to 45.02 Ohm */
|
||||
/* Adjust HSTX Pre-emphasis level to 0.55mA */
|
||||
writel(ODT_VALUE_45_02_OHM | HSTX_PRE_EMPHASIS_LEVEL_0_55MA,
|
||||
writel(HSTX_PRE_EMPHASIS_LEVEL_0_55MA,
|
||||
phybase + USB2PHY_USB_PHY_M31_XCFGI_5);
|
||||
|
||||
/*
|
||||
* Adjust HSTX Current of current-mode driver,
|
||||
* default 18.5mA * 22.5ohm = 416mV
|
||||
* 17.1mA * 22.5ohm = 385mV
|
||||
*/
|
||||
writel(HSTX_CURRENT_17_1MA_385MV,
|
||||
phybase + USB2PHY_USB_PHY_M31_XCFGI_9);
|
||||
|
||||
udelay(10);
|
||||
|
||||
writel(0, phybase + USB_PHY_UTMI_CTRL5);
|
||||
|
|
@ -811,6 +818,53 @@ int ipq_board_usb_init(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
unsigned int get_dts_machid(unsigned int machid)
|
||||
{
|
||||
switch (machid)
|
||||
{
|
||||
case MACH_TYPE_IPQ5332_AP_MI01_3_C2:
|
||||
return MACH_TYPE_IPQ5332_AP_MI01_3;
|
||||
case MACH_TYPE_IPQ5332_AP_MI04_1_C2:
|
||||
return MACH_TYPE_IPQ5332_AP_MI04_1;
|
||||
default:
|
||||
return machid;
|
||||
}
|
||||
}
|
||||
|
||||
void ipq_uboot_fdt_fixup(void)
|
||||
{
|
||||
int ret, len;
|
||||
char *config = NULL;
|
||||
|
||||
switch (gd->bd->bi_arch_number)
|
||||
{
|
||||
case MACH_TYPE_IPQ5332_AP_MI01_3_C2:
|
||||
config = "config@mi01.3-c2";
|
||||
break;
|
||||
case MACH_TYPE_IPQ5332_AP_MI04_1_C2:
|
||||
config = "config@mi04.1-c2";
|
||||
break;
|
||||
}
|
||||
|
||||
if (config != NULL)
|
||||
{
|
||||
len = fdt_totalsize(gd->fdt_blob) + strlen(config) + 1;
|
||||
|
||||
/*
|
||||
* Open in place with a new length.
|
||||
*/
|
||||
ret = fdt_open_into(gd->fdt_blob, (void *)gd->fdt_blob, len);
|
||||
if (ret)
|
||||
printf("uboot-fdt-fixup: Cannot expand FDT: %s\n", fdt_strerror(ret));
|
||||
|
||||
ret = fdt_setprop((void *)gd->fdt_blob, 0, "config_name",
|
||||
config, (strlen(config)+1));
|
||||
if (ret)
|
||||
printf("uboot-fdt-fixup: unable to set config_name(%d)\n", ret);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
__weak int ipq_get_tz_version(char *version_name, int buf_size)
|
||||
{
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -87,14 +87,15 @@ extern const add_node_t add_fdt_node[];
|
|||
#define USB2PHY_USB_PHY_M31_XCFGI_1 0xBC
|
||||
#define USB2PHY_USB_PHY_M31_XCFGI_4 0xC8
|
||||
#define USB2PHY_USB_PHY_M31_XCFGI_5 0xCC
|
||||
#define USB2PHY_USB_PHY_M31_XCFGI_9 0xDC
|
||||
#define USB2PHY_USB_PHY_M31_XCFGI_11 0xE4
|
||||
|
||||
#define USB2_0_TX_ENABLE BIT(2)
|
||||
#define HSTX_SLEW_RATE_565PS 3
|
||||
#define HSTX_SLEW_RATE_400PS 7
|
||||
#define PLL_CHARGING_PUMP_CURRENT_35UA (3 << 3)
|
||||
#define ODT_VALUE_38_02_OHM (3 << 6)
|
||||
#define ODT_VALUE_45_02_OHM BIT(2)
|
||||
#define HSTX_PRE_EMPHASIS_LEVEL_0_55MA (1)
|
||||
#define HSTX_CURRENT_17_1MA_385MV BIT(1)
|
||||
|
||||
#define UTMI_PHY_OVERRIDE_EN BIT(1)
|
||||
#define SLEEPM BIT(1)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#define DLOAD_MAGIC_COOKIE 0x10
|
||||
#define DLOAD_DISABLED 0x40
|
||||
#define CONFIG_NAME_MAX_LEN 128
|
||||
|
||||
#define LINUX6_1_NAND_DTS "/soc@0/nand@79b0000/"
|
||||
#define LINUX6_1_MMC_DTS "/soc@0/mmc@7804000/"
|
||||
|
|
@ -1399,59 +1400,93 @@ unsigned int get_dts_machid(unsigned int machid)
|
|||
|
||||
void ipq_uboot_fdt_fixup(void)
|
||||
{
|
||||
int ret, len;
|
||||
char *config = NULL;
|
||||
int ret, len = 0, config_nos = 0;
|
||||
char config[CONFIG_NAME_MAX_LEN];
|
||||
char *config_list[6] = { NULL };
|
||||
|
||||
switch (gd->bd->bi_arch_number)
|
||||
{
|
||||
case MACH_TYPE_IPQ9574_EMULATION:
|
||||
config = "config@emulation-fbc";
|
||||
config_list[config_nos++] = "config@emulation-fbc";
|
||||
break;
|
||||
case MACH_TYPE_IPQ9574_AP_AL02_C5:
|
||||
config = "config@al02-c5";
|
||||
config_list[config_nos++] = "config@al02-c5";
|
||||
break;
|
||||
case MACH_TYPE_IPQ9574_AP_AL02_C6:
|
||||
config = "config@al02-c6", "config@rdp449";
|
||||
config_list[config_nos++] = "config@al02-c6";
|
||||
config_list[config_nos++] = "config@rdp449";
|
||||
config_list[config_nos++] = "config-rdp449";
|
||||
break;
|
||||
case MACH_TYPE_IPQ9574_AP_AL02_C11:
|
||||
config = "config@al02-c11", "config@rdp467";
|
||||
config_list[config_nos++] = "config@al02-c11";
|
||||
config_list[config_nos++] = "config@rdp467";
|
||||
config_list[config_nos++] = "config-rdp467";
|
||||
break;
|
||||
case MACH_TYPE_IPQ9574_AP_AL02_C12:
|
||||
config = "config@al02-c12", "config@rdp455";
|
||||
break;
|
||||
config_list[config_nos++] = "config@al02-c12";
|
||||
config_list[config_nos++] = "config@rdp455";
|
||||
config_list[config_nos++] = "config-rdp455";
|
||||
break;
|
||||
case MACH_TYPE_IPQ9574_AP_AL02_C14:
|
||||
config = "config@al02-c14";
|
||||
break;
|
||||
config_list[config_nos++] = "config@al02-c14";
|
||||
break;
|
||||
case MACH_TYPE_IPQ9574_AP_AL02_C15:
|
||||
config = "config@al02-c15", "config@rdp457";
|
||||
config_list[config_nos++] = "config@al02-c15";
|
||||
config_list[config_nos++] = "config@rdp457";
|
||||
config_list[config_nos++] = "config-rdp457";
|
||||
break;
|
||||
case MACH_TYPE_IPQ9574_AP_AL02_C16:
|
||||
config = "config@al02-c16", "config@rdp456";
|
||||
config_list[config_nos++] = "config@al02-c16";
|
||||
config_list[config_nos++] = "config@rdp456";
|
||||
config_list[config_nos++] = "config-rdp456";
|
||||
break;
|
||||
case MACH_TYPE_IPQ9574_AP_AL03_C2:
|
||||
config = "config@al03-c2", "config@rdp458";
|
||||
config_list[config_nos++] = "config@al03-c2";
|
||||
config_list[config_nos++] = "config@rdp458";
|
||||
config_list[config_nos++] = "config-rdp458";
|
||||
break;
|
||||
}
|
||||
|
||||
if (config != NULL)
|
||||
if (config_nos)
|
||||
{
|
||||
len = fdt_totalsize(gd->fdt_blob) + strlen(config) + 1;
|
||||
while (config_nos--) {
|
||||
strlcpy(&config[len], config_list[config_nos],
|
||||
CONFIG_NAME_MAX_LEN - len);
|
||||
len += strnlen(config_list[config_nos],
|
||||
CONFIG_NAME_MAX_LEN) + 1;
|
||||
if (len > CONFIG_NAME_MAX_LEN) {
|
||||
printf("skipping uboot fdt fixup err: "
|
||||
"config name len-overflow\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Open in place with a new length.
|
||||
*/
|
||||
ret = fdt_open_into(gd->fdt_blob, (void *)gd->fdt_blob, len);
|
||||
ret = fdt_open_into(gd->fdt_blob, (void *)gd->fdt_blob,
|
||||
fdt_totalsize(gd->fdt_blob) + len);
|
||||
if (ret)
|
||||
printf("uboot-fdt-fixup: Cannot expand FDT: %s\n", fdt_strerror(ret));
|
||||
|
||||
ret = fdt_setprop((void *)gd->fdt_blob, 0, "config_name",
|
||||
config, (strlen(config)+1));
|
||||
config, len);
|
||||
if (ret)
|
||||
printf("uboot-fdt-fixup: unable to set config_name(%d)\n", ret);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void fdt_fixup_for_atf(void *blob)
|
||||
{
|
||||
if (fdt_path_offset(blob, "/soc/dma@704000") >= 0) {
|
||||
parse_fdt_fixup("/soc/dma@704000%qcom,controlled-remotely%0",
|
||||
blob);
|
||||
parse_fdt_fixup("/soc/dma@704000%qti,config-pipe-trust-reg%2",
|
||||
blob);
|
||||
}
|
||||
}
|
||||
|
||||
int do_dpr(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
|
||||
{
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ int bootm_load_os(bootm_headers_t *images, unsigned long *load_end,
|
|||
bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE);
|
||||
return err;
|
||||
}
|
||||
flush_cache(load, (*load_end - load) * sizeof(ulong));
|
||||
flush_cache(load, *load_end - load);
|
||||
|
||||
debug(" %s loaded at 0x%08lx, end = 0x%08lx\n",
|
||||
genimg_get_type_name(os.type), load, *load_end);
|
||||
|
|
|
|||
|
|
@ -25,15 +25,15 @@ CONFIG_IPQ_TINY=y
|
|||
#
|
||||
# Info commands
|
||||
#
|
||||
# CONFIG_CMD_BDI is not set
|
||||
# CONFIG_CMD_CONSOLE is not set
|
||||
CONFIG_CMD_BDI=y
|
||||
CONFIG_CMD_CONSOLE=y
|
||||
|
||||
#
|
||||
# Boot commands
|
||||
#
|
||||
# CONFIG_CMD_BOOTD is not set
|
||||
CONFIG_CMD_BOOTM=y
|
||||
# CONFIG_CMD_GO is not set
|
||||
CONFIG_CMD_GO=y
|
||||
CONFIG_CMD_RUN=y
|
||||
# CONFIG_CMD_IMI is not set
|
||||
# CONFIG_CMD_IMLS is not set
|
||||
|
|
@ -44,7 +44,7 @@ CONFIG_CMD_RUN=y
|
|||
#
|
||||
CONFIG_CMD_EXPORTENV=y
|
||||
CONFIG_CMD_IMPORTENV=y
|
||||
# CONFIG_CMD_EDITENV is not set
|
||||
CONFIG_CMD_EDITENV=y
|
||||
CONFIG_CMD_SAVEENV=y
|
||||
CONFIG_CMD_ENV_EXISTS=y
|
||||
|
||||
|
|
@ -62,29 +62,41 @@ CONFIG_CMD_CRC32=y
|
|||
# Device access commands
|
||||
#
|
||||
|
||||
# CONFIG_CMD_DM is not set
|
||||
CONFIG_CMD_DM=y
|
||||
# CONFIG_CMD_DEMO is not set
|
||||
# CONFIG_CMD_LOADB is not set
|
||||
# CONFIG_CMD_LOADS is not set
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
CONFIG_CMD_LOADB=y
|
||||
CONFIG_CMD_LOADS=y
|
||||
CONFIG_CMD_FLASH=y
|
||||
# CONFIG_CMD_NAND is not set
|
||||
# CONFIG_CMD_SF is not set
|
||||
# CONFIG_CMD_SPI is not set
|
||||
# CONFIG_CMD_I2C is not set
|
||||
# CONFIG_CMD_USB is not set
|
||||
# CONFIG_CMD_FPGA is not set
|
||||
CONFIG_CMD_FPGA=y
|
||||
|
||||
#
|
||||
# Shell scripting commands
|
||||
#
|
||||
CONFIG_CMD_ECHO=y
|
||||
# CONFIG_CMD_ITEST is not set
|
||||
CONFIG_CMD_ITEST=y
|
||||
CONFIG_CMD_SOURCE=y
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
CONFIG_CMD_SETEXPR=y
|
||||
|
||||
#
|
||||
# Network commands
|
||||
#
|
||||
|
||||
#
|
||||
# Network PHY
|
||||
#
|
||||
# CONFIG_IPQ_QCA_AQUANTIA_PHY is not set
|
||||
# CONFIG_QCA8033_PHY is not set
|
||||
CONFIG_QCA8081_PHY=y
|
||||
CONFIG_QCA8084_PHY=y
|
||||
CONFIG_QCA8084_SWT_MODE=y
|
||||
CONFIG_QCA8084_BYPASS_MODE=y
|
||||
# CONFIG_ATHRS17C_SWITCH is not set
|
||||
|
||||
CONFIG_CMD_NET=y
|
||||
# CONFIG_CMD_TFTPPUT is not set
|
||||
# CONFIG_CMD_TFTPSRV is not set
|
||||
|
|
@ -106,7 +118,7 @@ CONFIG_CMD_MISC=y
|
|||
# CONFIG_PARTITION_UUIDS is not set
|
||||
# CONFIG_CMD_TIMER is not set
|
||||
# CONFIG_IPQ_TZT is not set
|
||||
# CONFIG_UBI_WRITE is not set
|
||||
CONFIG_UBI_WRITE=y
|
||||
#
|
||||
# Boot timing
|
||||
#
|
||||
|
|
@ -210,12 +222,12 @@ CONFIG_SIMPLE_BUS=y
|
|||
#
|
||||
# Generic NAND options
|
||||
#
|
||||
# CONFIG_NAND_FLASH is not set
|
||||
CONFIG_NAND_FLASH=y
|
||||
|
||||
#
|
||||
# Serial NAND
|
||||
#
|
||||
# CONFIG_QPIC_SERIAL is not set
|
||||
CONFIG_QPIC_SERIAL=y
|
||||
|
||||
#
|
||||
# SPI Flash Support
|
||||
|
|
@ -226,7 +238,7 @@ CONFIG_SIMPLE_BUS=y
|
|||
# CONFIG_PHYLIB is not set
|
||||
# CONFIG_NETDEVICES is not set
|
||||
# CONFIG_IPQ_MTD_NOR is not set
|
||||
CONFIG_IPQ_TINY_SPI_NOR=y
|
||||
# CONFIG_IPQ_TINY_SPI_NOR is not set
|
||||
|
||||
#
|
||||
# PCI
|
||||
|
|
@ -296,15 +308,6 @@ CONFIG_REQUIRE_SERIAL_CONSOLE=y
|
|||
# File systems
|
||||
#
|
||||
|
||||
#
|
||||
# Ethernet PHY
|
||||
#
|
||||
# CONFIG_QCA8033_PHY is not set
|
||||
# CONFIG_IPQ_QCA_AQUANTIA_PHY is not set
|
||||
# CONFIG_QCA8081_PHY is not set
|
||||
# CONFIG_QCA8084_PHY is not set
|
||||
# CONFIG_ATHRS17C_SWITCH is not set
|
||||
|
||||
#
|
||||
# Library routines
|
||||
|
||||
|
|
@ -335,17 +338,9 @@ CONFIG_LZMA=y
|
|||
# CONFIG_ERRNO_STR is not set
|
||||
# CONFIG_UNIT_TEST is not set
|
||||
|
||||
#
|
||||
# Thumb2 mode support
|
||||
#
|
||||
CONFIG_SYS_THUMB_BUILD=y
|
||||
CONFIG_HAS_THUMB2=y
|
||||
|
||||
#
|
||||
# ART uncompression support
|
||||
#
|
||||
CONFIG_ART_COMPRESSED=y
|
||||
|
||||
#
|
||||
# DPR support
|
||||
#
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <phy.h>
|
||||
#include <net.h>
|
||||
#include <miiphy.h>
|
||||
#include <memalign.h>
|
||||
#include <asm/arch-ipq5332/edma_regs.h>
|
||||
#include <asm/global_data.h>
|
||||
#include <fdtdec.h>
|
||||
|
|
@ -45,6 +46,10 @@ DECLARE_GLOBAL_DATA_PTR;
|
|||
#define IPQ5332_EDMA_MAC_PORT_NO 3
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SYS_NONCACHED_MEMORY
|
||||
#define noncached_alloc(a, b) malloc_cache_aligned(a)
|
||||
#endif
|
||||
|
||||
static struct ipq5332_eth_dev *ipq5332_edma_dev[IPQ5332_EDMA_DEV];
|
||||
typedef struct {
|
||||
phy_info_t *phy_info;
|
||||
|
|
@ -919,6 +924,10 @@ static int ipq5332_eth_init(struct eth_device *eth_dev, bd_t *this)
|
|||
int sgmii_mode = EPORT_WRAPPER_SGMII0_RGMII4, sfp_mode = -1;
|
||||
char *active_port = NULL;
|
||||
|
||||
#ifndef CONFIG_SYS_NONCACHED_MEMORY
|
||||
dcache_disable();
|
||||
#endif
|
||||
|
||||
active_port = getenv("active_port");
|
||||
if (active_port != NULL) {
|
||||
current_active_port = simple_strtol(active_port, NULL, 10);
|
||||
|
|
@ -1234,6 +1243,10 @@ static void ipq5332_eth_halt(struct eth_device *dev)
|
|||
pr_debug("GMAC1 RXBADBYTE_L(0x3a00128c):%x\n", readl(0x3a00128c));
|
||||
pr_debug("GMAC1 RXBADBYTE_H(0x3a001290):%x\n", readl(0x3a001290));
|
||||
|
||||
#ifndef CONFIG_SYS_NONCACHED_MEMORY
|
||||
dcache_enable();
|
||||
#endif
|
||||
|
||||
pr_info("%s: done\n", __func__);
|
||||
}
|
||||
|
||||
|
|
@ -1834,7 +1847,8 @@ int ipq5332_edma_init(void *edma_board_cfg)
|
|||
ipq5332_edma_board_cfg_t ledma_cfg, *edma_cfg;
|
||||
phy_info_t *phy_info;
|
||||
int phy_id;
|
||||
uint32_t phy_chip_id, phy_chip_id1, phy_chip_id2;
|
||||
uint16_t phy_chip_id1 = 0, phy_chip_id2 = 0;
|
||||
uint32_t phy_chip_id = 0;
|
||||
int clk[4] = {0};
|
||||
int qca8084_swt_enb = 0;
|
||||
int qca8084_chip_detect = 0;
|
||||
|
|
@ -1849,7 +1863,9 @@ int ipq5332_edma_init(void *edma_board_cfg)
|
|||
/*
|
||||
* Init non cache buffer
|
||||
*/
|
||||
#ifdef CONFIG_SYS_NONCACHED_MEMORY
|
||||
noncached_init();
|
||||
#endif
|
||||
|
||||
node = fdt_path_offset(gd->fdt_blob, "/ess-switch");
|
||||
#ifdef CONFIG_QCA8084_SWT_MODE
|
||||
|
|
|
|||
|
|
@ -1950,7 +1950,8 @@ int ipq9574_edma_init(void *edma_board_cfg)
|
|||
int ret = -1;
|
||||
ipq9574_edma_board_cfg_t ledma_cfg, *edma_cfg;
|
||||
int phy_id;
|
||||
uint32_t phy_chip_id, phy_chip_id1, phy_chip_id2;
|
||||
uint16_t phy_chip_id1 = 0, phy_chip_id2 = 0;
|
||||
uint32_t phy_chip_id = 0;
|
||||
#ifdef CONFIG_IPQ9574_QCA8075_PHY
|
||||
static int sw_init_done = 0;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@
|
|||
#define CONFIG_SYS_NO_FLASH
|
||||
#define CONFIG_IPQ_NO_RELOC
|
||||
|
||||
#ifndef CONFIG_IPQ_TINY
|
||||
#define CONFIG_SYS_NONCACHED_MEMORY (1 << 20)
|
||||
#endif /* CONFIG_IPQ_TINY */
|
||||
|
||||
#define CONFIG_SYS_VSNPRINTF
|
||||
|
||||
|
|
@ -100,7 +102,11 @@
|
|||
#define GPIO_IN_OUT_ADDR(x) (TLMM_BASE + 0x4 + (x)*0x1000)
|
||||
|
||||
#define CONFIG_SYS_SDRAM_BASE 0x40000000
|
||||
#ifdef CONFIG_IPQ_TINY
|
||||
#define CONFIG_SYS_TEXT_BASE 0x4A450000
|
||||
#else
|
||||
#define CONFIG_SYS_TEXT_BASE 0x4A400000
|
||||
#endif
|
||||
#define CONFIG_SYS_SDRAM_SIZE 0x10000000
|
||||
#define CONFIG_MAX_RAM_BANK_SIZE CONFIG_SYS_SDRAM_SIZE
|
||||
#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + (64 << 20))
|
||||
|
|
@ -158,7 +164,11 @@ extern loff_t board_env_size;
|
|||
#define CONFIG_ENV_OFFSET board_env_offset
|
||||
#define CONFIG_ENV_SIZE CONFIG_ENV_SIZE_MAX
|
||||
#define CONFIG_ENV_RANGE board_env_range
|
||||
#ifdef CONFIG_IPQ_TINY
|
||||
#define CONFIG_SYS_MALLOC_LEN (832 << 10)
|
||||
#else
|
||||
#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE_MAX + (768 << 10))
|
||||
#endif
|
||||
|
||||
#define CONFIG_IPQ_NO_MACS 2
|
||||
|
||||
|
|
@ -206,14 +216,6 @@ extern loff_t board_env_size;
|
|||
|
||||
#define NUM_ALT_PARTITION 16
|
||||
|
||||
#ifdef CONFIG_IPQ_TINY
|
||||
|
||||
/* undef gzip lib */
|
||||
#undef CONFIG_GZIP
|
||||
#undef CONFIG_ZLIB
|
||||
|
||||
#else
|
||||
|
||||
#define CONFIG_CMD_BOOTZ
|
||||
|
||||
/* Mii command support */
|
||||
|
|
@ -223,8 +225,6 @@ extern loff_t board_env_size;
|
|||
#define CONFIG_CMD_ZIP
|
||||
#define CONFIG_GZIP_COMPRESSED
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Ethernet Configs
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2095,7 +2095,7 @@ class Pack(object):
|
|||
flinfo.chipsize, blocksize, chipsize, root_part)
|
||||
self.partitions = mibib_qcn9224.get_parts()
|
||||
|
||||
script.append('if test "$machid" = "8050301" || test "$machid" = "8050501" || test "$machid" = "8050601" || test "$machid" = "8050701" || test "$machid" = "8050801" || test "$machid" = "8050901" || test "$machid" = "8050a01" || test "$machid" = "8050b01" || test "$machid" = "8050c01" || test "$machid" = "8050d01" || test "$machid" = "8050e01" || test "$machid" = "8050f01" || test "$machid" = "8051001" || test "$machid" = "0x8051101" || test "$machid" = "8051201" || test "$machid" = "8050002" || test "$machid" = "8050102"; then\n', fatal=False)
|
||||
script.append('if test "$machid" = "8050301" || test "$machid" = "8050501" || test "$machid" = "8050601" || test "$machid" = "8050701" || test "$machid" = "8050801" || test "$machid" = "8050901" || test "$machid" = "8050a01" || test "$machid" = "8050b01" || test "$machid" = "8050c01" || test "$machid" = "8050d01" || test "$machid" = "8050e01" || test "$machid" = "8050f01" || test "$machid" = "8051001" || test "$machid" = "0x8051101" || test "$machid" = "8051201" || test "$machid" = "8050002" || test "$machid" = "8050102" || test "$machid" = "8050003" || test "$machid" = "8050004"; then\n', fatal=False)
|
||||
ret = self.__gen_flash_script(script, flinfo, root, True)
|
||||
if ret == 0:
|
||||
return 0 #Issue in packing al+wkk single-image
|
||||
|
|
@ -2121,7 +2121,7 @@ class Pack(object):
|
|||
gpt = GPT(part_fname_qcn9224, flinfo.pagesize, flinfo.blocksize, flinfo.chipsize)
|
||||
self.partitions = gpt.get_parts()
|
||||
|
||||
script.append('if test "$machid" = "8050301" || test "$machid" = "8050501" || test "$machid" = "8050601" || test "$machid" = "8050701" || test "$machid" = "8050801" || test "$machid" = "8050901" || test "$machid" = "8050a01" || test "$machid" = "8050b01" || test "$machid" = "8050c01" || test "$machid" = "8050d01" || test "$machid" = "8050e01" || test "$machid" = "8050f01" || test "$machid" = "8051001" || test "$machid" = "0x8051101" || test "$machid" = "8051201" || test "$machid" = "8050002" || test "$machid" = "8050102"; then\n', fatal=False)
|
||||
script.append('if test "$machid" = "8050301" || test "$machid" = "8050501" || test "$machid" = "8050601" || test "$machid" = "8050701" || test "$machid" = "8050801" || test "$machid" = "8050901" || test "$machid" = "8050a01" || test "$machid" = "8050b01" || test "$machid" = "8050c01" || test "$machid" = "8050d01" || test "$machid" = "8050e01" || test "$machid" = "8050f01" || test "$machid" = "8051001" || test "$machid" = "0x8051101" || test "$machid" = "8051201" || test "$machid" = "8050002" || test "$machid" = "8050102" || test "$machid" = "8050003" || test "$machid" = "8050004"; then\n', fatal=False)
|
||||
ret = self.__gen_flash_script(script, flinfo, root, True)
|
||||
if ret == 0:
|
||||
return 0 #Issue in packing al+wkk single-image
|
||||
|
|
|
|||
|
|
@ -812,6 +812,7 @@ class Pack(object):
|
|||
global MODE
|
||||
global SRC_DIR
|
||||
global ARCH_NAME
|
||||
global flash_size
|
||||
|
||||
diff_files = ""
|
||||
count = 0
|
||||
|
|
@ -821,9 +822,9 @@ class Pack(object):
|
|||
wifi_fw_type = ""
|
||||
|
||||
if self.flash_type == "norplusemmc" and flinfo.type == "emmc":
|
||||
srcDir_part = SRC_DIR + "/" + ARCH_NAME + "/flash_partition/" + flinfo.type + "-partition.xml"
|
||||
srcDir_part = SRC_DIR + "/" + ARCH_NAME + "/flash_partition/" + flinfo.type + "-partition"+ flash_size +".xml"
|
||||
else:
|
||||
srcDir_part = SRC_DIR + "/" + ARCH_NAME + "/flash_partition/" + self.flash_type.lower() + "-partition.xml"
|
||||
srcDir_part = SRC_DIR + "/" + ARCH_NAME + "/flash_partition/" + self.flash_type.lower() + "-partition"+ flash_size +".xml"
|
||||
|
||||
root_part = ET.parse(srcDir_part)
|
||||
if self.flash_type != "emmc" and flinfo.type != "emmc":
|
||||
|
|
@ -906,7 +907,7 @@ class Pack(object):
|
|||
if flinfo.type == "emmc":
|
||||
script.append("flupdate set mmc")
|
||||
|
||||
if flinfo.type != "emmc":
|
||||
if flinfo.type != "emmc" and image_type != "hlos":
|
||||
self.__gen_script_mibib(script, flinfo, parts, parts_length, "mibib_reload")
|
||||
|
||||
for index in range(parts_length):
|
||||
|
|
@ -1236,6 +1237,7 @@ class Pack(object):
|
|||
"""
|
||||
global MODE
|
||||
global SRC_DIR
|
||||
global flash_size
|
||||
|
||||
soc_version = 0
|
||||
diff_soc_ver_files = 0
|
||||
|
|
@ -1251,9 +1253,9 @@ class Pack(object):
|
|||
script.end()
|
||||
|
||||
if self.flash_type == "norplusemmc" and flinfo.type == "emmc":
|
||||
srcDir_part = SRC_DIR + "/" + ARCH_NAME + "/flash_partition/" + flinfo.type + "-partition.xml"
|
||||
srcDir_part = SRC_DIR + "/" + ARCH_NAME + "/flash_partition/" + flinfo.type + "-partition"+ flash_size +".xml"
|
||||
else:
|
||||
srcDir_part = SRC_DIR + "/" + ARCH_NAME + "/flash_partition/" + self.flash_type.lower() + "-partition.xml"
|
||||
srcDir_part = SRC_DIR + "/" + ARCH_NAME + "/flash_partition/" + self.flash_type.lower() + "-partition"+ flash_size +".xml"
|
||||
|
||||
root_part = ET.parse(srcDir_part)
|
||||
if self.flash_type != "emmc" and flinfo.type != "emmc":
|
||||
|
|
@ -1483,6 +1485,7 @@ class Pack(object):
|
|||
def __gen_board_script(self, flinfo, part_fname, images, root):
|
||||
global SRC_DIR
|
||||
global ARCH_NAME
|
||||
global flash_size
|
||||
|
||||
"""Generate the flashing script for one board.
|
||||
|
||||
|
|
@ -1512,7 +1515,7 @@ class Pack(object):
|
|||
blocks_per_chip = int(flash_param.find(".//total_block").text)
|
||||
chipsize = blocks_per_chip * blocksize
|
||||
|
||||
srcDir_part = SRC_DIR + "/" + ARCH_NAME + "/flash_partition/" + flinfo.type + "-partition.xml"
|
||||
srcDir_part = SRC_DIR + "/" + ARCH_NAME + "/flash_partition/" + flinfo.type + "-partition"+ flash_size +".xml"
|
||||
root_part = ET.parse(srcDir_part)
|
||||
|
||||
mibib = MIBIB(part_fname, flinfo, blocksize, chipsize, root_part)
|
||||
|
|
@ -1575,6 +1578,7 @@ class Pack(object):
|
|||
global SRC_DIR
|
||||
global ARCH_NAME
|
||||
global MODE
|
||||
global flash_size
|
||||
|
||||
try:
|
||||
if ftype == "tiny-nor" or ftype == "tiny-nor-debug":
|
||||
|
|
@ -1594,7 +1598,7 @@ class Pack(object):
|
|||
|
||||
MODE_APPEND = "_64" if MODE == "64" else ""
|
||||
|
||||
UBINIZE_CFG_NAME = ARCH_NAME + "-ubinize" + MODE_APPEND + ".cfg"
|
||||
UBINIZE_CFG_NAME = ARCH_NAME + "-ubinize" + MODE_APPEND + flash_size +".cfg"
|
||||
|
||||
f1 = open(SRC_DIR + "/" + ARCH_NAME + "/flash_partition/" + UBINIZE_CFG_NAME, 'r')
|
||||
UBINIZE_CFG_NAME = SRC_DIR + "/" + ARCH_NAME + "/flash_partition/tmp-" + UBINIZE_CFG_NAME
|
||||
|
|
@ -1604,7 +1608,7 @@ class Pack(object):
|
|||
f1.close()
|
||||
f2.close()
|
||||
|
||||
part_file = SRC_DIR + "/" + ARCH_NAME + "/flash_partition/" + ftype + "-partition.xml"
|
||||
part_file = SRC_DIR + "/" + ARCH_NAME + "/flash_partition/" + ftype + "-partition"+ flash_size +".xml"
|
||||
parts = ET.parse(part_file).findall('.//partitions/partition')
|
||||
for index in range(len(parts)):
|
||||
section = parts[index]
|
||||
|
|
@ -1632,7 +1636,7 @@ class Pack(object):
|
|||
if ret != 0:
|
||||
error("ubi image copy operation failed")
|
||||
|
||||
part_file = SRC_DIR + "/" + ARCH_NAME + "/flash_partition/" + ftype + "-partition.xml"
|
||||
part_file = SRC_DIR + "/" + ARCH_NAME + "/flash_partition/" + ftype + "-partition"+ flash_size +".xml"
|
||||
part_xml = ET.parse(part_file)
|
||||
if (part_xml.find(".//partitions/partition[name='0:MIBIB']")):
|
||||
partition = part_xml.find(".//partitions/partition[name='0:MIBIB']")
|
||||
|
|
@ -1725,6 +1729,8 @@ class ArgParser(object):
|
|||
global memory_size
|
||||
global atf
|
||||
global skip_4k_nand
|
||||
global flash_size
|
||||
flash_size = ""
|
||||
|
||||
"""Start the parsing process, and populate members with parsed value.
|
||||
|
||||
|
|
@ -1734,7 +1740,7 @@ class ArgParser(object):
|
|||
cdir = os.path.abspath(os.path.dirname(""))
|
||||
if len(sys.argv) > 1:
|
||||
try:
|
||||
opts, args = getopt(sys.argv[1:], "", ["arch=", "fltype=", "srcPath=", "inImage=", "outImage=", "image_type=", "memory=", "skip_4k_nand", "atf"])
|
||||
opts, args = getopt(sys.argv[1:], "", ["arch=", "fltype=", "srcPath=", "inImage=", "outImage=", "image_type=", "memory=", "flash_size=", "skip_4k_nand", "atf"])
|
||||
except GetoptError, e:
|
||||
raise UsageError(e.msg)
|
||||
|
||||
|
|
@ -1760,6 +1766,9 @@ class ArgParser(object):
|
|||
elif option == "--memory":
|
||||
memory_size = value
|
||||
|
||||
elif option == "--flash_size":
|
||||
flash_size = "-" + value
|
||||
|
||||
elif option =="--atf":
|
||||
atf = "true"
|
||||
|
||||
|
|
@ -1804,7 +1813,7 @@ class ArgParser(object):
|
|||
print "pack: %s" % msg
|
||||
print
|
||||
print "Usage:"
|
||||
print "python pack_hk.py [options] [Value] ..."
|
||||
print "python pack_v2.py [options] [Value] ..."
|
||||
print
|
||||
print "options:"
|
||||
print " --arch \tARCH_TYPE [" + '/'.join(supported_arch) + "]"
|
||||
|
|
@ -1820,6 +1829,7 @@ class ArgParser(object):
|
|||
print " --memory \tMemory size for low memory profile"
|
||||
print " \t\tIf it is not specified CDTs with default memory size are taken for single-image packing.\n"
|
||||
print " \t\tIf specified, CDTs created with specified memory size will be used for single-image.\n"
|
||||
print " --flash_size \tFlash size"
|
||||
print
|
||||
print " --atf \t\tReplace tz with atf for QSEE partition"
|
||||
print " --skip_4k_nand \tskip generating 4k nand images"
|
||||
|
|
@ -1857,6 +1867,7 @@ def main():
|
|||
global def_ver_list
|
||||
global possible_fw_vers
|
||||
global wifi_fws_avail
|
||||
global flash_size
|
||||
|
||||
wifi_fws_avail = dict()
|
||||
ver_check = True
|
||||
|
|
@ -1888,7 +1899,7 @@ def main():
|
|||
|
||||
if skip_4k_nand != "true":
|
||||
# Add nand-4k flash type, if nand flash type is specified
|
||||
if "nand" in parser.flash_type.split(","):
|
||||
if "nand" in parser.flash_type.split(",") and flash_size == "":
|
||||
if root.find(".//data[@type='NAND_PARAMETER']/entry") != None:
|
||||
parser.flash_type = parser.flash_type + ",nand-4k"
|
||||
|
||||
|
|
@ -1906,9 +1917,9 @@ def main():
|
|||
|
||||
MODE_APPEND = "_64" if MODE == "64" else ""
|
||||
if image_type == "hlos":
|
||||
suffix = "-apps.img"
|
||||
suffix = "-apps"+ flash_size + ".img"
|
||||
else:
|
||||
suffix = "-single.img"
|
||||
suffix = "-single" + flash_size + ".img"
|
||||
|
||||
parser.out_fname = flash_type + "-" + ARCH_NAME + MODE_APPEND + suffix
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@
|
|||
#define AUTHENTICATE_FILE "/sys/devices/system/qfprom/qfprom0/authenticate"
|
||||
#define SEC_AUTHENTICATE_FILE "/sys/sec_upgrade/sec_auth"
|
||||
#define TEMP_KERNEL_PATH "/tmp/tmp_kernel.bin"
|
||||
#define TEMP_ROOTFS_PATH "/tmp/rootfs_tmp.bin"
|
||||
#define TEMP_METADATA_PATH "/tmp/metadata.bin"
|
||||
#define TEMP_SHA_KEY_PATH "/tmp/sha_keyXXXXXX"
|
||||
#define ROOTFS_OFFSET 65536
|
||||
#define MAX_SBL_VERSION 11
|
||||
#define MAX_HLOS_VERSION 32
|
||||
#define MAX_TZ_VERSION 14
|
||||
|
|
@ -73,7 +77,7 @@ struct image_section sections[] = {
|
|||
.type = "rootfs",
|
||||
.max_version = MAX_HLOS_VERSION,
|
||||
.tmp_file = TMP_FILE_DIR,
|
||||
.pre_op = compute_sha384,
|
||||
.pre_op = compute_sha_hash,
|
||||
.file = TMP_FILE_DIR,
|
||||
.version_file = HLOS_VERSION_FILE,
|
||||
.is_present = NOT_PRESENT,
|
||||
|
|
@ -83,7 +87,7 @@ struct image_section sections[] = {
|
|||
.section_type = HLOS_TYPE,
|
||||
.type = "ubi",
|
||||
.tmp_file = TMP_FILE_DIR,
|
||||
.pre_op = extract_kernel_binary,
|
||||
.pre_op = extract_binary,
|
||||
.max_version = MAX_HLOS_VERSION,
|
||||
.file = TEMP_KERNEL_PATH,
|
||||
.version_file = HLOS_VERSION_FILE,
|
||||
|
|
@ -222,7 +226,7 @@ int get_sections(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
data_size = find_mtd_part_size();
|
||||
data_size = find_mtd_part_size("kernel");
|
||||
while ((file = readdir(dir)) != NULL) {
|
||||
for (i = 0, sec = §ions[0]; i < NO_OF_SECTIONS; i++, sec++) {
|
||||
/* Skip loading of ubi section if board is not from nand boot */
|
||||
|
|
@ -269,7 +273,7 @@ int load_sections(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
data_size = find_mtd_part_size();
|
||||
data_size = find_mtd_part_size("kernel");
|
||||
while ((file = readdir(dir)) != NULL) {
|
||||
for (i = 0, sec = §ions[0]; i < NO_OF_SECTIONS; i++, sec++) {
|
||||
/* Skip loading of ubi section if board is not from nand boot */
|
||||
|
|
@ -277,7 +281,6 @@ int load_sections(void)
|
|||
continue;
|
||||
if (!strncmp(file->d_name, sec->type, strlen(sec->type))) {
|
||||
strlcat(sec->file, file->d_name, sizeof(sec->file));
|
||||
|
||||
if (sec->pre_op) {
|
||||
strlcat(sec->tmp_file, file->d_name,
|
||||
sizeof(sec->tmp_file));
|
||||
|
|
@ -701,9 +704,8 @@ int get_sw_id_from_component_bin_elf64(struct image_section *section)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int find_mtd_part_size(void)
|
||||
int find_mtd_part_size(char *mtdname)
|
||||
{
|
||||
char *mtdname = "kernel";
|
||||
char prefix[] = "/dev/mtd";
|
||||
char dev[PATH_MAX];
|
||||
int i = -1, fd;
|
||||
|
|
@ -754,7 +756,7 @@ int find_mtd_part_size(void)
|
|||
/**
|
||||
* Helper function to dynamically get volume id
|
||||
*/
|
||||
int get_kernel_volume_id(void)
|
||||
int get_ubi_volume_id(char *vol_name)
|
||||
{
|
||||
int i, number_of_ubi_volumes;
|
||||
char ubi_vol_count[] = "/sys/class/ubi/ubi0/volumes_count";
|
||||
|
|
@ -775,8 +777,9 @@ int get_kernel_volume_id(void)
|
|||
snprintf(ubi_vol, sizeof(ubi_vol), "%s%d%s", prefix, i, suffix);
|
||||
fp = fopen(ubi_vol, "r");
|
||||
fgets(ubi_vol_name, sizeof(ubi_vol_name), fp);
|
||||
if (strstr(ubi_vol_name, "kernel")) {
|
||||
printf("kernel ubi volume id = %d\n", i);
|
||||
if (strstr(ubi_vol_name, vol_name)) {
|
||||
printf("%s volume id = %d\n", vol_name, i);
|
||||
close(fp);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
@ -784,6 +787,21 @@ int get_kernel_volume_id(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* For NAND image, kernel and rootfs image is ubinized.
|
||||
* Hence need to un-ubinize the ubi image and extract both kernel
|
||||
* and rootfs images. Kernel image section and volume name are passed as
|
||||
* argument in extract_kernel_binary(). After kernel extraction,
|
||||
* parse_elf_image_phdr() is called which parses the ELF32 program header
|
||||
* to get the ELF header of rootfs metadata.
|
||||
*/
|
||||
|
||||
void extract_binary(struct image_section *section)
|
||||
{
|
||||
extract_kernel_binary(section, "kernel");
|
||||
parse_elf_image_phdr(section);
|
||||
}
|
||||
|
||||
/**
|
||||
* In case of NAND image, Kernel image is ubinized & version information is
|
||||
* part of Kernel image. Hence need to un-ubinize the image.
|
||||
|
|
@ -798,18 +816,48 @@ int get_kernel_volume_id(void)
|
|||
*
|
||||
* @bin_file: struct image_section *
|
||||
*/
|
||||
int extract_kernel_binary(struct image_section *section)
|
||||
|
||||
int extract_kernel_binary(struct image_section *section, char *volname)
|
||||
{
|
||||
char *ifname, *ofname;
|
||||
|
||||
strlcpy(section->file, TEMP_KERNEL_PATH, sizeof(TEMP_KERNEL_PATH));
|
||||
ifname = section->tmp_file;
|
||||
ofname = section->file;
|
||||
|
||||
if (extract_ubi_volume(volname, ifname, ofname) != 1) {
|
||||
printf("Image extraction failed\n");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* extract_ubi_volume() extracts both kernel image and rootfs image
|
||||
* from UBI image. extract_kernel_binary() passes volume name,
|
||||
* UBI image as Input file name, kernel or rootfs as Output file name.
|
||||
* This function finds respective UBI volume ID, identifies each eraseble
|
||||
* block. Parses UBI header and gets Volume ID header offset as well as
|
||||
* Data offset. When volume ID matches for kernel and rootfs, Uses data offset
|
||||
* to extract both images separately.
|
||||
*/
|
||||
|
||||
int extract_ubi_volume(char *vol_name, char *if_name, char *of_name)
|
||||
{
|
||||
struct ubi_ec_hdr *ubi_ec;
|
||||
struct ubi_vid_hdr *ubi_vol;
|
||||
uint8_t *fp;
|
||||
int fd, ofd, magic, data_size, vid_hdr_offset, data_offset;
|
||||
int kernel_vol_id, curr_vol_id;
|
||||
int ret_vol_id, curr_vol_id;
|
||||
struct stat sb;
|
||||
|
||||
fd = open(section->tmp_file, O_RDONLY);
|
||||
if (if_name == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
fd = open(if_name, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
perror(section->tmp_file);
|
||||
perror(if_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -827,21 +875,21 @@ int extract_kernel_binary(struct image_section *section)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ofd = open(section->file, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
|
||||
ofd = open(of_name, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
|
||||
if (ofd == -1) {
|
||||
perror(section->file);
|
||||
perror(of_name);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
data_size = find_mtd_part_size();
|
||||
data_size = find_mtd_part_size(vol_name);
|
||||
if (data_size == -1) {
|
||||
printf("Error finding data size\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
kernel_vol_id = get_kernel_volume_id();
|
||||
if (kernel_vol_id == -1) {
|
||||
ret_vol_id = get_ubi_volume_id(vol_name);
|
||||
if (ret_vol_id == -1) {
|
||||
printf("Wrong ubi volume id for kernel\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -859,9 +907,8 @@ int extract_kernel_binary(struct image_section *section)
|
|||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
curr_vol_id = be32_to_cpu(ubi_vol->vol_id);
|
||||
if (curr_vol_id == kernel_vol_id) {
|
||||
if (curr_vol_id == ret_vol_id) {
|
||||
if (write(ofd, (void *)((uint8_t *)ubi_ec + data_offset), data_size) == -1) {
|
||||
printf("Write error\n");
|
||||
close(fd);
|
||||
|
|
@ -869,36 +916,138 @@ int extract_kernel_binary(struct image_section *section)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ubi_ec = (struct ubi_ec_hdr *)((uint8_t *)ubi_ec + data_offset + data_size);
|
||||
magic = be32_to_cpu(ubi_ec->magic);
|
||||
}
|
||||
|
||||
if (munmap(fp, sb.st_size) == -1) {
|
||||
perror("munmap");
|
||||
close(ofd);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
close(ofd);
|
||||
close(fd);
|
||||
printf("Kernel extracted from ubi image\n");
|
||||
if (!strncmp(vol_name, "ubi_rootfs", strlen("ubi_rootfs"))) {
|
||||
extract_rootfs_binary(of_name);
|
||||
}
|
||||
printf("%s extracted from ubi image\n", vol_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* check_image_exist() used to check whether the ubi image for NAND
|
||||
* or rootfs image for EMMC are available in /tmp directory.
|
||||
* If respective image was found, the filename will be passed. If
|
||||
* not found, it returns NULL
|
||||
*/
|
||||
|
||||
char * check_image_exist(char *imgname) {
|
||||
DIR* FD;
|
||||
struct dirent* in_file;
|
||||
char extension[256] = "/tmp/";
|
||||
|
||||
/* Scanning the in directory */
|
||||
if (NULL == (FD = opendir ("/tmp")))
|
||||
{
|
||||
fprintf(stderr, "Error : Failed to open input directory\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while ((in_file = readdir(FD)))
|
||||
{
|
||||
if (strstr(in_file->d_name, imgname)) {
|
||||
printf("%s file found\n", in_file->d_name);
|
||||
strlcat(extension, in_file->d_name, sizeof(extension));
|
||||
strlcpy(in_file->d_name, extension, sizeof(extension));
|
||||
return in_file->d_name;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* In case of EMMC, extract_rootfs_binary() extracts the rootfs image
|
||||
* till Deadcode from existing rootfs image. After extraction, the new rootfs
|
||||
* image will replace old rootfs image. This function removes padded
|
||||
* binaries and helps to authenticate rootfs image using sec_auth
|
||||
*/
|
||||
|
||||
int extract_rootfs_binary(char *filename)
|
||||
{
|
||||
int ifd;
|
||||
uint8_t *fp;
|
||||
struct stat sb;
|
||||
|
||||
if (filename == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ifd = open(filename, O_RDWR);
|
||||
if (ifd < 0) {
|
||||
perror(filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&sb, 0, sizeof(struct stat));
|
||||
if (fstat(ifd, &sb) == -1) {
|
||||
perror("fstat");
|
||||
close(ifd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
fp = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, ifd, 0);
|
||||
if (fp == MAP_FAILED) {
|
||||
perror("mmap");
|
||||
close(fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int offset = 0,dead_off;
|
||||
while ( offset <= sb.st_size)
|
||||
{
|
||||
if ((fp[offset] == 0xde) && (fp[offset+1] == 0xad) && (fp[offset+2] == 0xc0) && (fp[offset+3] == 0xde)) {
|
||||
dead_off=offset;
|
||||
break;
|
||||
}
|
||||
offset += ROOTFS_OFFSET;
|
||||
}
|
||||
|
||||
if (munmap(fp, sb.st_size) == -1) {
|
||||
perror("munmap");
|
||||
close(ifd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
close(ifd);
|
||||
truncate(filename, dead_off);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* The digest functions output the message digest of a supplied file and
|
||||
* write sha384 to /tmp/sha384_keyXXXXXX file
|
||||
* write sha-hash key to /tmp/sha_keyXXXXXX file
|
||||
*/
|
||||
int compute_sha384(struct image_section *section)
|
||||
int compute_sha_hash(struct image_section *section)
|
||||
{
|
||||
char sha384_hash[] = "/tmp/sha384_keyXXXXXX";
|
||||
char sha_hash[] = TEMP_SHA_KEY_PATH;
|
||||
char command[300];
|
||||
int retval;
|
||||
|
||||
#ifdef USE_SHA384
|
||||
snprintf(command, sizeof(command),
|
||||
"openssl dgst -sha384 -binary -out %s %s", sha384_hash, section->tmp_file);
|
||||
"openssl dgst -sha384 -binary -out %s %s", sha_hash, section->tmp_file);
|
||||
#endif
|
||||
#ifdef USE_SHA256
|
||||
snprintf(command, sizeof(command),
|
||||
"openssl dgst -sha256 -binary -out %s %s", sha_hash, section->tmp_file);
|
||||
#endif
|
||||
retval = system(command);
|
||||
if (retval != 0) {
|
||||
printf("Error generating sha384 hash\n");
|
||||
printf("Error generating sha-hash, command : %s\n",command);
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("sha384_hash file is created: %s \n",sha384_hash);
|
||||
printf("sha_hash file is created: %s \n",sha_hash);
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
|
|
@ -1239,8 +1388,8 @@ int parse_elf_image_phdr(struct image_section *section)
|
|||
printf("rootfs metada is not available\n");
|
||||
return 1;
|
||||
}
|
||||
create_file("/tmp/metadata.bin", (char *)(fp + phdr->p_offset + phdr->p_filesz), size);
|
||||
printf("rootfs meta data file: %s created with size:%x\n","/tmp/metadata.bin", size);
|
||||
create_file(TEMP_METADATA_PATH, (char *)(fp + phdr->p_offset + phdr->p_filesz), size);
|
||||
printf("rootfs meta data file: %s created with size:%x\n",TEMP_METADATA_PATH, size);
|
||||
|
||||
close(fd);
|
||||
return 1;
|
||||
|
|
@ -1603,14 +1752,13 @@ int sec_image_auth(void)
|
|||
}
|
||||
|
||||
len = snprintf(buf, SIG_SIZE, "%s %s", sections[i].img_code, sections[i].file);
|
||||
|
||||
if (!strncmp(sections[i].type, "rootfs", strlen("rootfs"))) {
|
||||
struct stat sb;
|
||||
if (stat("/tmp/metadata.bin", &sb) == -1)
|
||||
if (stat(TEMP_METADATA_PATH, &sb) == -1)
|
||||
continue;
|
||||
|
||||
len = snprintf(buf, SIG_SIZE, "%s %s %s", sections[i].img_code,
|
||||
"/tmp/metadata.bin", "/tmp/sha384_keyXXXXXX");
|
||||
TEMP_METADATA_PATH, TEMP_SHA_KEY_PATH);
|
||||
}
|
||||
|
||||
if (len < 0 || len > SIG_SIZE) {
|
||||
|
|
@ -1629,12 +1777,16 @@ int sec_image_auth(void)
|
|||
}
|
||||
close(fd);
|
||||
free(buf);
|
||||
remove_file(TEMP_KERNEL_PATH,TEMP_ROOTFS_PATH, TEMP_METADATA_PATH, TEMP_SHA_KEY_PATH);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int do_board_upgrade_check(char *img)
|
||||
{
|
||||
if (is_tz_authentication_enabled()) {
|
||||
/* If image is having signed rootfs image, then extract kernel and rootfs binary for parsing metadata. */
|
||||
extract_rootfs_binary(check_image_exist("rootfs-"));
|
||||
extract_ubi_volume("ubi_rootfs", check_image_exist("ubi-"), TEMP_ROOTFS_PATH);
|
||||
printf("TZ authentication enabled ...\n");
|
||||
if (!load_sections()) {
|
||||
printf("Error: Failed to load sections from image: %s\n", img);
|
||||
|
|
|
|||
|
|
@ -113,7 +113,8 @@ int is_version_check_enabled(void);
|
|||
int get_sw_id_from_component_bin(struct image_section *);
|
||||
int get_sw_id_from_component_bin_elf(struct image_section *);
|
||||
int get_sw_id_from_component_bin_elf64(struct image_section *);
|
||||
int extract_kernel_binary(struct image_section *);
|
||||
void extract_binary(struct image_section *);
|
||||
int extract_kernel_binary(struct image_section *, char *);
|
||||
int is_image_version_higher(void);
|
||||
int update_version(void);
|
||||
int check_image_version(void);
|
||||
|
|
@ -127,7 +128,8 @@ int is_component_authenticated(char *, char *, char *);
|
|||
int is_image_authenticated(void);
|
||||
int do_board_upgrade_check(char *);
|
||||
int check_nand_preamble(uint8_t *);
|
||||
int find_mtd_part_size(void);
|
||||
int find_mtd_part_size(char *);
|
||||
int create_file(char *, char *, int );
|
||||
int parse_elf_image_phdr(struct image_section *);
|
||||
int compute_sha384(struct image_section *);
|
||||
int compute_sha_hash(struct image_section *);
|
||||
char *check_image_exist(char *);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue