Merge branch '2019-01-14-master-imports'

- MediaTek improvements (eth support)
- DM conversion for HI6220
- ISEE, Toby Churchill, other platform updates
- Various format code printf fixes
- Build race fixes
- Command repeat functionality enhanced, command autocomplete support
  enhanced.
This commit is contained in:
Tom Rini 2019-01-15 20:33:07 -05:00
commit e807f6b5f9
104 changed files with 4464 additions and 729 deletions

View File

@ -176,6 +176,8 @@ F: drivers/ram/mediatek/
F: drivers/spi/mtk_qspi.c
F: drivers/timer/mtk_timer.c
F: drivers/watchdog/mtk_wdt.c
F: drivers/net/mtk_eth.c
F: drivers/reset/reset-mediatek.c
F: tools/mtk_image.c
F: tools/mtk_image.h
N: mediatek

View File

@ -534,7 +534,7 @@ include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
@# Otherwise, 'make silentoldconfig' would be invoked twice.
$(Q)touch include/config/auto.conf
u-boot.cfg spl/u-boot.cfg tpl/u-boot.cfg: include/config.h FORCE
u-boot.cfg spl/u-boot.cfg tpl/u-boot.cfg:
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.autoconf $(@)
-include include/autoconf.mk
@ -910,7 +910,7 @@ quiet_cmd_cfgcheck = CFGCHK $2
cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \
$(srctree)/scripts/config_whitelist.txt $(srctree)
all: $(ALL-y) cfg
all: $(ALL-y)
ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
@echo >&2 "===================== WARNING ======================"
@echo >&2 "This board uses CONFIG_DM_I2C_COMPAT. Please remove"
@ -1198,6 +1198,7 @@ MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \
$(if $(CONFIG_SPL_LOAD_FIT),u-boot-nodtb.bin dts/dt.dtb,u-boot.bin) FORCE
$(call if_changed,mkimage)
$(BOARD_SIZE_CHECK)
u-boot.itb: u-boot-nodtb.bin dts/dt.dtb $(U_BOOT_ITS) FORCE
$(call if_changed,mkfitimage)
@ -1555,7 +1556,7 @@ ifneq ($(KBUILD_SRC),)
endif
# prepare2 creates a makefile if using a separate output directory
prepare2: prepare3 outputmakefile
prepare2: prepare3 outputmakefile cfg
prepare1: prepare2 $(version_h) $(timestamp_h) \
include/config/auto.conf

View File

@ -193,7 +193,9 @@ dtb-$(CONFIG_AM33XX) += am335x-boneblack.dtb am335x-bone.dtb \
am335x-pxm50.dtb \
am335x-rut.dtb \
am335x-pdu001.dtb \
am335x-chiliboard.dtb
am335x-chiliboard.dtb \
am335x-sl50.dtb \
am335x-base0033.dtb
dtb-$(CONFIG_AM43XX) += am437x-gp-evm.dtb am437x-sk-evm.dtb \
am43x-epos-evm.dtb \
am437x-idk-evm.dtb \
@ -522,6 +524,9 @@ dtb-$(CONFIG_TARGET_OMAP3_BEAGLE) += \
omap3-beagle-xm.dtb \
omap3-beagle.dtb
dtb-$(CONFIG_TARGET_OMAP3_IGEP00X0) += \
omap3-igep0020.dtb
dtb-$(CONFIG_TARGET_SAMA5D2_PTC_EK) += \
at91-sama5d2_ptc_ek.dtb

View File

@ -0,0 +1,95 @@
/*
* am335x-base0033.dts - Device Tree file for IGEP AQUILA EXPANSION
*
* Copyright (C) 2013 ISEE 2007 SL - http://www.isee.biz
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include "am335x-igep0033.dtsi"
/ {
model = "IGEP COM AM335x on AQUILA Expansion";
compatible = "isee,am335x-base0033", "isee,am335x-igep0033", "ti,am33xx";
hdmi {
compatible = "ti,tilcdc,slave";
i2c = <&i2c0>;
pinctrl-names = "default", "off";
pinctrl-0 = <&nxp_hdmi_pins>;
pinctrl-1 = <&nxp_hdmi_off_pins>;
status = "okay";
};
leds_base {
pinctrl-names = "default";
pinctrl-0 = <&leds_base_pins>;
compatible = "gpio-leds";
led0 {
label = "base:red:user";
gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>; /* gpio1_21 */
default-state = "off";
};
led1 {
label = "base:green:user";
gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>; /* gpio2_0 */
default-state = "off";
};
};
};
&am33xx_pinmux {
nxp_hdmi_pins: pinmux_nxp_hdmi_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x9b0, PIN_OUTPUT | MUX_MODE3) /* xdma_event_intr0.clkout1 */
AM33XX_IOPAD(0x8a0, PIN_OUTPUT | MUX_MODE0) /* lcd_data0 */
AM33XX_IOPAD(0x8a4, PIN_OUTPUT | MUX_MODE0) /* lcd_data1 */
AM33XX_IOPAD(0x8a8, PIN_OUTPUT | MUX_MODE0) /* lcd_data2 */
AM33XX_IOPAD(0x8ac, PIN_OUTPUT | MUX_MODE0) /* lcd_data3 */
AM33XX_IOPAD(0x8b0, PIN_OUTPUT | MUX_MODE0) /* lcd_data4 */
AM33XX_IOPAD(0x8b4, PIN_OUTPUT | MUX_MODE0) /* lcd_data5 */
AM33XX_IOPAD(0x8b8, PIN_OUTPUT | MUX_MODE0) /* lcd_data6 */
AM33XX_IOPAD(0x8bc, PIN_OUTPUT | MUX_MODE0) /* lcd_data7 */
AM33XX_IOPAD(0x8c0, PIN_OUTPUT | MUX_MODE0) /* lcd_data8 */
AM33XX_IOPAD(0x8c4, PIN_OUTPUT | MUX_MODE0) /* lcd_data9 */
AM33XX_IOPAD(0x8c8, PIN_OUTPUT | MUX_MODE0) /* lcd_data10 */
AM33XX_IOPAD(0x8cc, PIN_OUTPUT | MUX_MODE0) /* lcd_data11 */
AM33XX_IOPAD(0x8d0, PIN_OUTPUT | MUX_MODE0) /* lcd_data12 */
AM33XX_IOPAD(0x8d4, PIN_OUTPUT | MUX_MODE0) /* lcd_data13 */
AM33XX_IOPAD(0x8d8, PIN_OUTPUT | MUX_MODE0) /* lcd_data14 */
AM33XX_IOPAD(0x8dc, PIN_OUTPUT | MUX_MODE0) /* lcd_data15 */
AM33XX_IOPAD(0x8e0, PIN_OUTPUT | MUX_MODE0) /* lcd_vsync */
AM33XX_IOPAD(0x8e4, PIN_OUTPUT | MUX_MODE0) /* lcd_hsync */
AM33XX_IOPAD(0x8e8, PIN_OUTPUT | MUX_MODE0) /* lcd_pclk */
AM33XX_IOPAD(0x8ec, PIN_OUTPUT | MUX_MODE0) /* lcd_ac_bias_en */
>;
};
nxp_hdmi_off_pins: pinmux_nxp_hdmi_off_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x9b0, PIN_OUTPUT | MUX_MODE3) /* xdma_event_intr0.clkout1 */
>;
};
leds_base_pins: pinmux_leds_base_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a5.gpio1_21 */
AM33XX_IOPAD(0x888, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_csn3.gpio2_0 */
>;
};
};
&lcdc {
status = "okay";
};
&i2c0 {
eeprom: eeprom@50 {
compatible = "atmel,24c256";
reg = <0x50>;
};
};

View File

@ -0,0 +1,323 @@
/*
* am335x-igep0033.dtsi - Device Tree file for IGEP COM AQUILA AM335x
*
* Copyright (C) 2013 ISEE 2007 SL - http://www.isee.biz
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;
#include "am33xx.dtsi"
#include <dt-bindings/interrupt-controller/irq.h>
/ {
cpus {
cpu@0 {
cpu0-supply = <&vdd1_reg>;
};
};
memory@80000000 {
device_type = "memory";
reg = <0x80000000 0x10000000>; /* 256 MB */
};
leds {
pinctrl-names = "default";
pinctrl-0 = <&leds_pins>;
compatible = "gpio-leds";
led0 {
label = "com:green:user";
gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
};
vbat: fixedregulator0 {
compatible = "regulator-fixed";
regulator-name = "vbat";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-boot-on;
};
vmmc: fixedregulator1 {
compatible = "regulator-fixed";
regulator-name = "vmmc";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
};
&am33xx_pinmux {
i2c0_pins: pinmux_i2c0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */
AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */
>;
};
nandflash_pins: pinmux_nandflash_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad0.gpmc_ad0 */
AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad1.gpmc_ad1 */
AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad2.gpmc_ad2 */
AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad3.gpmc_ad3 */
AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad4.gpmc_ad4 */
AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad5.gpmc_ad5 */
AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad6.gpmc_ad6 */
AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad7.gpmc_ad7 */
AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_wait0.gpmc_wait0 */
AM33XX_IOPAD(0x874, PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_wpn.gpio0_30 */
AM33XX_IOPAD(0x87c, PIN_OUTPUT | MUX_MODE0) /* gpmc_csn0.gpmc_csn0 */
AM33XX_IOPAD(0x890, PIN_OUTPUT | MUX_MODE0) /* gpmc_advn_ale.gpmc_advn_ale */
AM33XX_IOPAD(0x894, PIN_OUTPUT | MUX_MODE0) /* gpmc_oen_ren.gpmc_oen_ren */
AM33XX_IOPAD(0x898, PIN_OUTPUT | MUX_MODE0) /* gpmc_wen.gpmc_wen */
AM33XX_IOPAD(0x89c, PIN_OUTPUT | MUX_MODE0) /* gpmc_be0n_cle.gpmc_be0n_cle */
>;
};
uart0_pins: pinmux_uart0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */
>;
};
leds_pins: pinmux_leds_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x85c, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a7.gpio1_23 */
>;
};
};
&mac {
status = "okay";
};
&davinci_mdio {
status = "okay";
};
&cpsw_emac0 {
phy_id = <&davinci_mdio>, <0>;
phy-mode = "rmii";
};
&cpsw_emac1 {
phy_id = <&davinci_mdio>, <1>;
phy-mode = "rmii";
};
&phy_sel {
rmii-clock-ext;
};
&elm {
status = "okay";
};
&gpmc {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&nandflash_pins>;
ranges = <0 0 0x08000000 0x1000000>; /* CS0: 16MB for NAND */
nand@0,0 {
compatible = "ti,omap2-nand";
reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
interrupt-parent = <&gpmc>;
interrupts = <0 IRQ_TYPE_NONE>, /* fifoevent */
<1 IRQ_TYPE_NONE>; /* termcount */
rb-gpios = <&gpmc 0 GPIO_ACTIVE_HIGH>; /* gpmc_wait0 */
nand-bus-width = <8>;
ti,nand-ecc-opt = "bch8";
gpmc,device-width = <1>;
gpmc,sync-clk-ps = <0>;
gpmc,cs-on-ns = <0>;
gpmc,cs-rd-off-ns = <44>;
gpmc,cs-wr-off-ns = <44>;
gpmc,adv-on-ns = <6>;
gpmc,adv-rd-off-ns = <34>;
gpmc,adv-wr-off-ns = <44>;
gpmc,we-on-ns = <0>;
gpmc,we-off-ns = <40>;
gpmc,oe-on-ns = <0>;
gpmc,oe-off-ns = <54>;
gpmc,access-ns = <64>;
gpmc,rd-cycle-ns = <82>;
gpmc,wr-cycle-ns = <82>;
gpmc,bus-turnaround-ns = <0>;
gpmc,cycle2cycle-delay-ns = <0>;
gpmc,clk-activation-ns = <0>;
gpmc,wr-access-ns = <40>;
gpmc,wr-data-mux-bus-ns = <0>;
#address-cells = <1>;
#size-cells = <1>;
ti,elm-id = <&elm>;
/* MTD partition table */
partition@0 {
label = "SPL";
reg = <0x00000000 0x000080000>;
};
partition@1 {
label = "U-boot";
reg = <0x00080000 0x001e0000>;
};
partition@2 {
label = "U-Boot Env";
reg = <0x00260000 0x00020000>;
};
partition@3 {
label = "Kernel";
reg = <0x00280000 0x00500000>;
};
partition@4 {
label = "File System";
reg = <0x00780000 0x007880000>;
};
};
};
&i2c0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
clock-frequency = <400000>;
tps: tps@2d {
reg = <0x2d>;
};
};
&mmc1 {
status = "okay";
vmmc-supply = <&vmmc>;
bus-width = <4>;
};
&uart0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&uart0_pins>;
};
&usb {
status = "okay";
};
&usb_ctrl_mod {
status = "okay";
};
&usb0_phy {
status = "okay";
};
&usb1_phy {
status = "okay";
};
&usb0 {
status = "okay";
};
&usb1 {
status = "okay";
dr_mode = "host";
};
&cppi41dma {
status = "okay";
};
#include "tps65910.dtsi"
&tps {
vcc1-supply = <&vbat>;
vcc2-supply = <&vbat>;
vcc3-supply = <&vbat>;
vcc4-supply = <&vbat>;
vcc5-supply = <&vbat>;
vcc6-supply = <&vbat>;
vcc7-supply = <&vbat>;
vccio-supply = <&vbat>;
regulators {
vrtc_reg: regulator@0 {
regulator-always-on;
};
vio_reg: regulator@1 {
regulator-always-on;
};
vdd1_reg: regulator@2 {
/* VDD_MPU voltage limits 0.95V - 1.26V with +/-4% tolerance */
regulator-name = "vdd_mpu";
regulator-min-microvolt = <912500>;
regulator-max-microvolt = <1312500>;
regulator-boot-on;
regulator-always-on;
};
vdd2_reg: regulator@3 {
/* VDD_CORE voltage limits 0.95V - 1.1V with +/-4% tolerance */
regulator-name = "vdd_core";
regulator-min-microvolt = <912500>;
regulator-max-microvolt = <1150000>;
regulator-boot-on;
regulator-always-on;
};
vdd3_reg: regulator@4 {
regulator-always-on;
};
vdig1_reg: regulator@5 {
regulator-always-on;
};
vdig2_reg: regulator@6 {
regulator-always-on;
};
vpll_reg: regulator@7 {
regulator-always-on;
};
vdac_reg: regulator@8 {
regulator-always-on;
};
vaux1_reg: regulator@9 {
regulator-always-on;
};
vaux2_reg: regulator@10 {
regulator-always-on;
};
vaux33_reg: regulator@11 {
regulator-always-on;
};
vmmc_reg: regulator@12 {
regulator-always-on;
};
};
};

View File

@ -0,0 +1,549 @@
/*
* Copyright (C) 2015 Toby Churchill - http://www.toby-churchill.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;
#include "am33xx.dtsi"
/ {
model = "Toby Churchill SL50 Series";
compatible = "tcl,am335x-sl50", "ti,am33xx";
cpus {
cpu@0 {
cpu0-supply = <&dcdc2_reg>;
};
};
memory@80000000 {
device_type = "memory";
reg = <0x80000000 0x20000000>; /* 512 MB */
};
chosen {
stdout-path = &uart0;
};
leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&led_pins>;
led0 {
label = "sl50:green:usr0";
gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
default-state = "off";
};
led1 {
label = "sl50:red:usr1";
gpios = <&gpio1 22 GPIO_ACTIVE_LOW>;
default-state = "off";
};
led2 {
label = "sl50:green:usr2";
gpios = <&gpio1 23 GPIO_ACTIVE_LOW>;
default-state = "off";
};
led3 {
label = "sl50:red:usr3";
gpios = <&gpio1 24 GPIO_ACTIVE_LOW>;
default-state = "off";
};
};
backlight0: disp0 {
compatible = "pwm-backlight";
pwms = <&ehrpwm1 0 500000 0>;
brightness-levels = <0 10 20 30 40 50 60 70 80 90 99>;
default-brightness-level = <6>;
};
backlight1: disp1 {
compatible = "pwm-backlight";
pwms = <&ehrpwm1 1 500000 0>;
brightness-levels = <0 10 20 30 40 50 60 70 80 90 99>;
default-brightness-level = <6>;
};
clocks {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <0>;
/* audio external oscillator */
tlv320aic3x_mclk: oscillator@0 {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <24576000>; /* 24.576MHz */
};
};
sound {
compatible = "ti,da830-evm-audio";
ti,model = "AM335x-SL50";
ti,audio-codec = <&audio_codec>;
ti,mcasp-controller = <&mcasp0>;
clocks = <&tlv320aic3x_mclk>;
clock-names = "mclk";
ti,audio-routing =
"Headphone Jack", "HPLOUT",
"Headphone Jack", "HPROUT",
"LINE1R", "Line In",
"LINE1L", "Line In";
};
emmc_pwrseq: pwrseq@0 {
compatible = "mmc-pwrseq-emmc";
pinctrl-names = "default";
pinctrl-0 = <&emmc_pwrseq_pins>;
reset-gpios = <&gpio1 20 GPIO_ACTIVE_LOW>;
};
vmmcsd_fixed: fixedregulator0 {
compatible = "regulator-fixed";
regulator-name = "vmmcsd_fixed";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
};
&am33xx_pinmux {
pinctrl-names = "default";
pinctrl-0 = <&lwb_pins>;
led_pins: pinmux_led_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x854, PIN_OUTPUT | MUX_MODE7) /* gpmc_a5.gpio1_21 */
AM33XX_IOPAD(0x858, PIN_OUTPUT | MUX_MODE7) /* gpmc_a6.gpio1_22 */
AM33XX_IOPAD(0x85c, PIN_OUTPUT | MUX_MODE7) /* gpmc_a7.gpio1_23 */
AM33XX_IOPAD(0x860, PIN_OUTPUT | MUX_MODE7) /* gpmc_a8.gpio1_24 */
>;
};
uart0_pins: pinmux_uart0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */
>;
};
uart1_pins: pinmux_uart1_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x980, PIN_INPUT_PULLUP | MUX_MODE0) /* uart1_rxd.uart1_rxd */
AM33XX_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart1_txd.uart1_txd */
>;
};
uart4_pins: pinmux_uart4_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE6) /* gpmc_wait0.uart4_rxd */
AM33XX_IOPAD(0x874, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* gpmc_wpn.uart4_txd */
>;
};
i2c0_pins: pinmux_i2c0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */
AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */
>;
};
i2c2_pins: pinmux_i2c2_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE3) /* uart1_ctsn.i2c2_sda */
AM33XX_IOPAD(0x97c, PIN_INPUT_PULLUP | MUX_MODE3) /* uart1_rtsn.i2c2_scl */
>;
};
cpsw_default: cpsw_default {
pinctrl-single,pins = <
/* Slave 1 */
AM33XX_IOPAD(0x910, PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxerr.mii1_rxerr */
AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mii1_txen.mii1_txen */
AM33XX_IOPAD(0x918, PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxdv.mii1_rxdv */
AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mii1_txd3.mii1_txd3 */
AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mii1_txd2.mii1_txd2 */
AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mii1_txd1.mii1_txd1 */
AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mii1_txd0.mii1_txd0 */
AM33XX_IOPAD(0x92c, PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_txclk.mii1_txclk */
AM33XX_IOPAD(0x930, PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxclk.mii1_rxclk */
AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxd3.mii1_rxd3 */
AM33XX_IOPAD(0x938, PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxd2.mii1_rxd2 */
AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxd1.mii1_rxd1 */
AM33XX_IOPAD(0x940, PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxd0.mii1_rxd0 */
>;
};
cpsw_sleep: cpsw_sleep {
pinctrl-single,pins = <
/* Slave 1 reset value */
AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE7)
AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7)
AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE7)
AM33XX_IOPAD(0x91c, PIN_INPUT_PULLDOWN | MUX_MODE7)
AM33XX_IOPAD(0x920, PIN_INPUT_PULLDOWN | MUX_MODE7)
AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7)
AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7)
AM33XX_IOPAD(0x92c, PIN_INPUT_PULLDOWN | MUX_MODE7)
AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE7)
AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE7)
AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE7)
AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7)
AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7)
>;
};
davinci_mdio_default: davinci_mdio_default {
pinctrl-single,pins = <
/* MDIO */
AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */
AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */
>;
};
davinci_mdio_sleep: davinci_mdio_sleep {
pinctrl-single,pins = <
/* MDIO reset value */
AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7)
AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7)
>;
};
mmc1_pins: pinmux_mmc1_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x96c, PIN_INPUT | MUX_MODE7) /* uart0_rtsn.gpio1_9 */
>;
};
emmc_pwrseq_pins: pinmux_emmc_pwrseq_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x850, PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_a4.gpio1_20 */
>;
};
emmc_pins: pinmux_emmc_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */
AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */
AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */
AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */
>;
};
audio_pins: pinmux_audio_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x9ac, PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_ahcklx.mcasp0_ahclkx */
AM33XX_IOPAD(0x994, PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_fsx.mcasp0_fsx */
AM33XX_IOPAD(0x990, PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_aclkx.mcasp0_aclkx */
AM33XX_IOPAD(0x998, PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_axr0.mcasp0_axr0 */
AM33XX_IOPAD(0x99c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mcasp0_ahclkr.mcasp0_axr2 */
>;
};
ehrpwm1_pins: pinmux_ehrpwm1a_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x848, PIN_OUTPUT | MUX_MODE6) /* gpmc_a2.ehrpwm1a */
AM33XX_IOPAD(0x84c, PIN_OUTPUT | MUX_MODE6) /* gpmc_a3.ehrpwm1b */
>;
};
spi0_pins: pinmux_spi0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x954, PIN_INPUT_PULLUP | MUX_MODE0) /* SPI0_MOSI - spi0_d0.spi0_d0 */
AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE0) /* SPI0_MISO - spi0_d1.spi0_d1 */
AM33XX_IOPAD(0x950, PIN_INPUT_PULLUP | MUX_MODE0) /* SPI0_CLK - spi0_clk.spi0_clk */
AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE0) /* SPI0_CS0 (NBATTSS) - spi0_cs0.spi0_cs0 */
AM33XX_IOPAD(0x960, PIN_INPUT_PULLUP | MUX_MODE0) /* SPI0_CS1 (FPGA_FLASH_NCS) - spi0_cs1.spi0_cs1 */
>;
};
lwb_pins: pinmux_lwb_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x9a4, PIN_OUTPUT | MUX_MODE7) /* SoundPA_en - mcasp0_fsr.gpio3_19 */
AM33XX_IOPAD(0x828, PIN_OUTPUT | MUX_MODE7) /* nKbdOnC - gpmc_ad10.gpio0_26 */
AM33XX_IOPAD(0x830, PIN_INPUT_PULLUP | MUX_MODE7) /* nKbdInt - gpmc_ad12.gpio1_12 */
AM33XX_IOPAD(0x834, PIN_INPUT_PULLUP | MUX_MODE7) /* nKbdReset - gpmc_ad13.gpio1_13 */
AM33XX_IOPAD(0x838, PIN_INPUT_PULLUP | MUX_MODE7) /* nDispReset - gpmc_ad14.gpio1_14 */
AM33XX_IOPAD(0x844, PIN_INPUT_PULLUP | MUX_MODE7) /* USB1_enPower - gpmc_a1.gpio1_17 */
/* PDI Bus - Battery system */
AM33XX_IOPAD(0x840, PIN_INPUT_PULLUP | MUX_MODE7) /* nBattReset gpmc_a0.gpio1_16 */
AM33XX_IOPAD(0x83c, PIN_INPUT_PULLUP | MUX_MODE7) /* BattPDIData gpmc_ad15.gpio1_15 */
>;
};
};
&i2c0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
clock-frequency = <400000>;
tps: tps@24 {
reg = <0x24>;
};
bq32000: rtc@68 {
compatible = "ti,bq32000";
trickle-resistor-ohms = <1120>;
reg = <0x68>;
};
eeprom: eeprom@50 {
compatible = "atmel,24c256";
reg = <0x50>;
};
gpio_exp: mcp23017@20 {
compatible = "microchip,mcp23017";
reg = <0x20>;
};
};
&i2c2 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c2_pins>;
clock-frequency = <400000>;
audio_codec: tlv320aic3106@1b {
status = "okay";
compatible = "ti,tlv320aic3106";
reg = <0x1b>;
AVDD-supply = <&ldo4_reg>;
IOVDD-supply = <&ldo4_reg>;
DRVDD-supply = <&ldo4_reg>;
DVDD-supply = <&ldo3_reg>;
};
/* Ambient Light Sensor */
als: isl29023@44 {
compatible = "isil,isl29023";
reg = <0x44>;
};
};
&rtc {
status = "disabled";
};
&usb {
status = "okay";
};
&usb_ctrl_mod {
status = "okay";
};
&usb0_phy {
status = "okay";
};
&usb1_phy {
status = "okay";
};
&usb0 {
status = "okay";
dr_mode = "peripheral";
};
&usb1 {
status = "okay";
dr_mode = "host";
};
&cppi41dma {
status = "okay";
};
&mmc1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&mmc1_pins>;
bus-width = <4>;
cd-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
vmmc-supply = <&vmmcsd_fixed>;
};
&mmc2 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&emmc_pins>;
bus-width = <8>;
vmmc-supply = <&vmmcsd_fixed>;
mmc-pwrseq = <&emmc_pwrseq>;
};
&mcasp0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&audio_pins>;
op-mode = <0>; /* MCASP_ISS_MODE */
tdm-slots = <2>;
serial-dir = <
2 0 1 0
0 0 0 0
0 0 0 0
0 0 0 0
>;
tx-num-evt = <1>;
rx-num-evt = <1>;
};
&uart0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&uart0_pins>;
};
&uart1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&uart1_pins>;
};
&uart4 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&uart4_pins>;
};
&spi0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins>;
flash: n25q032@1 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "micron,n25q032";
reg = <1>;
spi-max-frequency = <5000000>;
};
};
#include "tps65217.dtsi"
&tps {
ti,pmic-shutdown-controller;
interrupt-parent = <&intc>;
interrupts = <7>; /* NNMI */
regulators {
dcdc1_reg: regulator@0 {
/* VDDS_DDR */
regulator-min-microvolt = <1500000>;
regulator-max-microvolt = <1500000>;
regulator-always-on;
};
dcdc2_reg: regulator@1 {
/* VDD_MPU voltage limits 0.95V - 1.26V with +/-4% tolerance */
regulator-name = "vdd_mpu";
regulator-min-microvolt = <925000>;
regulator-max-microvolt = <1325000>;
regulator-boot-on;
regulator-always-on;
};
dcdc3_reg: regulator@2 {
/* VDD_CORE voltage limits 0.95V - 1.1V with +/-4% tolerance */
regulator-name = "vdd_core";
regulator-min-microvolt = <925000>;
regulator-max-microvolt = <1150000>;
regulator-boot-on;
regulator-always-on;
};
ldo1_reg: regulator@3 {
/* VRTC / VIO / VDDS*/
regulator-always-on;
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
};
ldo2_reg: regulator@4 {
/* VDD_3V3AUX */
regulator-always-on;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
ldo3_reg: regulator@5 {
/* VDD_1V8 */
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};
ldo4_reg: regulator@6 {
/* VDD_3V3A */
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
};
};
&cpsw_emac0 {
phy_id = <&davinci_mdio>, <0>;
phy-mode = "mii";
};
&cpsw_emac1 {
phy_id = <&davinci_mdio>, <1>;
phy-mode = "mii";
};
&mac {
status = "okay";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&cpsw_default>;
pinctrl-1 = <&cpsw_sleep>;
};
&davinci_mdio {
status = "okay";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&davinci_mdio_default>;
pinctrl-1 = <&davinci_mdio_sleep>;
};
&sham {
status = "okay";
};
&aes {
status = "okay";
};
&epwmss1 {
status = "okay";
};
&ehrpwm1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&ehrpwm1_pins>;
};

View File

@ -0,0 +1,14 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* U-Boot additions
*
* Copyright (c) 2018 Linaro Ltd.
*/
&mmc0 {
u-boot,dm-pre-reloc;
};
&mmc1 {
u-boot,dm-pre-reloc;
};

View File

@ -40,6 +40,17 @@
};
};
&mmc0 {
status = "okay";
non-removable;
bus-width = <8>;
};
&mmc1 {
status = "okay";
bus-width = <4>;
};
&uart2 {
label = "LS-UART0";
};

View File

@ -162,6 +162,24 @@
#clock-cells = <1>;
};
mmc0: dwmmc@f723d000 {
compatible = "hisilicon,hi6220-dw-mshc";
reg = <0x0 0xf723d000 0x0 0x1000>;
interrupts = <0x0 0x48 0x4>;
clocks = <&sys_ctrl 2>, <&sys_ctrl 1>;
clock-names = "ciu", "biu";
status = "disabled";
};
mmc1: dwmmc@f723e000 {
compatible = "hisilicon,hi6220-dw-mshc";
reg = <0x0 0xf723e000 0x0 0x1000>;
interrupts = <0x0 0x49 0x4>;
clocks = <&sys_ctrl 4>, <&sys_ctrl 3>;
clock-names = "ciu", "biu";
status = "disabled";
};
uart0: uart@f8015000 { /* console */
compatible = "arm,pl011", "arm,primecell";
reg = <0x0 0xf8015000 0x0 0x1000>;

View File

@ -10,6 +10,7 @@
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/power/mt7623-power.h>
#include <dt-bindings/reset/mtk-reset.h>
#include "skeleton.dtsi"
/ {
@ -248,8 +249,26 @@
};
ethsys: syscon@1b000000 {
compatible = "mediatek,mt7623-ethsys";
compatible = "mediatek,mt7623-ethsys", "syscon";
reg = <0x1b000000 0x1000>;
#clock-cells = <1>;
#reset-cells = <1>;
};
eth: ethernet@1b100000 {
compatible = "mediatek,mt7623-eth", "syscon";
reg = <0x1b100000 0x20000>;
clocks = <&topckgen CLK_TOP_ETHIF_SEL>,
<&ethsys CLK_ETHSYS_ESW>,
<&ethsys CLK_ETHSYS_GP1>,
<&ethsys CLK_ETHSYS_GP2>,
<&apmixedsys CLK_APMIXED_TRGPLL>;
clock-names = "ethif", "esw", "gp1", "gp2", "trgpll";
power-domains = <&scpsys MT7623_POWER_DOMAIN_ETH>;
resets = <&ethsys ETHSYS_FE_RST>,
<&ethsys ETHSYS_MCM_RST>;
reset-names = "fe", "mcm";
mediatek,ethsys = <&ethsys>;
status = "disabled";
};
};

View File

@ -67,6 +67,19 @@
};
};
&eth {
status = "okay";
mediatek,gmac-id = <0>;
phy-mode = "rgmii";
mediatek,switch = "mt7530";
reset-gpios = <&gpio 33 GPIO_ACTIVE_HIGH>;
fixed-link {
speed = <1000>;
full-duplex;
};
};
&mmc0 {
pinctrl-names = "default";
pinctrl-0 = <&mmc0_pins_default>;

View File

@ -22,6 +22,17 @@
};
};
&eth {
status = "okay";
mediatek,gmac-id = <1>;
phy-mode = "gmii";
phy-handle = <&phy0>;
phy0: ethernet-phy@0 {
reg = <0>;
};
};
&pinctrl {
qspi_pins: qspi-pins {
mux {

View File

@ -10,6 +10,7 @@
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/power/mt7629-power.h>
#include <dt-bindings/reset/mtk-reset.h>
#include "skeleton.dtsi"
/ {
@ -228,6 +229,48 @@
compatible = "mediatek,mt7629-ethsys", "syscon";
reg = <0x1b000000 0x1000>;
#clock-cells = <1>;
#reset-cells = <1>;
};
eth: ethernet@1b100000 {
compatible = "mediatek,mt7629-eth", "syscon";
reg = <0x1b100000 0x20000>;
clocks = <&topckgen CLK_TOP_ETH_SEL>,
<&topckgen CLK_TOP_F10M_REF_SEL>,
<&ethsys CLK_ETH_ESW_EN>,
<&ethsys CLK_ETH_GP0_EN>,
<&ethsys CLK_ETH_GP1_EN>,
<&ethsys CLK_ETH_GP2_EN>,
<&ethsys CLK_ETH_FE_EN>,
<&sgmiisys0 CLK_SGMII_TX_EN>,
<&sgmiisys0 CLK_SGMII_RX_EN>,
<&sgmiisys0 CLK_SGMII_CDR_REF>,
<&sgmiisys0 CLK_SGMII_CDR_FB>,
<&sgmiisys1 CLK_SGMII_TX_EN>,
<&sgmiisys1 CLK_SGMII_RX_EN>,
<&sgmiisys1 CLK_SGMII_CDR_REF>,
<&sgmiisys1 CLK_SGMII_CDR_FB>,
<&apmixedsys CLK_APMIXED_SGMIPLL>,
<&apmixedsys CLK_APMIXED_ETH2PLL>;
clock-names = "ethif", "sgmiitop", "esw", "gp0", "gp1", "gp2",
"fe", "sgmii_tx250m", "sgmii_rx250m",
"sgmii_cdr_ref", "sgmii_cdr_fb",
"sgmii2_tx250m", "sgmii2_rx250m",
"sgmii2_cdr_ref", "sgmii2_cdr_fb",
"sgmii_ck", "eth2pll";
assigned-clocks = <&topckgen CLK_TOP_ETH_SEL>,
<&topckgen CLK_TOP_F10M_REF_SEL>;
assigned-clock-parents = <&topckgen CLK_TOP_UNIVPLL1_D2>,
<&topckgen CLK_TOP_SGMIIPLL_D2>;
power-domains = <&scpsys MT7629_POWER_DOMAIN_ETHSYS>;
resets = <&ethsys ETHSYS_FE_RST>;
reset-names = "fe";
mediatek,ethsys = <&ethsys>;
mediatek,sgmiisys = <&sgmiisys0>;
mediatek,infracfg = <&infracfg>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};
sgmiisys0: syscon@1b128000 {

View File

@ -0,0 +1,250 @@
/*
* Common device tree for IGEP boards based on AM/DM37x
*
* Copyright (C) 2012 Javier Martinez Canillas <javier@osg.samsung.com>
* Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;
#include "omap36xx.dtsi"
/ {
memory@80000000 {
device_type = "memory";
reg = <0x80000000 0x20000000>; /* 512 MB */
};
chosen {
stdout-path = &uart3;
};
sound {
compatible = "ti,omap-twl4030";
ti,model = "igep2";
ti,mcbsp = <&mcbsp2>;
};
vdd33: regulator-vdd33 {
compatible = "regulator-fixed";
regulator-name = "vdd33";
regulator-always-on;
};
};
&omap3_pmx_core {
gpmc_pins: pinmux_gpmc_pins {
pinctrl-single,pins = <
/* OneNAND seems to require PIN_INPUT on clock. */
OMAP3_CORE1_IOPAD(0x20be, PIN_INPUT | MUX_MODE0) /* gpmc_clk.gpmc_clk */
>;
};
uart1_pins: pinmux_uart1_pins {
pinctrl-single,pins = <
OMAP3_CORE1_IOPAD(0x2182, PIN_INPUT | MUX_MODE0) /* uart1_rx.uart1_rx */
OMAP3_CORE1_IOPAD(0x217c, PIN_OUTPUT | MUX_MODE0) /* uart1_tx.uart1_tx */
>;
};
uart3_pins: pinmux_uart3_pins {
pinctrl-single,pins = <
OMAP3_CORE1_IOPAD(0x219e, PIN_INPUT | MUX_MODE0) /* uart3_rx.uart3_rx */
OMAP3_CORE1_IOPAD(0x21a0, PIN_OUTPUT | MUX_MODE0) /* uart3_tx.uart3_tx */
>;
};
mcbsp2_pins: pinmux_mcbsp2_pins {
pinctrl-single,pins = <
OMAP3_CORE1_IOPAD(0x213c, PIN_INPUT | MUX_MODE0) /* mcbsp2_fsx.mcbsp2_fsx */
OMAP3_CORE1_IOPAD(0x213e, PIN_INPUT | MUX_MODE0) /* mcbsp2_clkx.mcbsp2_clkx */
OMAP3_CORE1_IOPAD(0x2140, PIN_INPUT | MUX_MODE0) /* mcbsp2_dr.mcbsp2.dr */
OMAP3_CORE1_IOPAD(0x2142, PIN_OUTPUT | MUX_MODE0) /* mcbsp2_dx.mcbsp2_dx */
>;
};
mmc1_pins: pinmux_mmc1_pins {
pinctrl-single,pins = <
OMAP3_CORE1_IOPAD(0x2144, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_clk.sdmmc1_clk */
OMAP3_CORE1_IOPAD(0x2146, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_cmd.sdmmc1_cmd */
OMAP3_CORE1_IOPAD(0x2148, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat0.sdmmc1_dat0 */
OMAP3_CORE1_IOPAD(0x214a, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat1.sdmmc1_dat1 */
OMAP3_CORE1_IOPAD(0x214c, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat2.sdmmc1_dat2 */
OMAP3_CORE1_IOPAD(0x214e, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat3.sdmmc1_dat3 */
>;
};
mmc2_pins: pinmux_mmc2_pins {
pinctrl-single,pins = <
OMAP3_CORE1_IOPAD(0x2158, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_clk.sdmmc2_clk */
OMAP3_CORE1_IOPAD(0x215a, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_cmd.sdmmc2_cmd */
OMAP3_CORE1_IOPAD(0x215c, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat0.sdmmc2_dat0 */
OMAP3_CORE1_IOPAD(0x215e, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat1.sdmmc2_dat1 */
OMAP3_CORE1_IOPAD(0x2160, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat2.sdmmc2_dat2 */
OMAP3_CORE1_IOPAD(0x2162, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat3.sdmmc2_dat3 */
>;
};
i2c1_pins: pinmux_i2c1_pins {
pinctrl-single,pins = <
OMAP3_CORE1_IOPAD(0x21ba, PIN_INPUT | MUX_MODE0) /* i2c1_scl.i2c1_scl */
OMAP3_CORE1_IOPAD(0x21bc, PIN_INPUT | MUX_MODE0) /* i2c1_sda.i2c1_sda */
>;
};
i2c3_pins: pinmux_i2c3_pins {
pinctrl-single,pins = <
OMAP3_CORE1_IOPAD(0x21c2, PIN_INPUT | MUX_MODE0) /* i2c3_scl.i2c3_scl */
OMAP3_CORE1_IOPAD(0x21c4, PIN_INPUT | MUX_MODE0) /* i2c3_sda.i2c3_sda */
>;
};
};
&gpmc {
pinctrl-names = "default";
pinctrl-0 = <&gpmc_pins>;
nand@0,0 {
compatible = "ti,omap2-nand";
reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
interrupt-parent = <&gpmc>;
interrupts = <0 IRQ_TYPE_NONE>, /* fifoevent */
<1 IRQ_TYPE_NONE>; /* termcount */
linux,mtd-name= "micron,mt29c4g96maz";
nand-bus-width = <16>;
gpmc,device-width = <2>;
ti,nand-ecc-opt = "bch8";
gpmc,sync-clk-ps = <0>;
gpmc,cs-on-ns = <0>;
gpmc,cs-rd-off-ns = <44>;
gpmc,cs-wr-off-ns = <44>;
gpmc,adv-on-ns = <6>;
gpmc,adv-rd-off-ns = <34>;
gpmc,adv-wr-off-ns = <44>;
gpmc,we-off-ns = <40>;
gpmc,oe-off-ns = <54>;
gpmc,access-ns = <64>;
gpmc,rd-cycle-ns = <82>;
gpmc,wr-cycle-ns = <82>;
gpmc,wr-access-ns = <40>;
gpmc,wr-data-mux-bus-ns = <0>;
#address-cells = <1>;
#size-cells = <1>;
status = "okay";
};
onenand@0,0 {
compatible = "ti,omap2-onenand";
reg = <0 0 0x20000>; /* CS0, offset 0, IO size 128K */
gpmc,sync-read;
gpmc,sync-write;
gpmc,burst-length = <16>;
gpmc,burst-wrap;
gpmc,burst-read;
gpmc,burst-write;
gpmc,device-width = <2>; /* GPMC_DEVWIDTH_16BIT */
gpmc,mux-add-data = <2>; /* GPMC_MUX_AD */
gpmc,cs-on-ns = <0>;
gpmc,cs-rd-off-ns = <96>;
gpmc,cs-wr-off-ns = <96>;
gpmc,adv-on-ns = <0>;
gpmc,adv-rd-off-ns = <12>;
gpmc,adv-wr-off-ns = <12>;
gpmc,oe-on-ns = <18>;
gpmc,oe-off-ns = <96>;
gpmc,we-on-ns = <0>;
gpmc,we-off-ns = <96>;
gpmc,rd-cycle-ns = <114>;
gpmc,wr-cycle-ns = <114>;
gpmc,access-ns = <90>;
gpmc,page-burst-access-ns = <12>;
gpmc,bus-turnaround-ns = <0>;
gpmc,cycle2cycle-delay-ns = <0>;
gpmc,wait-monitoring-ns = <0>;
gpmc,clk-activation-ns = <6>;
gpmc,wr-data-mux-bus-ns = <30>;
gpmc,wr-access-ns = <90>;
gpmc,sync-clk-ps = <12000>;
#address-cells = <1>;
#size-cells = <1>;
status = "disabled";
};
};
&i2c1 {
pinctrl-names = "default";
pinctrl-0 = <&i2c1_pins>;
clock-frequency = <2600000>;
twl: twl@48 {
reg = <0x48>;
interrupts = <7>; /* SYS_NIRQ cascaded to intc */
interrupt-parent = <&intc>;
twl_audio: audio {
compatible = "ti,twl4030-audio";
codec {
};
};
};
};
#include "twl4030.dtsi"
#include "twl4030_omap3.dtsi"
&i2c3 {
pinctrl-names = "default";
pinctrl-0 = <&i2c3_pins>;
};
&mcbsp2 {
pinctrl-names = "default";
pinctrl-0 = <&mcbsp2_pins>;
status = "okay";
};
&mmc1 {
pinctrl-names = "default";
pinctrl-0 = <&mmc1_pins>;
vmmc-supply = <&vmmc1>;
vmmc_aux-supply = <&vsim>;
bus-width = <4>;
cd-gpios = <&twl_gpio 0 GPIO_ACTIVE_LOW>;
};
&mmc3 {
status = "disabled";
};
&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&uart1_pins>;
};
&uart3 {
pinctrl-names = "default";
pinctrl-0 = <&uart3_pins>;
};
&twl_gpio {
ti,use-leds;
};
&usb_otg_hs {
interface-type = <0>;
usb-phy = <&usb2_phy>;
phys = <&usb2_phy>;
phy-names = "usb2-phy";
mode = <3>;
power = <50>;
};

View File

@ -0,0 +1,264 @@
/*
* Common Device Tree Source for IGEPv2
*
* Copyright (C) 2014 Javier Martinez Canillas <javier@osg.samsung.com>
* Copyright (C) 2014 Enric Balletbo i Serra <eballetbo@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include "omap3-igep.dtsi"
#include "omap-gpmc-smsc9221.dtsi"
/ {
leds {
pinctrl-names = "default";
pinctrl-0 = <&leds_pins>;
compatible = "gpio-leds";
boot {
label = "omap3:green:boot";
gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
user0 {
label = "omap3:red:user0";
gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
user1 {
label = "omap3:red:user1";
gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
user2 {
label = "omap3:green:user1";
gpios = <&twl_gpio 19 GPIO_ACTIVE_LOW>;
};
};
/* HS USB Port 1 Power */
hsusb1_power: hsusb1_power_reg {
compatible = "regulator-fixed";
regulator-name = "hsusb1_vbus";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
gpio = <&twl_gpio 18 GPIO_ACTIVE_LOW>; /* GPIO LEDA */
startup-delay-us = <70000>;
};
/* HS USB Host PHY on PORT 1 */
hsusb1_phy: hsusb1_phy {
compatible = "usb-nop-xceiv";
reset-gpios = <&gpio1 24 GPIO_ACTIVE_LOW>; /* gpio_24 */
vcc-supply = <&hsusb1_power>;
#phy-cells = <0>;
};
tfp410: encoder {
compatible = "ti,tfp410";
powerdown-gpios = <&gpio6 10 GPIO_ACTIVE_LOW>; /* gpio_170 */
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
tfp410_in: endpoint {
remote-endpoint = <&dpi_out>;
};
};
port@1 {
reg = <1>;
tfp410_out: endpoint {
remote-endpoint = <&dvi_connector_in>;
};
};
};
};
dvi0: connector {
compatible = "dvi-connector";
label = "dvi";
digital;
ddc-i2c-bus = <&i2c3>;
port {
dvi_connector_in: endpoint {
remote-endpoint = <&tfp410_out>;
};
};
};
};
&omap3_pmx_core {
pinctrl-names = "default";
pinctrl-0 = <
&tfp410_pins
&dss_dpi_pins
>;
tfp410_pins: pinmux_tfp410_pins {
pinctrl-single,pins = <
OMAP3_CORE1_IOPAD(0x21c6, PIN_OUTPUT | MUX_MODE4) /* hdq_sio.gpio_170 */
>;
};
dss_dpi_pins: pinmux_dss_dpi_pins {
pinctrl-single,pins = <
OMAP3_CORE1_IOPAD(0x20d4, PIN_OUTPUT | MUX_MODE0) /* dss_pclk.dss_pclk */
OMAP3_CORE1_IOPAD(0x20d6, PIN_OUTPUT | MUX_MODE0) /* dss_hsync.dss_hsync */
OMAP3_CORE1_IOPAD(0x20d8, PIN_OUTPUT | MUX_MODE0) /* dss_vsync.dss_vsync */
OMAP3_CORE1_IOPAD(0x20da, PIN_OUTPUT | MUX_MODE0) /* dss_acbias.dss_acbias */
OMAP3_CORE1_IOPAD(0x20dc, PIN_OUTPUT | MUX_MODE0) /* dss_data0.dss_data0 */
OMAP3_CORE1_IOPAD(0x20de, PIN_OUTPUT | MUX_MODE0) /* dss_data1.dss_data1 */
OMAP3_CORE1_IOPAD(0x20e0, PIN_OUTPUT | MUX_MODE0) /* dss_data2.dss_data2 */
OMAP3_CORE1_IOPAD(0x20e2, PIN_OUTPUT | MUX_MODE0) /* dss_data3.dss_data3 */
OMAP3_CORE1_IOPAD(0x20e4, PIN_OUTPUT | MUX_MODE0) /* dss_data4.dss_data4 */
OMAP3_CORE1_IOPAD(0x20e6, PIN_OUTPUT | MUX_MODE0) /* dss_data5.dss_data5 */
OMAP3_CORE1_IOPAD(0x20e8, PIN_OUTPUT | MUX_MODE0) /* dss_data6.dss_data6 */
OMAP3_CORE1_IOPAD(0x20ea, PIN_OUTPUT | MUX_MODE0) /* dss_data7.dss_data7 */
OMAP3_CORE1_IOPAD(0x20ec, PIN_OUTPUT | MUX_MODE0) /* dss_data8.dss_data8 */
OMAP3_CORE1_IOPAD(0x20ee, PIN_OUTPUT | MUX_MODE0) /* dss_data9.dss_data9 */
OMAP3_CORE1_IOPAD(0x20f0, PIN_OUTPUT | MUX_MODE0) /* dss_data10.dss_data10 */
OMAP3_CORE1_IOPAD(0x20f2, PIN_OUTPUT | MUX_MODE0) /* dss_data11.dss_data11 */
OMAP3_CORE1_IOPAD(0x20f4, PIN_OUTPUT | MUX_MODE0) /* dss_data12.dss_data12 */
OMAP3_CORE1_IOPAD(0x20f6, PIN_OUTPUT | MUX_MODE0) /* dss_data13.dss_data13 */
OMAP3_CORE1_IOPAD(0x20f8, PIN_OUTPUT | MUX_MODE0) /* dss_data14.dss_data14 */
OMAP3_CORE1_IOPAD(0x20fa, PIN_OUTPUT | MUX_MODE0) /* dss_data15.dss_data15 */
OMAP3_CORE1_IOPAD(0x20fc, PIN_OUTPUT | MUX_MODE0) /* dss_data16.dss_data16 */
OMAP3_CORE1_IOPAD(0x20fe, PIN_OUTPUT | MUX_MODE0) /* dss_data17.dss_data17 */
OMAP3_CORE1_IOPAD(0x2100, PIN_OUTPUT | MUX_MODE0) /* dss_data18.dss_data18 */
OMAP3_CORE1_IOPAD(0x2102, PIN_OUTPUT | MUX_MODE0) /* dss_data19.dss_data19 */
OMAP3_CORE1_IOPAD(0x2104, PIN_OUTPUT | MUX_MODE0) /* dss_data20.dss_data20 */
OMAP3_CORE1_IOPAD(0x2106, PIN_OUTPUT | MUX_MODE0) /* dss_data21.dss_data21 */
OMAP3_CORE1_IOPAD(0x2108, PIN_OUTPUT | MUX_MODE0) /* dss_data22.dss_data22 */
OMAP3_CORE1_IOPAD(0x210a, PIN_OUTPUT | MUX_MODE0) /* dss_data23.dss_data23 */
>;
};
uart2_pins: pinmux_uart2_pins {
pinctrl-single,pins = <
OMAP3_CORE1_IOPAD(0x2174, PIN_INPUT | MUX_MODE0) /* uart2_cts.uart2_cts */
OMAP3_CORE1_IOPAD(0x2176, PIN_OUTPUT | MUX_MODE0) /* uart2_rts .uart2_rts*/
OMAP3_CORE1_IOPAD(0x2178, PIN_OUTPUT | MUX_MODE0) /* uart2_tx.uart2_tx */
OMAP3_CORE1_IOPAD(0x217a, PIN_INPUT | MUX_MODE0) /* uart2_rx.uart2_rx */
>;
};
smsc9221_pins: pinmux_smsc9221_pins {
pinctrl-single,pins = <
OMAP3_CORE1_IOPAD(0x21d2, PIN_INPUT | MUX_MODE4) /* mcspi1_cs2.gpio_176 */
>;
};
};
&omap3_pmx_core2 {
pinctrl-names = "default";
pinctrl-0 = <
&hsusbb1_pins
>;
hsusbb1_pins: pinmux_hsusbb1_pins {
pinctrl-single,pins = <
OMAP3630_CORE2_IOPAD(0x25da, PIN_OUTPUT | MUX_MODE3) /* etk_ctl.hsusb1_clk */
OMAP3630_CORE2_IOPAD(0x25d8, PIN_OUTPUT | MUX_MODE3) /* etk_clk.hsusb1_stp */
OMAP3630_CORE2_IOPAD(0x25ec, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d8.hsusb1_dir */
OMAP3630_CORE2_IOPAD(0x25ee, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d9.hsusb1_nxt */
OMAP3630_CORE2_IOPAD(0x25dc, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d0.hsusb1_data0 */
OMAP3630_CORE2_IOPAD(0x25de, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d1.hsusb1_data1 */
OMAP3630_CORE2_IOPAD(0x25e0, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d2.hsusb1_data2 */
OMAP3630_CORE2_IOPAD(0x25e2, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d3.hsusb1_data7 */
OMAP3630_CORE2_IOPAD(0x25e4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d4.hsusb1_data4 */
OMAP3630_CORE2_IOPAD(0x25e6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d5.hsusb1_data5 */
OMAP3630_CORE2_IOPAD(0x25e8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d6.hsusb1_data6 */
OMAP3630_CORE2_IOPAD(0x25ea, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d7.hsusb1_data3 */
>;
};
leds_pins: pinmux_leds_pins {
pinctrl-single,pins = <
OMAP3630_CORE2_IOPAD(0x25f4, PIN_OUTPUT | MUX_MODE4) /* etk_d12.gpio_26 */
OMAP3630_CORE2_IOPAD(0x25f6, PIN_OUTPUT | MUX_MODE4) /* etk_d13.gpio_27 */
OMAP3630_CORE2_IOPAD(0x25f8, PIN_OUTPUT | MUX_MODE4) /* etk_d14.gpio_28 */
>;
};
mmc1_wp_pins: pinmux_mmc1_cd_pins {
pinctrl-single,pins = <
OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT | MUX_MODE4) /* etk_d15.gpio_29 */
>;
};
};
&i2c3 {
clock-frequency = <100000>;
/*
* Display monitor features are burnt in the EEPROM
* as EDID data.
*/
eeprom@50 {
compatible = "ti,eeprom";
reg = <0x50>;
};
};
&gpmc {
ranges = <0 0 0x30000000 0x01000000>, /* CS0: 16MB for NAND */
<5 0 0x2c000000 0x01000000>; /* CS5: 16MB for ethernet */
ethernet@gpmc {
pinctrl-names = "default";
pinctrl-0 = <&smsc9221_pins>;
reg = <5 0 0xff>;
interrupt-parent = <&gpio6>;
interrupts = <16 IRQ_TYPE_LEVEL_LOW>;
};
};
&uart2 {
pinctrl-names = "default";
pinctrl-0 = <&uart2_pins>;
};
&usbhshost {
port1-mode = "ehci-phy";
};
&usbhsehci {
phys = <&hsusb1_phy>;
};
&vpll2 {
/* Needed for DSS */
regulator-name = "vdds_dsi";
};
&dss {
status = "ok";
port {
dpi_out: endpoint {
remote-endpoint = <&tfp410_in>;
data-lines = <24>;
};
};
};
&mmc1 {
pinctrl-0 = <&mmc1_pins &mmc1_wp_pins>;
wp-gpios = <&gpio1 29 GPIO_ACTIVE_LOW>; /* gpio_29 */
};

View File

@ -0,0 +1,24 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* U-Boot additions
*
* (C) Copyright 2017 Derald D. Woods <woods.technical@gmail.com>
*/
/ {
chosen {
stdout-path = &uart3;
};
};
&uart1 {
reg-shift = <2>;
};
&uart2 {
reg-shift = <2>;
};
&uart3 {
reg-shift = <2>;
};

View File

@ -0,0 +1,50 @@
/*
* Device Tree Source for IGEPv2 Rev. C (TI OMAP AM/DM37x)
*
* Copyright (C) 2012 Javier Martinez Canillas <javier@osg.samsung.com>
* Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include "omap3-igep0020-common.dtsi"
/ {
model = "IGEPv2 Rev. C (TI OMAP AM/DM37x)";
compatible = "isee,omap3-igep0020", "ti,omap36xx", "ti,omap3";
vmmcsdio_fixed: fixedregulator-mmcsdio {
compatible = "regulator-fixed";
regulator-name = "vmmcsdio_fixed";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
mmc2_pwrseq: mmc2_pwrseq {
compatible = "mmc-pwrseq-simple";
reset-gpios = <&gpio5 11 GPIO_ACTIVE_LOW>, /* gpio_139 - RESET_N_W */
<&gpio5 10 GPIO_ACTIVE_LOW>; /* gpio_138 - WIFI_PDN */
};
};
&omap3_pmx_core {
lbee1usjyc_pins: pinmux_lbee1usjyc_pins {
pinctrl-single,pins = <
OMAP3_CORE1_IOPAD(0x2166, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat5.gpio_137 - RESET_N_W */
OMAP3_CORE1_IOPAD(0x2168, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat6.gpio_138 - WIFI_PDN */
OMAP3_CORE1_IOPAD(0x216a, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat7.gpio_139 - RST_N_B */
>;
};
};
/* On board Wifi module */
&mmc2 {
pinctrl-names = "default";
pinctrl-0 = <&mmc2_pins &lbee1usjyc_pins>;
vmmc-supply = <&vmmcsdio_fixed>;
mmc-pwrseq = <&mmc2_pwrseq>;
bus-width = <4>;
non-removable;
};

View File

@ -13,11 +13,16 @@
/* DEVICES */
#define REG_BASE_MCI 0xF9830000
#define REG_BASE_UART0 0xF8B00000
#define HIOTG_BASE_ADDR 0xF98C0000
/* PERI control registers (4KB) */
/* USB2 PHY01 configuration register */
#define PERI_CTRL_USB0 (REG_BASE_PERI_CTRL + 0x120)
/* USB2 controller configuration register */
#define PERI_CTRL_USB3 (REG_BASE_PERI_CTRL + 0x12c)
#define USB2_2P_CHIPID (1 << 28)
/* PERI CRG registers (4KB) */
/* USB2 CTRL0 clock and soft reset */
#define PERI_CRG46 (REG_BASE_CRG + 0xb8)

View File

@ -0,0 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2018 MediaTek Inc.
*/
#ifndef __MEDIATEK_RESET_H
#define __MEDIATEK_RESET_H
#include <dm.h>
int mediatek_reset_bind(struct udevice *pdev, u32 regofs, u32 num_regs);
#endif /* __MEDIATEK_RESET_H */

View File

@ -315,6 +315,12 @@
};
};
bootcount@0 {
compatible = "u-boot,bootcount-rtc";
rtc = <&rtc_1>;
offset = <0x13>;
};
adc@0 {
compatible = "sandbox,adc";
vdd-supply = <&buck2>;

View File

@ -166,6 +166,34 @@ int board_mmc_init(bd_t *bis)
return ret;
}
#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
#include <usb.h>
#include <usb/dwc2_udc.h>
#include <g_dnl.h>
static struct dwc2_plat_otg_data poplar_otg_data = {
.regs_otg = HIOTG_BASE_ADDR
};
static void set_usb_to_device(void)
{
setbits_le32(PERI_CTRL_USB3, USB2_2P_CHIPID);
}
int board_usb_init(int index, enum usb_init_type init)
{
set_usb_to_device();
return dwc2_udc_probe(&poplar_otg_data);
}
int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
{
if (!env_get("serial#"))
g_dnl_set_serialnumber("0123456789POPLAR");
return 0;
}
#endif
int board_init(void)
{
usb2_phy_init();

View File

@ -9,4 +9,6 @@ config SYS_VENDOR
config SYS_CONFIG_NAME
default "omap3_igep00x0"
source "board/ti/common/Kconfig"
endif

View File

@ -4,4 +4,3 @@ S: Maintained
F: board/isee/igep00x0/
F: include/configs/omap3_igep00x0.h
F: configs/igep00x0_defconfig
F: configs/igep0032_defconfig

View File

@ -146,37 +146,14 @@ static int do_adc_scan(cmd_tbl_t *cmdtp, int flag, int argc,
return CMD_RET_SUCCESS;
}
static cmd_tbl_t cmd_adc_sub[] = {
U_BOOT_CMD_MKENT(list, 1, 1, do_adc_list, "", ""),
U_BOOT_CMD_MKENT(info, 2, 1, do_adc_info, "", ""),
U_BOOT_CMD_MKENT(single, 3, 1, do_adc_single, "", ""),
U_BOOT_CMD_MKENT(scan, 3, 1, do_adc_scan, "", ""),
};
static int do_adc(cmd_tbl_t *cmdtp, int flag, int argc,
char *const argv[])
{
cmd_tbl_t *c;
if (argc < 2)
return CMD_RET_USAGE;
/* Strip off leading 'adc' command argument */
argc--;
argv++;
c = find_cmd_tbl(argv[0], &cmd_adc_sub[0], ARRAY_SIZE(cmd_adc_sub));
if (c)
return c->cmd(cmdtp, flag, argc, argv);
else
return CMD_RET_USAGE;
}
static char adc_help_text[] =
"list - list ADC devices\n"
"adc info <name> - Get ADC device info\n"
"adc single <name> <channel> - Get Single data of ADC device channel\n"
"adc scan <name> [channel mask] - Scan all [or masked] ADC channels";
U_BOOT_CMD(adc, 4, 1, do_adc, "ADC sub-system", adc_help_text);
U_BOOT_CMD_WITH_SUBCMDS(adc, "ADC sub-system", adc_help_text,
U_BOOT_SUBCMD_MKENT(list, 1, 1, do_adc_list),
U_BOOT_SUBCMD_MKENT(info, 2, 1, do_adc_info),
U_BOOT_SUBCMD_MKENT(single, 3, 1, do_adc_single),
U_BOOT_SUBCMD_MKENT(scan, 3, 1, do_adc_scan));

View File

@ -116,7 +116,7 @@ static int do_dtimg(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (!cp || argc > cp->maxargs)
return CMD_RET_USAGE;
if (flag == CMD_FLAG_REPEAT && !cp->repeatable)
if (flag == CMD_FLAG_REPEAT && !cmd_is_repeatable(cp))
return CMD_RET_SUCCESS;
return cp->cmd(cmdtp, flag, argc, argv);

View File

@ -213,7 +213,7 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
gpio_direction_output(gpio, value);
}
printf("gpio: pin %s (gpio %i) value is ", str_gpio, gpio);
printf("gpio: pin %s (gpio %u) value is ", str_gpio, gpio);
if (IS_ERR_VALUE(value))
printf("unknown (ret=%d)\n", value);
else

View File

@ -29,7 +29,7 @@ U_BOOT_CMD(
/* This does not use the U_BOOT_CMD macro as ? can't be used in symbol names */
ll_entry_declare(cmd_tbl_t, question_mark, cmd) = {
"?", CONFIG_SYS_MAXARGS, 1, do_help,
"?", CONFIG_SYS_MAXARGS, cmd_always_repeatable, do_help,
"alias for 'help'",
#ifdef CONFIG_SYS_LONGHELP
""

View File

@ -101,10 +101,19 @@ static struct mmc *init_mmc_device(int dev, bool force_init)
return NULL;
}
if (!mmc_getcd(mmc))
force_init = true;
if (force_init)
mmc->has_init = 0;
if (mmc_init(mmc))
return NULL;
#ifdef CONFIG_BLOCK_CACHE
struct blk_desc *bd = mmc_get_blk_desc(mmc);
blkcache_invalidate(bd->if_type, bd->devnum);
#endif
return mmc;
}
static int do_mmcinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@ -247,7 +256,7 @@ static int do_mmcrpmb(cmd_tbl_t *cmdtp, int flag,
if (cp == NULL || argc > cp->maxargs)
return CMD_RET_USAGE;
if (flag == CMD_FLAG_REPEAT && !cp->repeatable)
if (flag == CMD_FLAG_REPEAT && !cmd_is_repeatable(cp))
return CMD_RET_SUCCESS;
mmc = init_mmc_device(curr_device, false);
@ -907,7 +916,7 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (cp == NULL || argc > cp->maxargs)
return CMD_RET_USAGE;
if (flag == CMD_FLAG_REPEAT && !cp->repeatable)
if (flag == CMD_FLAG_REPEAT && !cmd_is_repeatable(cp))
return CMD_RET_SUCCESS;
if (curr_device < 0) {

476
cmd/mtd.c
View File

@ -15,6 +15,22 @@
#include <mapmem.h>
#include <mtd.h>
#include <linux/ctype.h>
static struct mtd_info *get_mtd_by_name(const char *name)
{
struct mtd_info *mtd;
mtd_probe_devices();
mtd = get_mtd_device_nm(name);
if (IS_ERR_OR_NULL(mtd))
printf("MTD device %s not found, ret %ld\n", name,
PTR_ERR(mtd));
return mtd;
}
static uint mtd_len_to_pages(struct mtd_info *mtd, u64 len)
{
do_div(len, mtd->writesize);
@ -177,7 +193,8 @@ static bool mtd_oob_write_is_empty(struct mtd_oob_ops *op)
return true;
}
static int do_mtd_list(void)
static int do_mtd_list(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
struct mtd_info *mtd;
int dev_nb = 0;
@ -221,229 +238,287 @@ static int mtd_special_write_oob(struct mtd_info *mtd, u64 off,
return ret;
}
static int do_mtd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
static int do_mtd_io(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
bool dump, read, raw, woob, write_empty_pages, has_pages = false;
u64 start_off, off, len, remaining, default_len;
struct mtd_oob_ops io_op = {};
uint user_addr = 0, npages;
const char *cmd = argv[0];
struct mtd_info *mtd;
const char *cmd;
char *mtd_name;
u32 oob_len;
u8 *buf;
int ret;
/* All MTD commands need at least two arguments */
if (argc < 2)
return CMD_RET_USAGE;
/* Parse the command name and its optional suffixes */
cmd = argv[1];
/* List the MTD devices if that is what the user wants */
if (strcmp(cmd, "list") == 0)
return do_mtd_list();
/*
* The remaining commands require also at least a device ID.
* Check the selected device is valid. Ensure it is probed.
*/
if (argc < 3)
return CMD_RET_USAGE;
mtd_name = argv[2];
mtd_probe_devices();
mtd = get_mtd_device_nm(mtd_name);
if (IS_ERR_OR_NULL(mtd)) {
printf("MTD device %s not found, ret %ld\n",
mtd_name, PTR_ERR(mtd));
mtd = get_mtd_by_name(argv[1]);
if (IS_ERR_OR_NULL(mtd))
return CMD_RET_FAILURE;
if (mtd->type == MTD_NANDFLASH || mtd->type == MTD_MLCNANDFLASH)
has_pages = true;
dump = !strncmp(cmd, "dump", 4);
read = dump || !strncmp(cmd, "read", 4);
raw = strstr(cmd, ".raw");
woob = strstr(cmd, ".oob");
write_empty_pages = !has_pages || strstr(cmd, ".dontskipff");
argc -= 2;
argv += 2;
if (!dump) {
if (!argc) {
ret = CMD_RET_USAGE;
goto out_put_mtd;
}
user_addr = simple_strtoul(argv[0], NULL, 16);
argc--;
argv++;
}
put_mtd_device(mtd);
argc -= 3;
argv += 3;
start_off = argc > 0 ? simple_strtoul(argv[0], NULL, 16) : 0;
if (!mtd_is_aligned_with_min_io_size(mtd, start_off)) {
printf("Offset not aligned with a page (0x%x)\n",
mtd->writesize);
ret = CMD_RET_FAILURE;
goto out_put_mtd;
}
/* Do the parsing */
if (!strncmp(cmd, "read", 4) || !strncmp(cmd, "dump", 4) ||
!strncmp(cmd, "write", 5)) {
bool has_pages = mtd->type == MTD_NANDFLASH ||
mtd->type == MTD_MLCNANDFLASH;
bool dump, read, raw, woob, write_empty_pages;
struct mtd_oob_ops io_op = {};
uint user_addr = 0, npages;
u64 start_off, off, len, remaining, default_len;
u32 oob_len;
u8 *buf;
int ret;
default_len = dump ? mtd->writesize : mtd->size;
len = argc > 1 ? simple_strtoul(argv[1], NULL, 16) : default_len;
if (!mtd_is_aligned_with_min_io_size(mtd, len)) {
len = round_up(len, mtd->writesize);
printf("Size not on a page boundary (0x%x), rounding to 0x%llx\n",
mtd->writesize, len);
}
dump = !strncmp(cmd, "dump", 4);
read = dump || !strncmp(cmd, "read", 4);
raw = strstr(cmd, ".raw");
woob = strstr(cmd, ".oob");
write_empty_pages = !has_pages || strstr(cmd, ".dontskipff");
remaining = len;
npages = mtd_len_to_pages(mtd, len);
oob_len = woob ? npages * mtd->oobsize : 0;
if (!dump) {
if (!argc)
return CMD_RET_USAGE;
if (dump)
buf = kmalloc(len + oob_len, GFP_KERNEL);
else
buf = map_sysmem(user_addr, 0);
user_addr = simple_strtoul(argv[0], NULL, 16);
argc--;
argv++;
}
if (!buf) {
printf("Could not map/allocate the user buffer\n");
ret = CMD_RET_FAILURE;
goto out_put_mtd;
}
start_off = argc > 0 ? simple_strtoul(argv[0], NULL, 16) : 0;
if (!mtd_is_aligned_with_min_io_size(mtd, start_off)) {
printf("Offset not aligned with a page (0x%x)\n",
mtd->writesize);
return CMD_RET_FAILURE;
}
if (has_pages)
printf("%s %lld byte(s) (%d page(s)) at offset 0x%08llx%s%s%s\n",
read ? "Reading" : "Writing", len, npages, start_off,
raw ? " [raw]" : "", woob ? " [oob]" : "",
!read && write_empty_pages ? " [dontskipff]" : "");
else
printf("%s %lld byte(s) at offset 0x%08llx\n",
read ? "Reading" : "Writing", len, start_off);
default_len = dump ? mtd->writesize : mtd->size;
len = argc > 1 ? simple_strtoul(argv[1], NULL, 16) :
default_len;
if (!mtd_is_aligned_with_min_io_size(mtd, len)) {
len = round_up(len, mtd->writesize);
printf("Size not on a page boundary (0x%x), rounding to 0x%llx\n",
mtd->writesize, len);
}
io_op.mode = raw ? MTD_OPS_RAW : MTD_OPS_AUTO_OOB;
io_op.len = has_pages ? mtd->writesize : len;
io_op.ooblen = woob ? mtd->oobsize : 0;
io_op.datbuf = buf;
io_op.oobbuf = woob ? &buf[len] : NULL;
remaining = len;
npages = mtd_len_to_pages(mtd, len);
oob_len = woob ? npages * mtd->oobsize : 0;
/* Search for the first good block after the given offset */
off = start_off;
while (mtd_block_isbad(mtd, off))
off += mtd->erasesize;
if (dump)
buf = kmalloc(len + oob_len, GFP_KERNEL);
else
buf = map_sysmem(user_addr, 0);
if (!buf) {
printf("Could not map/allocate the user buffer\n");
return CMD_RET_FAILURE;
}
if (has_pages)
printf("%s %lld byte(s) (%d page(s)) at offset 0x%08llx%s%s%s\n",
read ? "Reading" : "Writing", len, npages, start_off,
raw ? " [raw]" : "", woob ? " [oob]" : "",
!read && write_empty_pages ? " [dontskipff]" : "");
else
printf("%s %lld byte(s) at offset 0x%08llx\n",
read ? "Reading" : "Writing", len, start_off);
io_op.mode = raw ? MTD_OPS_RAW : MTD_OPS_AUTO_OOB;
io_op.len = has_pages ? mtd->writesize : len;
io_op.ooblen = woob ? mtd->oobsize : 0;
io_op.datbuf = buf;
io_op.oobbuf = woob ? &buf[len] : NULL;
/* Search for the first good block after the given offset */
off = start_off;
while (mtd_block_isbad(mtd, off))
/* Loop over the pages to do the actual read/write */
while (remaining) {
/* Skip the block if it is bad */
if (mtd_is_aligned_with_block_size(mtd, off) &&
mtd_block_isbad(mtd, off)) {
off += mtd->erasesize;
/* Loop over the pages to do the actual read/write */
while (remaining) {
/* Skip the block if it is bad */
if (mtd_is_aligned_with_block_size(mtd, off) &&
mtd_block_isbad(mtd, off)) {
off += mtd->erasesize;
continue;
}
if (read)
ret = mtd_read_oob(mtd, off, &io_op);
else
ret = mtd_special_write_oob(mtd, off, &io_op,
write_empty_pages,
woob);
if (ret) {
printf("Failure while %s at offset 0x%llx\n",
read ? "reading" : "writing", off);
return CMD_RET_FAILURE;
}
off += io_op.retlen;
remaining -= io_op.retlen;
io_op.datbuf += io_op.retlen;
io_op.oobbuf += io_op.oobretlen;
continue;
}
if (!ret && dump)
mtd_dump_device_buf(mtd, start_off, buf, len, woob);
if (dump)
kfree(buf);
if (read)
ret = mtd_read_oob(mtd, off, &io_op);
else
unmap_sysmem(buf);
ret = mtd_special_write_oob(mtd, off, &io_op,
write_empty_pages, woob);
if (ret) {
printf("%s on %s failed with error %d\n",
read ? "Read" : "Write", mtd->name, ret);
return CMD_RET_FAILURE;
printf("Failure while %s at offset 0x%llx\n",
read ? "reading" : "writing", off);
break;
}
} else if (!strcmp(cmd, "erase")) {
bool scrub = strstr(cmd, ".dontskipbad");
struct erase_info erase_op = {};
u64 off, len;
int ret;
off = argc > 0 ? simple_strtoul(argv[0], NULL, 16) : 0;
len = argc > 1 ? simple_strtoul(argv[1], NULL, 16) : mtd->size;
if (!mtd_is_aligned_with_block_size(mtd, off)) {
printf("Offset not aligned with a block (0x%x)\n",
mtd->erasesize);
return CMD_RET_FAILURE;
}
if (!mtd_is_aligned_with_block_size(mtd, len)) {
printf("Size not a multiple of a block (0x%x)\n",
mtd->erasesize);
return CMD_RET_FAILURE;
}
printf("Erasing 0x%08llx ... 0x%08llx (%d eraseblock(s))\n",
off, off + len - 1, mtd_div_by_eb(len, mtd));
erase_op.mtd = mtd;
erase_op.addr = off;
erase_op.len = len;
erase_op.scrub = scrub;
while (erase_op.len) {
ret = mtd_erase(mtd, &erase_op);
/* Abort if its not a bad block error */
if (ret != -EIO)
break;
printf("Skipping bad block at 0x%08llx\n",
erase_op.fail_addr);
/* Skip bad block and continue behind it */
erase_op.len -= erase_op.fail_addr - erase_op.addr;
erase_op.len -= mtd->erasesize;
erase_op.addr = erase_op.fail_addr + mtd->erasesize;
}
if (ret && ret != -EIO)
return CMD_RET_FAILURE;
} else if (!strcmp(cmd, "bad")) {
loff_t off;
if (!mtd_can_have_bb(mtd)) {
printf("Only NAND-based devices can have bad blocks\n");
return CMD_RET_SUCCESS;
}
printf("MTD device %s bad blocks list:\n", mtd->name);
for (off = 0; off < mtd->size; off += mtd->erasesize)
if (mtd_block_isbad(mtd, off))
printf("\t0x%08llx\n", off);
} else {
return CMD_RET_USAGE;
off += io_op.retlen;
remaining -= io_op.retlen;
io_op.datbuf += io_op.retlen;
io_op.oobbuf += io_op.oobretlen;
}
if (!ret && dump)
mtd_dump_device_buf(mtd, start_off, buf, len, woob);
if (dump)
kfree(buf);
else
unmap_sysmem(buf);
if (ret) {
printf("%s on %s failed with error %d\n",
read ? "Read" : "Write", mtd->name, ret);
ret = CMD_RET_FAILURE;
} else {
ret = CMD_RET_SUCCESS;
}
out_put_mtd:
put_mtd_device(mtd);
return ret;
}
static int do_mtd_erase(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
struct erase_info erase_op = {};
struct mtd_info *mtd;
u64 off, len;
bool scrub;
int ret;
if (argc < 2)
return CMD_RET_USAGE;
mtd = get_mtd_by_name(argv[1]);
if (IS_ERR_OR_NULL(mtd))
return CMD_RET_FAILURE;
scrub = strstr(argv[0], ".dontskipbad");
argc -= 2;
argv += 2;
off = argc > 0 ? simple_strtoul(argv[0], NULL, 16) : 0;
len = argc > 1 ? simple_strtoul(argv[1], NULL, 16) : mtd->size;
if (!mtd_is_aligned_with_block_size(mtd, off)) {
printf("Offset not aligned with a block (0x%x)\n",
mtd->erasesize);
ret = CMD_RET_FAILURE;
goto out_put_mtd;
}
if (!mtd_is_aligned_with_block_size(mtd, len)) {
printf("Size not a multiple of a block (0x%x)\n",
mtd->erasesize);
ret = CMD_RET_FAILURE;
goto out_put_mtd;
}
printf("Erasing 0x%08llx ... 0x%08llx (%d eraseblock(s))\n",
off, off + len - 1, mtd_div_by_eb(len, mtd));
erase_op.mtd = mtd;
erase_op.addr = off;
erase_op.len = len;
erase_op.scrub = scrub;
while (erase_op.len) {
ret = mtd_erase(mtd, &erase_op);
/* Abort if its not a bad block error */
if (ret != -EIO)
break;
printf("Skipping bad block at 0x%08llx\n", erase_op.fail_addr);
/* Skip bad block and continue behind it */
erase_op.len -= erase_op.fail_addr - erase_op.addr;
erase_op.len -= mtd->erasesize;
erase_op.addr = erase_op.fail_addr + mtd->erasesize;
}
if (ret && ret != -EIO)
ret = CMD_RET_FAILURE;
else
ret = CMD_RET_SUCCESS;
out_put_mtd:
put_mtd_device(mtd);
return ret;
}
static int do_mtd_bad(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
struct mtd_info *mtd;
loff_t off;
if (argc < 2)
return CMD_RET_USAGE;
mtd = get_mtd_by_name(argv[1]);
if (IS_ERR_OR_NULL(mtd))
return CMD_RET_FAILURE;
if (!mtd_can_have_bb(mtd)) {
printf("Only NAND-based devices can have bad blocks\n");
goto out_put_mtd;
}
printf("MTD device %s bad blocks list:\n", mtd->name);
for (off = 0; off < mtd->size; off += mtd->erasesize) {
if (mtd_block_isbad(mtd, off))
printf("\t0x%08llx\n", off);
}
out_put_mtd:
put_mtd_device(mtd);
return CMD_RET_SUCCESS;
}
#ifdef CONFIG_AUTO_COMPLETE
static int mtd_name_complete(int argc, char * const argv[], char last_char,
int maxv, char *cmdv[])
{
int len = 0, n_found = 0;
struct mtd_info *mtd;
argc--;
argv++;
if (argc > 1 ||
(argc == 1 && (last_char == '\0' || isblank(last_char))))
return 0;
if (argc)
len = strlen(argv[0]);
mtd_for_each_device(mtd) {
if (argc &&
(len > strlen(mtd->name) ||
strncmp(argv[0], mtd->name, len)))
continue;
if (n_found >= maxv - 2) {
cmdv[n_found++] = "...";
break;
}
cmdv[n_found++] = mtd->name;
}
cmdv[n_found] = NULL;
return n_found;
}
#endif /* CONFIG_AUTO_COMPLETE */
static char mtd_help_text[] =
#ifdef CONFIG_SYS_LONGHELP
"- generic operations on memory technology devices\n\n"
@ -470,4 +545,15 @@ static char mtd_help_text[] =
#endif
"";
U_BOOT_CMD(mtd, 10, 1, do_mtd, "MTD utils", mtd_help_text);
U_BOOT_CMD_WITH_SUBCMDS(mtd, "MTD utils", mtd_help_text,
U_BOOT_SUBCMD_MKENT(list, 1, 1, do_mtd_list),
U_BOOT_SUBCMD_MKENT_COMPLETE(read, 5, 0, do_mtd_io,
mtd_name_complete),
U_BOOT_SUBCMD_MKENT_COMPLETE(write, 5, 0, do_mtd_io,
mtd_name_complete),
U_BOOT_SUBCMD_MKENT_COMPLETE(dump, 4, 0, do_mtd_io,
mtd_name_complete),
U_BOOT_SUBCMD_MKENT_COMPLETE(erase, 4, 0, do_mtd_erase,
mtd_name_complete),
U_BOOT_SUBCMD_MKENT_COMPLETE(bad, 2, 1, do_mtd_bad,
mtd_name_complete));

View File

@ -708,8 +708,8 @@ int env_get_f(const char *name, char *buf, unsigned len)
if (n)
*--buf = '\0';
printf("env_buf [%d bytes] too small for value of \"%s\"\n",
len, name);
printf("env_buf [%u bytes] too small for value of \"%s\"\n",
len, name);
return n;
}

View File

@ -413,7 +413,7 @@ static void show_time(struct test_info *test, int stage)
do_div(speed, test->time_ms[stage] * 1024);
bps = speed * 8;
printf("%d %s: %d ticks, %d KiB/s %d.%03d Mbps\n", stage,
printf("%d %s: %u ticks, %d KiB/s %d.%03d Mbps\n", stage,
stage_name[stage], test->time_ms[stage],
(int)speed, bps / 1000, bps % 1000);
}

View File

@ -151,7 +151,7 @@ static int do_tpm_pcr_read(cmd_tbl_t *cmdtp, int flag, int argc,
rc = tpm2_pcr_read(dev, index, priv->pcr_select_min, data, &updates);
if (!rc) {
printf("PCR #%u content (%d known updates):\n", index, updates);
printf("PCR #%u content (%u known updates):\n", index, updates);
print_byte_string(data, TPM2_DIGEST_LEN);
}

View File

@ -472,12 +472,8 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (argc < 2)
return CMD_RET_USAGE;
if (strcmp(argv[1], "detach") == 0) {
if (argc < 2)
return CMD_RET_USAGE;
if (strcmp(argv[1], "detach") == 0)
return ubi_detach();
}
if (strcmp(argv[1], "part") == 0) {
const char *vid_header_offset = NULL;

View File

@ -27,7 +27,7 @@ static int do_unzip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (gunzip((void *) dst, dst_len, (void *) src, &src_len) != 0)
return 1;
printf("Uncompressed size: %ld = 0x%lX\n", src_len, src_len);
printf("Uncompressed size: %lu = 0x%lX\n", src_len, src_len);
env_set_hex("filesize", src_len);
return 0;

View File

@ -28,7 +28,7 @@ static int do_zip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (gzip((void *) dst, &dst_len, (void *) src, src_len) != 0)
return 1;
printf("Compressed size: %ld = 0x%lX\n", dst_len, dst_len);
printf("Compressed size: %lu = 0x%lX\n", dst_len, dst_len);
env_set_hex("filesize", dst_len);
return 0;

View File

@ -308,7 +308,7 @@ config 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 vaariable 'silent' to a non-empty value.
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
@ -430,7 +430,7 @@ config SYS_CONSOLE_INFO_QUIET
help
Normally U-Boot displays the current settings for stdout, stdin
and stderr on boot when the post-relocation console is set up.
Enable this option to supress this output. It can be obtained by
Enable this option to suppress this output. It can be obtained by
calling stdio_print_current_devices() from board code.
config SYS_STDIO_DEREGISTER
@ -565,14 +565,14 @@ config LOG_TEST
This enables a 'log test' command to test logging. It is normally
executed from a pytest and simply outputs logging information
in various different ways to test that the logging system works
correctly with varoius settings.
correctly with various settings.
config LOG_ERROR_RETURN
bool "Log all functions which return an error"
depends on LOG
help
When an error is returned in U-Boot it is sometimes difficult to
figure out the root cause. For eaxmple, reading from SPI flash may
figure out the root cause. For example, reading from SPI flash may
fail due to a problem in the SPI controller or due to the flash part
not returning the expected information. This option changes
log_ret() to log any errors it sees. With this option disabled,
@ -661,7 +661,7 @@ config ARCH_MISC_INIT
With this option U-Boot will call arch_misc_init() after
relocation to allow miscellaneous arch-dependent initialisation
to be performed. This function should be defined by the board
and will be called after the console is set up, after relocaiton.
and will be called after the console is set up, after relocation.
config BOARD_EARLY_INIT_F
bool "Call board-specific init before relocation"

View File

@ -262,7 +262,8 @@ int bootm_find_images(int flag, int argc, char * const argv[])
puts("Could not find a valid device tree\n");
return 1;
}
set_working_fdt_addr(map_to_sysmem(images.ft_addr));
if (CONFIG_IS_ENABLED(CMD_FDT))
set_working_fdt_addr(map_to_sysmem(images.ft_addr));
#endif
#if IMAGE_ENABLE_FIT

View File

@ -142,30 +142,45 @@ int cmd_usage(const cmd_tbl_t *cmdtp)
}
#ifdef CONFIG_AUTO_COMPLETE
static char env_complete_buf[512];
int var_complete(int argc, char * const argv[], char last_char, int maxv, char *cmdv[])
{
static char tmp_buf[512];
int space;
space = last_char == '\0' || isblank(last_char);
if (space && argc == 1)
return env_complete("", maxv, cmdv, sizeof(tmp_buf), tmp_buf);
return env_complete("", maxv, cmdv, sizeof(env_complete_buf),
env_complete_buf, false);
if (!space && argc == 2)
return env_complete(argv[1], maxv, cmdv, sizeof(tmp_buf), tmp_buf);
return env_complete(argv[1], maxv, cmdv,
sizeof(env_complete_buf),
env_complete_buf, false);
return 0;
}
static int dollar_complete(int argc, char * const argv[], char last_char,
int maxv, char *cmdv[])
{
/* Make sure the last argument starts with a $. */
if (argc < 1 || argv[argc - 1][0] != '$' ||
last_char == '\0' || isblank(last_char))
return 0;
return env_complete(argv[argc - 1], maxv, cmdv, sizeof(env_complete_buf),
env_complete_buf, true);
}
/*************************************************************************************/
static int complete_cmdv(int argc, char * const argv[], char last_char, int maxv, char *cmdv[])
int complete_subcmdv(cmd_tbl_t *cmdtp, int count, int argc,
char * const argv[], char last_char,
int maxv, char *cmdv[])
{
#ifdef CONFIG_CMDLINE
cmd_tbl_t *cmdtp = ll_entry_start(cmd_tbl_t, cmd);
const int count = ll_entry_count(cmd_tbl_t, cmd);
const cmd_tbl_t *cmdend = cmdtp + count;
const char *p;
int len, clen;
@ -193,7 +208,7 @@ static int complete_cmdv(int argc, char * const argv[], char last_char, int maxv
/* more than one arg or one but the start of the next */
if (argc > 1 || last_char == '\0' || isblank(last_char)) {
cmdtp = find_cmd(argv[0]);
cmdtp = find_cmd_tbl(argv[0], cmdtp, count);
if (cmdtp == NULL || cmdtp->complete == NULL) {
cmdv[0] = NULL;
return 0;
@ -238,6 +253,18 @@ static int complete_cmdv(int argc, char * const argv[], char last_char, int maxv
#endif
}
static int complete_cmdv(int argc, char * const argv[], char last_char,
int maxv, char *cmdv[])
{
#ifdef CONFIG_CMDLINE
return complete_subcmdv(ll_entry_start(cmd_tbl_t, cmd),
ll_entry_count(cmd_tbl_t, cmd), argc, argv,
last_char, maxv, cmdv);
#else
return 0;
#endif
}
static int make_argv(char *s, int argvsz, char *argv[])
{
int argc = 0;
@ -345,9 +372,14 @@ int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp)
/* separate into argv */
argc = make_argv(tmp_buf, sizeof(argv)/sizeof(argv[0]), argv);
/* do the completion and return the possible completions */
i = complete_cmdv(argc, argv, last_char,
sizeof(cmdv) / sizeof(cmdv[0]), cmdv);
/* first try a $ completion */
i = dollar_complete(argc, argv, last_char,
sizeof(cmdv) / sizeof(cmdv[0]), cmdv);
if (!i) {
/* do the completion and return the possible completions */
i = complete_cmdv(argc, argv, last_char,
sizeof(cmdv) / sizeof(cmdv[0]), cmdv);
}
/* no match; bell and out */
if (i == 0) {
@ -362,13 +394,21 @@ int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp)
sep = NULL;
seplen = 0;
if (i == 1) { /* one match; perfect */
k = strlen(argv[argc - 1]);
if (last_char != '\0' && !isblank(last_char))
k = strlen(argv[argc - 1]);
else
k = 0;
s = cmdv[0] + k;
len = strlen(s);
sep = " ";
seplen = 1;
} else if (i > 1 && (j = find_common_prefix(cmdv)) != 0) { /* more */
k = strlen(argv[argc - 1]);
if (last_char != '\0' && !isblank(last_char))
k = strlen(argv[argc - 1]);
else
k = 0;
j -= k;
if (j > 0) {
s = cmdv[0] + k;
@ -481,6 +521,30 @@ void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
}
#endif
int cmd_always_repeatable(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[], int *repeatable)
{
*repeatable = 1;
return cmdtp->cmd(cmdtp, flag, argc, argv);
}
int cmd_never_repeatable(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[], int *repeatable)
{
*repeatable = 0;
return cmdtp->cmd(cmdtp, flag, argc, argv);
}
int cmd_discard_repeatable(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
int repeatable;
return cmdtp->cmd_rep(cmdtp, flag, argc, argv, &repeatable);
}
/**
* Call a command function. This should be the only route in U-Boot to call
* a command, so that we can track whether we are waiting for input or
@ -490,13 +554,15 @@ void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
* @param flag Some flags normally 0 (see CMD_FLAG_.. above)
* @param argc Number of arguments (arg 0 must be the command text)
* @param argv Arguments
* @param repeatable Can the command be repeated
* @return 0 if command succeeded, else non-zero (CMD_RET_...)
*/
static int cmd_call(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
static int cmd_call(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
int *repeatable)
{
int result;
result = (cmdtp->cmd)(cmdtp, flag, argc, argv);
result = cmdtp->cmd_rep(cmdtp, flag, argc, argv, repeatable);
if (result)
debug("Command failed, result=%d\n", result);
return result;
@ -533,12 +599,14 @@ enum command_ret_t cmd_process(int flag, int argc, char * const argv[],
/* If OK so far, then do the command */
if (!rc) {
int newrep;
if (ticks)
*ticks = get_timer(0);
rc = cmd_call(cmdtp, flag, argc, argv);
rc = cmd_call(cmdtp, flag, argc, argv, &newrep);
if (ticks)
*ticks = get_timer(*ticks);
*repeatable &= cmdtp->repeatable;
*repeatable &= newrep;
}
if (rc == CMD_RET_USAGE)
rc = cmd_usage(cmdtp);

View File

@ -193,7 +193,8 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
*of_flat_tree = of_start;
*of_size = of_len;
set_working_fdt_addr(map_to_sysmem(*of_flat_tree));
if (CONFIG_IS_ENABLED(CMD_FDT))
set_working_fdt_addr(map_to_sysmem(*of_flat_tree));
return 0;
error:

View File

@ -69,12 +69,13 @@ static ulong ymodem_read_fit(struct spl_load_info *load, ulong offset,
static int spl_ymodem_load_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
int size = 0;
ulong size = 0;
int err;
int res;
int ret;
connection_info_t info;
char buf[BUF_SIZE];
struct image_header *ih;
ulong addr = 0;
info.mode = xyzModem_ymodem;
@ -107,12 +108,18 @@ static int spl_ymodem_load_image(struct spl_image_info *spl_image,
while ((res = xyzModem_stream_read(buf, BUF_SIZE, &err)) > 0)
size += res;
} else {
ret = spl_parse_image_header(spl_image,
(struct image_header *)buf);
ih = (struct image_header *)buf;
ret = spl_parse_image_header(spl_image, ih);
if (ret)
return ret;
addr = spl_image->load_addr;
#ifdef CONFIG_SPL_GZIP
if (ih->ih_comp == IH_COMP_GZIP)
addr = CONFIG_SYS_LOAD_ADDR;
else
#endif
addr = spl_image->load_addr;
memcpy((void *)addr, buf, res);
ih = (struct image_header *)addr;
size += res;
addr += res;
@ -121,13 +128,25 @@ static int spl_ymodem_load_image(struct spl_image_info *spl_image,
size += res;
addr += res;
}
#ifdef CONFIG_SPL_GZIP
if (ih->ih_comp == IH_COMP_GZIP) {
if (gunzip((void *)(spl_image->load_addr + sizeof(*ih)),
CONFIG_SYS_BOOTM_LEN,
(void *)(CONFIG_SYS_LOAD_ADDR + sizeof(*ih)),
&size)) {
puts("Uncompressing error\n");
return -EIO;
}
}
#endif
}
end_stream:
xyzModem_stream_close(&err);
xyzModem_stream_terminate(false, &getcymodem);
printf("Loaded %d bytes\n", size);
printf("Loaded %lu bytes\n", size);
return 0;
}
SPL_LOAD_IMAGE_METHOD("UART", 0, BOOT_DEVICE_UART, spl_ymodem_load_image);

View File

@ -25,6 +25,7 @@
#include <xyzModem.h>
#include <stdarg.h>
#include <u-boot/crc.h>
#include <watchdog.h>
/* Assumption - run xyzModem protocol over the console port */
@ -63,6 +64,7 @@ CYGACC_COMM_IF_GETC_TIMEOUT (char chan, char *c)
{
ulong now = get_timer(0);
WATCHDOG_RESET();
while (!tstc ())
{
if (get_timer(now) > xyzModem_CHAR_TIMEOUT)

View File

@ -41,6 +41,9 @@ CONFIG_CMD_UBI=y
# CONFIG_CMD_UBIFS is not set
CONFIG_ENV_IS_IN_UBI=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_DEFAULT_DEVICE_TREE="am335x-base0033"
CONFIG_OF_CONTROL=y
CONFIG_DM_MMC=y
CONFIG_MMC_OMAP_HS=y
CONFIG_NAND=y
CONFIG_MTD_UBI_FASTMAP=y

View File

@ -40,6 +40,9 @@ CONFIG_CMD_EXT4_WRITE=y
CONFIG_ENV_IS_IN_MMC=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_BOOTCOUNT_LIMIT=y
CONFIG_DEFAULT_DEVICE_TREE="am335x-sl50"
CONFIG_OF_CONTROL=y
CONFIG_DM_MMC=y
CONFIG_MMC_OMAP_HS=y
CONFIG_MII=y
CONFIG_DRIVER_TI_CPSW=y

View File

@ -25,6 +25,7 @@ CONFIG_SPL_DMA_SUPPORT=y
# CONFIG_SPL_NAND_SUPPORT is not set
CONFIG_SPL_OS_BOOT=y
CONFIG_SPL_SPI_LOAD=y
CONFIG_SPL_YMODEM_SUPPORT=y
CONFIG_CMD_SPL=y
# CONFIG_CMD_FLASH is not set
# CONFIG_CMD_SETEXPR is not set

View File

@ -18,6 +18,7 @@ CONFIG_DEFAULT_DEVICE_TREE="hi6220-hikey"
CONFIG_ENV_IS_IN_FAT=y
CONFIG_ENV_FAT_INTERFACE="mmc"
CONFIG_ENV_FAT_DEVICE_AND_PART="1:1"
CONFIG_DM_MMC=y
CONFIG_MMC_DW=y
CONFIG_MMC_DW_K3=y
CONFIG_CONS_INDEX=4

View File

@ -1,53 +0,0 @@
CONFIG_ARM=y
CONFIG_ARCH_OMAP2PLUS=y
CONFIG_TARGET_OMAP3_IGEP00X0=y
CONFIG_SPL=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_NR_DRAM_BANKS=2
CONFIG_OF_BOARD_SETUP=y
CONFIG_BOOTDELAY=3
CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_VERSION_VARIABLE=y
# CONFIG_DISPLAY_BOARDINFO is not set
# CONFIG_SPL_EXT_SUPPORT is not set
CONFIG_SPL_MTD_SUPPORT=y
CONFIG_SPL_ONENAND_SUPPORT=y
CONFIG_SPL_OS_BOOT=y
CONFIG_CMD_SPL=y
CONFIG_CMD_ASKENV=y
# CONFIG_CMD_FLASH is not set
CONFIG_CMD_GPIO=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
CONFIG_CMD_NAND=y
CONFIG_CMD_ONENAND=y
CONFIG_CMD_SPI=y
# CONFIG_CMD_SETEXPR is not set
CONFIG_CMD_CACHE=y
CONFIG_CMD_EXT4_WRITE=y
CONFIG_CMD_MTDPARTS=y
CONFIG_CMD_UBI=y
# CONFIG_CMD_UBIFS is not set
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_MMC_OMAP_HS=y
CONFIG_NAND=y
CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
CONFIG_SPL_NAND_SIMPLE=y
CONFIG_SMC911X=y
CONFIG_SMC911X_BASE=0x2C000000
CONFIG_SMC911X_32_BIT=y
CONFIG_CONS_INDEX=3
CONFIG_SPI=y
CONFIG_OMAP3_SPI=y
CONFIG_USB=y
CONFIG_USB_MUSB_UDC=y
CONFIG_USB_OMAP3=y
CONFIG_TWL4030_USB=y
CONFIG_USB_GADGET=y
CONFIG_FAT_WRITE=y
CONFIG_UBIFS_SILENCE_MSG=y
CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
CONFIG_FDT_FIXUP_PARTITIONS=y

View File

@ -1,7 +1,9 @@
CONFIG_ARM=y
CONFIG_ARCH_OMAP2PLUS=y
CONFIG_TI_COMMON_CMD_OPTIONS=y
CONFIG_TARGET_OMAP3_IGEP00X0=y
CONFIG_SPL=y
CONFIG_SPL_SYS_MALLOC_SIMPLE=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_NR_DRAM_BANKS=2
CONFIG_OF_BOARD_SETUP=y
@ -16,21 +18,18 @@ CONFIG_SPL_MTD_SUPPORT=y
CONFIG_SPL_ONENAND_SUPPORT=y
CONFIG_SPL_OS_BOOT=y
CONFIG_CMD_SPL=y
CONFIG_CMD_ASKENV=y
# CONFIG_CMD_FLASH is not set
CONFIG_CMD_GPIO=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
CONFIG_CMD_NAND=y
CONFIG_CMD_ONENAND=y
CONFIG_CMD_SPI=y
# CONFIG_CMD_SETEXPR is not set
CONFIG_CMD_CACHE=y
CONFIG_CMD_EXT4_WRITE=y
CONFIG_CMD_MTDPARTS=y
CONFIG_CMD_UBI=y
# CONFIG_CMD_UBIFS is not set
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_DEFAULT_DEVICE_TREE="omap3-igep0020"
CONFIG_OF_CONTROL=y
CONFIG_DM_MMC=y
CONFIG_MMC_OMAP_HS=y
CONFIG_NAND=y
CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
@ -42,11 +41,6 @@ CONFIG_SMC911X_32_BIT=y
CONFIG_CONS_INDEX=3
CONFIG_SPI=y
CONFIG_OMAP3_SPI=y
CONFIG_USB=y
CONFIG_USB_MUSB_UDC=y
CONFIG_USB_OMAP3=y
CONFIG_TWL4030_USB=y
CONFIG_USB_GADGET=y
CONFIG_FAT_WRITE=y
CONFIG_UBIFS_SILENCE_MSG=y
CONFIG_BCH=y

View File

@ -26,8 +26,9 @@ CONFIG_CMD_READ=y
CONFIG_CMD_PING=y
CONFIG_CMD_FAT=y
CONFIG_CMD_FS_GENERIC=y
CONFIG_OF_EMBED=y
CONFIG_OF_SEPARATE=y
CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_REGMAP=y
CONFIG_SYSCON=y
# CONFIG_BLOCK_CACHE is not set
@ -37,6 +38,11 @@ CONFIG_DM_MMC=y
# CONFIG_MMC_QUIRKS is not set
CONFIG_MMC_HS400_SUPPORT=y
CONFIG_MMC_MTK=y
CONFIG_DM_RESET=y
CONFIG_RESET_MEDIATEK=y
CONFIG_PHY_FIXED=y
CONFIG_DM_ETH=y
CONFIG_MEDIATEK_ETH=y
CONFIG_PINCTRL=y
CONFIG_PINCONF=y
CONFIG_PINCTRL_MT7623=y

View File

@ -29,9 +29,10 @@ CONFIG_CMD_SF_TEST=y
# CONFIG_CMD_NFS is not set
CONFIG_CMD_PING=y
# CONFIG_PARTITIONS is not set
CONFIG_OF_EMBED=y
CONFIG_OF_SEPARATE=y
CONFIG_DEFAULT_DEVICE_TREE="mt7629-rfb"
CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-parents"
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_SPL_DM_SEQ_ALIAS=y
CONFIG_REGMAP=y
CONFIG_SPL_REGMAP=y
@ -51,6 +52,10 @@ CONFIG_SPI_FLASH_MACRONIX=y
CONFIG_SPI_FLASH_SPANSION=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_DM_RESET=y
CONFIG_RESET_MEDIATEK=y
CONFIG_DM_ETH=y
CONFIG_MEDIATEK_ETH=y
CONFIG_PINCTRL=y
CONFIG_PINCONF=y
CONFIG_PINCTRL_MT7629=y

View File

@ -11,11 +11,23 @@ CONFIG_CMD_USB=y
# CONFIG_ISO_PARTITION is not set
CONFIG_DEFAULT_DEVICE_TREE="hi3798cv200-poplar"
CONFIG_ENV_IS_IN_MMC=y
CONFIG_USB_FUNCTION_FASTBOOT=y
CONFIG_FASTBOOT_BUF_ADDR=0x20000000
CONFIG_FASTBOOT_BUF_SIZE=0x10000000
CONFIG_FASTBOOT_FLASH=y
CONFIG_FASTBOOT_FLASH_MMC_DEV=0
CONFIG_DM_MMC=y
CONFIG_MMC_DW=y
CONFIG_MMC_DW_K3=y
CONFIG_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_GENERIC=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_MANUFACTURER="HiSilicon"
CONFIG_USB_GADGET_VENDOR_NUM=0x18d1
CONFIG_USB_GADGET_PRODUCT_NUM=0xd00d
CONFIG_USB_GADGET_DWC2_OTG=y
CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
CONFIG_USB_HOST_ETHER=y
CONFIG_USB_ETHER_ASIX=y
CONFIG_FAT_WRITE=y

View File

@ -57,6 +57,7 @@ CONFIG_CMD_DNS=y
CONFIG_CMD_LINK_LOCAL=y
CONFIG_CMD_ETHSW=y
CONFIG_CMD_BMP=y
CONFIG_CMD_BOOTCOUNT=y
CONFIG_CMD_TIME=y
CONFIG_CMD_TIMER=y
CONFIG_CMD_SOUND=y
@ -86,6 +87,9 @@ CONFIG_ADC=y
CONFIG_ADC_SANDBOX=y
CONFIG_AXI=y
CONFIG_AXI_SANDBOX=y
CONFIG_BOOTCOUNT_LIMIT=y
CONFIG_DM_BOOTCOUNT=y
CONFIG_DM_BOOTCOUNT_RTC=y
CONFIG_CLK=y
CONFIG_CPU=y
CONFIG_DM_DEMO=y
@ -217,3 +221,4 @@ CONFIG_UNIT_TEST=y
CONFIG_UT_TIME=y
CONFIG_UT_DM=y
CONFIG_UT_ENV=y
CONFIG_UT_OVERLAY=y

View File

@ -20,7 +20,6 @@ CONFIG_CMD_IMLS=y
# CONFIG_CMD_SETEXPR is not set
CONFIG_CMD_TIMER=y
CONFIG_OF_CONTROL=y
CONFIG_OF_EMBED=y
CONFIG_DEFAULT_DEVICE_TREE="stm32f429-disco"
CONFIG_ENV_IS_IN_FLASH=y
# CONFIG_MMC is not set

View File

@ -23,7 +23,6 @@ CONFIG_CMD_CACHE=y
CONFIG_CMD_TIMER=y
# CONFIG_ISO_PARTITION is not set
CONFIG_OF_CONTROL=y
CONFIG_OF_EMBED=y
CONFIG_DEFAULT_DEVICE_TREE="stm32429i-eval"
CONFIG_DM_MMC=y
CONFIG_ARM_PL180_MMCI=y

View File

@ -23,7 +23,6 @@ CONFIG_CMD_CACHE=y
CONFIG_CMD_TIMER=y
# CONFIG_ISO_PARTITION is not set
CONFIG_OF_CONTROL=y
CONFIG_OF_EMBED=y
CONFIG_DEFAULT_DEVICE_TREE="stm32f469-disco"
CONFIG_DM_MMC=y
CONFIG_ARM_PL180_MMCI=y

View File

@ -23,7 +23,6 @@ CONFIG_CMD_TIMER=y
CONFIG_CMD_EXT4_WRITE=y
# CONFIG_ISO_PARTITION is not set
CONFIG_OF_CONTROL=y
CONFIG_OF_EMBED=y
CONFIG_DEFAULT_DEVICE_TREE="stm32h743i-disco"
CONFIG_DM_MMC=y
CONFIG_STM32_SDMMC2=y

View File

@ -23,7 +23,6 @@ CONFIG_CMD_TIMER=y
CONFIG_CMD_EXT4_WRITE=y
# CONFIG_ISO_PARTITION is not set
CONFIG_OF_CONTROL=y
CONFIG_OF_EMBED=y
CONFIG_DEFAULT_DEVICE_TREE="stm32h743i-eval"
CONFIG_DM_MMC=y
CONFIG_STM32_SDMMC2=y

View File

@ -74,17 +74,16 @@ Firmware storage device described in device tree source
File system firmware Loader API
-------------------------------
int request_firmware_into_buf(struct device_platdata *plat,
int request_firmware_into_buf(struct udevice *dev,
const char *name,
void *buf, size_t size, u32 offset,
struct firmware **firmwarep)
void *buf, size_t size, u32 offset)
--------------------------------------------------------------------
Load firmware into a previously allocated buffer
Parameters:
1. struct device_platdata *plat
Platform data such as storage and partition firmware loading from
1. struct udevice *dev
An instance of a driver
2. const char *name
name of firmware file
@ -98,36 +97,16 @@ Parameters:
5. u32 offset
offset of a file for start reading into buffer
6. struct firmware **firmwarep
pointer to firmware image
return:
size of total read
-ve when error
Description:
The firmware is loaded directly into the buffer pointed to by buf and
the @firmwarep data member is pointed at buf
Note: Memory would be allocated for firmware image, hence user should
free() *firmwarep and *firmwarep->priv structs after usage of
request_firmware_into_buf(), otherwise it will always leak memory
while subsequent calls of request_firmware_into_buf() with the same
*firmwarep argument. Those arguments can be free through calling API
below release_firmware();
The firmware is loaded directly into the buffer pointed to by buf
Example of creating firmware loader instance and calling
request_firmware_into_buf API:
if (uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0, &dev)) {
request_firmware_into_buf(dev->plat, filename, buffer_location,
buffer_size, offset_ofreading, &fw);
request_firmware_into_buf(dev, filename, buffer_location,
buffer_size, offset_ofreading);
}
void release_firmware(struct firmware *firmware)
------------------------------------------------
Release the resource associated with a firmware image
Parameters:
1. struct firmware *firmware
Firmware resource to release

View File

@ -24,7 +24,7 @@ struct block_cache_node {
static LIST_HEAD(block_cache);
static struct block_cache_stats _stats = {
.max_blocks_per_entry = 2,
.max_blocks_per_entry = 8,
.max_entries = 32
};

View File

@ -8,6 +8,7 @@
#include <common.h>
#include <dm.h>
#include <asm/arch-mediatek/reset.h>
#include <asm/io.h>
#include <dt-bindings/clock/mt7623-clk.h>
@ -782,6 +783,19 @@ static int mt7623_ethsys_probe(struct udevice *dev)
return mtk_common_clk_gate_init(dev, &mt7623_clk_tree, eth_cgs);
}
static int mt7623_ethsys_bind(struct udevice *dev)
{
int ret = 0;
#if CONFIG_IS_ENABLED(RESET_MEDIATEK)
ret = mediatek_reset_bind(dev, ETHSYS_RST_CTRL_OFS, 1);
if (ret)
debug("Warning: failed to bind ethsys reset controller\n");
#endif
return ret;
}
static const struct udevice_id mt7623_apmixed_compat[] = {
{ .compatible = "mediatek,mt7623-apmixedsys" },
{ }
@ -865,6 +879,7 @@ U_BOOT_DRIVER(mtk_clk_ethsys) = {
.id = UCLASS_CLK,
.of_match = mt7623_ethsys_compat,
.probe = mt7623_ethsys_probe,
.bind = mt7623_ethsys_bind,
.priv_auto_alloc_size = sizeof(struct mtk_cg_priv),
.ops = &mtk_clk_gate_ops,
};

View File

@ -8,6 +8,7 @@
#include <common.h>
#include <dm.h>
#include <asm/arch-mediatek/reset.h>
#include <asm/io.h>
#include <dt-bindings/clock/mt7629-clk.h>
@ -602,6 +603,19 @@ static int mt7629_ethsys_probe(struct udevice *dev)
return mtk_common_clk_gate_init(dev, &mt7629_clk_tree, eth_cgs);
}
static int mt7629_ethsys_bind(struct udevice *dev)
{
int ret = 0;
#if CONFIG_IS_ENABLED(RESET_MEDIATEK)
ret = mediatek_reset_bind(dev, ETHSYS_RST_CTRL_OFS, 1);
if (ret)
debug("Warning: failed to bind ethsys reset controller\n");
#endif
return ret;
}
static int mt7629_sgmiisys_probe(struct udevice *dev)
{
return mtk_common_clk_gate_init(dev, &mt7629_clk_tree, sgmii_cgs);
@ -695,6 +709,7 @@ U_BOOT_DRIVER(mtk_clk_ethsys) = {
.id = UCLASS_CLK,
.of_match = mt7629_ethsys_compat,
.probe = mt7629_ethsys_probe,
.bind = mt7629_ethsys_bind,
.priv_auto_alloc_size = sizeof(struct mtk_cg_priv),
.ops = &mtk_clk_gate_ops,
};

View File

@ -23,6 +23,8 @@
#define CLK_PARENT_TOPCKGEN BIT(5)
#define CLK_PARENT_MASK GENMASK(5, 4)
#define ETHSYS_RST_CTRL_OFS 0x34
/* struct mtk_pll_data - hardware-specific PLLs data */
struct mtk_pll_data {
const int id;

View File

@ -16,9 +16,22 @@
DECLARE_GLOBAL_DATA_PTR;
struct firmware_priv {
const char *name; /* Filename */
u32 offset; /* Offset of reading a file */
/**
* struct firmware - A place for storing firmware and its attribute data.
*
* This holds information about a firmware and its content.
*
* @size: Size of a file
* @data: Buffer for file
* @priv: Firmware loader private fields
* @name: Filename
* @offset: Offset of reading a file
*/
struct firmware {
size_t size;
const u8 *data;
const char *name;
u32 offset;
};
#ifdef CONFIG_CMD_UBIFS
@ -88,74 +101,42 @@ static int select_fs_dev(struct device_platdata *plat)
/**
* _request_firmware_prepare - Prepare firmware struct.
*
* @dev: An instance of a driver.
* @name: Name of firmware file.
* @dbuf: Address of buffer to load firmware into.
* @size: Size of buffer.
* @offset: Offset of a file for start reading into buffer.
* @firmwarep: Pointer to pointer to firmware image.
*
* Return: Negative value if fail, 0 for successful.
*/
static int _request_firmware_prepare(const char *name, void *dbuf,
size_t size, u32 offset,
struct firmware **firmwarep)
static int _request_firmware_prepare(struct udevice *dev,
const char *name, void *dbuf,
size_t size, u32 offset)
{
if (!name || name[0] == '\0')
return -EINVAL;
/* No memory allocation is required if *firmwarep is allocated */
if (!(*firmwarep)) {
(*firmwarep) = calloc(1, sizeof(struct firmware));
if (!(*firmwarep))
return -ENOMEM;
struct firmware *firmwarep = dev_get_priv(dev);
(*firmwarep)->priv = calloc(1, sizeof(struct firmware_priv));
if (!(*firmwarep)->priv) {
free(*firmwarep);
return -ENOMEM;
}
} else if (!(*firmwarep)->priv) {
(*firmwarep)->priv = calloc(1, sizeof(struct firmware_priv));
if (!(*firmwarep)->priv) {
free(*firmwarep);
return -ENOMEM;
}
}
if (!firmwarep)
return -ENOMEM;
((struct firmware_priv *)((*firmwarep)->priv))->name = name;
((struct firmware_priv *)((*firmwarep)->priv))->offset = offset;
(*firmwarep)->data = dbuf;
(*firmwarep)->size = size;
firmwarep->name = name;
firmwarep->offset = offset;
firmwarep->data = dbuf;
firmwarep->size = size;
return 0;
}
/**
* release_firmware - Release the resource associated with a firmware image
* @firmware: Firmware resource to release
*/
void release_firmware(struct firmware *firmware)
{
if (firmware) {
if (firmware->priv) {
free(firmware->priv);
firmware->priv = NULL;
}
free(firmware);
}
}
/**
* fw_get_filesystem_firmware - load firmware into an allocated buffer.
* @plat: Platform data such as storage and partition firmware loading from.
* @firmware: pointer to firmware image.
* @dev: An instance of a driver.
*
* Return: Size of total read, negative value when error.
*/
static int fw_get_filesystem_firmware(struct device_platdata *plat,
struct firmware *firmware)
static int fw_get_filesystem_firmware(struct udevice *dev)
{
struct firmware_priv *fw_priv = NULL;
loff_t actread;
char *storage_interface, *dev_part, *ubi_mtdpart, *ubi_volume;
int ret;
@ -178,20 +159,23 @@ static int fw_get_filesystem_firmware(struct device_platdata *plat,
else
ret = -ENODEV;
} else {
ret = select_fs_dev(plat);
ret = select_fs_dev(dev->platdata);
}
if (ret)
goto out;
fw_priv = firmware->priv;
struct firmware *firmwarep = dev_get_priv(dev);
ret = fs_read(fw_priv->name, (ulong)map_to_sysmem(firmware->data),
fw_priv->offset, firmware->size, &actread);
if (!firmwarep)
return -ENOMEM;
ret = fs_read(firmwarep->name, (ulong)map_to_sysmem(firmwarep->data),
firmwarep->offset, firmwarep->size, &actread);
if (ret) {
debug("Error: %d Failed to read %s from flash %lld != %zu.\n",
ret, fw_priv->name, actread, firmware->size);
ret, firmwarep->name, actread, firmwarep->size);
} else {
ret = actread;
}
@ -205,33 +189,30 @@ out:
/**
* request_firmware_into_buf - Load firmware into a previously allocated buffer.
* @plat: Platform data such as storage and partition firmware loading from.
* @dev: An instance of a driver.
* @name: Name of firmware file.
* @buf: Address of buffer to load firmware into.
* @size: Size of buffer.
* @offset: Offset of a file for start reading into buffer.
* @firmwarep: Pointer to firmware image.
*
* The firmware is loaded directly into the buffer pointed to by @buf and
* the @firmwarep data member is pointed at @buf.
* The firmware is loaded directly into the buffer pointed to by @buf.
*
* Return: Size of total read, negative value when error.
*/
int request_firmware_into_buf(struct device_platdata *plat,
int request_firmware_into_buf(struct udevice *dev,
const char *name,
void *buf, size_t size, u32 offset,
struct firmware **firmwarep)
void *buf, size_t size, u32 offset)
{
int ret;
if (!plat)
if (!dev)
return -EINVAL;
ret = _request_firmware_prepare(name, buf, size, offset, firmwarep);
ret = _request_firmware_prepare(dev, name, buf, size, offset);
if (ret < 0) /* error */
return ret;
ret = fw_get_filesystem_firmware(plat, *firmwarep);
ret = fw_get_filesystem_firmware(dev);
return ret;
}
@ -286,6 +267,7 @@ U_BOOT_DRIVER(fs_loader) = {
.probe = fs_loader_probe,
.ofdata_to_platdata = fs_loader_ofdata_to_platdata,
.platdata_auto_alloc_size = sizeof(struct device_platdata),
.priv_auto_alloc_size = sizeof(struct firmware),
};
UCLASS_DRIVER(fs_loader) = {

View File

@ -5,51 +5,89 @@
*/
#include <common.h>
#include <dm.h>
#include <dwmmc.h>
#include <errno.h>
#include <fdtdec.h>
#include <malloc.h>
#include <linux/errno.h>
#define DWMMC_MAX_CH_NUM 4
DECLARE_GLOBAL_DATA_PTR;
#define DWMMC_MAX_FREQ 50000000
#define DWMMC_MIN_FREQ 400000
struct hi6220_dwmmc_plat {
struct mmc_config cfg;
struct mmc mmc;
};
/* Source clock is configured to 100MHz by ATF bl1*/
#define MMC0_DEFAULT_FREQ 100000000
struct hi6220_dwmmc_priv_data {
struct dwmci_host host;
};
static int hi6220_dwmci_core_init(struct dwmci_host *host, int index)
static int hi6220_dwmmc_ofdata_to_platdata(struct udevice *dev)
{
host->name = "Hisilicon DWMMC";
struct hi6220_dwmmc_priv_data *priv = dev_get_priv(dev);
struct dwmci_host *host = &priv->host;
host->dev_index = index;
host->name = dev->name;
host->ioaddr = (void *)devfdt_get_addr(dev);
host->buswidth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
"bus-width", 4);
/* use non-removable property for differentiating SD card and eMMC */
if (dev_read_bool(dev, "non-removable"))
host->dev_index = 0;
else
host->dev_index = 1;
host->priv = priv;
/* Add the mmc channel to be registered with mmc core */
if (add_dwmci(host, DWMMC_MAX_FREQ, DWMMC_MIN_FREQ)) {
printf("DWMMC%d registration failed\n", index);
return -1;
}
return 0;
}
/*
* This function adds the mmc channel to be registered with mmc core.
* index - mmc channel number.
* regbase - register base address of mmc channel specified in 'index'.
* bus_width - operating bus width of mmc channel specified in 'index'.
*/
int hi6220_dwmci_add_port(int index, u32 regbase, int bus_width)
static int hi6220_dwmmc_probe(struct udevice *dev)
{
struct dwmci_host *host = NULL;
struct hi6220_dwmmc_plat *plat = dev_get_platdata(dev);
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
struct hi6220_dwmmc_priv_data *priv = dev_get_priv(dev);
struct dwmci_host *host = &priv->host;
host = calloc(1, sizeof(struct dwmci_host));
if (!host) {
pr_err("dwmci_host calloc failed!\n");
return -ENOMEM;
}
/* Use default bus speed due to absence of clk driver */
host->bus_hz = 50000000;
host->ioaddr = (void *)(ulong)regbase;
host->buswidth = bus_width;
host->bus_hz = MMC0_DEFAULT_FREQ;
dwmci_setup_cfg(&plat->cfg, host, host->bus_hz, 400000);
host->mmc = &plat->mmc;
return hi6220_dwmci_core_init(host, index);
host->mmc->priv = &priv->host;
upriv->mmc = host->mmc;
host->mmc->dev = dev;
return dwmci_probe(dev);
}
static int hi6220_dwmmc_bind(struct udevice *dev)
{
struct hi6220_dwmmc_plat *plat = dev_get_platdata(dev);
int ret;
ret = dwmci_bind(dev, &plat->mmc, &plat->cfg);
if (ret)
return ret;
return 0;
}
static const struct udevice_id hi6220_dwmmc_ids[] = {
{ .compatible = "hisilicon,hi6220-dw-mshc" },
{ }
};
U_BOOT_DRIVER(hi6220_dwmmc_drv) = {
.name = "hi6220_dwmmc",
.id = UCLASS_MMC,
.of_match = hi6220_dwmmc_ids,
.ofdata_to_platdata = hi6220_dwmmc_ofdata_to_platdata,
.ops = &dm_dwmci_ops,
.bind = hi6220_dwmmc_bind,
.probe = hi6220_dwmmc_probe,
.priv_auto_alloc_size = sizeof(struct hi6220_dwmmc_priv_data),
.platdata_auto_alloc_size = sizeof(struct hi6220_dwmmc_plat),
};

View File

@ -754,7 +754,8 @@ int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value)
}
#if !CONFIG_IS_ENABLED(MMC_TINY)
static int mmc_set_card_speed(struct mmc *mmc, enum bus_mode mode)
static int mmc_set_card_speed(struct mmc *mmc, enum bus_mode mode,
bool hsdowngrade)
{
int err;
int speed_bits;
@ -788,6 +789,20 @@ static int mmc_set_card_speed(struct mmc *mmc, enum bus_mode mode)
if (err)
return err;
#if CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) || \
CONFIG_IS_ENABLED(MMC_HS400_SUPPORT)
/*
* In case the eMMC is in HS200/HS400 mode and we are downgrading
* to HS mode, the card clock are still running much faster than
* the supported HS mode clock, so we can not reliably read out
* Extended CSD. Reconfigure the controller to run at HS mode.
*/
if (hsdowngrade) {
mmc_select_mode(mmc, MMC_HS);
mmc_set_clock(mmc, mmc_mode2freq(mmc, MMC_HS), false);
}
#endif
if ((mode == MMC_HS) || (mode == MMC_HS_52)) {
/* Now check to see that it worked */
err = mmc_send_ext_csd(mmc, test_csd);
@ -1849,7 +1864,7 @@ static int mmc_select_hs400(struct mmc *mmc)
int err;
/* Set timing to HS200 for tuning */
err = mmc_set_card_speed(mmc, MMC_HS_200);
err = mmc_set_card_speed(mmc, MMC_HS_200, false);
if (err)
return err;
@ -1865,7 +1880,7 @@ static int mmc_select_hs400(struct mmc *mmc)
}
/* Set back to HS */
mmc_set_card_speed(mmc, MMC_HS);
mmc_set_card_speed(mmc, MMC_HS, false);
mmc_set_clock(mmc, mmc_mode2freq(mmc, MMC_HS), false);
err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH,
@ -1873,7 +1888,7 @@ static int mmc_select_hs400(struct mmc *mmc)
if (err)
return err;
err = mmc_set_card_speed(mmc, MMC_HS_400);
err = mmc_set_card_speed(mmc, MMC_HS_400, false);
if (err)
return err;
@ -1920,7 +1935,19 @@ static int mmc_select_mode_and_width(struct mmc *mmc, uint card_caps)
return -ENOTSUPP;
}
mmc_set_clock(mmc, mmc->legacy_speed, MMC_CLK_ENABLE);
#if CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) || \
CONFIG_IS_ENABLED(MMC_HS400_SUPPORT)
/*
* In case the eMMC is in HS200/HS400 mode, downgrade to HS mode
* before doing anything else, since a transition from either of
* the HS200/HS400 mode directly to legacy mode is not supported.
*/
if (mmc->selected_mode == MMC_HS_200 ||
mmc->selected_mode == MMC_HS_400)
mmc_set_card_speed(mmc, MMC_HS, true);
else
#endif
mmc_set_clock(mmc, mmc->legacy_speed, MMC_CLK_ENABLE);
for_each_mmc_mode_by_pref(card_caps, mwt) {
for_each_supported_width(card_caps & mwt->widths,
@ -1952,7 +1979,7 @@ static int mmc_select_mode_and_width(struct mmc *mmc, uint card_caps)
}
} else {
/* configure the bus speed (card) */
err = mmc_set_card_speed(mmc, mwt->mode);
err = mmc_set_card_speed(mmc, mwt->mode, false);
if (err)
goto error;

View File

@ -513,4 +513,14 @@ config TSEC_ENET
This driver implements support for the (Enhanced) Three-Speed
Ethernet Controller found on Freescale SoCs.
config MEDIATEK_ETH
bool "MediaTek Ethernet GMAC Driver"
depends on DM_ETH
select PHYLIB
select DM_GPIO
select DM_RESET
help
This Driver support MediaTek Ethernet GMAC
Say Y to enable support for the MediaTek Ethernet GMAC.
endif # NETDEVICES

View File

@ -74,3 +74,4 @@ obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o
obj-$(CONFIG_FSL_PFE) += pfe_eth/
obj-$(CONFIG_SNI_AVE) += sni_ave.o
obj-y += ti/
obj-$(CONFIG_MEDIATEK_ETH) += mtk_eth.o

1175
drivers/net/mtk_eth.c Normal file

File diff suppressed because it is too large Load Diff

286
drivers/net/mtk_eth.h Normal file
View File

@ -0,0 +1,286 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2018 MediaTek Inc.
*
* Author: Weijie Gao <weijie.gao@mediatek.com>
* Author: Mark Lee <mark-mc.lee@mediatek.com>
*/
#ifndef _MTK_ETH_H_
#define _MTK_ETH_H_
/* Frame Engine Register Bases */
#define PDMA_BASE 0x0800
#define GDMA1_BASE 0x0500
#define GDMA2_BASE 0x1500
#define GMAC_BASE 0x10000
/* Ethernet subsystem registers */
#define ETHSYS_SYSCFG0_REG 0x14
#define SYSCFG0_GE_MODE_S(n) (12 + ((n) * 2))
#define SYSCFG0_GE_MODE_M 0x3
#define ETHSYS_CLKCFG0_REG 0x2c
#define ETHSYS_TRGMII_CLK_SEL362_5 BIT(11)
/* SYSCFG0_GE_MODE: GE Modes */
#define GE_MODE_RGMII 0
#define GE_MODE_MII 1
#define GE_MODE_MII_PHY 2
#define GE_MODE_RMII 3
/* Frame Engine Registers */
/* PDMA */
#define TX_BASE_PTR_REG(n) (0x000 + (n) * 0x10)
#define TX_MAX_CNT_REG(n) (0x004 + (n) * 0x10)
#define TX_CTX_IDX_REG(n) (0x008 + (n) * 0x10)
#define TX_DTX_IDX_REG(n) (0x00c + (n) * 0x10)
#define RX_BASE_PTR_REG(n) (0x100 + (n) * 0x10)
#define RX_MAX_CNT_REG(n) (0x104 + (n) * 0x10)
#define RX_CRX_IDX_REG(n) (0x108 + (n) * 0x10)
#define RX_DRX_IDX_REG(n) (0x10c + (n) * 0x10)
#define PDMA_GLO_CFG_REG 0x204
#define TX_WB_DDONE BIT(6)
#define RX_DMA_BUSY BIT(3)
#define RX_DMA_EN BIT(2)
#define TX_DMA_BUSY BIT(1)
#define TX_DMA_EN BIT(0)
#define PDMA_RST_IDX_REG 0x208
#define RST_DRX_IDX0 BIT(16)
#define RST_DTX_IDX0 BIT(0)
/* GDMA */
#define GDMA_IG_CTRL_REG 0x000
#define GDM_ICS_EN BIT(22)
#define GDM_TCS_EN BIT(21)
#define GDM_UCS_EN BIT(20)
#define STRP_CRC BIT(16)
#define MYMAC_DP_S 12
#define MYMAC_DP_M 0xf000
#define BC_DP_S 8
#define BC_DP_M 0xf00
#define MC_DP_S 4
#define MC_DP_M 0xf0
#define UN_DP_S 0
#define UN_DP_M 0x0f
#define GDMA_MAC_LSB_REG 0x008
#define GDMA_MAC_MSB_REG 0x00c
/* MYMAC_DP/BC_DP/MC_DP/UN_DP: Destination ports */
#define DP_PDMA 0
#define DP_GDMA1 1
#define DP_GDMA2 2
#define DP_PPE 4
#define DP_QDMA 5
#define DP_DISCARD 7
/* GMAC Registers */
#define GMAC_PIAC_REG 0x0004
#define PHY_ACS_ST BIT(31)
#define MDIO_REG_ADDR_S 25
#define MDIO_REG_ADDR_M 0x3e000000
#define MDIO_PHY_ADDR_S 20
#define MDIO_PHY_ADDR_M 0x1f00000
#define MDIO_CMD_S 18
#define MDIO_CMD_M 0xc0000
#define MDIO_ST_S 16
#define MDIO_ST_M 0x30000
#define MDIO_RW_DATA_S 0
#define MDIO_RW_DATA_M 0xffff
/* MDIO_CMD: MDIO commands */
#define MDIO_CMD_ADDR 0
#define MDIO_CMD_WRITE 1
#define MDIO_CMD_READ 2
#define MDIO_CMD_READ_C45 3
/* MDIO_ST: MDIO start field */
#define MDIO_ST_C45 0
#define MDIO_ST_C22 1
#define GMAC_PORT_MCR(p) (0x0100 + (p) * 0x100)
#define MAC_RX_PKT_LEN_S 24
#define MAC_RX_PKT_LEN_M 0x3000000
#define IPG_CFG_S 18
#define IPG_CFG_M 0xc0000
#define MAC_MODE BIT(16)
#define FORCE_MODE BIT(15)
#define MAC_TX_EN BIT(14)
#define MAC_RX_EN BIT(13)
#define BKOFF_EN BIT(9)
#define BACKPR_EN BIT(8)
#define FORCE_RX_FC BIT(5)
#define FORCE_TX_FC BIT(4)
#define FORCE_SPD_S 2
#define FORCE_SPD_M 0x0c
#define FORCE_DPX BIT(1)
#define FORCE_LINK BIT(0)
/* MAC_RX_PKT_LEN: Max RX packet length */
#define MAC_RX_PKT_LEN_1518 0
#define MAC_RX_PKT_LEN_1536 1
#define MAC_RX_PKT_LEN_1552 2
#define MAC_RX_PKT_LEN_JUMBO 3
/* FORCE_SPD: Forced link speed */
#define SPEED_10M 0
#define SPEED_100M 1
#define SPEED_1000M 2
#define GMAC_TRGMII_RCK_CTRL 0x300
#define RX_RST BIT(31)
#define RXC_DQSISEL BIT(30)
#define GMAC_TRGMII_TD_ODT(n) (0x354 + (n) * 8)
#define TD_DM_DRVN_S 4
#define TD_DM_DRVN_M 0xf0
#define TD_DM_DRVP_S 0
#define TD_DM_DRVP_M 0x0f
/* MT7530 Registers */
#define PCR_REG(p) (0x2004 + (p) * 0x100)
#define PORT_MATRIX_S 16
#define PORT_MATRIX_M 0xff0000
#define PVC_REG(p) (0x2010 + (p) * 0x100)
#define STAG_VPID_S 16
#define STAG_VPID_M 0xffff0000
#define VLAN_ATTR_S 6
#define VLAN_ATTR_M 0xc0
/* VLAN_ATTR: VLAN attributes */
#define VLAN_ATTR_USER 0
#define VLAN_ATTR_STACK 1
#define VLAN_ATTR_TRANSLATION 2
#define VLAN_ATTR_TRANSPARENT 3
#define PCMR_REG(p) (0x3000 + (p) * 0x100)
/* XXX: all fields are defined under GMAC_PORT_MCR */
#define SYS_CTRL_REG 0x7000
#define SW_PHY_RST BIT(2)
#define SW_SYS_RST BIT(1)
#define SW_REG_RST BIT(0)
#define NUM_TRGMII_CTRL 5
#define HWTRAP_REG 0x7800
#define MHWTRAP_REG 0x7804
#define CHG_TRAP BIT(16)
#define LOOPDET_DIS BIT(14)
#define P5_INTF_SEL_S 13
#define P5_INTF_SEL_M 0x2000
#define SMI_ADDR_S 11
#define SMI_ADDR_M 0x1800
#define XTAL_FSEL_S 9
#define XTAL_FSEL_M 0x600
#define P6_INTF_DIS BIT(8)
#define P5_INTF_MODE_S 7
#define P5_INTF_MODE_M 0x80
#define P5_INTF_DIS BIT(6)
#define C_MDIO_BPS BIT(5)
#define CHIP_MODE_S 0
#define CHIP_MODE_M 0x0f
/* P5_INTF_SEL: Interface type of Port5 */
#define P5_INTF_SEL_GPHY 0
#define P5_INTF_SEL_GMAC5 1
/* P5_INTF_MODE: Interface mode of Port5 */
#define P5_INTF_MODE_GMII_MII 0
#define P5_INTF_MODE_RGMII 1
#define MT7530_P6ECR 0x7830
#define P6_INTF_MODE_M 0x3
#define P6_INTF_MODE_S 0
/* P6_INTF_MODE: Interface mode of Port6 */
#define P6_INTF_MODE_RGMII 0
#define P6_INTF_MODE_TRGMII 1
#define MT7530_TRGMII_RD(n) (0x7a10 + (n) * 8)
#define RD_TAP_S 0
#define RD_TAP_M 0x7f
#define MT7530_TRGMII_TD_ODT(n) (0x7a54 + (n) * 8)
/* XXX: all fields are defined under GMAC_TRGMII_TD_ODT */
/* MT7530 GPHY MDIO Indirect Access Registers */
#define MII_MMD_ACC_CTL_REG 0x0d
#define MMD_CMD_S 14
#define MMD_CMD_M 0xc000
#define MMD_DEVAD_S 0
#define MMD_DEVAD_M 0x1f
/* MMD_CMD: MMD commands */
#define MMD_ADDR 0
#define MMD_DATA 1
#define MMD_DATA_RW_POST_INC 2
#define MMD_DATA_W_POST_INC 3
#define MII_MMD_ADDR_DATA_REG 0x0e
/* MT7530 GPHY MDIO MMD Registers */
#define CORE_PLL_GROUP2 0x401
#define RG_SYSPLL_EN_NORMAL BIT(15)
#define RG_SYSPLL_VODEN BIT(14)
#define RG_SYSPLL_POSDIV_S 5
#define RG_SYSPLL_POSDIV_M 0x60
#define CORE_PLL_GROUP4 0x403
#define RG_SYSPLL_DDSFBK_EN BIT(12)
#define RG_SYSPLL_BIAS_EN BIT(11)
#define RG_SYSPLL_BIAS_LPF_EN BIT(10)
#define CORE_PLL_GROUP5 0x404
#define RG_LCDDS_PCW_NCPO1_S 0
#define RG_LCDDS_PCW_NCPO1_M 0xffff
#define CORE_PLL_GROUP6 0x405
#define RG_LCDDS_PCW_NCPO0_S 0
#define RG_LCDDS_PCW_NCPO0_M 0xffff
#define CORE_PLL_GROUP7 0x406
#define RG_LCDDS_PWDB BIT(15)
#define RG_LCDDS_ISO_EN BIT(13)
#define RG_LCCDS_C_S 4
#define RG_LCCDS_C_M 0x70
#define RG_LCDDS_PCW_NCPO_CHG BIT(3)
#define CORE_PLL_GROUP10 0x409
#define RG_LCDDS_SSC_DELTA_S 0
#define RG_LCDDS_SSC_DELTA_M 0xfff
#define CORE_PLL_GROUP11 0x40a
#define RG_LCDDS_SSC_DELTA1_S 0
#define RG_LCDDS_SSC_DELTA1_M 0xfff
#define CORE_GSWPLL_GRP1 0x40d
#define RG_GSWPLL_POSDIV_200M_S 12
#define RG_GSWPLL_POSDIV_200M_M 0x3000
#define RG_GSWPLL_EN_PRE BIT(11)
#define RG_GSWPLL_FBKDIV_200M_S 0
#define RG_GSWPLL_FBKDIV_200M_M 0xff
#define CORE_GSWPLL_GRP2 0x40e
#define RG_GSWPLL_POSDIV_500M_S 8
#define RG_GSWPLL_POSDIV_500M_M 0x300
#define RG_GSWPLL_FBKDIV_500M_S 0
#define RG_GSWPLL_FBKDIV_500M_M 0xff
#define CORE_TRGMII_GSW_CLK_CG 0x410
#define REG_GSWCK_EN BIT(0)
#define REG_TRGMIICK_EN BIT(1)
#endif /* _MTK_ETH_H_ */

View File

@ -106,4 +106,11 @@ config RESET_SOCFPGA
help
Support for reset controller on SoCFPGA platform.
config RESET_MEDIATEK
bool "Reset controller driver for MediaTek SoCs"
depends on DM_RESET && ARCH_MEDIATEK && CLK
default y
help
Support for reset controller on MediaTek SoCs.
endmenu

View File

@ -17,3 +17,4 @@ obj-$(CONFIG_AST2500_RESET) += ast2500-reset.o
obj-$(CONFIG_RESET_ROCKCHIP) += reset-rockchip.o
obj-$(CONFIG_RESET_MESON) += reset-meson.o
obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o
obj-$(CONFIG_RESET_MEDIATEK) += reset-mediatek.o

View File

@ -0,0 +1,102 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2018 MediaTek Inc.
*
* Author: Ryder Lee <ryder.lee@mediatek.com>
* Weijie Gao <weijie.gao@mediatek.com>
*/
#include <common.h>
#include <dm.h>
#include <dm/lists.h>
#include <regmap.h>
#include <reset-uclass.h>
#include <syscon.h>
struct mediatek_reset_priv {
struct regmap *regmap;
u32 regofs;
u32 nr_resets;
};
static int mediatek_reset_request(struct reset_ctl *reset_ctl)
{
return 0;
}
static int mediatek_reset_free(struct reset_ctl *reset_ctl)
{
return 0;
}
static int mediatek_reset_assert(struct reset_ctl *reset_ctl)
{
struct mediatek_reset_priv *priv = dev_get_priv(reset_ctl->dev);
int id = reset_ctl->id;
if (id >= priv->nr_resets)
return -EINVAL;
return regmap_update_bits(priv->regmap,
priv->regofs + ((id / 32) << 2), BIT(id % 32), BIT(id % 32));
}
static int mediatek_reset_deassert(struct reset_ctl *reset_ctl)
{
struct mediatek_reset_priv *priv = dev_get_priv(reset_ctl->dev);
int id = reset_ctl->id;
if (id >= priv->nr_resets)
return -EINVAL;
return regmap_update_bits(priv->regmap,
priv->regofs + ((id / 32) << 2), BIT(id % 32), 0);
}
struct reset_ops mediatek_reset_ops = {
.request = mediatek_reset_request,
.free = mediatek_reset_free,
.rst_assert = mediatek_reset_assert,
.rst_deassert = mediatek_reset_deassert,
};
static int mediatek_reset_probe(struct udevice *dev)
{
struct mediatek_reset_priv *priv = dev_get_priv(dev);
if (!priv->regofs && !priv->nr_resets)
return -EINVAL;
priv->regmap = syscon_node_to_regmap(dev_ofnode(dev));
if (IS_ERR(priv->regmap))
return PTR_ERR(priv->regmap);
return 0;
}
int mediatek_reset_bind(struct udevice *pdev, u32 regofs, u32 num_regs)
{
struct udevice *rst_dev;
struct mediatek_reset_priv *priv;
int ret;
ret = device_bind_driver_to_node(pdev, "mediatek_reset", "reset",
dev_ofnode(pdev), &rst_dev);
if (ret)
return ret;
priv = malloc(sizeof(struct mediatek_reset_priv));
priv->regofs = regofs;
priv->nr_resets = num_regs * 32;
rst_dev->priv = priv;
return 0;
}
U_BOOT_DRIVER(mediatek_reset) = {
.name = "mediatek_reset",
.id = UCLASS_RESET,
.probe = mediatek_reset_probe,
.ops = &mediatek_reset_ops,
.priv_auto_alloc_size = sizeof(struct mediatek_reset_priv),
};

View File

@ -442,10 +442,23 @@ config DEBUG_UART_ANNOUNCE
config DEBUG_UART_SKIP_INIT
bool "Skip UART initialization"
depends on DEBUG_UART
help
Select this if the UART you want to use for debug output is already
initialized by the time U-Boot starts its execution.
config DEBUG_UART_NS16550_CHECK_ENABLED
bool "Check if UART is enabled on output"
depends on DEBUG_UART
depends on DEBUG_UART_NS16550
help
Select this if puts()/putc() might be called before the debug UART
has been initialized. If this is disabled, putc() might sit in a
tight loop if it is called before debug_uart_init() has been called.
Note that this does not work for every ns16550-compatible UART and
so has to be enabled carefully or you might notice lost characters.
config ALTERA_JTAG_UART
bool "Altera JTAG UART support"
depends on DM_SERIAL

View File

@ -272,12 +272,28 @@ static inline void _debug_uart_init(void)
serial_dout(&com_port->lcr, UART_LCRVAL);
}
static inline int NS16550_read_baud_divisor(struct NS16550 *com_port)
{
int ret;
serial_dout(&com_port->lcr, UART_LCR_BKSE | UART_LCRVAL);
ret = serial_din(&com_port->dll) & 0xff;
ret |= (serial_din(&com_port->dlm) & 0xff) << 8;
serial_dout(&com_port->lcr, UART_LCRVAL);
return ret;
}
static inline void _debug_uart_putc(int ch)
{
struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE;
while (!(serial_din(&com_port->lsr) & UART_LSR_THRE))
;
while (!(serial_din(&com_port->lsr) & UART_LSR_THRE)) {
#ifdef CONFIG_DEBUG_UART_NS16550_CHECK_ENABLED
if (!NS16550_read_baud_divisor(com_port))
return;
#endif
}
serial_dout(&com_port->thr, ch);
}

View File

@ -43,9 +43,6 @@ endif
arch-dtbs:
$(Q)$(MAKE) $(build)=$(ARCH_PATH) dtbs
.SECONDARY: $(obj)/dt.dtb.S $(obj)/dt-spl.dtb.S
ifeq ($(CONFIG_SPL_BUILD),y)
obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
# support "out-of-tree" build for dtb-spl

52
env/common.c vendored
View File

@ -240,32 +240,76 @@ void env_relocate(void)
}
}
#if defined(CONFIG_AUTO_COMPLETE) && !defined(CONFIG_SPL_BUILD)
int env_complete(char *var, int maxv, char *cmdv[], int bufsz, char *buf)
#ifdef CONFIG_AUTO_COMPLETE
int env_complete(char *var, int maxv, char *cmdv[], int bufsz, char *buf,
bool dollar_comp)
{
ENTRY *match;
int found, idx;
if (dollar_comp) {
/*
* When doing $ completion, the first character should
* obviously be a '$'.
*/
if (var[0] != '$')
return 0;
var++;
/*
* The second one, if present, should be a '{', as some
* configuration of the u-boot shell expand ${var} but not
* $var.
*/
if (var[0] == '{')
var++;
else if (var[0] != '\0')
return 0;
}
idx = 0;
found = 0;
cmdv[0] = NULL;
while ((idx = hmatch_r(var, idx, &match, &env_htab))) {
int vallen = strlen(match->key) + 1;
if (found >= maxv - 2 || bufsz < vallen)
if (found >= maxv - 2 ||
bufsz < vallen + (dollar_comp ? 3 : 0))
break;
cmdv[found++] = buf;
/* Add the '${' prefix to each var when doing $ completion. */
if (dollar_comp) {
strcpy(buf, "${");
buf += 2;
bufsz -= 3;
}
memcpy(buf, match->key, vallen);
buf += vallen;
bufsz -= vallen;
if (dollar_comp) {
/*
* This one is a bit odd: vallen already contains the
* '\0' character but we need to add the '}' suffix,
* hence the buf - 1 here. strcpy() will add the '\0'
* character just after '}'. buf is then incremented
* to account for the extra '}' we just added.
*/
strcpy(buf - 1, "}");
buf++;
}
}
qsort(cmdv, found, sizeof(cmdv[0]), strcmp_compar);
if (idx)
cmdv[found++] = "...";
cmdv[found++] = dollar_comp ? "${...}" : "...";
cmdv[found] = NULL;
return found;

View File

@ -26,7 +26,6 @@ LIB = $(obj)/libstubs.o
LIBOBJS-$(CONFIG_PPC) += ppc_longjmp.o ppc_setjmp.o
LIBOBJS-y += stubs.o
.SECONDARY: $(call objectify,$(COBJS))
targets += $(patsubst $(obj)/%,%,$(LIB)) $(COBJS) $(LIBOBJS-y)
LIBOBJS := $(addprefix $(obj)/,$(LIBOBJS-y))

View File

@ -29,7 +29,16 @@
struct cmd_tbl_s {
char *name; /* Command Name */
int maxargs; /* maximum number of arguments */
int repeatable; /* autorepeat allowed? */
/*
* Same as ->cmd() except the command
* tells us if it can be repeated.
* Replaces the old ->repeatable field
* which was not able to make
* repeatable property different for
* the main command and sub-commands.
*/
int (*cmd_rep)(struct cmd_tbl_s *cmd, int flags, int argc,
char * const argv[], int *repeatable);
/* Implementation function */
int (*cmd)(struct cmd_tbl_s *, int, int, char * const []);
char *usage; /* Usage message (short) */
@ -54,9 +63,25 @@ int _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp, int
flag, int argc, char * const argv[]);
cmd_tbl_t *find_cmd(const char *cmd);
cmd_tbl_t *find_cmd_tbl (const char *cmd, cmd_tbl_t *table, int table_len);
int complete_subcmdv(cmd_tbl_t *cmdtp, int count, int argc,
char * const argv[], char last_char, int maxv,
char *cmdv[]);
extern int cmd_usage(const cmd_tbl_t *cmdtp);
/* Dummy ->cmd and ->cmd_rep wrappers. */
int cmd_always_repeatable(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[], int *repeatable);
int cmd_never_repeatable(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[], int *repeatable);
int cmd_discard_repeatable(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[]);
static inline bool cmd_is_repeatable(cmd_tbl_t *cmdtp)
{
return cmdtp->cmd_rep == cmd_always_repeatable;
}
#ifdef CONFIG_AUTO_COMPLETE
extern int var_complete(int argc, char * const argv[], char last_char, int maxv, char *cmdv[]);
extern int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp);
@ -184,17 +209,93 @@ int board_run_command(const char *cmdline);
# define _CMD_HELP(x)
#endif
#ifdef CONFIG_NEEDS_MANUAL_RELOC
#define U_BOOT_SUBCMDS_RELOC(_cmdname) \
static void _cmdname##_subcmds_reloc(void) \
{ \
static int relocated; \
\
if (relocated) \
return; \
\
fixup_cmdtable(_cmdname##_subcmds, \
ARRAY_SIZE(_cmdname##_subcmds)); \
relocated = 1; \
}
#else
#define U_BOOT_SUBCMDS_RELOC(_cmdname) \
static void _cmdname##_subcmds_reloc(void) { }
#endif
#define U_BOOT_SUBCMDS_DO_CMD(_cmdname) \
static int do_##_cmdname(cmd_tbl_t *cmdtp, int flag, int argc, \
char * const argv[], int *repeatable) \
{ \
cmd_tbl_t *subcmd; \
\
_cmdname##_subcmds_reloc(); \
\
/* We need at least the cmd and subcmd names. */ \
if (argc < 2 || argc > CONFIG_SYS_MAXARGS) \
return CMD_RET_USAGE; \
\
subcmd = find_cmd_tbl(argv[1], _cmdname##_subcmds, \
ARRAY_SIZE(_cmdname##_subcmds)); \
if (!subcmd || argc - 1 > subcmd->maxargs) \
return CMD_RET_USAGE; \
\
if (flag == CMD_FLAG_REPEAT && \
!cmd_is_repeatable(subcmd)) \
return CMD_RET_SUCCESS; \
\
return subcmd->cmd_rep(subcmd, flag, argc - 1, \
argv + 1, repeatable); \
}
#ifdef CONFIG_AUTO_COMPLETE
#define U_BOOT_SUBCMDS_COMPLETE(_cmdname) \
static int complete_##_cmdname(int argc, char * const argv[], \
char last_char, int maxv, \
char *cmdv[]) \
{ \
return complete_subcmdv(_cmdname##_subcmds, \
ARRAY_SIZE(_cmdname##_subcmds), \
argc - 1, argv + 1, last_char, \
maxv, cmdv); \
}
#else
#define U_BOOT_SUBCMDS_COMPLETE(_cmdname)
#endif
#define U_BOOT_SUBCMDS(_cmdname, ...) \
static cmd_tbl_t _cmdname##_subcmds[] = { __VA_ARGS__ }; \
U_BOOT_SUBCMDS_RELOC(_cmdname) \
U_BOOT_SUBCMDS_DO_CMD(_cmdname) \
U_BOOT_SUBCMDS_COMPLETE(_cmdname)
#ifdef CONFIG_CMDLINE
#define U_BOOT_CMDREP_MKENT_COMPLETE(_name, _maxargs, _cmd_rep, \
_usage, _help, _comp) \
{ #_name, _maxargs, _cmd_rep, cmd_discard_repeatable, \
_usage, _CMD_HELP(_help) _CMD_COMPLETE(_comp) }
#define U_BOOT_CMD_MKENT_COMPLETE(_name, _maxargs, _rep, _cmd, \
_usage, _help, _comp) \
{ #_name, _maxargs, _rep, _cmd, _usage, \
_CMD_HELP(_help) _CMD_COMPLETE(_comp) }
{ #_name, _maxargs, \
_rep ? cmd_always_repeatable : cmd_never_repeatable, \
_cmd, _usage, _CMD_HELP(_help) _CMD_COMPLETE(_comp) }
#define U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, _comp) \
ll_entry_declare(cmd_tbl_t, _name, cmd) = \
U_BOOT_CMD_MKENT_COMPLETE(_name, _maxargs, _rep, _cmd, \
_usage, _help, _comp);
#define U_BOOT_CMDREP_COMPLETE(_name, _maxargs, _cmd_rep, _usage, \
_help, _comp) \
ll_entry_declare(cmd_tbl_t, _name, cmd) = \
U_BOOT_CMDREP_MKENT_COMPLETE(_name, _maxargs, _cmd_rep, \
_usage, _help, _comp)
#else
#define U_BOOT_SUBCMD_START(name) static cmd_tbl_t name[] = {};
#define U_BOOT_SUBCMD_END
@ -206,15 +307,25 @@ int board_run_command(const char *cmdline);
_cmd(NULL, 0, 0, NULL); \
return 0; \
}
#define U_BOOT_CMDREP_MKENT_COMPLETE(_name, _maxargs, _cmd_rep, \
_usage, _help, _comp) \
{ #_name, _maxargs, 0 ? _cmd_rep : NULL, NULL, _usage, \
_CMD_HELP(_help) _CMD_COMPLETE(_comp) }
#define U_BOOT_CMD_MKENT_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, \
_help, _comp) \
{ #_name, _maxargs, _rep, 0 ? _cmd : NULL, _usage, \
{ #_name, _maxargs, NULL, 0 ? _cmd : NULL, _usage, \
_CMD_HELP(_help) _CMD_COMPLETE(_comp) }
#define U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, \
_comp) \
_CMD_REMOVE(sub_ ## _name, _cmd)
#define U_BOOT_CMDREP_COMPLETE(_name, _maxargs, _cmd_rep, _usage, \
_help, _comp) \
_CMD_REMOVE(sub_ ## _name, _cmd_rep)
#endif /* CONFIG_CMDLINE */
#define U_BOOT_CMD(_name, _maxargs, _rep, _cmd, _usage, _help) \
@ -224,4 +335,18 @@ int board_run_command(const char *cmdline);
U_BOOT_CMD_MKENT_COMPLETE(_name, _maxargs, _rep, _cmd, \
_usage, _help, NULL)
#define U_BOOT_SUBCMD_MKENT_COMPLETE(_name, _maxargs, _rep, _do_cmd, \
_comp) \
U_BOOT_CMD_MKENT_COMPLETE(_name, _maxargs, _rep, _do_cmd, \
"", "", _comp)
#define U_BOOT_SUBCMD_MKENT(_name, _maxargs, _rep, _do_cmd) \
U_BOOT_SUBCMD_MKENT_COMPLETE(_name, _maxargs, _rep, _do_cmd, \
NULL)
#define U_BOOT_CMD_WITH_SUBCMDS(_name, _usage, _help, ...) \
U_BOOT_SUBCMDS(_name, __VA_ARGS__) \
U_BOOT_CMDREP_COMPLETE(_name, CONFIG_SYS_MAXARGS, do_##_name, \
_usage, _help, complete_##_name)
#endif /* __COMMAND_H */

View File

@ -248,7 +248,8 @@ static inline int env_set_addr(const char *varname, const void *addr)
}
#ifdef CONFIG_AUTO_COMPLETE
int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf);
int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf,
bool dollar_comp);
#endif
int get_env_id (void);

View File

@ -18,6 +18,8 @@
#define CONFIG_REMAKE_ELF
#define CONFIG_SYS_BOOTM_LEN SZ_64M
/* Physical Memory Map */
/* CONFIG_SYS_TEXT_BASE needs to align with where ATF loads bl33.bin */

View File

@ -24,6 +24,7 @@
/* Size of malloc() pool */
#define CONFIG_SYS_MALLOC_LEN SZ_4M
#define CONFIG_SYS_NONCACHED_MEMORY SZ_1M
/* Environment */
#define CONFIG_ENV_SIZE SZ_4K
@ -53,4 +54,8 @@
#define CONFIG_EXTRA_ENV_SETTINGS \
FDT_HIGH
/* Ethernet */
#define CONFIG_IPADDR 192.168.1.1
#define CONFIG_SERVERIP 192.168.1.2
#endif

View File

@ -24,6 +24,7 @@
/* Size of malloc() pool */
#define CONFIG_SYS_MALLOC_LEN SZ_4M
#define CONFIG_SYS_NONCACHED_MEMORY SZ_1M
/* Environment */
#define CONFIG_ENV_SIZE SZ_4K
@ -54,4 +55,8 @@
/* DRAM */
#define CONFIG_SYS_SDRAM_BASE 0x40000000
/* Ethernet */
#define CONFIG_IPADDR 192.168.1.1
#define CONFIG_SERVERIP 192.168.1.2
#endif

View File

@ -32,16 +32,6 @@
#define GPIO_IGEP00X0_BOARD_DETECTION 28
#define GPIO_IGEP00X0_REVISION_DETECTION 129
/* USB device configuration */
#define CONFIG_USB_DEVICE 1
#define CONFIG_USB_TTY 1
/* Change these to suit your needs */
#define CONFIG_USBD_VENDORID 0x0451
#define CONFIG_USBD_PRODUCTID 0x5678
#define CONFIG_USBD_MANUFACTURER "Texas Instruments"
#define CONFIG_USBD_PRODUCT_NAME "IGEP"
#ifndef CONFIG_SPL_BUILD
/* Environment */

View File

@ -0,0 +1,18 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2018 MediaTek Inc.
*/
#ifndef _DT_BINDINGS_MTK_RESET_H_
#define _DT_BINDINGS_MTK_RESET_H_
/* ETHSYS */
#define ETHSYS_PPE_RST 31
#define ETHSYS_EPHY_RST 24
#define ETHSYS_GMAC_RST 23
#define ETHSYS_ESW_RST 16
#define ETHSYS_FE_RST 6
#define ETHSYS_MCM_RST 2
#define ETHSYS_SYS_RST 0
#endif /* _DT_BINDINGS_MTK_RESET_H_ */

View File

@ -8,21 +8,6 @@
#include <dm.h>
/**
* struct firmware - A place for storing firmware and its attribute data.
*
* This holds information about a firmware and its content.
*
* @size: Size of a file
* @data: Buffer for file
* @priv: Firmware loader private fields
*/
struct firmware {
size_t size;
const u8 *data;
void *priv;
};
/**
* struct phandle_part - A place for storing phandle of node and its partition
*
@ -52,28 +37,19 @@ struct device_platdata {
char *ubivol;
};
/**
* release_firmware - Release the resource associated with a firmware image
* @firmware: Firmware resource to release
*/
void release_firmware(struct firmware *firmware);
/**
* request_firmware_into_buf - Load firmware into a previously allocated buffer.
* @plat: Platform data such as storage and partition firmware loading from.
* @dev: An instance of a driver.
* @name: Name of firmware file.
* @buf: Address of buffer to load firmware into.
* @size: Size of buffer.
* @offset: Offset of a file for start reading into buffer.
* @firmwarep: Pointer to firmware image.
*
* The firmware is loaded directly into the buffer pointed to by @buf and
* the @firmwarep data member is pointed at @buf.
* The firmware is loaded directly into the buffer pointed to by @buf.
*
* Return: Size of total read, negative value when error.
*/
int request_firmware_into_buf(struct device_platdata *plat,
int request_firmware_into_buf(struct udevice *dev,
const char *name,
void *buf, size_t size, u32 offset,
struct firmware **firmwarep);
void *buf, size_t size, u32 offset);
#endif

View File

@ -41,7 +41,6 @@ obj-y += ldiv.o
obj-$(CONFIG_MD5) += md5.o
obj-y += net_utils.o
obj-$(CONFIG_PHYSMEM) += physmem.o
obj-y += qsort.o
obj-y += rc4.o
obj-$(CONFIG_SUPPORT_EMMC_RPMB) += sha256.o
obj-$(CONFIG_RBTREE) += rbtree.o
@ -67,7 +66,6 @@ obj-$(CONFIG_$(SPL_)LZ4) += lz4_wrapper.o
obj-$(CONFIG_LIBAVB) += libavb/
obj-$(CONFIG_$(SPL_TPL_)SAVEENV) += qsort.o
obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += libfdt/
ifneq ($(CONFIG_$(SPL_TPL_)BUILD)$(CONFIG_$(SPL_TPL_)OF_PLATDATA),yy)
obj-$(CONFIG_$(SPL_TPL_)OF_CONTROL) += fdtdec_common.o
@ -80,6 +78,7 @@ obj-$(CONFIG_$(SPL_TPL_)HASH_SUPPORT) += crc16.o
obj-$(CONFIG_SPL_NET_SUPPORT) += net_utils.o
endif
obj-$(CONFIG_ADDR_MAP) += addr_map.o
obj-y += qsort.o
obj-y += hashtable.o
obj-y += errno.o
obj-y += display_options.o

View File

@ -271,7 +271,7 @@ void gen_rand_uuid_str(char *uuid_str, int str_format)
uuid_bin_to_str(uuid_bin, uuid_str, str_format);
}
#ifdef CONFIG_CMD_UUID
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_CMD_UUID)
int do_uuid(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char uuid[UUID_STR_LEN + 1];

View File

@ -11,9 +11,6 @@ targets += $(objs-before-objcopy)
$(foreach m, $(objs-before-objcopy), $(eval CFLAGS_REMOVE_$m := -msoft-float))
ccflags-y := -mhard-float -fkeep-inline-functions
# Do not delete intermidiate files (*.o)
.SECONDARY: $(call objectify, $(objs-before-objcopy))
obj-y := $(objs-before-objcopy:.o=_.o)
OBJCOPYFLAGS := -R .gnu.attributes

View File

@ -315,6 +315,12 @@ why = \
echo-why = $(call escsq, $(strip $(why)))
endif
# delete partially updated (i.e. corrupted) files on error
.DELETE_ON_ERROR:
# do not delete intermediate files automatically
.SECONDARY:
ifdef CONFIG_SPL_BUILD
SPL_ := SPL_
ifeq ($(CONFIG_TPL_BUILD),y)

View File

@ -331,8 +331,6 @@ quiet_cmd_asn1_compiler = ASN.1 $@
cmd_asn1_compiler = $(objtree)/scripts/asn1_compiler $< \
$(subst .h,.c,$@) $(subst .c,.h,$@)
.PRECIOUS: $(objtree)/$(obj)/%-asn1.c $(objtree)/$(obj)/%-asn1.h
$(obj)/%-asn1.c $(obj)/%-asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler
$(call cmd,asn1_compiler)

View File

@ -214,7 +214,6 @@ endef
quiet_cmd_flex = LEX $@
cmd_flex = $(LEX) -o$@ -L $<
.PRECIOUS: $(obj)/%.lex.c
$(obj)/%.lex.c: $(src)/%.l FORCE
$(call if_changed,flex)
@ -223,14 +222,12 @@ $(obj)/%.lex.c: $(src)/%.l FORCE
quiet_cmd_bison = YACC $@
cmd_bison = $(YACC) -o$@ -t -l $<
.PRECIOUS: $(obj)/%.tab.c
$(obj)/%.tab.c: $(src)/%.y FORCE
$(call if_changed,bison)
quiet_cmd_bison_h = YACC $@
cmd_bison_h = $(YACC) -o/dev/null --defines=$@ -t -l $<
.PRECIOUS: $(obj)/%.tab.h
$(obj)/%.tab.h: $(src)/%.y FORCE
$(call if_changed,bison_h)

View File

@ -21,7 +21,7 @@ quiet_cmd_pymod = PYMOD $@
CPPFLAGS="$(HOSTCFLAGS) -I$(LIBFDT_srcdir)" OBJDIR=$(obj) \
SOURCES="$(PYLIBFDT_srcs)" \
SWIG_OPTS="-I$(LIBFDT_srcdir) -I$(LIBFDT_srcdir)/.." \
$(PYTHON) $< --quiet build_ext --inplace
$(PYTHON2) $< --quiet build_ext --inplace
$(obj)/_libfdt.so: $(src)/setup.py $(PYLIBFDT_srcs) FORCE
$(call if_changed,pymod)

View File

@ -15,6 +15,7 @@ ifneq ($(CONFIG_SANDBOX),)
obj-$(CONFIG_SOUND) += audio.o
obj-$(CONFIG_BLK) += blk.o
obj-$(CONFIG_BOARD) += board.o
obj-$(CONFIG_DM_BOOTCOUNT) += bootcount.o
obj-$(CONFIG_CLK) += clk.o
obj-$(CONFIG_DM_ETH) += eth.o
obj-$(CONFIG_FIRMWARE) += firmware.o

30
test/dm/bootcount.c Normal file
View File

@ -0,0 +1,30 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* (C) 2018 Theobroma Systems Design und Consulting GmbH
*/
#include <common.h>
#include <dm.h>
#include <bootcount.h>
#include <asm/test.h>
#include <dm/test.h>
#include <test/ut.h>
static int dm_test_bootcount(struct unit_test_state *uts)
{
struct udevice *dev;
u32 val;
ut_assertok(uclass_get_device(UCLASS_BOOTCOUNT, 0, &dev));
ut_assertok(dm_bootcount_set(dev, 0));
ut_assertok(dm_bootcount_get(dev, &val));
ut_assert(val == 0);
ut_assertok(dm_bootcount_set(dev, 0xab));
ut_assertok(dm_bootcount_get(dev, &val));
ut_assert(val == 0xab);
return 0;
}
DM_TEST(dm_test_bootcount, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);

View File

@ -51,22 +51,22 @@ def test_avb_mmc_uuid(u_boot_console):
part_lines = u_boot_console.run_command('mmc part').splitlines()
part_list = {}
cur_partname = ""
cur_partname = ''
for line in part_lines:
if "\"" in line:
start_pt = line.find("\"")
end_pt = line.find("\"", start_pt + 1)
if '"' in line:
start_pt = line.find('"')
end_pt = line.find('"', start_pt + 1)
cur_partname = line[start_pt + 1: end_pt]
if "guid:" in line:
guid_to_check = line.split("guid:\t")
if 'guid:' in line:
guid_to_check = line.split('guid:\t')
part_list[cur_partname] = guid_to_check[1]
# lets check all guids with avb get_guid
for part, guid in part_list.iteritems():
avb_guid_resp = u_boot_console.run_command('avb get_uuid %s' % part)
assert guid == avb_guid_resp.split("UUID: ")[1]
assert guid == avb_guid_resp.split('UUID: ')[1]
@pytest.mark.buildconfigspec('cmd_avb')

View File

@ -25,82 +25,82 @@ def in_tree(response, name, uclass, drv, depth, last_child):
def test_bind_unbind_with_node(u_boot_console):
#bind /bind-test. Device should come up as well as its children
response = u_boot_console.run_command("bind /bind-test generic_simple_bus")
response = u_boot_console.run_command('bind /bind-test generic_simple_bus')
assert response == ''
tree = u_boot_console.run_command("dm tree")
assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, False)
assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
tree = u_boot_console.run_command('dm tree')
assert in_tree(tree, 'bind-test', 'simple_bus', 'generic_simple_bus', 0, True)
assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, False)
assert in_tree(tree, 'bind-test-child2', 'simple_bus', 'generic_simple_bus', 1, True)
#Unbind child #1. No error expected and all devices should be there except for bind-test-child1
response = u_boot_console.run_command("unbind /bind-test/bind-test-child1")
response = u_boot_console.run_command('unbind /bind-test/bind-test-child1')
assert response == ''
tree = u_boot_console.run_command("dm tree")
assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert "bind-test-child1" not in tree
assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
tree = u_boot_console.run_command('dm tree')
assert in_tree(tree, 'bind-test', 'simple_bus', 'generic_simple_bus', 0, True)
assert 'bind-test-child1' not in tree
assert in_tree(tree, 'bind-test-child2', 'simple_bus', 'generic_simple_bus', 1, True)
#bind child #1. No error expected and all devices should be there
response = u_boot_console.run_command("bind /bind-test/bind-test-child1 phy_sandbox")
response = u_boot_console.run_command('bind /bind-test/bind-test-child1 phy_sandbox')
assert response == ''
tree = u_boot_console.run_command("dm tree")
assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, True)
assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, False)
tree = u_boot_console.run_command('dm tree')
assert in_tree(tree, 'bind-test', 'simple_bus', 'generic_simple_bus', 0, True)
assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, True)
assert in_tree(tree, 'bind-test-child2', 'simple_bus', 'generic_simple_bus', 1, False)
#Unbind child #2. No error expected and all devices should be there except for bind-test-child2
response = u_boot_console.run_command("unbind /bind-test/bind-test-child2")
response = u_boot_console.run_command('unbind /bind-test/bind-test-child2')
assert response == ''
tree = u_boot_console.run_command("dm tree")
assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, True)
assert "bind-test-child2" not in tree
tree = u_boot_console.run_command('dm tree')
assert in_tree(tree, 'bind-test', 'simple_bus', 'generic_simple_bus', 0, True)
assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, True)
assert 'bind-test-child2' not in tree
#Bind child #2. No error expected and all devices should be there
response = u_boot_console.run_command("bind /bind-test/bind-test-child2 generic_simple_bus")
response = u_boot_console.run_command('bind /bind-test/bind-test-child2 generic_simple_bus')
assert response == ''
tree = u_boot_console.run_command("dm tree")
assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, False)
assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
tree = u_boot_console.run_command('dm tree')
assert in_tree(tree, 'bind-test', 'simple_bus', 'generic_simple_bus', 0, True)
assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, False)
assert in_tree(tree, 'bind-test-child2', 'simple_bus', 'generic_simple_bus', 1, True)
#Unbind parent. No error expected. All devices should be removed and unbound
response = u_boot_console.run_command("unbind /bind-test")
response = u_boot_console.run_command('unbind /bind-test')
assert response == ''
tree = u_boot_console.run_command("dm tree")
assert "bind-test" not in tree
assert "bind-test-child1" not in tree
assert "bind-test-child2" not in tree
tree = u_boot_console.run_command('dm tree')
assert 'bind-test' not in tree
assert 'bind-test-child1' not in tree
assert 'bind-test-child2' not in tree
#try binding invalid node with valid driver
response = u_boot_console.run_command("bind /not-a-valid-node generic_simple_bus")
response = u_boot_console.run_command('bind /not-a-valid-node generic_simple_bus')
assert response != ''
tree = u_boot_console.run_command("dm tree")
assert "not-a-valid-node" not in tree
tree = u_boot_console.run_command('dm tree')
assert 'not-a-valid-node' not in tree
#try binding valid node with invalid driver
response = u_boot_console.run_command("bind /bind-test not_a_driver")
response = u_boot_console.run_command('bind /bind-test not_a_driver')
assert response != ''
tree = u_boot_console.run_command("dm tree")
assert "bind-test" not in tree
tree = u_boot_console.run_command('dm tree')
assert 'bind-test' not in tree
#bind /bind-test. Device should come up as well as its children
response = u_boot_console.run_command("bind /bind-test generic_simple_bus")
response = u_boot_console.run_command('bind /bind-test generic_simple_bus')
assert response == ''
tree = u_boot_console.run_command("dm tree")
assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, False)
assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
tree = u_boot_console.run_command('dm tree')
assert in_tree(tree, 'bind-test', 'simple_bus', 'generic_simple_bus', 0, True)
assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, False)
assert in_tree(tree, 'bind-test-child2', 'simple_bus', 'generic_simple_bus', 1, True)
response = u_boot_console.run_command("unbind /bind-test")
response = u_boot_console.run_command('unbind /bind-test')
assert response == ''
def get_next_line(tree, name):
treelines = [x.strip() for x in tree.splitlines() if x.strip()]
child_line = ""
child_line = ''
for idx, line in enumerate(treelines):
if ("-- " + name) in line:
if ('-- ' + name) in line:
try:
child_line = treelines[idx+1]
except:
@ -111,68 +111,68 @@ def get_next_line(tree, name):
@pytest.mark.buildconfigspec('cmd_bind')
def test_bind_unbind_with_uclass(u_boot_console):
#bind /bind-test
response = u_boot_console.run_command("bind /bind-test generic_simple_bus")
response = u_boot_console.run_command('bind /bind-test generic_simple_bus')
assert response == ''
#make sure bind-test-child2 is there and get its uclass/index pair
tree = u_boot_console.run_command("dm tree")
child2_line = [x.strip() for x in tree.splitlines() if "-- bind-test-child2" in x]
tree = u_boot_console.run_command('dm tree')
child2_line = [x.strip() for x in tree.splitlines() if '-- bind-test-child2' in x]
assert len(child2_line) == 1
child2_uclass = child2_line[0].split()[0]
child2_index = int(child2_line[0].split()[1])
#bind generic_simple_bus as a child of bind-test-child2
response = u_boot_console.run_command("bind {} {} generic_simple_bus".format(child2_uclass, child2_index, "generic_simple_bus"))
response = u_boot_console.run_command('bind {} {} generic_simple_bus'.format(child2_uclass, child2_index, 'generic_simple_bus'))
#check that the child is there and its uclass/index pair is right
tree = u_boot_console.run_command("dm tree")
tree = u_boot_console.run_command('dm tree')
child_of_child2_line = get_next_line(tree, "bind-test-child2")
child_of_child2_line = get_next_line(tree, 'bind-test-child2')
assert child_of_child2_line
child_of_child2_index = int(child_of_child2_line.split()[1])
assert in_tree(tree, "generic_simple_bus", "simple_bus", "generic_simple_bus", 2, True)
assert in_tree(tree, 'generic_simple_bus', 'simple_bus', 'generic_simple_bus', 2, True)
assert child_of_child2_index == child2_index + 1
#unbind the child and check it has been removed
response = u_boot_console.run_command("unbind simple_bus {}".format(child_of_child2_index))
response = u_boot_console.run_command('unbind simple_bus {}'.format(child_of_child2_index))
assert response == ''
tree = u_boot_console.run_command("dm tree")
assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
assert not in_tree(tree, "generic_simple_bus", "simple_bus", "generic_simple_bus", 2, True)
child_of_child2_line = get_next_line(tree, "bind-test-child2")
assert child_of_child2_line == ""
tree = u_boot_console.run_command('dm tree')
assert in_tree(tree, 'bind-test-child2', 'simple_bus', 'generic_simple_bus', 1, True)
assert not in_tree(tree, 'generic_simple_bus', 'simple_bus', 'generic_simple_bus', 2, True)
child_of_child2_line = get_next_line(tree, 'bind-test-child2')
assert child_of_child2_line == ''
#bind generic_simple_bus as a child of bind-test-child2
response = u_boot_console.run_command("bind {} {} generic_simple_bus".format(child2_uclass, child2_index, "generic_simple_bus"))
response = u_boot_console.run_command('bind {} {} generic_simple_bus'.format(child2_uclass, child2_index, 'generic_simple_bus'))
#check that the child is there and its uclass/index pair is right
tree = u_boot_console.run_command("dm tree")
tree = u_boot_console.run_command('dm tree')
treelines = [x.strip() for x in tree.splitlines() if x.strip()]
child_of_child2_line = get_next_line(tree, "bind-test-child2")
child_of_child2_line = get_next_line(tree, 'bind-test-child2')
assert child_of_child2_line
child_of_child2_index = int(child_of_child2_line.split()[1])
assert in_tree(tree, "generic_simple_bus", "simple_bus", "generic_simple_bus", 2, True)
assert in_tree(tree, 'generic_simple_bus', 'simple_bus', 'generic_simple_bus', 2, True)
assert child_of_child2_index == child2_index + 1
#unbind the child and check it has been removed
response = u_boot_console.run_command("unbind {} {} generic_simple_bus".format(child2_uclass, child2_index, "generic_simple_bus"))
response = u_boot_console.run_command('unbind {} {} generic_simple_bus'.format(child2_uclass, child2_index, 'generic_simple_bus'))
assert response == ''
tree = u_boot_console.run_command("dm tree")
assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
tree = u_boot_console.run_command('dm tree')
assert in_tree(tree, 'bind-test-child2', 'simple_bus', 'generic_simple_bus', 1, True)
child_of_child2_line = get_next_line(tree, "bind-test-child2")
assert child_of_child2_line == ""
child_of_child2_line = get_next_line(tree, 'bind-test-child2')
assert child_of_child2_line == ''
#unbind the child again and check it doesn't change the tree
tree_old = u_boot_console.run_command("dm tree")
response = u_boot_console.run_command("unbind {} {} generic_simple_bus".format(child2_uclass, child2_index, "generic_simple_bus"))
tree_new = u_boot_console.run_command("dm tree")
tree_old = u_boot_console.run_command('dm tree')
response = u_boot_console.run_command('unbind {} {} generic_simple_bus'.format(child2_uclass, child2_index, 'generic_simple_bus'))
tree_new = u_boot_console.run_command('dm tree')
assert response == ''
assert tree_old == tree_new
response = u_boot_console.run_command("unbind /bind-test")
response = u_boot_console.run_command('unbind /bind-test')
assert response == ''

View File

@ -20,28 +20,28 @@ For example:
env__usb_dev_ports = (
{
"fixture_id": "micro_b",
"tgt_usb_ctlr": "0",
"host_usb_dev_node": "/dev/usbdev-p2371-2180",
'fixture_id': 'micro_b',
'tgt_usb_ctlr': '0',
'host_usb_dev_node': '/dev/usbdev-p2371-2180',
# This parameter is optional /if/ you only have a single board
# attached to your host at a time.
"host_usb_port_path": "3-13",
'host_usb_port_path': '3-13',
},
)
# Optional entries (required only when "alt_id_test_file" and
# "alt_id_dummy_file" are specified).
test_file_name = "/dfu_test.bin"
dummy_file_name = "/dfu_dummy.bin"
# Above files are used to generate proper "alt_info" entry
"alt_info": "/%s ext4 0 2;/%s ext4 0 2" % (test_file_name, dummy_file_name),
# Optional entries (required only when 'alt_id_test_file' and
# 'alt_id_dummy_file' are specified).
test_file_name = '/dfu_test.bin'
dummy_file_name = '/dfu_dummy.bin'
# Above files are used to generate proper 'alt_info' entry
'alt_info': '/%s ext4 0 2;/%s ext4 0 2' % (test_file_name, dummy_file_name),
env__dfu_configs = (
# eMMC, partition 1
{
"fixture_id": "emmc",
"alt_info": "/dfu_test.bin ext4 0 1;/dfu_dummy.bin ext4 0 1",
"cmd_params": "mmc 0",
'fixture_id': 'emmc',
'alt_info': '/dfu_test.bin ext4 0 1;/dfu_dummy.bin ext4 0 1',
'cmd_params': 'mmc 0',
# This value is optional.
# If present, it specified the set of transfer sizes tested.
# If missing, a default list of sizes will be used, which covers
@ -49,7 +49,7 @@ env__dfu_configs = (
# Manually specifying test sizes is useful if you wish to test 4 DFU
# configurations, but don't want to test every single transfer size
# on each, to avoid bloating the overall time taken by testing.
"test_sizes": (63, 64, 65),
'test_sizes': (63, 64, 65),
# This value is optional.
# The name of the environment variable that the the dfu command reads
# alt info from. If unspecified, this defaults to dfu_alt_info, which is
@ -57,17 +57,17 @@ env__dfu_configs = (
# One example is the Odroid XU3, which automatically generates
# $dfu_alt_info, each time the dfu command is run, by concatenating
# $dfu_alt_boot and $dfu_alt_system.
"alt_info_env_name": "dfu_alt_system",
'alt_info_env_name': 'dfu_alt_system',
# This value is optional.
# For boards which require the "test file" alt setting number other than
# For boards which require the 'test file' alt setting number other than
# default (0) it is possible to specify exact file name to be used as
# this parameter.
"alt_id_test_file": test_file_name,
'alt_id_test_file': test_file_name,
# This value is optional.
# For boards which require the "dummy file" alt setting number other
# For boards which require the 'dummy file' alt setting number other
# than default (1) it is possible to specify exact file name to be used
# as this parameter.
"alt_id_dummy_file": dummy_file_name,
'alt_id_dummy_file': dummy_file_name,
},
)

View File

@ -35,17 +35,17 @@ env__net_dhcp_server = True
# static IP. If solely relying on DHCP, this variable may be omitted or set to
# an empty list.
env__net_static_env_vars = [
("ipaddr", "10.0.0.100"),
("netmask", "255.255.255.0"),
("serverip", "10.0.0.1"),
('ipaddr', '10.0.0.100'),
('netmask', '255.255.255.0'),
('serverip', '10.0.0.1'),
]
# Details regarding a file that may be read from a TFTP server. This variable
# may be omitted or set to None if TFTP testing is not possible or desired.
env__efi_loader_helloworld_file = {
"fn": "lib/efi_loader/helloworld.efi",
"size": 5058624,
"crc32": "c2244b26",
'fn': 'lib/efi_loader/helloworld.efi',
'size': 5058624,
'crc32': 'c2244b26',
}
"""

View File

@ -24,40 +24,40 @@ env__net_dhcp_server = True
# static IP. In this test case we atleast need serverip for performing tftpb
# to get required files.
env__net_static_env_vars = [
("ipaddr", "10.0.0.100"),
("netmask", "255.255.255.0"),
("serverip", "10.0.0.1"),
('ipaddr', '10.0.0.100'),
('netmask', '255.255.255.0'),
('serverip', '10.0.0.1'),
]
# Details regarding the files that may be read from a TFTP server. .
env__fpga_secure_readable_file = {
"fn": "auth_bhdr_ppk1_bit.bin",
"enckupfn": "auth_bhdr_enc_kup_load_bit.bin",
"addr": 0x1000000,
"keyaddr": 0x100000,
"keyfn": "key.txt",
'fn': 'auth_bhdr_ppk1_bit.bin',
'enckupfn': 'auth_bhdr_enc_kup_load_bit.bin',
'addr': 0x1000000,
'keyaddr': 0x100000,
'keyfn': 'key.txt',
}
env__fpga_under_test = {
"dev": 0,
"addr" : 0x1000000,
"bitstream_load": "compress.bin",
"bitstream_load_size": 1831960,
"bitstream_loadp": "compress_pr.bin",
"bitstream_loadp_size": 423352,
"bitstream_loadb": "compress.bit",
"bitstream_loadb_size": 1832086,
"bitstream_loadbp": "compress_pr.bit",
"bitstream_loadbp_size": 423491,
"mkimage_legacy": "download.ub",
"mkimage_legacy_size": 13321468,
"mkimage_legacy_gz": "download.gz.ub",
"mkimage_legacy_gz_size": 53632,
"mkimage_fit": "download-fit.ub",
"mkimage_fit_size": 13322784,
"loadfs": "mmc 0 compress.bin",
"loadfs_size": 1831960,
"loadfs_block_size": 0x10000,
'dev': 0,
'addr' : 0x1000000,
'bitstream_load': 'compress.bin',
'bitstream_load_size': 1831960,
'bitstream_loadp': 'compress_pr.bin',
'bitstream_loadp_size': 423352,
'bitstream_loadb': 'compress.bit',
'bitstream_loadb_size': 1832086,
'bitstream_loadbp': 'compress_pr.bit',
'bitstream_loadbp_size': 423491,
'mkimage_legacy': 'download.ub',
'mkimage_legacy_size': 13321468,
'mkimage_legacy_gz': 'download.gz.ub',
'mkimage_legacy_gz_size': 53632,
'mkimage_fit': 'download-fit.ub',
'mkimage_fit_size': 13322784,
'loadfs': 'mmc 0 compress.bin',
'loadfs_size': 1831960,
'loadfs_block_size': 0x10000,
}
"""

View File

@ -54,7 +54,7 @@ def pytest_configure(config):
supported_fs = config.getoption('fs_type')
if supported_fs:
print("*** FS TYPE modified: %s" % supported_fs)
print('*** FS TYPE modified: %s' % supported_fs)
supported_fs_basic = intersect(supported_fs, supported_fs_basic)
supported_fs_ext = intersect(supported_fs, supported_fs_ext)
supported_fs_mkdir = intersect(supported_fs, supported_fs_mkdir)
@ -174,7 +174,7 @@ def tool_is_in_path(tool):
Return:
True if available, False if not.
"""
for path in os.environ["PATH"].split(os.pathsep):
for path in os.environ['PATH'].split(os.pathsep):
fn = os.path.join(path, tool)
if os.path.isfile(fn) and os.access(fn, os.X_OK):
return True
@ -202,9 +202,9 @@ def mount_fs(fs_type, device, mount_point):
check_call('guestmount -a %s -m /dev/sda %s'
% (device, mount_point), shell=True)
else:
mount_opt = "loop,rw"
mount_opt = 'loop,rw'
if re.match('fat', fs_type):
mount_opt += ",umask=0000"
mount_opt += ',umask=0000'
check_call('sudo mount -o %s %s %s'
% (mount_opt, device, mount_point), shell=True)

View File

@ -14,45 +14,45 @@ which MMC devices should be tested. For example:
env__mmc_rd_configs = (
{
"fixture_id": "emmc-boot0",
"is_emmc": True,
"devid": 0,
"partid": 1,
"sector": 0x10,
"count": 1,
'fixture_id': 'emmc-boot0',
'is_emmc': True,
'devid': 0,
'partid': 1,
'sector': 0x10,
'count': 1,
},
{
"fixture_id": "emmc-boot1",
"is_emmc": True,
"devid": 0,
"partid": 2,
"sector": 0x10,
"count": 1,
'fixture_id': 'emmc-boot1',
'is_emmc': True,
'devid': 0,
'partid': 2,
'sector': 0x10,
'count': 1,
},
{
"fixture_id": "emmc-data",
"is_emmc": True,
"devid": 0,
"partid": 0,
"sector": 0x10,
"count": 0x1000,
'fixture_id': 'emmc-data',
'is_emmc': True,
'devid': 0,
'partid': 0,
'sector': 0x10,
'count': 0x1000,
},
{
"fixture_id": "sd-mbr",
"is_emmc": False,
"devid": 1,
"partid": None,
"sector": 0,
"count": 1,
"crc32": "8f6ecf0d",
'fixture_id': 'sd-mbr',
'is_emmc': False,
'devid': 1,
'partid': None,
'sector': 0,
'count': 1,
'crc32': '8f6ecf0d',
},
{
"fixture_id": "sd-large",
"is_emmc": False,
"devid": 1,
"partid": None,
"sector": 0x10,
"count": 0x1000,
'fixture_id': 'sd-large',
'is_emmc': False,
'devid': 1,
'partid': None,
'sector': 0x10,
'count': 0x1000,
},
)
"""
@ -92,9 +92,9 @@ def test_mmc_rd(u_boot_console, env__mmc_rd_config):
response = u_boot_console.run_command(cmd)
assert 'no card present' not in response
if is_emmc:
partid_response = "(part %d)" % partid
partid_response = '(part %d)' % partid
else:
partid_response = ""
partid_response = ''
good_response = 'mmc%d%s is current device' % (devid, partid_response)
assert good_response in response

Some files were not shown because too many files have changed in this diff Show More