Re: [PATCH v4 00/16] General Tegra improvements
You are correct, crypto.c was moved from T20 to common mach-tegra, but I have sent patches already on top on u-boot/master and rebase gave me no errors. Looks like commit ARM: tegra: crypto: extend crypto functional was picked before ARM: tegra: expose crypto module for all Tegra SoCs which caused the error you pointed to. вт, 14 лют. 2023 р. о 23:45 Tom Warren пише: > > > > Svyatoslav, > > Taking TOT u-boot-tegra/master, and fast-forwarding to TOT u-boot/master, I > then try to apply your 16 patch series and get the following failures (using > patch). Note that I retargeted the crypto.c patch by hand to point to > tegra20/crypto.c, which I believe one of your patches moves to > arch/arm/tegra. PTAL. > > tom@tom-ThinkPad-T580:~/denx/uboot-tegra$ patch -p1 -i > ~/Downloads/bundle-23303-Svyatoslav-16-v4.mbox --dry-run > checking file arch/arm/include/asm/arch-tegra30/clock-tables.h > checking file arch/arm/mach-tegra/tegra30/clock.c > checking file arch/arm/mach-tegra/tegra20/clock.c > checking file arch/arm/mach-tegra/tegra30/clock.c > checking file arch/arm/include/asm/arch-tegra/clock.h > checking file arch/arm/mach-tegra/tegra114/clock.c > checking file arch/arm/mach-tegra/tegra124/clock.c > checking file arch/arm/mach-tegra/tegra20/clock.c > checking file arch/arm/mach-tegra/tegra210/clock.c > checking file arch/arm/mach-tegra/tegra30/clock.c > checking file arch/arm/include/asm/arch-tegra/clock.h > checking file arch/arm/mach-tegra/clock.c > checking file arch/arm/mach-tegra/tegra30/clock.c > Hunk #1 succeeded at 632 (offset -37 lines). > checking file arch/arm/dts/tegra114.dtsi > checking file arch/arm/dts/tegra124.dtsi > checking file arch/arm/mach-tegra/tegra114/clock.c > Hunk #1 succeeded at 745 (offset -37 lines). > checking file arch/arm/mach-tegra/tegra124/clock.c > Hunk #1 succeeded at 1170 (offset -38 lines). > checking file arch/arm/mach-tegra/tegra20/clock.c > Hunk #1 succeeded at 767 (offset -37 lines). > checking file arch/arm/mach-tegra/tegra210/clock.c > Hunk #1 succeeded at 1241 (offset -37 lines). > checking file arch/arm/mach-tegra/tegra30/clock.c > Hunk #1 succeeded at 806 (offset -78 lines). > checking file drivers/pwm/tegra_pwm.c > checking file drivers/spi/tegra20_slink.c > checking file configs/beaver_defconfig > checking file configs/cei-tk1-som_defconfig > checking file configs/dalmore_defconfig > checking file configs/jetson-tk1_defconfig > checking file configs/nyan-big_defconfig > checking file configs/p2371-_defconfig > checking file configs/p2371-2180_defconfig > checking file configs/p2571_defconfig > checking file configs/p3450-_defconfig > checking file configs/venice2_defconfig > checking file drivers/usb/gadget/Kconfig > checking file arch/arm/include/asm/arch-tegra/sys_proto.h > checking file arch/arm/mach-tegra/board2.c > checking file arch/arm/include/asm/arch-tegra/tegra_i2c.h > checking file arch/arm/mach-tegra/cpu.h > checking file arch/arm/mach-tegra/tegra124/cpu.c > checking file arch/arm/mach-tegra/tegra30/cpu.c > checking file board/nvidia/venice2/as3722_init.c > checking file board/nvidia/venice2/as3722_init.h > checking file board/toradex/apalis-tk1/as3722_init.c > checking file board/toradex/apalis-tk1/as3722_init.h > checking file arch/arm/mach-tegra/tegra30/Kconfig > checking file arch/arm/mach-tegra/tegra30/cpu.c > Hunk #1 FAILED at 15. > Hunk #2 FAILED at 41. > 2 out of 2 hunks FAILED > checking file board/avionic-design/tec-ng/Makefile > checking file board/avionic-design/tec-ng/tec-ng-spl.c > checking file board/nvidia/beaver/Makefile > checking file board/nvidia/beaver/beaver-spl.c > checking file board/nvidia/cardhu/Makefile > checking file board/nvidia/cardhu/cardhu-spl.c > checking file board/toradex/apalis_t30/Makefile > checking file board/toradex/apalis_t30/apalis_t30-spl.c > checking file board/toradex/colibri_t30/Makefile > checking file board/toradex/colibri_t30/colibri_t30-spl.c > checking file arch/arm/mach-tegra/Kconfig > checking file arch/arm/mach-tegra/Makefile > checking file arch/arm/mach-tegra/crypto.c (renamed from > arch/arm/mach-tegra/tegra20/crypto.c) > checking file arch/arm/mach-tegra/crypto.h (renamed from > arch/arm/mach-tegra/tegra20/crypto.h) > checking file arch/arm/mach-tegra/tegra20/Kconfig > checking file arch/arm/mach-tegra/tegra20/Makefile > checking file arch/arm/include/asm/arch-tegra/crypto.h > can't find file to patch at input line 3811 > Perhaps you used the wrong -p or --strip option? > The text leading up to this was: > -- > |diff --git a/arch/arm/mach-tegra/crypto.c b/arch/arm/mach-tegra/crypto.c > |index 1efaa5c3ec..893da35e0b 100644 > |--- a/arch/arm/mach-tegra/crypto.c > |+++ b/arch/arm/mach-tegra/crypto.c > -- > File to patch: arch/arm/mach-tegra/tegra20/crypto.c > checking file arch/arm/mach-tegra/tegra20/crypto.c > The next patch would delete the file arch/arm/mach-tegra/crypto.h, > which does not exist! Assume -R? [n] > Apply
Re: [PATCH v2 2/2] riscv: ae350: Adjust the memory layout of ae350
On Tue, Feb 14, 2023 at 08:42:50PM +0800, Leo Yu-Chi Liang wrote: > Adjust the initial stack pointer address to 0x1000(256M) > > Signed-off-by: Leo Yu-Chi Liang Reviewed-by: Yu Chien Peter Lin > --- > Change v1 -> v2: > * Modify the address from 0x100(16MB) to 0x1000(256MB) > --- > configs/ae350_rv32_spl_defconfig | 6 +++--- > configs/ae350_rv32_spl_xip_defconfig | 6 +++--- > configs/ae350_rv64_spl_defconfig | 6 +++--- > configs/ae350_rv64_spl_xip_defconfig | 6 +++--- > 4 files changed, 12 insertions(+), 12 deletions(-) > > diff --git a/configs/ae350_rv32_spl_defconfig > b/configs/ae350_rv32_spl_defconfig > index e328308e097..f2fe276c5c8 100644 > --- a/configs/ae350_rv32_spl_defconfig > +++ b/configs/ae350_rv32_spl_defconfig > @@ -1,7 +1,9 @@ > CONFIG_RISCV=y > -CONFIG_TEXT_BASE=0x0120 > +CONFIG_TEXT_BASE=0x0180 > CONFIG_SYS_MALLOC_LEN=0x8 > CONFIG_NR_DRAM_BANKS=2 > +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y > +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000 > CONFIG_ENV_SECT_SIZE=0x1000 > CONFIG_DEFAULT_DEVICE_TREE="ae350_32" > CONFIG_SYS_PROMPT="RISC-V # " > @@ -12,8 +14,6 @@ CONFIG_TARGET_AE350=y > CONFIG_RISCV_SMODE=y > # CONFIG_AVAILABLE_HARTS is not set > CONFIG_DISTRO_DEFAULTS=y > -CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y > -CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x00 > CONFIG_SYS_MONITOR_LEN=786432 > CONFIG_FIT=y > CONFIG_SPL_LOAD_FIT_ADDRESS=0x0020 > diff --git a/configs/ae350_rv32_spl_xip_defconfig > b/configs/ae350_rv32_spl_xip_defconfig > index da8edf44d4c..4ed5e2cad99 100644 > --- a/configs/ae350_rv32_spl_xip_defconfig > +++ b/configs/ae350_rv32_spl_xip_defconfig > @@ -1,7 +1,9 @@ > CONFIG_RISCV=y > -CONFIG_TEXT_BASE=0x0120 > +CONFIG_TEXT_BASE=0x0180 > CONFIG_SYS_MALLOC_LEN=0x8 > CONFIG_NR_DRAM_BANKS=2 > +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y > +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000 > CONFIG_ENV_SECT_SIZE=0x1000 > CONFIG_DEFAULT_DEVICE_TREE="ae350_32" > CONFIG_SPL_TEXT_BASE=0x8000 > @@ -13,8 +15,6 @@ CONFIG_TARGET_AE350=y > CONFIG_RISCV_SMODE=y > CONFIG_SPL_XIP=y > CONFIG_DISTRO_DEFAULTS=y > -CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y > -CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x00 > CONFIG_SYS_MONITOR_LEN=786432 > CONFIG_FIT=y > CONFIG_SPL_LOAD_FIT_ADDRESS=0x8001 > diff --git a/configs/ae350_rv64_spl_defconfig > b/configs/ae350_rv64_spl_defconfig > index 9c5018c4462..90dfc7d02ee 100644 > --- a/configs/ae350_rv64_spl_defconfig > +++ b/configs/ae350_rv64_spl_defconfig > @@ -1,7 +1,9 @@ > CONFIG_RISCV=y > -CONFIG_TEXT_BASE=0x0120 > +CONFIG_TEXT_BASE=0x0180 > CONFIG_SYS_MALLOC_LEN=0x8 > CONFIG_NR_DRAM_BANKS=2 > +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y > +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000 > CONFIG_ENV_SECT_SIZE=0x1000 > CONFIG_DEFAULT_DEVICE_TREE="ae350_64" > CONFIG_SYS_PROMPT="RISC-V # " > @@ -13,8 +15,6 @@ CONFIG_ARCH_RV64I=y > CONFIG_RISCV_SMODE=y > # CONFIG_AVAILABLE_HARTS is not set > CONFIG_DISTRO_DEFAULTS=y > -CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y > -CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xfffe70 > CONFIG_FIT=y > CONFIG_SPL_LOAD_FIT_ADDRESS=0x0020 > CONFIG_SYS_MONITOR_BASE=0x8800 > diff --git a/configs/ae350_rv64_spl_xip_defconfig > b/configs/ae350_rv64_spl_xip_defconfig > index 9351deffa3b..f174638f692 100644 > --- a/configs/ae350_rv64_spl_xip_defconfig > +++ b/configs/ae350_rv64_spl_xip_defconfig > @@ -1,7 +1,9 @@ > CONFIG_RISCV=y > -CONFIG_TEXT_BASE=0x0120 > +CONFIG_TEXT_BASE=0x0180 > CONFIG_SYS_MALLOC_LEN=0x8 > CONFIG_NR_DRAM_BANKS=2 > +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y > +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000 > CONFIG_ENV_SECT_SIZE=0x1000 > CONFIG_DEFAULT_DEVICE_TREE="ae350_64" > CONFIG_SPL_TEXT_BASE=0x8000 > @@ -14,8 +16,6 @@ CONFIG_ARCH_RV64I=y > CONFIG_RISCV_SMODE=y > CONFIG_SPL_XIP=y > CONFIG_DISTRO_DEFAULTS=y > -CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y > -CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xfffe70 > CONFIG_FIT=y > CONFIG_SPL_LOAD_FIT_ADDRESS=0x8001 > CONFIG_SYS_MONITOR_BASE=0x8800
Re: imx8mp EQOS regression in dwc_eth_qos,c
Am 15.02.23 um 01:19 schrieb Marek Vasut: On 2/14/23 18:31, Elmar Psilog wrote: Am 13.02.23 um 22:20 schrieb Marek Vasut: On 2/13/23 22:04, Fabio Estevam wrote: Adding Marek, who has sent some EQOS patches recently. On Mon, Feb 13, 2023 at 6:02 PM Elmar Psilog wrote: Hello, Think I found a regression in EQOS driver with fixed-phy. Maybe someone with a imx8mp board might check that use case to confirm? That would be great. While ethernet was working in v2022.04 a "ping" in v2023.01 returns ERROR: no/invalid property! invalid speed 0 eqos_adjust_link() failed: -22 FAILED although devicetree/hardware kept unchanged. This happens because in file fixed.c in in function fixedphy_config() the call val = ofnode_read_u32_default(node, "speed", 0); returns 0 instead of 1000 and also the duplex is not set. Found that in file/function dwc_eth_qos.c / eqos_start() the line eqos->phy->node = eqos->phy_of_node; is responsible for losing the information. Don't know what magic happens here - so I can't fix it - I just followed the data. So all works well and even the parsing of old and new fixed-link devicetree works til that line. After that I don't get speed anymore. Maybe you can have a look at this? Try this patch (needs CONFIG_FIXED_PHY=y) : diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index d488bd0c288..592af53b352 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -791,9 +791,21 @@ static int eqos_start(struct udevice *dev) */ if (!eqos->phy) { int addr = -1; - addr = eqos_get_phy_addr(eqos, dev); - eqos->phy = phy_connect(eqos->mii, addr, dev, - eqos->config->interface(dev)); + ofnode fixed_node; + + if (IS_ENABLED(CONFIG_PHY_FIXED)) { + fixed_node = ofnode_find_subnode(dev_ofnode(dev), + "fixed-link"); + if (ofnode_valid(fixed_node)) { + eqos->phy = fixed_phy_create(dev_ofnode(dev)); + } + + if (!eqos->phy) { + addr = eqos_get_phy_addr(eqos, dev); + eqos->phy = phy_connect(eqos->mii, addr, dev, + eqos->config->interface(dev)); + } + if (!eqos->phy) { pr_err("phy_connect() failed"); goto err_stop_resets; Thanks Fabio for forwarding and Marek for the quick patch! Don't get this exactly. Bit confused about the closing "}" in if(IS_ENABLED) seems to be missed (or an else path)? Where exactly should this be? From the insertion it looks like you mean: Yes, the { shouldn't be at the end of 'if (ofnode_valid(fixed_node)) {' . + if (IS_ENABLED(CONFIG_PHY_FIXED)) { + fixed_node = ofnode_find_subnode(dev_ofnode(dev), + "fixed-link"); + if (ofnode_valid(fixed_node)) { + eqos->phy = fixed_phy_create(dev_ofnode(dev)); Add this here (*) too (see below): eqos->phy_of_node = fixed_node; + } This works too. + } + if (!eqos->phy) { + addr = eqos_get_phy_addr(eqos, dev); + eqos->phy = phy_connect(eqos->mii, addr, dev, eqos->config->interface(dev)); + } But that doesn't solve the issue. The magic line eqos->phy->node = eqos->phy_of_node; will still executed. See (*) above , does that help ? Likely a different issue but connected to EQOS: I am wondering why the clocks for ethernet look so much different if FEC is not configured. Shouldn't be the case, right? At least imx8mp.dtsi doesn't tell about any 24MHz clock. Also counter is "0"? Well, EQOS works with uncommenting the line above and this clock, but why? Each device is probed on first use, so the clock are left unconfigured until the device is actually used (e.g. for ethernet transfer). Note that there is a huge series which overhauls the EQoS and FEC clock on the ML, see: [PATCH v3 01/14] clk: imx8mp: Add EQoS MAC clock Marek, great! Can confirm that this patch (just to be sure attached complete below) does it's job. My concern with the clock is, that what is done in u-boot seems to have an effect in linux/kernel too. Not all clocks seems to be reconfigured in kernel. I'll try the upcoming 2023.04 release next. Again, big thanks. diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index afc47b56ff..10915d8e47 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -785,9 +785,21 @@ static int eqos_start(struct udevice *dev) */ if (!eqos->phy) { int addr = -1; - addr = eqos_get_phy_addr(eqos, dev); - eqos->phy = phy_connect(eqos->mii, addr, dev, - eqos->config->interface(dev)); + ofnode fixed_node; + +
Re: U-boot not loading NVMe driver on Pi CM4
On Wed, Feb 15, 2023 at 3:52 PM Ignatius Rivaldi wrote: > > Hi Stefan, > On Tue, Feb 14, 2023 at 2:00 AM Stefan Roese wrote: > >> Hi Ignatius, >> >> On 2/10/23 17:05, Simon Glass wrote: >> > Hi Ignatius, >> > >> > On Thu, 9 Feb 2023 at 17:29, Ignatius Rivaldi >> wrote: >> >> >> >> Added more debug logging and for some reason the nvme driver tries to >> bind >> >> to pcie root bridge instead of the SSD >> >> drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple() >> >> pcie_brcm pcie@7d50: set_state_simple op missing >> >> PCIe BRCM: link up, 5.0 Gbps x1 (SSC) >> >> drivers/core/device.c:184- device_bind_common() Bound device >> pci_0:0.0 to >> >> pcie@7d50 >> >> drivers/core/uclass.c:338-uclass_find_device_by_seq() 0 >> >> drivers/core/uclass.c:346-uclass_find_device_by_seq()- 0 >> 'gpio@7e20' >> >> >> >> drivers/core/uclass.c:349-uclass_find_device_by_seq()- found >> >> drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple() >> >> pci_bridge_drv pci_0:0.0: set_state_simple op missing >> >> drivers/core/device.c:184- device_bind_common() Bound device nvme#0 to >> >> pci_0:0.0 >> >> U-Boot> pci >> >> >> DEBUG.driver-model,drivers/core/uclass.c:338-uclass_find_device_by_seq() 0 >> >> >> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq() >> >> - 0 'pcie@7d50' >> >> >> DEBUG.driver-model,drivers/core/uclass.c:349-uclass_find_device_by_seq() >> >> - found >> >> BusDevFun VendorId DeviceId Device Class Sub-Class >> >> _ >> >> 00.00.00 0x14e4 0x2711 Bridge device 0x04 >> >> >> DEBUG.driver-model,drivers/core/uclass.c:338-uclass_find_device_by_seq() 1 >> >> >> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq() >> >> - 0 'pcie@7d50' >> >> >> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq() >> >> - 1 'pci_0:0.0' >> >> >> DEBUG.driver-model,drivers/core/uclass.c:349-uclass_find_device_by_seq() >> >> - found >> >> 01.00.00 0x1e0f 0x0001 Mass storage controller 0x08 >> >> >> DEBUG.driver-model,drivers/core/uclass.c:338-uclass_find_device_by_seq() 2 >> >> >> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq() >> >> - 0 'pcie@7d50' >> >> >> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq() >> >> - 1 'pci_0:0.0' >> >> >> DEBUG.driver-model,drivers/core/uclass.c:353-uclass_find_device_by_seq() >> >> - not found >> >> >> >> It should be pci_1:0.0 I think >> >> >> >> On Thu, Feb 9, 2023 at 11:22 AM Ignatius Rivaldi < >> minecraft2...@gmail.com> >> >> wrote: >> > >> > (please try not to top post) >> > >> > I don't know what is going on here. The PCI scan seems to show the >> > wrong device, as you say. Perhaps it is a bug in the bcm controller >> > driver? >> > >> > +Michal Suchanek >> > +Stefan Roese >> >> I've not used the NVMe driver in U-Boot yet, but at least the PCI class >> and subclass ID seem to be fine AFAIT: >> >> class code = 0x01 (Mass storage controller) >> sub class code = 0x08 >> programming interface = 0x02 >> >> Are other PCI drivers probed correctly, if you can test this on your >> board? E.g. an Intel E1000 PCIe board perhaps? >> >> Added Bin, perhaps he has some further ideas. >> >> Thanks, >> Stefan >> >> (for some reason your email got sent to my spam folder) > > I'm installing the u-boot to the NVMe drive as the CM4 I have doesn't have > eMMC > And CM4 only have 1 PCIe lane so I can't add another PCIe device > > I think Home Assistant OS 9.5 which is based on u-boot 2022.1 works with > my hardware, > as the green LED is blinking. But I'm not sure as it seems that their rpi4 > build doesn't enable > serial console. > > Thanks > Ignatius > > I've got serial out working with Home Assistant OS 9.5: https://github.com/home-assistant/operating-system/releases/tag/9.5 and I can confirm that their u-boot works with my hardware: U-Boot 2022.01 (Feb 15 2023 - 02:55:50 +) DRAM: 948 MiB RPI Compute Module 4 (0xa03140) MMC: mmcnr@7e30: 1, mmc@7e34: 0 Loading Environment from nowhere... OK In:serial Out: serial Err: serial Net: eth0: ethernet@7d58 PCIe BRCM: link up, 5.0 Gbps x1 (SSC) starting USB... No working controllers found Card did not respond to voltage select! : -110 Card did not respond to voltage select! : -110 MMC Device 2 not found no mmc device at slot 2 Device 0: Vendor: 0x1e0f Rev: 10410106 Prod: X15PD1GSQX93 Type: Hard Disk Capacity: 122104.3 MB = 119.2 GB (250069680 x 512) ... is now current device Scanning nvme 0:1... Found U-Boot script /boot.scr 2411 bytes read in 0 ms ## Executing script at 0240 Device 0: Vendor: 0x1e0f Rev: 10410106 Prod: X15PD1GSQX93 Type: Hard Disk Capacity: 122104.3 MB = 119.2 GB (250069680 x 512) ... is now current device loading env... nvme read: device 0
Re: U-boot not loading NVMe driver on Pi CM4
Hi Stefan, On Tue, Feb 14, 2023 at 2:00 AM Stefan Roese wrote: > Hi Ignatius, > > On 2/10/23 17:05, Simon Glass wrote: > > Hi Ignatius, > > > > On Thu, 9 Feb 2023 at 17:29, Ignatius Rivaldi > wrote: > >> > >> Added more debug logging and for some reason the nvme driver tries to > bind > >> to pcie root bridge instead of the SSD > >> drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple() > >> pcie_brcm pcie@7d50: set_state_simple op missing > >> PCIe BRCM: link up, 5.0 Gbps x1 (SSC) > >> drivers/core/device.c:184- device_bind_common() Bound device pci_0:0.0 > to > >> pcie@7d50 > >> drivers/core/uclass.c:338-uclass_find_device_by_seq() 0 > >> drivers/core/uclass.c:346-uclass_find_device_by_seq()- 0 > 'gpio@7e20' > >> > >> drivers/core/uclass.c:349-uclass_find_device_by_seq()- found > >> drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple() > >> pci_bridge_drv pci_0:0.0: set_state_simple op missing > >> drivers/core/device.c:184- device_bind_common() Bound device nvme#0 to > >> pci_0:0.0 > >> U-Boot> pci > >> > DEBUG.driver-model,drivers/core/uclass.c:338-uclass_find_device_by_seq() 0 > >> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq() > >> - 0 'pcie@7d50' > >> DEBUG.driver-model,drivers/core/uclass.c:349-uclass_find_device_by_seq() > >> - found > >> BusDevFun VendorId DeviceId Device Class Sub-Class > >> _ > >> 00.00.00 0x14e4 0x2711 Bridge device 0x04 > >> > DEBUG.driver-model,drivers/core/uclass.c:338-uclass_find_device_by_seq() 1 > >> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq() > >> - 0 'pcie@7d50' > >> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq() > >> - 1 'pci_0:0.0' > >> DEBUG.driver-model,drivers/core/uclass.c:349-uclass_find_device_by_seq() > >> - found > >> 01.00.00 0x1e0f 0x0001 Mass storage controller 0x08 > >> > DEBUG.driver-model,drivers/core/uclass.c:338-uclass_find_device_by_seq() 2 > >> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq() > >> - 0 'pcie@7d50' > >> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq() > >> - 1 'pci_0:0.0' > >> DEBUG.driver-model,drivers/core/uclass.c:353-uclass_find_device_by_seq() > >> - not found > >> > >> It should be pci_1:0.0 I think > >> > >> On Thu, Feb 9, 2023 at 11:22 AM Ignatius Rivaldi < > minecraft2...@gmail.com> > >> wrote: > > > > (please try not to top post) > > > > I don't know what is going on here. The PCI scan seems to show the > > wrong device, as you say. Perhaps it is a bug in the bcm controller > > driver? > > > > +Michal Suchanek > > +Stefan Roese > > I've not used the NVMe driver in U-Boot yet, but at least the PCI class > and subclass ID seem to be fine AFAIT: > > class code = 0x01 (Mass storage controller) > sub class code = 0x08 > programming interface = 0x02 > > Are other PCI drivers probed correctly, if you can test this on your > board? E.g. an Intel E1000 PCIe board perhaps? > > Added Bin, perhaps he has some further ideas. > > Thanks, > Stefan > > (for some reason your email got sent to my spam folder) I'm installing the u-boot to the NVMe drive as the CM4 I have doesn't have eMMC And CM4 only have 1 PCIe lane so I can't add another PCIe device I think Home Assistant OS 9.5 which is based on u-boot 2022.1 works with my hardware, as the green LED is blinking. But I'm not sure as it seems that their rpi4 build doesn't enable serial console. Thanks Ignatius > > > > Regards, > > SImon > > > > > >> > >>> Hi all, > >>> > >>> I'm using U-boot 2022.07 from Yocto Langdale distribution, with the > >>> following NVMe related kconfigs manually enabled through menuconfig: > >>> > >>> CONFIG_NVME > >>> CONFIG_NVME_PCI > >>> CONFIG_CMD_NVME > >>> > >>> and logging turned into max > >>> > >>> The SSD is Kioxia SSD, and it works with Pi 4 bootloader as I can boot > >>> Raspberry Pi OS from the NVMe drive. > >>> > >>> U boot is installed in the fat32 partition in the NVMe SSD for this > Yocto > >>> poky build. > >>> > >>> When I boot to U boot prompt, I can see that the SSD is detected by pci > >>> U-Boot> pci long > >>> 0 > >>>- 0 'pcie@7d50' > >>>- found > >>> > >>> Found PCI device 00.00.00: > >>> vendor ID = 0x14e4 > >>> device ID = 0x2711 > >>> command register ID = 0x0006 > >>> status register = 0x0010 > >>> revision ID = 0x20 > >>> class code = 0x06 (Bridge device) > >>> sub class code = 0x04 > >>> programming interface = 0x00 > >>> cache line = 0x08 > >>> latency time =0x00 > >>> header type = 0x01 > >>> BIST =0x00 > >>> base address 0 = 0x > >>>
Re: [PATCH v3 61/95] kconfig: Support writing separate SPL files
On Tue, Feb 14, 2023 at 03:42:53PM -0700, Simon Glass wrote: > Hi Tom, > > On Tue, 14 Feb 2023 at 13:51, Tom Rini wrote: > > > > On Tue, Feb 14, 2023 at 12:59:34PM -0700, Simon Glass wrote: > > > Hi Tom, > > > > > > On Tue, 14 Feb 2023 at 10:38, Tom Rini wrote: > > > > > > > > On Tue, Feb 14, 2023 at 09:58:59AM -0700, Simon Glass wrote: > > > > > Hi Tom, > > > > > > > > > > On Tue, 14 Feb 2023 at 09:31, Tom Rini wrote: > > > > > > > > > > > > On Sun, Feb 12, 2023 at 04:16:04PM -0700, Simon Glass wrote: > > > > > > > > > > > > > At present kconfig writes out several files, including: > > > > > > > > > > > > > >auto.conf - CONFIG settings used by make > > > > > > >autoconf.h - header file used by C code > > > > > > > > > > > > > > This works well but is a bit ugly in places, for example > > > > > > > requiring the use > > > > > > > of a SPL_TPL_ macro in Makefiles to distinguish between options > > > > > > > intended > > > > > > > for SPL and U-Boot proper. > > > > > > > > > > > > > > Update the kconfig tool to also output separate files for each > > > > > > > phase: e.g. > > > > > > > auto_spl.conf and autoconf_spl.h > > > > > > > > > > > > > > These are similar to the existing files, but drop the SPL_ prefix > > > > > > > so that > > > > > > > SPL_TPL_ is not needed. It also allows the CONFIG_IS_ENABLED() > > > > > > > macro to be > > > > > > > simplified, in a later patch, eventually replacing it with > > > > > > > IS_ENABLED(). > > > > > > > > > > > > > > When CONFIG_FOO is used within SPL, it means that FOO is enabled > > > > > > > in that > > > > > > > SPL phase. For example if CONFIG_SPL_FOO is enabled in the > > > > > > > Kconfig, that > > > > > > > means that CONFIG_FOO will be enabled in the SPL phase. So the > > > > > > > SPL builds > > > > > > > can just use CONFIG_FOO to check it. There is no need to use > > > > > > > CONFIG_SPL_FOO or CONFIG_IS_ENABLED() anymore. > > > > > > > > > > > > > > This of course means that if there is a need to access a PPL > > > > > > > symbol from > > > > > > > an SPL build, there is no way to do it. To copy with that, we > > > > > > > need a > > > > > > > CONFIG_PPL_FOO to be visibilty to all SPL builds. > > > > > > > > > > > > > > So this change also adds new PPL_ output for U-Boot proper > > > > > > > (Primary > > > > > > > Program Loader). So every CONFIG_FOO that is enabled in PPL also > > > > > > > has a > > > > > > > CONFIG_PPL_FOO > > > > > > > > > > > > > > This allows SPL to access the TEXT_BASE for U-Boot proper, for > > > > > > > example, so > > > > > > > it knows where to load it. There are about 30 places where this > > > > > > > is needed, > > > > > > > in addition to TEXT_BASE. The environment has the same problem, > > > > > > > adding > > > > > > > another dozen or so caes in include/config_distro_bootcmd.h but > > > > > > > it has > > > > > > > been decided to ignore that for now. > > > > > > > > > > > > > > The feature is controlled by an environment variable, since it > > > > > > > seems to be > > > > > > > bad form to add flags to the conf tool. > > > > > > > > > > > > > > Rebuild the autoconf files if the split config is not present. > > > > > > > This allows > > > > > > > building this commit as part of a chain, without generating build > > > > > > > errors. > > > > > > > > > > > > > > These changes may benefit from some reworking to send upstream, > > > > > > > e.g. to > > > > > > > use a struct for the 'arg' parameter. > > > > > > > > > > > > > > Signed-off-by: Simon Glass > > > > > > > > > > > > This patch, I think, is where my largest problem is. We go from > > > > > > being > > > > > > able to say "if CONFIG_SPL_FOO is undefined, it is false" to "we > > > > > > must > > > > > > define CONFIG_SPL_FOO to false". There's around 150 cases of this, > > > > > > with > > > > > > the series. Why can we not extend the PPL logic (which I'm not super > > > > > > happy with, but, I understand and I think an audit of everything > > > > > > not-TEXT_BASE should be fairly straight forward), to say that if > > > > > > CONFIG_FOO exists and CONFIG_SPL_FOO does not exist, say > > > > > > CONFIG_SPL_FOO > > > > > > is now false. > > > > > > > > > > Well it is all about choices. > > > > > > > > > > We don't have to add a CONFIG_SPL_xxx to tell Kconfig that the PPL > > > > > symbol controls all phases. We can use the conf_nospl file instead. > > > > > But then the entire description is not in Kconfig. Of course, we might > > > > > expect that some of those things in conf_nospl might end up needing to > > > > > be controlled in SPL, so perhaps that file would shrink? Not sure > > > > > about that, though. > > > > > > > > > > It isn't just SPL , BTW. We might have any xPL symbol defined. > > > > > > > > > > I suppose you are thinking of something like: > > > > > > > > > > #define CONFIG_IS_ENABLED(x) IS_ENABLED(CONFIG_ ## xpl_prefix ## x) > > > > > || > > > > >( IS_ENABLED(CONFIG_ ## x) && !IS_ENABLED(CONFIG_ SPL_
[PATCH] efi_loader: fix wrong attribute check for QueryVariableInfo
QueryVariableInfo with EFI_VARIABLE_HARDWARE_ERROR_RECORD is accepted, remove wrong attribute check. Fixes: 454a9442fbce ("efi_loader: update attribute check for QueryVariableInfo()") Signed-off-by: Masahisa Kojima --- lib/efi_loader/efi_variable.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index b12e79d658..f1d967cd0e 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -385,9 +385,6 @@ efi_status_t efi_query_variable_info_int(u32 attributes, EFI_VARIABLE_RUNTIME_ACCESS) return EFI_INVALID_PARAMETER; - if (attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) - return EFI_UNSUPPORTED; - if (attributes & ~(u32)EFI_VARIABLE_MASK) return EFI_INVALID_PARAMETER; -- 2.17.1
[PATCH v2] efi_loader: update SetVariable attribute check
UEFI specification v2.10 says that EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and EFI_UNSUPPORTED should be returned in SetVariable variable service. Current implementation returns EFI_INVALID_PARAMETER, let's fix the return value. Together with above change, this commit also updates the SetVariable attribute check to be aligned with the EDK2 reference implementation. Signed-off-by: Masahisa Kojima --- Changes in v2: - fix coding style - HR must be set with NV lib/efi_loader/efi_variable.c | 33 ++--- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index 4c85cfa607..b12e79d658 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -230,9 +230,31 @@ efi_status_t efi_set_variable_int(const u16 *variable_name, u64 time = 0; enum efi_auth_var_type var_type; - if (!variable_name || !*variable_name || !vendor || - ((attributes & EFI_VARIABLE_RUNTIME_ACCESS) && -!(attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS))) + if (!variable_name || !*variable_name || !vendor) + return EFI_INVALID_PARAMETER; + + if (data_size && !data) + return EFI_INVALID_PARAMETER; + + /* EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated */ + if (attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS || + (!(attributes & EFI_VARIABLE_MASK))) + return EFI_UNSUPPORTED; + + /* Make sure if runtime bit is set, boot service bit is set also */ + if ((attributes & +(EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == + EFI_VARIABLE_RUNTIME_ACCESS) + return EFI_INVALID_PARAMETER; + + /* only EFI_VARIABLE_NON_VOLATILE attribute is invalid */ + if ((attributes & EFI_VARIABLE_MASK) == EFI_VARIABLE_NON_VOLATILE) + return EFI_INVALID_PARAMETER; + + /* Make sure HR is set with NV */ + if ((attributes & +(EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_HARDWARE_ERROR_RECORD)) == + EFI_VARIABLE_HARDWARE_ERROR_RECORD) return EFI_INVALID_PARAMETER; /* check if a variable exists */ @@ -281,8 +303,6 @@ efi_status_t efi_set_variable_int(const u16 *variable_name, /* authenticate a variable */ if (IS_ENABLED(CONFIG_EFI_SECURE_BOOT)) { - if (attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) - return EFI_INVALID_PARAMETER; if (attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) { u32 env_attr; @@ -300,8 +320,7 @@ efi_status_t efi_set_variable_int(const u16 *variable_name, } } else { if (attributes & - (EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | -EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)) { + EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) { EFI_PRINT("Secure boot is not configured\n"); return EFI_INVALID_PARAMETER; } -- 2.17.1
Re: [PATCH] efi_loader: update SetVariable attribute check
On Tue, 14 Feb 2023 at 20:15, Heinrich Schuchardt wrote: > > On 2/14/23 10:19, Masahisa Kojima wrote: > > UEFI specification v2.10 says that > > EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and > > EFI_UNSUPPORTED should be returned in SetVariable variable service. > > Current implementation returns EFI_INVALID_PARAMETER, > > let's fix the return value. > > > > Together with above change, this commit also updates the SetVariable > > attribute check to be aligned with the EDK2 reference implementation. > > > > Signed-off-by: Masahisa Kojima > > --- > > lib/efi_loader/efi_variable.c | 30 +++--- > > 1 file changed, 23 insertions(+), 7 deletions(-) > > > > diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c > > index 4c85cfa607..1076ff7585 100644 > > --- a/lib/efi_loader/efi_variable.c > > +++ b/lib/efi_loader/efi_variable.c > > @@ -230,9 +230,28 @@ efi_status_t efi_set_variable_int(const u16 > > *variable_name, > > u64 time = 0; > > enum efi_auth_var_type var_type; > > > > - if (!variable_name || !*variable_name || !vendor || > > - ((attributes & EFI_VARIABLE_RUNTIME_ACCESS) && > > - !(attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS))) > > + if (!variable_name || !*variable_name || !vendor) > > + return EFI_INVALID_PARAMETER; > > + > > + if (data_size != 0 && !data) > > We tend to not use '!= 0' and ' == 0' in logical constraints. You could use > > if (data_size && !data) > > instead. OK. > > > + return EFI_INVALID_PARAMETER; > > + > > + /* EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated */ > > + if (attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS || > > + ((attributes & EFI_VARIABLE_MASK) == 0)) > > !(attributes & EFI_VARIABLE_MASK) OK. > > > + return EFI_UNSUPPORTED; > > + > > + /* Make sure if runtime bit is set, boot service bit is set also */ > > + if ((attributes & > > + (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) > > == > > + EFI_VARIABLE_RUNTIME_ACCESS) > > + return EFI_INVALID_PARAMETER; > > + > > + /* only EFI_VARIABLE_NON_VOLATILE attribute is invalid */ > > + if ((attributes & EFI_VARIABLE_MASK) == EFI_VARIABLE_NON_VOLATILE) > > + return EFI_INVALID_PARAMETER; > > + > > + if (attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) > > return EFI_INVALID_PARAMETER; > > Variables with flags NV, BS, RT, HR, name HwErrRec, and GUID > EFI_HARDWARE_ERROR_VARIABLE are allowable according to the UEFI spec. > Why do we return EFI_INVALID_PARAMETER here? Sorry, I misunderstood EDK2 implementation. I will update to check HR must be set with NV. 454a9442fb(efi_loader: update attribute check for QueryVariableInfo()) also does wrong check for HR, I will fix it. > > Please, sort the checks above such that all EFI_INVALID_PARAMETER are > together followed by EFI_UNSUPPORTED. SCT SIE(Security Interface Extension) expects that deprecated EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS attribute check is first priority. So let me prioritise EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS check. In the next version, the error check order is: - basic parameter check such as variable_name is NULL - deprecated and unsupported attribute check - invalid attribute check Thanks, Masahisa Kojima > > Best regards > > Heinrich > > > > > /* check if a variable exists */ > > @@ -281,8 +300,6 @@ efi_status_t efi_set_variable_int(const u16 > > *variable_name, > > > > /* authenticate a variable */ > > if (IS_ENABLED(CONFIG_EFI_SECURE_BOOT)) { > > - if (attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) > > - return EFI_INVALID_PARAMETER; > > if (attributes & > > EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) { > > u32 env_attr; > > @@ -300,8 +317,7 @@ efi_status_t efi_set_variable_int(const u16 > > *variable_name, > > } > > } else { > > if (attributes & > > - (EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | > > - EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)) { > > + EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) { > > EFI_PRINT("Secure boot is not configured\n"); > > return EFI_INVALID_PARAMETER; > > } >
arm: lib1funcs.S: Plan to resync Linux code?
Hi Marek, Do you have plans to resync Linux lib1funcs.S to u-boot? Tom mentioned it it this thread: https://lists.denx.de/pipermail/u-boot/2023-January/504287.html And one of the reasons it came up was that an armv5 board (Pogo V4) has both CONFIG_LTO and CONFIG_SYS_THUMB_BUILD enabled. And we experienced build failure, so we had to disable CONFIG_LTO: https://lists.denx.de/pipermail/u-boot/2022-November/500460.html It would be great to have the lib1funcs.S resync with Linux again, so we can reduce the binary size when needed. I don't have enough experience with ARM assembler code to attempt that task, but I would volunteer to be a tester for a few armv5 boards (Marvell Kirkwood) and armv7 (Marvell Armada 385) boards. Thanks, Tony
Re: [PATCH v5 01/11] schemas: Add schema for U-Boot driver model 'phase tags'
U-Boot has some particular challenges with device tree and devices: - U-Boot has multiple build phases, such as a Secondary Program Loader (SPL) phase which typically runs in a pre-SDRAM environment where code and data space are limited. In particular, there may not be enough space for the full device tree blob. U-Boot uses various automated techniques to reduce the size from perhaps 40KB to 3KB. It is not always possible to handle these tags entirely at build time, since U-Boot proper must have the full device tree, even though we do not want it to process all nodes until after relocation. - Some U-Boot phases needs to run before the clocks are properly set up, where the CPU may be running very slowly. Therefore it is important to bind only those devices which are actually needed in that phase - U-Boot uses lazy initialisation for its devices, with 'bind' and 'probe' being separate steps. Even if a device is bound, it is not actually probed until it is used. This is necessary to keep the boot time reasonable, e.g. to under a second The phases of U-Boot in order are: TPL, VPL, SPL, U-Boot (first pre-relocation, then post-relocation). ALl but the last two are optional. For the above reasons, U-Boot only includes the full device tree in the final 'U-Boot proper' build. Even then, before relocation U-Boot only processes nodes which are marked as being needed. For this to work, U-Boot's driver model[1] provides a way to mark device tree nodes as applicable for a particular phase. This works by adding a tag to the node, e.g.: cru: clock-controller@ff76 { bootph-all; compatible = "rockchip,rk3399-cru"; reg = <0x0 0xff76 0x0 0x1000>; rockchip,grf = <>; #clock-cells = <1>; #reset-cells = <1>; ... }; Here the "bootph-all" tag indicates that the node must be present in all phases, since the clock driver is required. There has been discussion over the years about whether this could be done in a property instead, e.g. options { bootph-all = <> <_a> ...; ... }; Some problems with this: - we need to be able to merge several such tags from different .dtsi files since many boards have their own specific requirements - it is hard to find and cross-reference the affected nodes - it is more error-prone - it requires significant tool rework in U-Boot, including fdtgrep and the build system - is harder (slower, more code) to process since it involves scanning another node/property to find out what to do with a particular node - we don't want to add phandle arguments to the above since we are referring, e.g., to the clock device as a whole, not a paricular clock - the of-platdata feature[2], which converts device tree to C for even more constrained environments, would need to become aware of the /options node There is also the question about whether this needs to be U-Boot-specific, or whether the tags could be generic. From what I can tell, U-Boot is the only bootloader which seriously attempts to use a runtime device tree in all cases. For this version, an attempt is made to name the phases in a generic manner. It should also be noted that the approach provided here has stood the test of time, used in U-Boot for 8 years so far. So add the schema for this. This will allow a major class of schema exceptions to be dropped from the U-Boot source tree. This has been applied upstream[3] [1] https://u-boot.readthedocs.io/en/latest/develop/driver-model/index.html [2] https://u-boot.readthedocs.io/en/latest/develop/driver-model/of-plat.html [3] https://github.com/devicetree-org/dt-schema/commit/63bd847 Signed-off-by: Simon Glass --- (no changes since v2) Changes in v2: - Add binding document doc/device-tree-bindings/bootph.yaml | 88 1 file changed, 88 insertions(+) create mode 100644 doc/device-tree-bindings/bootph.yaml Applied to u-boot-dm/next, thanks!
Re: [PATCH v5 03/11] dm: dts: Convert driver model tags to use new schema
Now that Linux has accepted these tags, move the device tree files in U-Boot over to use them. Signed-off-by: Simon Glass --- (no changes since v3) Changes in v3: - Rebase to master again, with new conversions Changes in v2: - Convert k3-am68-sk boards also arch/arc/dts/abilis_tb100.dts | 2 +- arch/arc/dts/axc001.dtsi | 2 +- arch/arc/dts/axc003.dtsi | 2 +- arch/arc/dts/axs10x_mb.dtsi | 6 +- arch/arc/dts/emsdp.dts| 2 +- arch/arc/dts/hsdk-common.dtsi | 2 +- arch/arc/dts/iot_devkit.dts | 2 +- arch/arc/dts/nsim.dts | 2 +- arch/arc/dts/skeleton.dtsi| 2 +- arch/arm/dts/am335x-brppt1-mmc-u-boot.dtsi| 48 +- arch/arm/dts/am335x-brsmarc1.dts | 28 +++--- arch/arm/dts/am335x-brxre1.dts| 22 ++--- arch/arm/dts/am335x-evm-u-boot.dtsi | 22 ++--- arch/arm/dts/am335x-evmsk-u-boot.dtsi | 4 +- arch/arm/dts/am335x-guardian-u-boot.dtsi | 28 +++--- arch/arm/dts/am335x-pdu001-u-boot.dtsi| 30 +++ arch/arm/dts/am335x-pxm50-u-boot.dtsi | 4 +- arch/arm/dts/am335x-regor-rdk-u-boot.dtsi | 8 +- arch/arm/dts/am335x-rut-u-boot.dtsi | 4 +- .../dts/am335x-sancloud-bbe-lite-u-boot.dtsi | 18 ++-- arch/arm/dts/am335x-shc-u-boot.dtsi | 20 ++--- arch/arm/dts/am335x-wega-rdk-u-boot.dtsi | 14 +-- arch/arm/dts/am33xx-u-boot.dtsi | 2 +- arch/arm/dts/am3517-evm-u-boot.dtsi | 18 ++-- arch/arm/dts/am4372-generic-u-boot.dtsi | 4 +- arch/arm/dts/am4372-u-boot.dtsi | 20 ++--- arch/arm/dts/am437x-gp-evm-u-boot.dtsi| 24 ++--- arch/arm/dts/am437x-idk-evm-u-boot.dtsi | 8 +- arch/arm/dts/am437x-sk-evm-u-boot.dtsi| 8 +- arch/arm/dts/armada-3720-eDPU-u-boot.dtsi | 6 +- arch/arm/dts/armada-3720-uDPU-u-boot.dtsi | 6 +- arch/arm/dts/armada-385-atl-x530-u-boot.dtsi | 2 +- .../dts/armada-385-turris-omnia-u-boot.dtsi | 12 +-- arch/arm/dts/armada-388-clearfog-u-boot.dtsi | 18 ++-- arch/arm/dts/armada-388-helios4-u-boot.dtsi | 20 ++--- .../armada-38x-controlcenterdc-u-boot.dtsi| 12 +-- arch/arm/dts/armada-ap80x-quad.dtsi | 8 +- .../arm/dts/armada-xp-theadorable-u-boot.dtsi | 2 +- arch/arm/dts/ast2500-evb.dts | 8 +- arch/arm/dts/ast2500-u-boot.dtsi | 8 +- arch/arm/dts/ast2600-evb.dts | 6 +- arch/arm/dts/ast2600-u-boot.dtsi | 10 +-- .../dts/at91-sam9x60_curiosity-u-boot.dtsi| 34 +++ arch/arm/dts/at91-sama5d27_giantboard.dts | 16 ++-- arch/arm/dts/at91-sama5d27_som1_ek.dts| 24 ++--- .../dts/at91-sama5d27_wlsom1_ek-u-boot.dtsi | 20 ++--- arch/arm/dts/at91-sama5d2_icp-u-boot.dtsi | 18 ++-- arch/arm/dts/at91-sama5d2_ptc_ek.dts | 18 ++-- arch/arm/dts/at91-sama5d2_xplained.dts| 38 arch/arm/dts/at91-sama5d3_xplained.dts| 14 +-- arch/arm/dts/at91-sama5d4_xplained.dts| 20 ++--- arch/arm/dts/at91-sama5d4ek.dts | 20 ++--- arch/arm/dts/at91-sama7g5ek-u-boot.dtsi | 24 ++--- arch/arm/dts/at91sam9260-smartweb.dts | 4 +- arch/arm/dts/at91sam9260.dtsi | 26 +++--- arch/arm/dts/at91sam9260ek.dts| 4 +- arch/arm/dts/at91sam9261.dtsi | 26 +++--- arch/arm/dts/at91sam9263.dtsi | 26 +++--- arch/arm/dts/at91sam9263ek.dts| 4 +- arch/arm/dts/at91sam9g15ek.dts| 2 +- arch/arm/dts/at91sam9g20-taurus.dts | 6 +- arch/arm/dts/at91sam9g20ek_common.dtsi| 4 +- ...1sam9g25-gardena-smart-gateway-u-boot.dtsi | 2 +- arch/arm/dts/at91sam9g35ek.dts| 2 +- arch/arm/dts/at91sam9g45-corvus.dts | 4 +- arch/arm/dts/at91sam9g45-gurnard.dts | 4 +- arch/arm/dts/at91sam9g45.dtsi | 12 +-- arch/arm/dts/at91sam9m10g45ek.dts | 4 +- arch/arm/dts/at91sam9n12.dtsi | 26 +++--- arch/arm/dts/at91sam9n12ek.dts| 4 +- arch/arm/dts/at91sam9rl.dtsi | 30 +++ arch/arm/dts/at91sam9rlek.dts | 4 +- arch/arm/dts/at91sam9x35ek.dts| 2 +- arch/arm/dts/at91sam9x5.dtsi | 14 +-- arch/arm/dts/at91sam9x5dm.dtsi| 4 +- arch/arm/dts/at91sam9x5ek.dtsi| 4 +- arch/arm/dts/bcm283x-u-boot.dtsi | 10 +-- arch/arm/dts/bcm63158.dtsi| 4 +- arch/arm/dts/bcm6855.dtsi | 4 +- arch/arm/dts/bcm6856.dtsi | 4 +- arch/arm/dts/bcm6858.dtsi | 4 +- arch/arm/dts/bcm96753ref.dts | 2 +- arch/arm/dts/bcm968360bg.dts | 2 +- arch/arm/dts/bcm968580xref.dts| 2 +-
Re: [PATCH v5 06/11] dm: doc: Update documentation for new driver model schema
Now that Linux has accepted these tags, move U-Boot over to use them. Tidy up the comments and formatting, making sure that VPL is mentioned too. Signed-off-by: Simon Glass --- Changes in v5: - Add a note to the SPL file about the migration doc/README.TPL| 4 +-- doc/develop/driver-model/design.rst | 15 +-- .../driver-model/fs_firmware_loader.rst | 4 +-- doc/develop/driver-model/of-plat.rst | 25 ++- doc/develop/driver-model/pci-info.rst | 10 doc/develop/driver-model/serial-howto.rst | 24 +- doc/develop/spl.rst | 9 +-- 7 files changed, 49 insertions(+), 42 deletions(-) Applied to u-boot-dm/next, thanks!
Re: [PATCH v5 09/11] CI: Add a check for pre-schema driver model tags
These should not be used anymore. Add a check to ensure they don't creek back into U-Boot. Use bootph-... instead. Signed-off-by: Simon Glass --- (no changes since v3) Changes in v3: - Add a new patch to check for pre-schema driver model tags in CI .azure-pipelines.yml | 12 .gitlab-ci.yml | 9 + 2 files changed, 21 insertions(+) Applied to u-boot-dm/next, thanks!
Re: [PATCH v5 10/11] test: Add a way to set the environment for a pytest
This is useful when we need to control a particular environment variable. Add a way to handle this. Signed-off-by: Simon Glass --- (no changes since v4) Changes in v4: - Add new patch with a way to set the environment for a pytest test/py/multiplexed_log.py | 5 +++-- test/py/u_boot_utils.py| 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) Applied to u-boot-dm/next, thanks!
Re: [PATCH v5 02/11] dm: Add support for handling old u-boot, dm- tags
On 2/13/23 16:56, Simon Glass wrote: > Add a CONFIG option to deal with this automatically, printing a warning > when U-Boot starts up. This can be useful if the device tree comes from > another project. > > We will maintain this through the 2023.07 release, providing 6 months > for people to notice. > > Signed-off-by: Simon Glass > Version 4: This line above shouldn't be there. M Applied to u-boot-dm/next, thanks!
Re: [PATCH v5 05/11] dm: doc: Update device tree binding docs for new schema
Now that Linux has accepted these tags, move U-Boot over to use them. Signed-off-by: Simon Glass --- (no changes since v1) doc/device-tree-bindings/chosen.txt | 2 +- .../clock/rockchip,rk3368-dmc.txt | 2 +- .../clock/rockchip,rk3399-dmc.txt | 2 +- .../clock/st,stm32mp1.txt | 22 +-- doc/device-tree-bindings/device.txt | 6 ++--- .../fsp/fsp2/apollolake/fsp-s.txt | 2 +- .../memory-controller/k3-j721e-ddrss.txt | 2 +- .../memory-controllers/k3-am654-ddrss.txt | 2 +- doc/device-tree-bindings/misc/fs_loader.txt | 8 +++ doc/device-tree-bindings/net/mdio-mux-reg.txt | 2 +- doc/device-tree-bindings/pci/x86-pci.txt | 4 ++-- .../pinctrl/nexell,s5pxx18-pinctrl.txt| 2 +- .../ram/fsl,mpc83xx-mem-controller.txt| 2 +- .../video/atmel-hlcdc.txt | 2 +- 14 files changed, 30 insertions(+), 30 deletions(-) Applied to u-boot-dm/next, thanks!
Re: [PATCH v5 07/11] dm: doc: Move to new driver model schema
Now that Linux has accepted these tags, update the dtoc tool to use them. Signed-off-by: Simon Glass --- (no changes since v1) tools/dtoc/dtb_platdata.py | 10 +- tools/dtoc/test/dtoc_test_add_prop.dts | 4 ++-- tools/dtoc/test/dtoc_test_addr32.dts | 4 ++-- tools/dtoc/test/dtoc_test_addr32_64.dts| 6 +++--- tools/dtoc/test/dtoc_test_addr64.dts | 6 +++--- tools/dtoc/test/dtoc_test_addr64_32.dts| 6 +++--- tools/dtoc/test/dtoc_test_alias_bad.dts| 6 +++--- tools/dtoc/test/dtoc_test_alias_bad_path.dts | 6 +++--- tools/dtoc/test/dtoc_test_alias_bad_uc.dts | 6 +++--- tools/dtoc/test/dtoc_test_aliases.dts | 4 ++-- tools/dtoc/test/dtoc_test_driver_alias.dts | 2 +- tools/dtoc/test/dtoc_test_inst.dts | 6 +++--- tools/dtoc/test/dtoc_test_invalid_driver.dts | 2 +- tools/dtoc/test/dtoc_test_noparent.dts | 6 +++--- tools/dtoc/test/dtoc_test_noprops.dts | 2 +- tools/dtoc/test/dtoc_test_phandle.dts | 10 +- tools/dtoc/test/dtoc_test_phandle_bad.dts | 2 +- tools/dtoc/test/dtoc_test_phandle_bad2.dts | 4 ++-- tools/dtoc/test/dtoc_test_phandle_cd_gpios.dts | 10 +- tools/dtoc/test/dtoc_test_phandle_reorder.dts | 4 ++-- tools/dtoc/test/dtoc_test_phandle_single.dts | 4 ++-- tools/dtoc/test/dtoc_test_simple.dts | 10 +- tools/dtoc/test/dtoc_test_single_reg.dts | 4 ++-- 23 files changed, 62 insertions(+), 62 deletions(-) Applied to u-boot-dm/next, thanks!
Re: [PATCH v5 08/11] checkpatch: Add a warning for pre-schema driver model tags
Help ensure that these don't creep into development by adding a check in checkpatch for them. Signed-off-by: Simon Glass --- (no changes since v3) Changes in v3: - Add a new patch to warn about pre-schema driver model tags scripts/checkpatch.pl | 6 ++ tools/patman/test_checkpatch.py | 6 ++ 2 files changed, 12 insertions(+) Applied to u-boot-dm/next, thanks!
Re: [PATCH v5 04/11] dm: treewide: Complete migration to new driver model schema
Update various build and test components to use the new schema. Signed-off-by: Simon Glass --- (no changes since v1) drivers/core/ofnode.c| 10 +- drivers/video/video-uclass.c | 4 ++-- dts/Kconfig | 2 +- include/dm/device.h | 2 +- include/dm/ofnode.h | 10 +- test/dm/test-fdt.c | 2 +- test/py/tests/test_ofplatdata.py | 8 tools/binman/binman.rst | 3 +-- tools/dtoc/test_fdt.py | 8 9 files changed, 24 insertions(+), 25 deletions(-) Applied to u-boot-dm/next, thanks!
Re: [PATCH v5 11/11] dm: test: Add a test for the various migration combinations
Test that: - sandbox shows a warning when an unmigrated DT is used - sandbox fails to run when migration is turned off - sandbox_spl fails to build when migration is turned off Signed-off-by: Simon Glass --- Changes in v5: - Ensure that the old tags are supported in each commit of this series Changes in v4: - Add new patch with a test for the various migration combinations test/py/tests/test_of_migrate.py | 108 +++ 1 file changed, 108 insertions(+) create mode 100644 test/py/tests/test_of_migrate.py Applied to u-boot-dm/next, thanks!
Re: bind/unbind command not working for usb_ether
On Tue, Feb 14, 2023 at 4:31 PM Marek Vasut wrote: > > On 2/15/23 01:11, Tim Harvey wrote: > > On Sat, Aug 13, 2022 at 7:59 AM Simon Glass wrote: > >> > > > >>> > >>> Simon, > >>> > >>> Now that we have identified a fix needed to uclass_get_by_name to fix > >>> the dm bind command, can you comment on the other issue we have run > >>> into trying to use usb_ether? > >>> > >>> Here's an example with some debugging: > >>> Ventana > net list > >>> device_probe ethernet@2188000 flags=0x1043 > >>> eth0 : ethernet@2188000 00:d0:12:f3:f2:f5 active > >>> Ventana > bind usb 0 usb_ether > >>> Ventana > net list > >>> eth0 : ethernet@2188000 00:d0:12:f3:f2:f5 active > >>> eth1 : usb_ether 00:00:00:00:00:00 > >>> Ventana > setenv ethact eth1 > >>> Ventana > ping 192.168.1.146 > >>> device_probe ethernet@2188000 flags=0x1043 > >>> device_probe usb_ether flags=0x4a > >>> device_probe usb@2184000 flags=0x1042 > >>> device_probe bus@210 flags=0x1051 > >>> device_probe usbotggrp flags=0x40 > >>> device_probe iomuxc@20e flags=0x1041 > >>> device_probe iomuxc@20e flags=0x1041 > >>> device_probe regulator-usb-otg-vbus flags=0x52 > >>> device_probe gpio@20a4000 flags=0x1043 > >>> device_probe root_driver flags=0x1041 > >>> device_probe iomuxc@20e flags=0x1041 > >>> usb_eth_probe usb_ether > >>> usb_eth_start > >>> usb_setup_ehci_gadget > >>> usb_setup_ehci_gadget removing old device 'usb@2184000' > >>> device_remove usb@2184000 > >>> device_remove usb_ether > >>> usb_eth_stop > >>> usb_setup_ehci_gadget probing 'usb@2184000' > >>> device_probe usb@2184000 flags=0x42 > >>> device_probe bus@210 flags=0x1051 > >>> device_probe usbotggrp flags=0x1041 > >>> device_probe regulator-usb-otg-vbus flags=0x1053 > >>> usb_setup_ehci_gadget done > >>> ^^^ hangs here - notice usb controller and the usb_ether child were > >>> removed then usb controller probed again (but not usb_ether) > >>> > >>> fbeceb260232 ("dm: usb: Allow setting up a USB controller as a > >>> device/gadget") adds the usb_setup_ehci_gadget() function which > >>> removes the old USB controller device (and its usb_ether child) then > >>> probes only the USB controller leaving the usb_ether device un-probed. > >>> The commit log makes it sound like something isn't complete: > >>> > >>> Some controllers support OTG (on-the-go) where they can operate as > >>> either > >>> host or device. The gadget layer in U-Boot supports this. > >>> > >>> While this layer does not interact with driver model, we can provide > >>> a > >>> function which sets up the controller in the correct way. This way > >>> the code > >>> at least builds (although it likely will not work). > >>> > >>> I'm not clear why the USB controller (and children) need to be removed > >>> here. If I comment out the removal and re-probe of the controller > >>> usb_ether then works fine: > >>> > >>> diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c > >>> index 27e2fc6fcd36..0882641b51b0 100644 > >>> --- a/drivers/usb/host/usb-uclass.c > >>> +++ b/drivers/usb/host/usb-uclass.c > >>> @@ -399,6 +399,7 @@ int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp) > >>> ret = uclass_find_first_device(UCLASS_USB, ); > >>> if (ret) > >>> return ret; > >>> +#if 0 > >>> ret = device_remove(dev, DM_REMOVE_NORMAL); > >>> if (ret) > >>> return ret; > >>> @@ -408,6 +409,7 @@ int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp) > >>> ret = device_probe(dev); > >>> if (ret) > >>> return ret; > >>> +#endif > >>> *ctlrp = dev_get_priv(dev); > >>> > >>> return 0; > >>> > >>> Why was it necessary to remove the USB controller and children and > >>> reprobe? > >> > >> +Marek Vasut who may know more > >> > >> I suspect that this is a bit of a hack to get the device running after > >> it is swtiched from host to device mode? > >> > >> The gadget side of things should really move to driver model. > >> > > > > Marek, > > > > Do you know if there is a proper way of binding a usb_ether gadget > > driver at runtime so as to get USB over ethernet gadget support? > > > > 'bind usb 0 usb_ether' does bind the driver but when you try to use it > > the usb controller is removed which causes a failure. > > Look around patch > > [PATCH v2] usb: gadget: ether: split start/stop from init/halt > > which is a huge bag of subtle issues in its own right. I think it is > moving in the right direction, except there seem to be additional bugs > lurking around, which need to be addressed first instead of papering > over them. Marek, Thanks for the reference - I'll take a look at Niel's patch. It doesn't address what I'm seeing but it seems to aim to resolve similar issues. Best Regards, Tim
Re: bind/unbind command not working for usb_ether
On 2/15/23 01:11, Tim Harvey wrote: On Sat, Aug 13, 2022 at 7:59 AM Simon Glass wrote: Simon, Now that we have identified a fix needed to uclass_get_by_name to fix the dm bind command, can you comment on the other issue we have run into trying to use usb_ether? Here's an example with some debugging: Ventana > net list device_probe ethernet@2188000 flags=0x1043 eth0 : ethernet@2188000 00:d0:12:f3:f2:f5 active Ventana > bind usb 0 usb_ether Ventana > net list eth0 : ethernet@2188000 00:d0:12:f3:f2:f5 active eth1 : usb_ether 00:00:00:00:00:00 Ventana > setenv ethact eth1 Ventana > ping 192.168.1.146 device_probe ethernet@2188000 flags=0x1043 device_probe usb_ether flags=0x4a device_probe usb@2184000 flags=0x1042 device_probe bus@210 flags=0x1051 device_probe usbotggrp flags=0x40 device_probe iomuxc@20e flags=0x1041 device_probe iomuxc@20e flags=0x1041 device_probe regulator-usb-otg-vbus flags=0x52 device_probe gpio@20a4000 flags=0x1043 device_probe root_driver flags=0x1041 device_probe iomuxc@20e flags=0x1041 usb_eth_probe usb_ether usb_eth_start usb_setup_ehci_gadget usb_setup_ehci_gadget removing old device 'usb@2184000' device_remove usb@2184000 device_remove usb_ether usb_eth_stop usb_setup_ehci_gadget probing 'usb@2184000' device_probe usb@2184000 flags=0x42 device_probe bus@210 flags=0x1051 device_probe usbotggrp flags=0x1041 device_probe regulator-usb-otg-vbus flags=0x1053 usb_setup_ehci_gadget done ^^^ hangs here - notice usb controller and the usb_ether child were removed then usb controller probed again (but not usb_ether) fbeceb260232 ("dm: usb: Allow setting up a USB controller as a device/gadget") adds the usb_setup_ehci_gadget() function which removes the old USB controller device (and its usb_ether child) then probes only the USB controller leaving the usb_ether device un-probed. The commit log makes it sound like something isn't complete: Some controllers support OTG (on-the-go) where they can operate as either host or device. The gadget layer in U-Boot supports this. While this layer does not interact with driver model, we can provide a function which sets up the controller in the correct way. This way the code at least builds (although it likely will not work). I'm not clear why the USB controller (and children) need to be removed here. If I comment out the removal and re-probe of the controller usb_ether then works fine: diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c index 27e2fc6fcd36..0882641b51b0 100644 --- a/drivers/usb/host/usb-uclass.c +++ b/drivers/usb/host/usb-uclass.c @@ -399,6 +399,7 @@ int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp) ret = uclass_find_first_device(UCLASS_USB, ); if (ret) return ret; +#if 0 ret = device_remove(dev, DM_REMOVE_NORMAL); if (ret) return ret; @@ -408,6 +409,7 @@ int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp) ret = device_probe(dev); if (ret) return ret; +#endif *ctlrp = dev_get_priv(dev); return 0; Why was it necessary to remove the USB controller and children and reprobe? +Marek Vasut who may know more I suspect that this is a bit of a hack to get the device running after it is swtiched from host to device mode? The gadget side of things should really move to driver model. Marek, Do you know if there is a proper way of binding a usb_ether gadget driver at runtime so as to get USB over ethernet gadget support? 'bind usb 0 usb_ether' does bind the driver but when you try to use it the usb controller is removed which causes a failure. Look around patch [PATCH v2] usb: gadget: ether: split start/stop from init/halt which is a huge bag of subtle issues in its own right. I think it is moving in the right direction, except there seem to be additional bugs lurking around, which need to be addressed first instead of papering over them.
Re: Please pull u-boot-dm into -next
On Tue, Feb 14, 2023 at 11:11:46AM -0700, Simon Glass wrote: > Hi Tom, > > This is for the -next branch > > https://source.denx.de/u-boot/custodians/u-boot-dm/-/pipelines/15198 > > > The following changes since commit faac9dee8e0629326dc122f4624fc4897e3f38b0: > > Prepare v2023.04-rc2 (2023-02-13 18:39:15 -0500) > > are available in the Git repository at: > > git://git.denx.de/u-boot-dm.git tags/dm-next-valentine > > for you to fetch changes up to 9a8a27a76ad7ab51f19c7f019d7cdac8a3f9f3c9: > > dm: test: Add a test for the various migration combinations > (2023-02-14 09:43:27 -0700) > Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: imx8mp EQOS regression in dwc_eth_qos,c
On 2/14/23 18:31, Elmar Psilog wrote: Am 13.02.23 um 22:20 schrieb Marek Vasut: On 2/13/23 22:04, Fabio Estevam wrote: Adding Marek, who has sent some EQOS patches recently. On Mon, Feb 13, 2023 at 6:02 PM Elmar Psilog wrote: Hello, Think I found a regression in EQOS driver with fixed-phy. Maybe someone with a imx8mp board might check that use case to confirm? That would be great. While ethernet was working in v2022.04 a "ping" in v2023.01 returns ERROR: no/invalid property! invalid speed 0 eqos_adjust_link() failed: -22 FAILED although devicetree/hardware kept unchanged. This happens because in file fixed.c in in function fixedphy_config() the call val = ofnode_read_u32_default(node, "speed", 0); returns 0 instead of 1000 and also the duplex is not set. Found that in file/function dwc_eth_qos.c / eqos_start() the line eqos->phy->node = eqos->phy_of_node; is responsible for losing the information. Don't know what magic happens here - so I can't fix it - I just followed the data. So all works well and even the parsing of old and new fixed-link devicetree works til that line. After that I don't get speed anymore. Maybe you can have a look at this? Try this patch (needs CONFIG_FIXED_PHY=y) : diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index d488bd0c288..592af53b352 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -791,9 +791,21 @@ static int eqos_start(struct udevice *dev) */ if (!eqos->phy) { int addr = -1; - addr = eqos_get_phy_addr(eqos, dev); - eqos->phy = phy_connect(eqos->mii, addr, dev, - eqos->config->interface(dev)); + ofnode fixed_node; + + if (IS_ENABLED(CONFIG_PHY_FIXED)) { + fixed_node = ofnode_find_subnode(dev_ofnode(dev), + "fixed-link"); + if (ofnode_valid(fixed_node)) { + eqos->phy = fixed_phy_create(dev_ofnode(dev)); + } + + if (!eqos->phy) { + addr = eqos_get_phy_addr(eqos, dev); + eqos->phy = phy_connect(eqos->mii, addr, dev, + eqos->config->interface(dev)); + } + if (!eqos->phy) { pr_err("phy_connect() failed"); goto err_stop_resets; Thanks Fabio for forwarding and Marek for the quick patch! Don't get this exactly. Bit confused about the closing "}" in if(IS_ENABLED) seems to be missed (or an else path)? Where exactly should this be? From the insertion it looks like you mean: Yes, the { shouldn't be at the end of 'if (ofnode_valid(fixed_node)) {' . + if (IS_ENABLED(CONFIG_PHY_FIXED)) { + fixed_node = ofnode_find_subnode(dev_ofnode(dev), + "fixed-link"); + if (ofnode_valid(fixed_node)) { + eqos->phy = fixed_phy_create(dev_ofnode(dev)); Add this here (*) too (see below): eqos->phy_of_node = fixed_node; + } This works too. + } + if (!eqos->phy) { + addr = eqos_get_phy_addr(eqos, dev); + eqos->phy = phy_connect(eqos->mii, addr, dev, eqos->config->interface(dev)); + } But that doesn't solve the issue. The magic line eqos->phy->node = eqos->phy_of_node; will still executed. See (*) above , does that help ? Likely a different issue but connected to EQOS: I am wondering why the clocks for ethernet look so much different if FEC is not configured. Shouldn't be the case, right? At least imx8mp.dtsi doesn't tell about any 24MHz clock. Also counter is "0"? Well, EQOS works with uncommenting the line above and this clock, but why? Each device is probed on first use, so the clock are left unconfigured until the device is actually used (e.g. for ethernet transfer). Note that there is a huge series which overhauls the EQoS and FEC clock on the ML, see: [PATCH v3 01/14] clk: imx8mp: Add EQoS MAC clock
Re: bind/unbind command not working for usb_ether
On Sat, Aug 13, 2022 at 7:59 AM Simon Glass wrote: > > > > > Simon, > > > > Now that we have identified a fix needed to uclass_get_by_name to fix > > the dm bind command, can you comment on the other issue we have run > > into trying to use usb_ether? > > > > Here's an example with some debugging: > > Ventana > net list > > device_probe ethernet@2188000 flags=0x1043 > > eth0 : ethernet@2188000 00:d0:12:f3:f2:f5 active > > Ventana > bind usb 0 usb_ether > > Ventana > net list > > eth0 : ethernet@2188000 00:d0:12:f3:f2:f5 active > > eth1 : usb_ether 00:00:00:00:00:00 > > Ventana > setenv ethact eth1 > > Ventana > ping 192.168.1.146 > > device_probe ethernet@2188000 flags=0x1043 > > device_probe usb_ether flags=0x4a > > device_probe usb@2184000 flags=0x1042 > > device_probe bus@210 flags=0x1051 > > device_probe usbotggrp flags=0x40 > > device_probe iomuxc@20e flags=0x1041 > > device_probe iomuxc@20e flags=0x1041 > > device_probe regulator-usb-otg-vbus flags=0x52 > > device_probe gpio@20a4000 flags=0x1043 > > device_probe root_driver flags=0x1041 > > device_probe iomuxc@20e flags=0x1041 > > usb_eth_probe usb_ether > > usb_eth_start > > usb_setup_ehci_gadget > > usb_setup_ehci_gadget removing old device 'usb@2184000' > > device_remove usb@2184000 > > device_remove usb_ether > > usb_eth_stop > > usb_setup_ehci_gadget probing 'usb@2184000' > > device_probe usb@2184000 flags=0x42 > > device_probe bus@210 flags=0x1051 > > device_probe usbotggrp flags=0x1041 > > device_probe regulator-usb-otg-vbus flags=0x1053 > > usb_setup_ehci_gadget done > > ^^^ hangs here - notice usb controller and the usb_ether child were > > removed then usb controller probed again (but not usb_ether) > > > > fbeceb260232 ("dm: usb: Allow setting up a USB controller as a > > device/gadget") adds the usb_setup_ehci_gadget() function which > > removes the old USB controller device (and its usb_ether child) then > > probes only the USB controller leaving the usb_ether device un-probed. > > The commit log makes it sound like something isn't complete: > > > > Some controllers support OTG (on-the-go) where they can operate as > > either > > host or device. The gadget layer in U-Boot supports this. > > > > While this layer does not interact with driver model, we can provide a > > function which sets up the controller in the correct way. This way the > > code > > at least builds (although it likely will not work). > > > > I'm not clear why the USB controller (and children) need to be removed > > here. If I comment out the removal and re-probe of the controller > > usb_ether then works fine: > > > > diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c > > index 27e2fc6fcd36..0882641b51b0 100644 > > --- a/drivers/usb/host/usb-uclass.c > > +++ b/drivers/usb/host/usb-uclass.c > > @@ -399,6 +399,7 @@ int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp) > > ret = uclass_find_first_device(UCLASS_USB, ); > > if (ret) > > return ret; > > +#if 0 > > ret = device_remove(dev, DM_REMOVE_NORMAL); > > if (ret) > > return ret; > > @@ -408,6 +409,7 @@ int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp) > > ret = device_probe(dev); > > if (ret) > > return ret; > > +#endif > > *ctlrp = dev_get_priv(dev); > > > > return 0; > > > > Why was it necessary to remove the USB controller and children and reprobe? > > +Marek Vasut who may know more > > I suspect that this is a bit of a hack to get the device running after > it is swtiched from host to device mode? > > The gadget side of things should really move to driver model. > Marek, Do you know if there is a proper way of binding a usb_ether gadget driver at runtime so as to get USB over ethernet gadget support? 'bind usb 0 usb_ether' does bind the driver but when you try to use it the usb controller is removed which causes a failure. Best Regards, Tim
Re: [PATCH 1/3] binman: add sign option for binman
On Sat, 2023-02-04 at 15:23 -0700, Simon Glass wrote: > Hi Ivan, > > On Sun, 15 Jan 2023 at 16:54, Ivan Mikhaylov > wrote: > > > > On Fri, 2023-01-13 at 11:00 -0700, Simon Glass wrote: > > > Hi Ivan, > > > > > > On Sat, 24 Dec 2022 at 15:35, Ivan Mikhaylov > > > > > > wrote: > > > > > > > > On Sat, 2022-12-17 at 15:02 -0700, Simon Glass wrote: > > > > > Hi Ivan, > > > > > > > > > > On Tue, 13 Dec 2022 at 11:51, Ivan Mikhaylov > > > > > > > > > > wrote: > > > > > > > > > > > > On Fri, 2022-11-18 at 13:50 -0700, Simon Glass wrote: > > > > > > > Hi Ivan, > > > > > > > > > > > > > > On Thu, 15 Sept 2022 at 13:44, Ivan Mikhaylov > > > > > > > > > > > > > > wrote: > > > > > > > > > > > > > > > > On Wed, 2022-09-07 at 15:10 -0600, Simon Glass wrote: > > > > > > > > > Hi Ivan, > > > > > > > > > > > > > > > > > > Section data comes from the BuildSectionData() > > > > > > > > > method, so > > > > > > > > > you > > > > > > > > > could > > > > > > > > > try calling that. > > > > > > > > > > > > > > > > > > See also collect_contents_to_file() > > > > > > > > > > > > > > > > > > Regards, > > > > > > > > > Simon > > > > > > > > > > > > > > > > Simon, I've tried both these ways and they both don't > > > > > > > > work > > > > > > > > to > > > > > > > > me. > > > > > > > > What > > > > > > > > I've got: > > > > > > > > > > > > > > > > def SignEntries(image_fname, input_fname, > > > > > > > > privatekey_fname, > > > > > > > > algo, > > > > > > > > entry_paths): > > > > > > > > image_fname = os.path.abspath(image_fname) > > > > > > > > image = Image.FromFile(image_fname) > > > > > > > > state.PrepareFromLoadedData(image) > > > > > > > > image.LoadData() > > > > > > > > > > > > > > > > 1. BuildSectionData > > > > > > > > > > > > > > > > for entry_path in entry_paths: > > > > > > > > entry = image.FindEntryPath(entry_path) > > > > > > > > > > > > > > > > try: > > > > > > > > entry.BuildSectionData(True) > > > > > > > > except Exception as e: > > > > > > > > logging.error(traceback.format_exc()) > > > > > > > > > > > > > > > > > > > > > > > > ERROR:root:AttributeError: 'NoneType' object has no > > > > > > > > attribute > > > > > > > > 'run' > > > > > > > > > > > > Hi Simon, sorry for long delay. > > > > > > > > > > > > binman: 'NoneType' object has no attribute 'run' > > > > > > > > > > > > Traceback (most recent call last): > > > > > > File "/home/fr/upstream_uboot/tools/binman/binman", line > > > > > > 133, > > > > > > in > > > > > > RunBinman > > > > > > ret_code = control.Binman(args) > > > > > > File "/home/fr/upstream_uboot/tools/binman/control.py", > > > > > > line > > > > > > 684, > > > > > > in > > > > > > Binman > > > > > > SignEntries(args.image, args.file, args.key, args.algo, > > > > > > args.paths) > > > > > > File "/home/fr/upstream_uboot/tools/binman/control.py", > > > > > > line > > > > > > 469, > > > > > > in > > > > > > SignEntries > > > > > > entry.BuildSectionData(True) > > > > > > File "/home/fr/upstream_uboot/tools/binman/etype/fit.py", > > > > > > line > > > > > > 426, > > > > > > in BuildSectionData > > > > > > if self.mkimage.run(reset_timestamp=True, > > > > > > output_fname=output_fname, > > > > > > AttributeError: 'NoneType' object has no attribute 'run' > > > > > > > > > > > > > > > > You need to call image.CollectBintolls() like ReadEntry() and > > > > > other > > > > > functions similar to yours that read images from a file. This > > > > > is > > > > > the > > > > > only way that the 'mkimage' tool becomes available to fit.py > > > > > > > > > > See fit.AddBintools() which is called by that function and > > > > > sets > > > > > 'self.mkimage' > > > > > > > > > > Simon, thanks, now this part works fine but there is still > > > > issue > > > > with > > > > updating of fit section, saw that there exists some functions > > > > like > > > > WriteData but for section(etype/fit.py) it is not implemented > > > > yet. > > > > > > > > ValueError: Node '/fit': Replacing sections is not implemented > > > > yet > > > > > > > > Also tried SetContents but it doesn't update fit section in > > > > place. > > > > Any > > > > suggestions here? > > > > > > Updating a FIT in the image is not supported, or at least not > > > tested, > > > so presumably doesn't work. > > > > > > I obtained fdt_add_pubkey > > > from > > > https://patchwork.ozlabs.org/project/uboot/list/?series=271511= > > > * > > > > > > I tried this: > > > > > > binman test testSignSimple > > > Running binman tests > > > > > > E > > > = > > > > > > = > > > ERROR: binman.ftest.TestFunctional.testSignSimple > > > (subunit.RemotedTestCase) > > > binman.ftest.TestFunctional.testSignSimple > > > - > > > > > > - > > >
Re: [PATCH 1/2] Makefile: Link with -z noexectack
On Tue, 14 Feb 2023 at 13:09, Tom Rini wrote: > > When moving to gcc-12.2 we started trying to quiet some of the new > linker warnings, that are not relevant to us. However, a > misunderstanding of the mechanics at play meant that I intentionally > omitted passing -z noexecstack to the linker, when we do need to. Add > this flag and in turn remove warnings from the linker. > > Fixes: 1e1c51f8ace8 ("Makefile: link with --no-warn-rwx-segments") > Signed-off-by: Tom Rini > --- > Makefile | 1 + > 1 file changed, 1 insertion(+) > Reviewed-by: Simon Glass
Re: [PATCH v3 61/95] kconfig: Support writing separate SPL files
Hi Tom, On Tue, 14 Feb 2023 at 13:51, Tom Rini wrote: > > On Tue, Feb 14, 2023 at 12:59:34PM -0700, Simon Glass wrote: > > Hi Tom, > > > > On Tue, 14 Feb 2023 at 10:38, Tom Rini wrote: > > > > > > On Tue, Feb 14, 2023 at 09:58:59AM -0700, Simon Glass wrote: > > > > Hi Tom, > > > > > > > > On Tue, 14 Feb 2023 at 09:31, Tom Rini wrote: > > > > > > > > > > On Sun, Feb 12, 2023 at 04:16:04PM -0700, Simon Glass wrote: > > > > > > > > > > > At present kconfig writes out several files, including: > > > > > > > > > > > >auto.conf - CONFIG settings used by make > > > > > >autoconf.h - header file used by C code > > > > > > > > > > > > This works well but is a bit ugly in places, for example requiring > > > > > > the use > > > > > > of a SPL_TPL_ macro in Makefiles to distinguish between options > > > > > > intended > > > > > > for SPL and U-Boot proper. > > > > > > > > > > > > Update the kconfig tool to also output separate files for each > > > > > > phase: e.g. > > > > > > auto_spl.conf and autoconf_spl.h > > > > > > > > > > > > These are similar to the existing files, but drop the SPL_ prefix > > > > > > so that > > > > > > SPL_TPL_ is not needed. It also allows the CONFIG_IS_ENABLED() > > > > > > macro to be > > > > > > simplified, in a later patch, eventually replacing it with > > > > > > IS_ENABLED(). > > > > > > > > > > > > When CONFIG_FOO is used within SPL, it means that FOO is enabled in > > > > > > that > > > > > > SPL phase. For example if CONFIG_SPL_FOO is enabled in the Kconfig, > > > > > > that > > > > > > means that CONFIG_FOO will be enabled in the SPL phase. So the SPL > > > > > > builds > > > > > > can just use CONFIG_FOO to check it. There is no need to use > > > > > > CONFIG_SPL_FOO or CONFIG_IS_ENABLED() anymore. > > > > > > > > > > > > This of course means that if there is a need to access a PPL symbol > > > > > > from > > > > > > an SPL build, there is no way to do it. To copy with that, we need a > > > > > > CONFIG_PPL_FOO to be visibilty to all SPL builds. > > > > > > > > > > > > So this change also adds new PPL_ output for U-Boot proper (Primary > > > > > > Program Loader). So every CONFIG_FOO that is enabled in PPL also > > > > > > has a > > > > > > CONFIG_PPL_FOO > > > > > > > > > > > > This allows SPL to access the TEXT_BASE for U-Boot proper, for > > > > > > example, so > > > > > > it knows where to load it. There are about 30 places where this is > > > > > > needed, > > > > > > in addition to TEXT_BASE. The environment has the same problem, > > > > > > adding > > > > > > another dozen or so caes in include/config_distro_bootcmd.h but it > > > > > > has > > > > > > been decided to ignore that for now. > > > > > > > > > > > > The feature is controlled by an environment variable, since it > > > > > > seems to be > > > > > > bad form to add flags to the conf tool. > > > > > > > > > > > > Rebuild the autoconf files if the split config is not present. This > > > > > > allows > > > > > > building this commit as part of a chain, without generating build > > > > > > errors. > > > > > > > > > > > > These changes may benefit from some reworking to send upstream, > > > > > > e.g. to > > > > > > use a struct for the 'arg' parameter. > > > > > > > > > > > > Signed-off-by: Simon Glass > > > > > > > > > > This patch, I think, is where my largest problem is. We go from being > > > > > able to say "if CONFIG_SPL_FOO is undefined, it is false" to "we must > > > > > define CONFIG_SPL_FOO to false". There's around 150 cases of this, > > > > > with > > > > > the series. Why can we not extend the PPL logic (which I'm not super > > > > > happy with, but, I understand and I think an audit of everything > > > > > not-TEXT_BASE should be fairly straight forward), to say that if > > > > > CONFIG_FOO exists and CONFIG_SPL_FOO does not exist, say > > > > > CONFIG_SPL_FOO > > > > > is now false. > > > > > > > > Well it is all about choices. > > > > > > > > We don't have to add a CONFIG_SPL_xxx to tell Kconfig that the PPL > > > > symbol controls all phases. We can use the conf_nospl file instead. > > > > But then the entire description is not in Kconfig. Of course, we might > > > > expect that some of those things in conf_nospl might end up needing to > > > > be controlled in SPL, so perhaps that file would shrink? Not sure > > > > about that, though. > > > > > > > > It isn't just SPL , BTW. We might have any xPL symbol defined. > > > > > > > > I suppose you are thinking of something like: > > > > > > > > #define CONFIG_IS_ENABLED(x) IS_ENABLED(CONFIG_ ## xpl_prefix ## x) || > > > >( IS_ENABLED(CONFIG_ ## x) && !IS_ENABLED(CONFIG_ SPL_ ## x) && > > > > !IS_ENABLED(CONFIG_TPL_ ##x) ..) > > > > > > > > But how do we deal with Makefiles? We still end up with the SPL_TPL_ > > > > stuff. > > > > > > I see it as a very useful feature that today if we don't set > > > CONFIG_xPL_FOO, it evaluates to false, anywhere we need it to. In all of > > > the prep work for split config, I
RE: [PATCH v4 00/16] General Tegra improvements
Svyatoslav, Taking TOT u-boot-tegra/master, and fast-forwarding to TOT u-boot/master, I then try to apply your 16 patch series and get the following failures (using patch). Note that I retargeted the crypto.c patch by hand to point to tegra20/crypto.c, which I believe one of your patches moves to arch/arm/tegra. PTAL. tom@tom-ThinkPad-T580:~/denx/uboot-tegra$ patch -p1 -i ~/Downloads/bundle-23303-Svyatoslav-16-v4.mbox --dry-run checking file arch/arm/include/asm/arch-tegra30/clock-tables.h checking file arch/arm/mach-tegra/tegra30/clock.c checking file arch/arm/mach-tegra/tegra20/clock.c checking file arch/arm/mach-tegra/tegra30/clock.c checking file arch/arm/include/asm/arch-tegra/clock.h checking file arch/arm/mach-tegra/tegra114/clock.c checking file arch/arm/mach-tegra/tegra124/clock.c checking file arch/arm/mach-tegra/tegra20/clock.c checking file arch/arm/mach-tegra/tegra210/clock.c checking file arch/arm/mach-tegra/tegra30/clock.c checking file arch/arm/include/asm/arch-tegra/clock.h checking file arch/arm/mach-tegra/clock.c checking file arch/arm/mach-tegra/tegra30/clock.c Hunk #1 succeeded at 632 (offset -37 lines). checking file arch/arm/dts/tegra114.dtsi checking file arch/arm/dts/tegra124.dtsi checking file arch/arm/mach-tegra/tegra114/clock.c Hunk #1 succeeded at 745 (offset -37 lines). checking file arch/arm/mach-tegra/tegra124/clock.c Hunk #1 succeeded at 1170 (offset -38 lines). checking file arch/arm/mach-tegra/tegra20/clock.c Hunk #1 succeeded at 767 (offset -37 lines). checking file arch/arm/mach-tegra/tegra210/clock.c Hunk #1 succeeded at 1241 (offset -37 lines). checking file arch/arm/mach-tegra/tegra30/clock.c Hunk #1 succeeded at 806 (offset -78 lines). checking file drivers/pwm/tegra_pwm.c checking file drivers/spi/tegra20_slink.c checking file configs/beaver_defconfig checking file configs/cei-tk1-som_defconfig checking file configs/dalmore_defconfig checking file configs/jetson-tk1_defconfig checking file configs/nyan-big_defconfig checking file configs/p2371-_defconfig checking file configs/p2371-2180_defconfig checking file configs/p2571_defconfig checking file configs/p3450-_defconfig checking file configs/venice2_defconfig checking file drivers/usb/gadget/Kconfig checking file arch/arm/include/asm/arch-tegra/sys_proto.h checking file arch/arm/mach-tegra/board2.c checking file arch/arm/include/asm/arch-tegra/tegra_i2c.h checking file arch/arm/mach-tegra/cpu.h checking file arch/arm/mach-tegra/tegra124/cpu.c checking file arch/arm/mach-tegra/tegra30/cpu.c checking file board/nvidia/venice2/as3722_init.c checking file board/nvidia/venice2/as3722_init.h checking file board/toradex/apalis-tk1/as3722_init.c checking file board/toradex/apalis-tk1/as3722_init.h checking file arch/arm/mach-tegra/tegra30/Kconfig checking file arch/arm/mach-tegra/tegra30/cpu.c Hunk #1 FAILED at 15. Hunk #2 FAILED at 41. 2 out of 2 hunks FAILED checking file board/avionic-design/tec-ng/Makefile checking file board/avionic-design/tec-ng/tec-ng-spl.c checking file board/nvidia/beaver/Makefile checking file board/nvidia/beaver/beaver-spl.c checking file board/nvidia/cardhu/Makefile checking file board/nvidia/cardhu/cardhu-spl.c checking file board/toradex/apalis_t30/Makefile checking file board/toradex/apalis_t30/apalis_t30-spl.c checking file board/toradex/colibri_t30/Makefile checking file board/toradex/colibri_t30/colibri_t30-spl.c checking file arch/arm/mach-tegra/Kconfig checking file arch/arm/mach-tegra/Makefile checking file arch/arm/mach-tegra/crypto.c (renamed from arch/arm/mach-tegra/tegra20/crypto.c) checking file arch/arm/mach-tegra/crypto.h (renamed from arch/arm/mach-tegra/tegra20/crypto.h) checking file arch/arm/mach-tegra/tegra20/Kconfig checking file arch/arm/mach-tegra/tegra20/Makefile checking file arch/arm/include/asm/arch-tegra/crypto.h can't find file to patch at input line 3811 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -- |diff --git a/arch/arm/mach-tegra/crypto.c b/arch/arm/mach-tegra/crypto.c |index 1efaa5c3ec..893da35e0b 100644 |--- a/arch/arm/mach-tegra/crypto.c |+++ b/arch/arm/mach-tegra/crypto.c -- File to patch: arch/arm/mach-tegra/tegra20/crypto.c checking file arch/arm/mach-tegra/tegra20/crypto.c The next patch would delete the file arch/arm/mach-tegra/crypto.h, which does not exist! Assume -R? [n] Apply anyway? [n] Skipping patch. 1 out of 1 hunk ignored checking file arch/arm/mach-tegra/Kconfig Hunk #1 succeeded at 224 (offset -5 lines). checking file arch/arm/mach-tegra/tegra30/Makefile checking file arch/arm/mach-tegra/tegra30/bct.c checking file arch/arm/mach-tegra/tegra30/bct.h checking file arch/arm/mach-tegra/Kconfig Hunk #1 FAILED at 231. 1 out of 1 hunk FAILED checking file arch/arm/mach-tegra/tegra20/Makefile checking file arch/arm/mach-tegra/tegra20/bct.c checking file arch/arm/mach-tegra/tegra20/bct.h checking file doc/usage/cmd/ebtupdate.rst
Re: [PATCH v3 61/95] kconfig: Support writing separate SPL files
On Tue, Feb 14, 2023 at 12:59:34PM -0700, Simon Glass wrote: > Hi Tom, > > On Tue, 14 Feb 2023 at 10:38, Tom Rini wrote: > > > > On Tue, Feb 14, 2023 at 09:58:59AM -0700, Simon Glass wrote: > > > Hi Tom, > > > > > > On Tue, 14 Feb 2023 at 09:31, Tom Rini wrote: > > > > > > > > On Sun, Feb 12, 2023 at 04:16:04PM -0700, Simon Glass wrote: > > > > > > > > > At present kconfig writes out several files, including: > > > > > > > > > >auto.conf - CONFIG settings used by make > > > > >autoconf.h - header file used by C code > > > > > > > > > > This works well but is a bit ugly in places, for example requiring > > > > > the use > > > > > of a SPL_TPL_ macro in Makefiles to distinguish between options > > > > > intended > > > > > for SPL and U-Boot proper. > > > > > > > > > > Update the kconfig tool to also output separate files for each phase: > > > > > e.g. > > > > > auto_spl.conf and autoconf_spl.h > > > > > > > > > > These are similar to the existing files, but drop the SPL_ prefix so > > > > > that > > > > > SPL_TPL_ is not needed. It also allows the CONFIG_IS_ENABLED() macro > > > > > to be > > > > > simplified, in a later patch, eventually replacing it with > > > > > IS_ENABLED(). > > > > > > > > > > When CONFIG_FOO is used within SPL, it means that FOO is enabled in > > > > > that > > > > > SPL phase. For example if CONFIG_SPL_FOO is enabled in the Kconfig, > > > > > that > > > > > means that CONFIG_FOO will be enabled in the SPL phase. So the SPL > > > > > builds > > > > > can just use CONFIG_FOO to check it. There is no need to use > > > > > CONFIG_SPL_FOO or CONFIG_IS_ENABLED() anymore. > > > > > > > > > > This of course means that if there is a need to access a PPL symbol > > > > > from > > > > > an SPL build, there is no way to do it. To copy with that, we need a > > > > > CONFIG_PPL_FOO to be visibilty to all SPL builds. > > > > > > > > > > So this change also adds new PPL_ output for U-Boot proper (Primary > > > > > Program Loader). So every CONFIG_FOO that is enabled in PPL also has a > > > > > CONFIG_PPL_FOO > > > > > > > > > > This allows SPL to access the TEXT_BASE for U-Boot proper, for > > > > > example, so > > > > > it knows where to load it. There are about 30 places where this is > > > > > needed, > > > > > in addition to TEXT_BASE. The environment has the same problem, adding > > > > > another dozen or so caes in include/config_distro_bootcmd.h but it has > > > > > been decided to ignore that for now. > > > > > > > > > > The feature is controlled by an environment variable, since it seems > > > > > to be > > > > > bad form to add flags to the conf tool. > > > > > > > > > > Rebuild the autoconf files if the split config is not present. This > > > > > allows > > > > > building this commit as part of a chain, without generating build > > > > > errors. > > > > > > > > > > These changes may benefit from some reworking to send upstream, e.g. > > > > > to > > > > > use a struct for the 'arg' parameter. > > > > > > > > > > Signed-off-by: Simon Glass > > > > > > > > This patch, I think, is where my largest problem is. We go from being > > > > able to say "if CONFIG_SPL_FOO is undefined, it is false" to "we must > > > > define CONFIG_SPL_FOO to false". There's around 150 cases of this, with > > > > the series. Why can we not extend the PPL logic (which I'm not super > > > > happy with, but, I understand and I think an audit of everything > > > > not-TEXT_BASE should be fairly straight forward), to say that if > > > > CONFIG_FOO exists and CONFIG_SPL_FOO does not exist, say CONFIG_SPL_FOO > > > > is now false. > > > > > > Well it is all about choices. > > > > > > We don't have to add a CONFIG_SPL_xxx to tell Kconfig that the PPL > > > symbol controls all phases. We can use the conf_nospl file instead. > > > But then the entire description is not in Kconfig. Of course, we might > > > expect that some of those things in conf_nospl might end up needing to > > > be controlled in SPL, so perhaps that file would shrink? Not sure > > > about that, though. > > > > > > It isn't just SPL , BTW. We might have any xPL symbol defined. > > > > > > I suppose you are thinking of something like: > > > > > > #define CONFIG_IS_ENABLED(x) IS_ENABLED(CONFIG_ ## xpl_prefix ## x) || > > >( IS_ENABLED(CONFIG_ ## x) && !IS_ENABLED(CONFIG_ SPL_ ## x) && > > > !IS_ENABLED(CONFIG_TPL_ ##x) ..) > > > > > > But how do we deal with Makefiles? We still end up with the SPL_TPL_ > > > stuff. > > > > I see it as a very useful feature that today if we don't set > > CONFIG_xPL_FOO, it evaluates to false, anywhere we need it to. In all of > > the prep work for split config, I think we've seen one case where we got > > things wrong (in that it lead to failure). Split config build is doing a > > whole bunch of things to then remove this feature. And the series > > intentionally ignores the Makefile design issue / feature of wrapping > > large chunks with a check for being/not-being in an xPL_BUILD phase. >
Re: [PATCH v2 1/6] binman: Add support for a rockchip-tpl entry
Hi Simon, On 2023-02-14 20:48, Simon Glass wrote: > Hi Jonas, > > On Tue, 14 Feb 2023 at 03:33, Jonas Karlman wrote: >> >> The rockchip-tpl entry can be used when an external TPL binary should be >> used instead of the normal U-Boot TPL. >> >> Signed-off-by: Jonas Karlman >> --- >> v2: >> - rename external-tpl to rockchip-tpl >> - missing message moved to this patch >> >> tools/binman/entries.rst | 14 ++ >> tools/binman/etype/rockchip_tpl.py | 20 >> tools/binman/ftest.py | 7 +++ >> tools/binman/missing-blob-help | 5 + >> tools/binman/test/277_rockchip_tpl.dts | 16 >> 5 files changed, 62 insertions(+) >> create mode 100644 tools/binman/etype/rockchip_tpl.py >> create mode 100644 tools/binman/test/277_rockchip_tpl.dts > > Reviewed-by: Simon Glass > nit below > >> >> diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst >> index 7a04a613992d..e177860a6a82 100644 >> --- a/tools/binman/entries.rst >> +++ b/tools/binman/entries.rst >> @@ -1386,6 +1386,20 @@ For example, this creates an image with a pre-load >> header and a binary:: >> >> >> >> +.. _etype_rockchip_tpl: >> + >> +Entry: rockchip-tpl: Rockchip TPL binary >> + >> + >> +Properties / Entry arguments: >> +- rockchip-tpl-path: Filename of file to read into the entry, >> + typically _ddr_.bin >> + >> +This entry holds an external TPL binary used by some Rockchip SoCs >> +instead of normal U-Boot TPL, typically to initialize DRAM. >> + >> + >> + >> .. _etype_scp: >> >> Entry: scp: System Control Processor (SCP) firmware blob >> diff --git a/tools/binman/etype/rockchip_tpl.py >> b/tools/binman/etype/rockchip_tpl.py >> new file mode 100644 >> index ..74f58ba8570c >> --- /dev/null >> +++ b/tools/binman/etype/rockchip_tpl.py >> @@ -0,0 +1,20 @@ >> +# SPDX-License-Identifier: GPL-2.0+ >> +# >> +# Entry-type module for Rockchip TPL binary >> +# >> + >> +from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg >> + >> +class Entry_rockchip_tpl(Entry_blob_named_by_arg): >> +"""Rockchip TPL binary >> + >> +Properties / Entry arguments: >> +- rockchip-tpl-path: Filename of file to read into the entry, >> + typically _ddr_.bin >> + >> +This entry holds an external TPL binary used by some Rockchip SoCs >> +instead of normal U-Boot TPL, typically to initialize DRAM. >> +""" >> +def __init__(self, section, etype, node): >> +super().__init__(section, etype, node, 'rockchip-tpl') >> +self.external = True >> diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py >> index 062f54adb0ed..ed4b5c987557 100644 >> --- a/tools/binman/ftest.py >> +++ b/tools/binman/ftest.py >> @@ -90,6 +90,7 @@ TEE_OS_DATA = b'this is some tee OS data' >> ATF_BL2U_DATA = b'bl2u' >> OPENSBI_DATA = b'opensbi' >> SCP_DATA = b'scp' >> +ROCKCHIP_TPL_DATA = b'rockchip-tpl' >> TEST_FDT1_DATA= b'fdt1' >> TEST_FDT2_DATA= b'test-fdt2' >> ENV_DATA = b'var1=1\nvar2="2"' >> @@ -205,6 +206,7 @@ class TestFunctional(unittest.TestCase): >> TestFunctional._MakeInputFile('bl2u.bin', ATF_BL2U_DATA) >> TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA) >> TestFunctional._MakeInputFile('scp.bin', SCP_DATA) >> +TestFunctional._MakeInputFile('rockchip-tpl.bin', ROCKCHIP_TPL_DATA) >> >> # Add a few .dtb files for testing >> TestFunctional._MakeInputFile('%s/test-fdt1.dtb' % TEST_FDT_SUBDIR, >> @@ -4097,6 +4099,11 @@ class TestFunctional(unittest.TestCase): >> data = self._DoReadFile('172_scp.dts') >> self.assertEqual(SCP_DATA, data[:len(SCP_DATA)]) >> >> +def testPackRockchipTpl(self): >> +"""Test that an image with a Rockchip TPL binary can be created""" >> +data = self._DoReadFile('277_rockchip_tpl.dts') >> +self.assertEqual(ROCKCHIP_TPL_DATA, data[:len(ROCKCHIP_TPL_DATA)]) >> + > > nit: please put new tests at the end of the file Thanks, I will move the test to the end of the file. Regards, Jonas > >> def testFitFdt(self): >> """Test an image with an FIT with multiple FDT images""" >> def _CheckFdt(seq, expected_data): >> diff --git a/tools/binman/missing-blob-help b/tools/binman/missing-blob-help >> index c61ca02a35ee..e8c991206fe5 100644 >> --- a/tools/binman/missing-blob-help >> +++ b/tools/binman/missing-blob-help >> @@ -34,6 +34,11 @@ If CONFIG_WDT_K3_RTI_LOAD_FW is enabled, a firmware image >> is needed for >> the R5F core(s) to trigger the system reset. One possible source is >> https://github.com/siemens/k3-rti-wdt>>> >> +rockchip-tpl: >> +An external TPL is required to initialize DRAM. Get the external TPL >> +binary and build with ROCKCHIP_TPL=/path/to/ddr.bin. One possible source >> +for the
Re: [PATCH] binman: Avoid requiring a home directory on startup
On Tue, Feb 14, 2023 at 03:12:46PM -0500, Mike Frysinger wrote: > On Tue, Feb 14, 2023 at 3:08 PM Tom Rini wrote: > > Downloading things from the internet and putting them in to the default > > PATH always and forever is also kinda not great? > > you just described a standard distribution. this is like literally > how all of them work. not to mention every other language-specific > distro tool out there (e.g. Python pip, Perl cpan, Go, etc...). > > maybe you'd like more guarantees on top (e.g. signature verification) > which is reasonable. > > but to be clear, this script is already merged & in the tree, so your > feedback doesn't block this patch. Yes, exactly. This is a fix on top of what we do today, so it should go in. But modern distributions only install signed packages, and language-specific tools tend to be a hive of bad examples. Looking over binman right now, I see that we're either using apt (and oh, there's "aot" typo in one spot) or downloading from a known Google drive, for only a few less common tools. So yes, I would like to see some ideas on how to improve things in the future so we aren't putting the binaries somewhere that's not a default (or frequently common) PATH location. -- Tom signature.asc Description: PGP signature
Re: [PATCH v2 5/8] video console: allow font size configuration at runtime
Am 14. Februar 2023 20:48:53 MEZ schrieb Simon Glass : >Hi Dzmitry, > >On Mon, 13 Feb 2023 at 09:57, Dzmitry Sankouski wrote: >> >> Allow font size configuration at runtime for console_simple.c >> driver. This needed for unit testing different fonts. >> >> - move 8x16 font data to video_font_8x16.h file > >please do that in a separate patch > >> - place common font macro in video_font_data.h file >> >> Signed-off-by: Dzmitry Sankouski >> --- >> Changes for v2: N/A >> >> cmd/Kconfig|8 + >> cmd/Makefile |2 +- >> common/splash.c|7 +- >> drivers/video/Kconfig | 16 + >> drivers/video/console_simple.c | 178 +- >> include/video_font.h | 19 +- >> include/video_font_4x6.h | 11 +- >> include/video_font_8x16.h | 4624 +++ >> include/video_font_data.h | 4644 Shouldn't we have a font that is somehow legible on a 4k display, e.g. 16x32? Best regards Heinrich +--- >> 9 files changed, 4802 insertions(+), 4707 deletions(-) >> create mode 100644 include/video_font_8x16.h >> >> diff --git a/cmd/Kconfig b/cmd/Kconfig >> index 199a55383e..033095769b 100644 >> --- a/cmd/Kconfig >> +++ b/cmd/Kconfig >> @@ -2211,6 +2211,14 @@ config CMD_VIDCONSOLE >> The name 'lcdputs' is a bit of a misnomer, but so named because the >> video device is often an LCD. >> >> +config CMD_SELECT_FONT >> +bool "select font size" >> + depends on VIDEO >> + default n >> + help >> + Enabling this will provide 'font' command. >> + Allows font selection at runtime. >> + >> endmenu >> >> source "cmd/ti/Kconfig" >> diff --git a/cmd/Makefile b/cmd/Makefile >> index 0b6a96c1d9..80b2796c1d 100644 >> --- a/cmd/Makefile >> +++ b/cmd/Makefile >> @@ -79,7 +79,7 @@ obj-$(CONFIG_CMD_EXT2) += ext2.o >> obj-$(CONFIG_CMD_FAT) += fat.o >> obj-$(CONFIG_CMD_FDT) += fdt.o >> obj-$(CONFIG_CMD_SQUASHFS) += sqfs.o >> -obj-$(CONFIG_CONSOLE_TRUETYPE) += font.o >> +obj-$(CONFIG_CMD_SELECT_FONT) += font.o >> obj-$(CONFIG_CMD_FLASH) += flash.o >> obj-$(CONFIG_CMD_FPGA) += fpga.o >> obj-$(CONFIG_CMD_FPGAD) += fpgad.o >> diff --git a/common/splash.c b/common/splash.c >> index 2e466a8a0f..3b36876a79 100644 >> --- a/common/splash.c >> +++ b/common/splash.c >> @@ -131,6 +131,7 @@ void splash_get_pos(int *x, int *y) >> void splash_display_banner(void) >> { >> struct udevice *dev; >> + struct video_priv *vid_priv; >> char buf[DISPLAY_OPTIONS_BANNER_LENGTH]; >> int col, row, ret; >> >> @@ -138,9 +139,11 @@ void splash_display_banner(void) >> if (ret) >> return; >> >> + vid_priv = dev_get_uclass_priv(dev->parent); >> + >> #ifdef CONFIG_VIDEO_LOGO >> - col = BMP_LOGO_WIDTH / VIDEO_FONT_WIDTH + 1; >> - row = BMP_LOGO_HEIGHT / VIDEO_FONT_HEIGHT + 1; >> + col = BMP_LOGO_WIDTH / vid_priv->fontdata->width + 1; >> + row = BMP_LOGO_HEIGHT / vid_priv->fontdata->height + 1; >> #else >> col = 0; >> row = 0; >> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig >> index 1dfe11d182..31dbf1f98d 100644 >> --- a/drivers/video/Kconfig >> +++ b/drivers/video/Kconfig >> @@ -16,6 +16,21 @@ config VIDEO >> >> if VIDEO >> >> +config VIDEO_FONT_4X6 >> + bool "4 x 6 font size" >> + help >> + Font for video console driver, 4 x 6 pixels. >> + Provides character bitmap data in header file. >> + When selecting multiple fonts, you may want to enable >> CMD_SELECT_FONT too. >> + >> +config VIDEO_FONT_8X16 >> + bool "8 x 16 font size" >> + default y >> + help >> + Font for video console driver, 8 x 16 pixels >> + Provides character bitmap data in header file. >> + When selecting multiple fonts, you may want to enable >> CMD_SELECT_FONT too. >> + >> config VIDEO_LOGO >> bool "Show the U-Boot logo on the display" >> default y if !SPLASH_SCREEN >> @@ -147,6 +162,7 @@ config CONSOLE_ROTATION >> >> config CONSOLE_TRUETYPE >> bool "Support a console that uses TrueType fonts" >> + select CMD_SELECT_FONT >> help >> TrueTrype fonts can provide outline-drawing capability rather than >> needing to provide a bitmap for each font and size that is needed. >> diff --git a/drivers/video/console_simple.c b/drivers/video/console_simple.c >> index cdc26cac30..f50a01d22e 100644 >> --- a/drivers/video/console_simple.c >> +++ b/drivers/video/console_simple.c >> @@ -12,12 +12,58 @@ >> #include >> #include /* Get font data, width and height */ >> >> -#define VIDEO_FONT_BYTE_WIDTH ((VIDEO_FONT_WIDTH / 8) + (VIDEO_FONT_WIDTH >> % 8 > 0)) >> -#define VIDEO_FONT_CHAR_PIXEL_BYTES(VIDEO_FONT_HEIGHT * >> VIDEO_FONT_BYTE_WIDTH) >> - >> #define FLIPPED_DIRECTION 1 >> #define NORMAL_DIRECTION 0 >> >> +static int
Re: [PATCH] binman: Avoid requiring a home directory on startup
On Tue, Feb 14, 2023 at 3:08 PM Tom Rini wrote: > Downloading things from the internet and putting them in to the default > PATH always and forever is also kinda not great? you just described a standard distribution. this is like literally how all of them work. not to mention every other language-specific distro tool out there (e.g. Python pip, Perl cpan, Go, etc...). maybe you'd like more guarantees on top (e.g. signature verification) which is reasonable. but to be clear, this script is already merged & in the tree, so your feedback doesn't block this patch. -mike
Re: [PATCH] binman: Avoid requiring a home directory on startup
considering, iiuc, the user has to execute the command to opt-in to installing the programs, putting it into a dir that's in $PATH is reasonable i would quibble that ~/bin is archaic and everyone should be using ~/.local/bin nowadays. but that can be a followup. https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html -mike
[PATCH v2 1/1] arm64: dts: rockchip: rk3308: Add Radxa ROCK Pi S support
Add Radxa ROCK 3 Model A support. sync rk3308-rock-pi-s.dts from Linux 6.2.0-rc7. ROCK Pi S is RK3308 based SBC from radxa.com. ROCK Pi S has a, - 256MB/512MB DDR3 RAM - SD, NAND flash (optional on board 1/2/4/8Gb) - 100MB ethernet, PoE (optional) - Onboard 802.11 b/g/n wifi + Bluetooth 4.0 Module - USB2.0 Type-A HOST x1 - USB3.0 Type-C OTG x1 - 26-pin expansion header - USB Type-C DC 5V Power Supply Linux commit commit for the same, <2e04c25b1320> ("arm64: dts: rockchip: add ROCK Pi S DTS support") Signed-off-by: Akash Gajjar --- Changes in v2: - Add MAINTAINER for the board --- arch/arm/dts/rk3308-rock-pi-s-u-boot.dtsi | 17 ++ arch/arm/dts/rk3308-rock-pi-s.dts | 228 ++ board/rockchip/evb_rk3308/MAINTAINERS | 7 + configs/rock-pi-s-rk3308_defconfig| 89 + 4 files changed, 341 insertions(+) create mode 100644 arch/arm/dts/rk3308-rock-pi-s-u-boot.dtsi create mode 100644 arch/arm/dts/rk3308-rock-pi-s.dts create mode 100644 configs/rock-pi-s-rk3308_defconfig diff --git a/arch/arm/dts/rk3308-rock-pi-s-u-boot.dtsi b/arch/arm/dts/rk3308-rock-pi-s-u-boot.dtsi new file mode 100644 index 00..27735c49dd --- /dev/null +++ b/arch/arm/dts/rk3308-rock-pi-s-u-boot.dtsi @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2018-2019 Rockchip Electronics Co., Ltd + */ +#include "rk3308-u-boot.dtsi" + +/ { + chosen { + u-boot,spl-boot-order = "same-as-spl", + }; +}; + + { + u-boot,dm-pre-reloc; + clock-frequency = <2400>; + status = "okay"; +}; diff --git a/arch/arm/dts/rk3308-rock-pi-s.dts b/arch/arm/dts/rk3308-rock-pi-s.dts new file mode 100644 index 00..b5a8691b3f --- /dev/null +++ b/arch/arm/dts/rk3308-rock-pi-s.dts @@ -0,0 +1,228 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd + * Copyright (C) 2023 Akash Gajjar + * Copyright (c) 2023 Jagan Teki + */ + +/dts-v1/; +#include +#include "rk3308.dtsi" + +/ { + model = "Radxa ROCK Pi S"; + compatible = "radxa,rockpis", "rockchip,rk3308"; + + aliases { + ethernet0 = + mmc0 = + mmc1 = + }; + + chosen { + stdout-path = "serial0:150n8"; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <_led_gio>, <_led_gpio>; + + green-led { + default-state = "on"; + gpios = < RK_PA6 GPIO_ACTIVE_HIGH>; + label = "rockpis:green:power"; + linux,default-trigger = "default-on"; + }; + + blue-led { + default-state = "on"; + gpios = < RK_PA5 GPIO_ACTIVE_HIGH>; + label = "rockpis:blue:user"; + linux,default-trigger = "heartbeat"; + }; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-0 = <_enable_h>; + pinctrl-names = "default"; + reset-gpios = < RK_PA2 GPIO_ACTIVE_LOW>; + }; + + vcc_1v8: vcc-1v8 { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <180>; + regulator-max-microvolt = <180>; + vin-supply = <_io>; + }; + + vcc_io: vcc-io { + compatible = "regulator-fixed"; + regulator-name = "vcc_io"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <330>; + regulator-max-microvolt = <330>; + vin-supply = <_sys>; + }; + + vcc_ddr: vcc-ddr { + compatible = "regulator-fixed"; + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <150>; + regulator-max-microvolt = <150>; + vin-supply = <_sys>; + }; + + vcc5v0_otg: vcc5v0-otg { + compatible = "regulator-fixed"; + enable-active-high; + gpio = < RK_PC5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <_vbus_drv>; + regulator-name = "vcc5v0_otg"; + regulator-always-on; + vin-supply = <_sys>; + }; + + vcc5v0_sys: vcc5v0-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500>; + regulator-max-microvolt =
[PATCH v2 0/1] Add Radxa ROCK Pi S support in U-boot
ROCK Pi S is rk3308 soc based board from Radxa. Add board support in u-boot. Booting logs is accessible at https://paste.ubuntu.com/p/cJDRzBRdXq/ Akash Gajjar (1): arm64: dts: rockchip: rk3308: Add Radxa ROCK Pi S support arch/arm/dts/rk3308-rock-pi-s-u-boot.dtsi | 17 ++ arch/arm/dts/rk3308-rock-pi-s.dts | 228 ++ board/rockchip/evb_rk3308/MAINTAINERS | 7 + configs/rock-pi-s-rk3308_defconfig| 89 + 4 files changed, 341 insertions(+) create mode 100644 arch/arm/dts/rk3308-rock-pi-s-u-boot.dtsi create mode 100644 arch/arm/dts/rk3308-rock-pi-s.dts create mode 100644 configs/rock-pi-s-rk3308_defconfig -- 2.25.1
[PATCH v4 1/1] arm64: dts: rockchip: rk3568: Add Radxa ROCK 3 Model A board support
Add Radxa ROCK 3 Model A support. sync rk3568-rock-3a.dts from Linux 6.2.0-rc7 Board Specifications - Rockchip RK3568 - 2/4/8GB LPDDR4 3200MT/s - eMMC socket, SD card slot - GbE LAN - PCIe 3.0/2.0 - M.2 Connector - 3.5mm Audio jack with mic - HDMI 2.0, MIPI DSI/CSI - USB 3.0 Host/OTG, USB 2.0 Host - 40-pin GPIO expansion ports - USB Type C PD 2.0, 9V/2A, 12V/2A, 15V/2A, 20V/2A Refer Linux commit <22a442e6586c> ("arm64: dts: rockchip: add basic dts for the radxa rock3 model a") Signed-off-by: Akash Gajjar --- Changes in v2: - Ammend the commit message, Replace Rock Pi 3a with ROCK3A Model A. Update the specs from https://wiki.radxa.com/Rock3/3a - Sync missing node in dts, still some of the nodes like vop, vop mmu, i2s2_2ch gpu, hdmi removed as there is no driver support present in u-boot. - Duplicated sdmmc node removed from dts. Changes in v3: - Replace rock-pi-3a-rk3568_defconfig with rock-3a-rk3568_defconfig Changes in v4: - Add maintainer for the board --- arch/arm/dts/Makefile | 3 +- arch/arm/dts/rk3568-rock-3a-u-boot.dtsi | 24 + arch/arm/dts/rk3568-rock-3a.dts | 609 board/rockchip/evb_rk3568/MAINTAINERS | 7 + configs/rock-3a-rk3568_defconfig| 74 +++ 5 files changed, 716 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/rk3568-rock-3a-u-boot.dtsi create mode 100644 arch/arm/dts/rk3568-rock-3a.dts create mode 100644 configs/rock-3a-rk3568_defconfig diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 9d647b9639..945843bebc 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -165,7 +165,8 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \ rk3399pro-rock-pi-n10.dtb dtb-$(CONFIG_ROCKCHIP_RK3568) += \ - rk3568-evb.dtb + rk3568-evb.dtb \ + rk3568-rock-3a.dtb dtb-$(CONFIG_ROCKCHIP_RV1108) += \ rv1108-elgin-r1.dtb \ diff --git a/arch/arm/dts/rk3568-rock-3a-u-boot.dtsi b/arch/arm/dts/rk3568-rock-3a-u-boot.dtsi new file mode 100644 index 00..ae23ae8587 --- /dev/null +++ b/arch/arm/dts/rk3568-rock-3a-u-boot.dtsi @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2021 Rockchip Electronics Co., Ltd + * (C) Copyright 2023 Akash Gajjar + */ + +#include "rk356x-u-boot.dtsi" + +/ { + chosen { + stdout-path = + u-boot,spl-boot-order = "same-as-spl", + }; +}; + + { + status = "okay"; +}; + + { + clock-frequency = <2400>; + u-boot,dm-spl; + status = "okay"; +}; diff --git a/arch/arm/dts/rk3568-rock-3a.dts b/arch/arm/dts/rk3568-rock-3a.dts new file mode 100644 index 00..a2f2baa4ea --- /dev/null +++ b/arch/arm/dts/rk3568-rock-3a.dts @@ -0,0 +1,609 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2021 Rockchip Electronics Co., Ltd. + * Copyright (c) 2023 Akash Gajjar + */ + +/dts-v1/; +#include +#include +#include "rk3568.dtsi" + +/ { + model = "Radxa ROCK3 Model A"; + compatible = "radxa,rock3a", "rockchip,rk3568"; + + chosen: chosen { + stdout-path = "serial2:150n8"; + }; + + gmac1_clkin: external-gmac1-clock { + compatible = "fixed-clock"; + clock-frequency = <12500>; + clock-output-names = "gmac1_clkin"; + #clock-cells = <0>; + }; + + vcc12v_dcin: vcc12v-dcin-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc12v_dcin"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1200>; + regulator-max-microvolt = <1200>; + }; + + vcc3v3_sys: vcc3v3-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <330>; + regulator-max-microvolt = <330>; + vin-supply = <_dcin>; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500>; + regulator-max-microvolt = <500>; + vin-supply = <_dcin>; + }; + + vcc5v0_usb: vcc5v0-usb-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usb"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500>; + regulator-max-microvolt = <500>; + vin-supply = <_dcin>; + }; + + vcc5v0_usb_host: vcc5v0-usb-host-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = < RK_PA6 GPIO_ACTIVE_HIGH>;
[PATCH v4 0/1] Add Radxa ROCK 3 Model A support in U-boot.
ROCK 3 Model A is rk3568 based soc board from Radxa, Add board support in u-boot. Booting logs available at https://paste.ubuntu.com/p/v9BNrB7MdM/ Akash Gajjar (1): arm64: dts: rockchip: rk3568: Add Radxa ROCK 3 Model A board support arch/arm/dts/Makefile | 3 +- arch/arm/dts/rk3568-rock-3a-u-boot.dtsi | 24 + arch/arm/dts/rk3568-rock-3a.dts | 609 board/rockchip/evb_rk3568/MAINTAINERS | 7 + configs/rock-3a-rk3568_defconfig| 74 +++ 5 files changed, 716 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/rk3568-rock-3a-u-boot.dtsi create mode 100644 arch/arm/dts/rk3568-rock-3a.dts create mode 100644 configs/rock-3a-rk3568_defconfig -- 2.25.1
Re: [PATCH 06/11] efi: Support copy framebuffer
Am 14. Februar 2023 20:48:58 MEZ schrieb Simon Glass : >Hi Heinrich, > >On Fri, 10 Feb 2023 at 05:11, Heinrich Schuchardt wrote: >> >> On 2/5/23 20:46, Simon Glass wrote: >> > Add support for this to EFI in case it becomes useful. At present it just >> > slows things down. Enable CONFIG_VIDEO_COPY to turn it on. >> > >> > Signed-off-by: Simon Glass >> > --- >> > >> > arch/x86/dts/efi-x86_app.dts | 1 + >> > drivers/video/efi.c | 11 +++ >> > 2 files changed, 12 insertions(+) >> > >> > diff --git a/arch/x86/dts/efi-x86_app.dts b/arch/x86/dts/efi-x86_app.dts >> > index a5316e2a1a7..7afa3d72d57 100644 >> > --- a/arch/x86/dts/efi-x86_app.dts >> > +++ b/arch/x86/dts/efi-x86_app.dts >> > @@ -27,6 +27,7 @@ >> > }; >> > efi-fb { >> > compatible = "efi-fb"; >> > + u-boot,dm-pre-reloc; >> > }; >> > >> > }; >> > diff --git a/drivers/video/efi.c b/drivers/video/efi.c >> > index 169637c2882..9135a8e8187 100644 >> > --- a/drivers/video/efi.c >> > +++ b/drivers/video/efi.c >> > @@ -207,6 +207,16 @@ err: >> > return ret; >> > } >> > >> > +static int efi_video_bind(struct udevice *dev) >> > +{ >> > + struct video_uc_plat *plat = dev_get_uclass_plat(dev); >> > + >> > + /* Use a 16MB frame buffer in case VIDEO_COPY is enabled */ >> > + plat->copy_size = 16 << 20; >> >> This does not work with today's display sizes: >> >> 3840 * 2160 * 4 = 33177600 >> 7680 * 4320 * 4 = 132710400 >> >> You have to determine the buffer size from the mode information. > >I am trying to do this when the device is bound, i.e. before we know >the mode information. How about I just increase it? Why not access the graphics output protocol here? You have to look for a graphics output protocol before binding a video device anyway. Best regards Heinrich > >BTW I notice that the EFI display is very slow on x86, e.g. with >scrolling. Are the mtrrs supposed to be set up? > >Regards, >Simon
[PATCH 2/2] x86: Pass -z execstack for EFI payload flags
To match how we link EFI executables elsewhere, and to silence a linker warning, pass -z execstack here as well. Cc: Bin Meng Cc: Heinrich Schuchardt Signed-off-by: Tom Rini --- arch/x86/config.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/config.mk b/arch/x86/config.mk index a4a694ddf313..26ec1af2f0b0 100644 --- a/arch/x86/config.mk +++ b/arch/x86/config.mk @@ -37,7 +37,8 @@ KBUILD_LDFLAGS += -m $(if $(IS_32BIT),elf_i386,elf_x86_64) # This is used in the top-level Makefile which does not include # KBUILD_LDFLAGS -LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions -shared --no-undefined -s +LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions -shared --no-undefined \ + -s -zexecstack OBJCOPYFLAGS_EFI := -j .text -j .sdata -j .data -j .dynamic -j .dynsym \ -j .rel -j .rela -j .reloc --strip-all -- 2.34.1
[PATCH 1/2] Makefile: Link with -z noexectack
When moving to gcc-12.2 we started trying to quiet some of the new linker warnings, that are not relevant to us. However, a misunderstanding of the mechanics at play meant that I intentionally omitted passing -z noexecstack to the linker, when we do need to. Add this flag and in turn remove warnings from the linker. Fixes: 1e1c51f8ace8 ("Makefile: link with --no-warn-rwx-segments") Signed-off-by: Tom Rini --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 54f894dab841..bc1ee94fb74e 100644 --- a/Makefile +++ b/Makefile @@ -806,6 +806,7 @@ KBUILD_CPPFLAGS += $(KCPPFLAGS) KBUILD_AFLAGS += $(KAFLAGS) KBUILD_CFLAGS += $(KCFLAGS) +KBUILD_LDFLAGS += -z noexecstack KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments) KBUILD_HOSTCFLAGS += $(if $(CONFIG_TOOLS_DEBUG),-g) -- 2.34.1
Re: [PATCH] binman: Avoid requiring a home directory on startup
On Tue, Feb 14, 2023 at 12:48:56PM -0700, Simon Glass wrote: > Hi Mark, > > On Fri, 10 Feb 2023 at 14:23, Mark Kettenis wrote: > > > > > From: Simon Glass > > > Date: Fri, 10 Feb 2023 13:59:46 -0700 > > > > > > This is needed to download tools, but we may not need to do this. At > > > present binman fails to start if HOME is not set. > > > > > > Use the current directory as a default to avoid this. > > > > > > Signed-off-by: Simon Glass > > > > Not new, but $HOME/bin seems like an *extremely* poor choice for a > > directory to download random binaries from the internet into as this > > directory is often part of a user's $PATH. > > But isn't that the point? It is designed to bring in tools for use by the > user. Downloading things from the internet and putting them in to the default PATH always and forever is also kinda not great? buildman --fetch-arch places things elsewhere and some sub directory of ~/.buildman-toolchains is less risky. -- Tom signature.asc Description: PGP signature
Re: [PATCH v3 61/95] kconfig: Support writing separate SPL files
Hi Tom, On Tue, 14 Feb 2023 at 10:38, Tom Rini wrote: > > On Tue, Feb 14, 2023 at 09:58:59AM -0700, Simon Glass wrote: > > Hi Tom, > > > > On Tue, 14 Feb 2023 at 09:31, Tom Rini wrote: > > > > > > On Sun, Feb 12, 2023 at 04:16:04PM -0700, Simon Glass wrote: > > > > > > > At present kconfig writes out several files, including: > > > > > > > >auto.conf - CONFIG settings used by make > > > >autoconf.h - header file used by C code > > > > > > > > This works well but is a bit ugly in places, for example requiring the > > > > use > > > > of a SPL_TPL_ macro in Makefiles to distinguish between options intended > > > > for SPL and U-Boot proper. > > > > > > > > Update the kconfig tool to also output separate files for each phase: > > > > e.g. > > > > auto_spl.conf and autoconf_spl.h > > > > > > > > These are similar to the existing files, but drop the SPL_ prefix so > > > > that > > > > SPL_TPL_ is not needed. It also allows the CONFIG_IS_ENABLED() macro to > > > > be > > > > simplified, in a later patch, eventually replacing it with IS_ENABLED(). > > > > > > > > When CONFIG_FOO is used within SPL, it means that FOO is enabled in that > > > > SPL phase. For example if CONFIG_SPL_FOO is enabled in the Kconfig, that > > > > means that CONFIG_FOO will be enabled in the SPL phase. So the SPL > > > > builds > > > > can just use CONFIG_FOO to check it. There is no need to use > > > > CONFIG_SPL_FOO or CONFIG_IS_ENABLED() anymore. > > > > > > > > This of course means that if there is a need to access a PPL symbol from > > > > an SPL build, there is no way to do it. To copy with that, we need a > > > > CONFIG_PPL_FOO to be visibilty to all SPL builds. > > > > > > > > So this change also adds new PPL_ output for U-Boot proper (Primary > > > > Program Loader). So every CONFIG_FOO that is enabled in PPL also has a > > > > CONFIG_PPL_FOO > > > > > > > > This allows SPL to access the TEXT_BASE for U-Boot proper, for example, > > > > so > > > > it knows where to load it. There are about 30 places where this is > > > > needed, > > > > in addition to TEXT_BASE. The environment has the same problem, adding > > > > another dozen or so caes in include/config_distro_bootcmd.h but it has > > > > been decided to ignore that for now. > > > > > > > > The feature is controlled by an environment variable, since it seems to > > > > be > > > > bad form to add flags to the conf tool. > > > > > > > > Rebuild the autoconf files if the split config is not present. This > > > > allows > > > > building this commit as part of a chain, without generating build > > > > errors. > > > > > > > > These changes may benefit from some reworking to send upstream, e.g. to > > > > use a struct for the 'arg' parameter. > > > > > > > > Signed-off-by: Simon Glass > > > > > > This patch, I think, is where my largest problem is. We go from being > > > able to say "if CONFIG_SPL_FOO is undefined, it is false" to "we must > > > define CONFIG_SPL_FOO to false". There's around 150 cases of this, with > > > the series. Why can we not extend the PPL logic (which I'm not super > > > happy with, but, I understand and I think an audit of everything > > > not-TEXT_BASE should be fairly straight forward), to say that if > > > CONFIG_FOO exists and CONFIG_SPL_FOO does not exist, say CONFIG_SPL_FOO > > > is now false. > > > > Well it is all about choices. > > > > We don't have to add a CONFIG_SPL_xxx to tell Kconfig that the PPL > > symbol controls all phases. We can use the conf_nospl file instead. > > But then the entire description is not in Kconfig. Of course, we might > > expect that some of those things in conf_nospl might end up needing to > > be controlled in SPL, so perhaps that file would shrink? Not sure > > about that, though. > > > > It isn't just SPL , BTW. We might have any xPL symbol defined. > > > > I suppose you are thinking of something like: > > > > #define CONFIG_IS_ENABLED(x) IS_ENABLED(CONFIG_ ## xpl_prefix ## x) || > >( IS_ENABLED(CONFIG_ ## x) && !IS_ENABLED(CONFIG_ SPL_ ## x) && > > !IS_ENABLED(CONFIG_TPL_ ##x) ..) > > > > But how do we deal with Makefiles? We still end up with the SPL_TPL_ stuff. > > I see it as a very useful feature that today if we don't set > CONFIG_xPL_FOO, it evaluates to false, anywhere we need it to. In all of > the prep work for split config, I think we've seen one case where we got > things wrong (in that it lead to failure). Split config build is doing a > whole bunch of things to then remove this feature. And the series > intentionally ignores the Makefile design issue / feature of wrapping > large chunks with a check for being/not-being in an xPL_BUILD phase. In another thread you suggested moving to separate defconfig files for each phase (I think). Presumably that would operate the same way as this series, in that you would not be able to handle the special case you mention. So I see this series as the best of both worlds - a unified Kconfig (and .config) but with separate auto.conf files
Re: [PATCH v2 6/6] RFC: binman: Improve allow missing for mkimage entry
Hi Jonas, On Tue, 14 Feb 2023 at 03:34, Jonas Karlman wrote: > > Implement CheckMissing and CheckOptional methods that is adapted to > Entry_mkimage in order to improve support for allow missing flag. > > Use collect_contents_to_file in multiple-data-files handling to improve > support for allow missing and fake blobs handling. > > Signed-off-by: Jonas Karlman > --- > Building for RK3568 without ROCKCHIP_TPL will result in the following > error message, regardless if BINMAN_ALLOW_MISSING is used or not. > > binman: Filename 'rockchip-tpl' not found in input path (...) > > With this patch and using BINMAN_ALLOW_MISSING=1 a new external blob > with no content is created and then passed to mkimage, resulting in an > error from the mkimage command. > > binman: Error 255 running 'mkimage -d > ./mkimage-0.simple-bin.mkimage:./mkimage-1.simple-bin.mkimage -n rk3568 -T > rksd ./idbloader.img': mkimage: Can't read ./mkimage-0.simple-bin.mkimage: > Invalid argument > > If the --fake-ext-blobs argument is also used I get the message I was > expecting to see from the beginning. > > Image 'main-section' is missing external blobs and is non-functional: > rockchip-tpl > > /binman/simple-bin/mkimage/rockchip-tpl: > An external TPL is required to initialize DRAM. Get the external TPL > binary and build with ROCKCHIP_TPL=/path/to/ddr.bin. One possible source > for the external TPL binary is https://github.com/rockchip-linux/rkbin. > Image 'main-section' has faked external blobs and is non-functional: > rockchip-tpl > > Some images are invalid > > Not sure how this should work, but I was expecting to see the message > about the missing rockchip-tpl from the beginning instead of the generic > "not found in input path" message. At leas with BINMAN_ALLOW_MISSING=1. > > tools/binman/etype/mkimage.py | 37 +++ > 1 file changed, 33 insertions(+), 4 deletions(-) > > diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py > index cb264c3cad0b..44510a8c40ba 100644 > --- a/tools/binman/etype/mkimage.py > +++ b/tools/binman/etype/mkimage.py > @@ -153,10 +153,12 @@ class Entry_mkimage(Entry): > if self._multiple_data_files: > fnames = [] > uniq = self.GetUniqueName() > -for entry in self._mkimage_entries.values(): > -if not entry.ObtainContents(fake_size=fake_size): > +for idx, entry in enumerate(self._mkimage_entries.values()): > +entry_data, entry_fname, _ = self.collect_contents_to_file( > +[entry], 'mkimage-%s' % idx, fake_size) > +if entry_data is None: This is OK, I suppose, but I'm not quite sure what actually changes here, other than writing each entry to a file? Also, if you do this, please add / extend a test that checks that the output files are written, since there is otherwise no coverage here. What test uses these optional mkimage pieces? > return False > - > fnames.append(tools.get_input_filename(entry.GetDefaultFilename())) > +fnames.append(entry_fname) > input_fname = ":".join(fnames) > else: > data, input_fname, uniq = self.collect_contents_to_file( > @@ -165,7 +167,7 @@ class Entry_mkimage(Entry): > return False > if self._imagename: > image_data, imagename_fname, _ = self.collect_contents_to_file( > -[self._imagename], 'mkimage-n', 1024) > +[self._imagename], 'mkimage-n', fake_size) > if image_data is None: > return False > outfile = self._filename if self._filename else 'mkimage-out.%s' % > uniq > @@ -216,6 +218,20 @@ class Entry_mkimage(Entry): > if self._imagename: > self._imagename.SetAllowFakeBlob(allow_fake) > > +def CheckMissing(self, missing_list): > +"""Check if any entries in this section have missing external blobs > + > +If there are missing (non-optional) blobs, the entries are added to > the > +list > + > +Args: > +missing_list: List of Entry objects to be added to > +""" > +for entry in self._mkimage_entries.values(): > +entry.CheckMissing(missing_list) > +if self._imagename: > +self._imagename.CheckMissing(missing_list) > + > def CheckFakedBlobs(self, faked_blobs_list): > """Check if any entries in this section have faked external blobs > > @@ -229,6 +245,19 @@ class Entry_mkimage(Entry): > if self._imagename: > self._imagename.CheckFakedBlobs(faked_blobs_list) > > +def CheckOptional(self, optional_list): > +"""Check the section for missing but optional external blobs > + > +If there are missing (optional) blobs, the entries are added to the > list > + > +Args: > +optional_list (list): List of Entry
Re: [PATCH 06/11] efi: Support copy framebuffer
Hi Heinrich, On Fri, 10 Feb 2023 at 05:11, Heinrich Schuchardt wrote: > > On 2/5/23 20:46, Simon Glass wrote: > > Add support for this to EFI in case it becomes useful. At present it just > > slows things down. Enable CONFIG_VIDEO_COPY to turn it on. > > > > Signed-off-by: Simon Glass > > --- > > > > arch/x86/dts/efi-x86_app.dts | 1 + > > drivers/video/efi.c | 11 +++ > > 2 files changed, 12 insertions(+) > > > > diff --git a/arch/x86/dts/efi-x86_app.dts b/arch/x86/dts/efi-x86_app.dts > > index a5316e2a1a7..7afa3d72d57 100644 > > --- a/arch/x86/dts/efi-x86_app.dts > > +++ b/arch/x86/dts/efi-x86_app.dts > > @@ -27,6 +27,7 @@ > > }; > > efi-fb { > > compatible = "efi-fb"; > > + u-boot,dm-pre-reloc; > > }; > > > > }; > > diff --git a/drivers/video/efi.c b/drivers/video/efi.c > > index 169637c2882..9135a8e8187 100644 > > --- a/drivers/video/efi.c > > +++ b/drivers/video/efi.c > > @@ -207,6 +207,16 @@ err: > > return ret; > > } > > > > +static int efi_video_bind(struct udevice *dev) > > +{ > > + struct video_uc_plat *plat = dev_get_uclass_plat(dev); > > + > > + /* Use a 16MB frame buffer in case VIDEO_COPY is enabled */ > > + plat->copy_size = 16 << 20; > > This does not work with today's display sizes: > > 3840 * 2160 * 4 = 33177600 > 7680 * 4320 * 4 = 132710400 > > You have to determine the buffer size from the mode information. I am trying to do this when the device is bound, i.e. before we know the mode information. How about I just increase it? BTW I notice that the EFI display is very slow on x86, e.g. with scrolling. Are the mtrrs supposed to be set up? Regards, Simon
Re: [PATCH] binman: Avoid requiring a home directory on startup
Hi Mark, On Fri, 10 Feb 2023 at 14:23, Mark Kettenis wrote: > > > From: Simon Glass > > Date: Fri, 10 Feb 2023 13:59:46 -0700 > > > > This is needed to download tools, but we may not need to do this. At > > present binman fails to start if HOME is not set. > > > > Use the current directory as a default to avoid this. > > > > Signed-off-by: Simon Glass > > Not new, but $HOME/bin seems like an *extremely* poor choice for a > directory to download random binaries from the internet into as this > directory is often part of a user's $PATH. But isn't that the point? It is designed to bring in tools for use by the user. Regards, Simon
Re: [PATCH v2 1/6] binman: Add support for a rockchip-tpl entry
Hi Jonas, On Tue, 14 Feb 2023 at 03:33, Jonas Karlman wrote: > > The rockchip-tpl entry can be used when an external TPL binary should be > used instead of the normal U-Boot TPL. > > Signed-off-by: Jonas Karlman > --- > v2: > - rename external-tpl to rockchip-tpl > - missing message moved to this patch > > tools/binman/entries.rst | 14 ++ > tools/binman/etype/rockchip_tpl.py | 20 > tools/binman/ftest.py | 7 +++ > tools/binman/missing-blob-help | 5 + > tools/binman/test/277_rockchip_tpl.dts | 16 > 5 files changed, 62 insertions(+) > create mode 100644 tools/binman/etype/rockchip_tpl.py > create mode 100644 tools/binman/test/277_rockchip_tpl.dts Reviewed-by: Simon Glass nit below > > diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst > index 7a04a613992d..e177860a6a82 100644 > --- a/tools/binman/entries.rst > +++ b/tools/binman/entries.rst > @@ -1386,6 +1386,20 @@ For example, this creates an image with a pre-load > header and a binary:: > > > > +.. _etype_rockchip_tpl: > + > +Entry: rockchip-tpl: Rockchip TPL binary > + > + > +Properties / Entry arguments: > +- rockchip-tpl-path: Filename of file to read into the entry, > + typically _ddr_.bin > + > +This entry holds an external TPL binary used by some Rockchip SoCs > +instead of normal U-Boot TPL, typically to initialize DRAM. > + > + > + > .. _etype_scp: > > Entry: scp: System Control Processor (SCP) firmware blob > diff --git a/tools/binman/etype/rockchip_tpl.py > b/tools/binman/etype/rockchip_tpl.py > new file mode 100644 > index ..74f58ba8570c > --- /dev/null > +++ b/tools/binman/etype/rockchip_tpl.py > @@ -0,0 +1,20 @@ > +# SPDX-License-Identifier: GPL-2.0+ > +# > +# Entry-type module for Rockchip TPL binary > +# > + > +from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg > + > +class Entry_rockchip_tpl(Entry_blob_named_by_arg): > +"""Rockchip TPL binary > + > +Properties / Entry arguments: > +- rockchip-tpl-path: Filename of file to read into the entry, > + typically _ddr_.bin > + > +This entry holds an external TPL binary used by some Rockchip SoCs > +instead of normal U-Boot TPL, typically to initialize DRAM. > +""" > +def __init__(self, section, etype, node): > +super().__init__(section, etype, node, 'rockchip-tpl') > +self.external = True > diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py > index 062f54adb0ed..ed4b5c987557 100644 > --- a/tools/binman/ftest.py > +++ b/tools/binman/ftest.py > @@ -90,6 +90,7 @@ TEE_OS_DATA = b'this is some tee OS data' > ATF_BL2U_DATA = b'bl2u' > OPENSBI_DATA = b'opensbi' > SCP_DATA = b'scp' > +ROCKCHIP_TPL_DATA = b'rockchip-tpl' > TEST_FDT1_DATA= b'fdt1' > TEST_FDT2_DATA= b'test-fdt2' > ENV_DATA = b'var1=1\nvar2="2"' > @@ -205,6 +206,7 @@ class TestFunctional(unittest.TestCase): > TestFunctional._MakeInputFile('bl2u.bin', ATF_BL2U_DATA) > TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA) > TestFunctional._MakeInputFile('scp.bin', SCP_DATA) > +TestFunctional._MakeInputFile('rockchip-tpl.bin', ROCKCHIP_TPL_DATA) > > # Add a few .dtb files for testing > TestFunctional._MakeInputFile('%s/test-fdt1.dtb' % TEST_FDT_SUBDIR, > @@ -4097,6 +4099,11 @@ class TestFunctional(unittest.TestCase): > data = self._DoReadFile('172_scp.dts') > self.assertEqual(SCP_DATA, data[:len(SCP_DATA)]) > > +def testPackRockchipTpl(self): > +"""Test that an image with a Rockchip TPL binary can be created""" > +data = self._DoReadFile('277_rockchip_tpl.dts') > +self.assertEqual(ROCKCHIP_TPL_DATA, data[:len(ROCKCHIP_TPL_DATA)]) > + nit: please put new tests at the end of the file > def testFitFdt(self): > """Test an image with an FIT with multiple FDT images""" > def _CheckFdt(seq, expected_data): > diff --git a/tools/binman/missing-blob-help b/tools/binman/missing-blob-help > index c61ca02a35ee..e8c991206fe5 100644 > --- a/tools/binman/missing-blob-help > +++ b/tools/binman/missing-blob-help > @@ -34,6 +34,11 @@ If CONFIG_WDT_K3_RTI_LOAD_FW is enabled, a firmware image > is needed for > the R5F core(s) to trigger the system reset. One possible source is > https://github.com/siemens/k3-rti-wdt. > > +rockchip-tpl: > +An external TPL is required to initialize DRAM. Get the external TPL > +binary and build with ROCKCHIP_TPL=/path/to/ddr.bin. One possible source > +for the external TPL binary is https://github.com/rockchip-linux/rkbin. > + > tee-os: > See the documentation for your board. You may need to build Open Portable > Trusted Execution Environment (OP-TEE) with TEE=/path/to/tee.bin > diff --git
Re: [PATCH v2 2/6] rockchip: Use an external TPL binary on RK3568
On Tue, 14 Feb 2023 at 03:33, Jonas Karlman wrote: > > Rockchip SoCs typically use U-Boot TPL to initialize DRAM, then jumps > back to BootRom to load next stage, U-Boot SPL, into DRAM. BootRom then > jumps to U-Boot SPL to continue the normal boot flow. > > However, there is no support to initialize DRAM on RK35xx SoCs using > U-Boot TPL and instead an external TPL binary must be used to generate a > bootable u-boot-rockchip.bin image. > > Add CONFIG_ROCKCHIP_EXTERNAL_TPL to indicate that an external TPL should > be used. Build U-Boot with ROCKCHIP_TPL=/path/to/ddr.bin to generate a > bootable u-boot-rockchip.bin image for RK3568. > > Signed-off-by: Jonas Karlman > --- > v2: > - rename external-tpl-path to rockchip-tpl-path > - rename EXTERNAL_TPL to ROCKCHIP_TPL > - add CONFIG_ROCKCHIP_EXTERNAL_TPL option > > Makefile | 1 + > arch/arm/dts/rockchip-u-boot.dtsi | 10 -- > arch/arm/mach-rockchip/Kconfig| 4 > 3 files changed, 13 insertions(+), 2 deletions(-) Reviewed-by: Simon Glass Please add help for Kconfig > > diff --git a/Makefile b/Makefile > index 54f894dab841..58f8c7a35335 100644 > --- a/Makefile > +++ b/Makefile > @@ -1335,6 +1335,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if > $(BINMAN_DEBUG),-D) \ > -a opensbi-path=${OPENSBI} \ > -a default-dt=$(default_dt) \ > -a scp-path=$(SCP) \ > + -a rockchip-tpl-path=$(ROCKCHIP_TPL) \ > -a spl-bss-pad=$(if $(CONFIG_SPL_SEPARATE_BSS),,1) \ > -a tpl-bss-pad=$(if $(CONFIG_TPL_SEPARATE_BSS),,1) \ > -a spl-dtb=$(CONFIG_SPL_OF_REAL) \ > diff --git a/arch/arm/dts/rockchip-u-boot.dtsi > b/arch/arm/dts/rockchip-u-boot.dtsi > index 6c662a72d4f9..2878b80926c4 100644 > --- a/arch/arm/dts/rockchip-u-boot.dtsi > +++ b/arch/arm/dts/rockchip-u-boot.dtsi > @@ -20,9 +20,12 @@ > mkimage { > filename = "idbloader.img"; > args = "-n", CONFIG_SYS_SOC, "-T", "rksd"; > -#ifdef CONFIG_TPL > multiple-data-files; > > +#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL > + rockchip-tpl { > + }; > +#elif defined(CONFIG_TPL) > u-boot-tpl { > }; > #endif > @@ -134,9 +137,12 @@ > mkimage { > filename = "idbloader-spi.img"; > args = "-n", CONFIG_SYS_SOC, "-T", "rkspi"; > -#ifdef CONFIG_TPL > multiple-data-files; > > +#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL > + rockchip-tpl { > + }; > +#elif defined(CONFIG_TPL) > u-boot-tpl { > }; > #endif > diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig > index b678ec41318e..4a5415403446 100644 > --- a/arch/arm/mach-rockchip/Kconfig > +++ b/arch/arm/mach-rockchip/Kconfig > @@ -377,6 +377,10 @@ config TPL_ROCKCHIP_BACK_TO_BROM >SPL will return to the boot rom, which will then load the U-Boot >binary to keep going on. > > +config ROCKCHIP_EXTERNAL_TPL > + bool "Use external TPL binary" > + default y if ROCKCHIP_RK3568 > + > config ROCKCHIP_COMMON_BOARD > bool "Rockchip common board file" > help > -- > 2.39.1 >
Re: [PATCH v2 5/8] video console: allow font size configuration at runtime
Hi Dzmitry, On Mon, 13 Feb 2023 at 09:57, Dzmitry Sankouski wrote: > > Allow font size configuration at runtime for console_simple.c > driver. This needed for unit testing different fonts. > > - move 8x16 font data to video_font_8x16.h file please do that in a separate patch > - place common font macro in video_font_data.h file > > Signed-off-by: Dzmitry Sankouski > --- > Changes for v2: N/A > > cmd/Kconfig|8 + > cmd/Makefile |2 +- > common/splash.c|7 +- > drivers/video/Kconfig | 16 + > drivers/video/console_simple.c | 178 +- > include/video_font.h | 19 +- > include/video_font_4x6.h | 11 +- > include/video_font_8x16.h | 4624 +++ > include/video_font_data.h | 4644 +--- > 9 files changed, 4802 insertions(+), 4707 deletions(-) > create mode 100644 include/video_font_8x16.h > > diff --git a/cmd/Kconfig b/cmd/Kconfig > index 199a55383e..033095769b 100644 > --- a/cmd/Kconfig > +++ b/cmd/Kconfig > @@ -2211,6 +2211,14 @@ config CMD_VIDCONSOLE > The name 'lcdputs' is a bit of a misnomer, but so named because the > video device is often an LCD. > > +config CMD_SELECT_FONT > +bool "select font size" > + depends on VIDEO > + default n > + help > + Enabling this will provide 'font' command. > + Allows font selection at runtime. > + > endmenu > > source "cmd/ti/Kconfig" > diff --git a/cmd/Makefile b/cmd/Makefile > index 0b6a96c1d9..80b2796c1d 100644 > --- a/cmd/Makefile > +++ b/cmd/Makefile > @@ -79,7 +79,7 @@ obj-$(CONFIG_CMD_EXT2) += ext2.o > obj-$(CONFIG_CMD_FAT) += fat.o > obj-$(CONFIG_CMD_FDT) += fdt.o > obj-$(CONFIG_CMD_SQUASHFS) += sqfs.o > -obj-$(CONFIG_CONSOLE_TRUETYPE) += font.o > +obj-$(CONFIG_CMD_SELECT_FONT) += font.o > obj-$(CONFIG_CMD_FLASH) += flash.o > obj-$(CONFIG_CMD_FPGA) += fpga.o > obj-$(CONFIG_CMD_FPGAD) += fpgad.o > diff --git a/common/splash.c b/common/splash.c > index 2e466a8a0f..3b36876a79 100644 > --- a/common/splash.c > +++ b/common/splash.c > @@ -131,6 +131,7 @@ void splash_get_pos(int *x, int *y) > void splash_display_banner(void) > { > struct udevice *dev; > + struct video_priv *vid_priv; > char buf[DISPLAY_OPTIONS_BANNER_LENGTH]; > int col, row, ret; > > @@ -138,9 +139,11 @@ void splash_display_banner(void) > if (ret) > return; > > + vid_priv = dev_get_uclass_priv(dev->parent); > + > #ifdef CONFIG_VIDEO_LOGO > - col = BMP_LOGO_WIDTH / VIDEO_FONT_WIDTH + 1; > - row = BMP_LOGO_HEIGHT / VIDEO_FONT_HEIGHT + 1; > + col = BMP_LOGO_WIDTH / vid_priv->fontdata->width + 1; > + row = BMP_LOGO_HEIGHT / vid_priv->fontdata->height + 1; > #else > col = 0; > row = 0; > diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig > index 1dfe11d182..31dbf1f98d 100644 > --- a/drivers/video/Kconfig > +++ b/drivers/video/Kconfig > @@ -16,6 +16,21 @@ config VIDEO > > if VIDEO > > +config VIDEO_FONT_4X6 > + bool "4 x 6 font size" > + help > + Font for video console driver, 4 x 6 pixels. > + Provides character bitmap data in header file. > + When selecting multiple fonts, you may want to enable > CMD_SELECT_FONT too. > + > +config VIDEO_FONT_8X16 > + bool "8 x 16 font size" > + default y > + help > + Font for video console driver, 8 x 16 pixels > + Provides character bitmap data in header file. > + When selecting multiple fonts, you may want to enable > CMD_SELECT_FONT too. > + > config VIDEO_LOGO > bool "Show the U-Boot logo on the display" > default y if !SPLASH_SCREEN > @@ -147,6 +162,7 @@ config CONSOLE_ROTATION > > config CONSOLE_TRUETYPE > bool "Support a console that uses TrueType fonts" > + select CMD_SELECT_FONT > help > TrueTrype fonts can provide outline-drawing capability rather than > needing to provide a bitmap for each font and size that is needed. > diff --git a/drivers/video/console_simple.c b/drivers/video/console_simple.c > index cdc26cac30..f50a01d22e 100644 > --- a/drivers/video/console_simple.c > +++ b/drivers/video/console_simple.c > @@ -12,12 +12,58 @@ > #include > #include /* Get font data, width and height */ > > -#define VIDEO_FONT_BYTE_WIDTH ((VIDEO_FONT_WIDTH / 8) + (VIDEO_FONT_WIDTH % > 8 > 0)) > -#define VIDEO_FONT_CHAR_PIXEL_BYTES(VIDEO_FONT_HEIGHT * > VIDEO_FONT_BYTE_WIDTH) > - > #define FLIPPED_DIRECTION 1 > #define NORMAL_DIRECTION 0 > > +static int console_set_font(struct udevice *dev, struct video_fontdata > *fontdata) > +{ > + struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); > + struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); > + > + debug("console_simple: setting %s font\n", fontdata->name); > + debug("width:
Re: [PATCH v2 8/8] video console: add 12x22 console simple font test
On Mon, 13 Feb 2023 at 09:57, Dzmitry Sankouski wrote: > > Tests fonts wider than a byte. > > Signed-off-by: Dzmitry Sankouski > --- > Changes for v2: N/A > > configs/sandbox_defconfig | 3 +++ > test/dm/video.c | 41 +++ > 2 files changed, 44 insertions(+) Reviewed-by: Simon Glass very nice
Re: [PATCH v2 4/8] video console: add select font logic to vidconsole uclass driver
Hi Dzmitry, On Mon, 13 Feb 2023 at 09:57, Dzmitry Sankouski wrote: > > Select font logic at runtime needed to unit test different fonts. > This commit is a preparation to enable runtime font selection in > console_simple driver. > > - move console true type select font logic to driver ops > - add select font logic to vidconsole-uclass.c > > Signed-off-by: Dzmitry Sankouski > --- > Changes for v2: N/A > > cmd/font.c| 7 ++- > drivers/video/console_truetype.c | 6 -- > drivers/video/vidconsole-uclass.c | 22 ++ > include/video.h | 1 + > include/video_console.h | 18 +- > 5 files changed, 50 insertions(+), 4 deletions(-) > > diff --git a/cmd/font.c b/cmd/font.c > index 3e522f3aaa..769796c5ec 100644 > --- a/cmd/font.c > +++ b/cmd/font.c > @@ -15,7 +15,12 @@ > static int do_font_list(struct cmd_tbl *cmdtp, int flag, int argc, > char *const argv[]) > { > - vidconsole_list_fonts(); > + struct udevice *dev; > + > + if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, )) > + return CMD_RET_FAILURE; > + > + vidconsole_list_fonts(dev); > > return 0; > } > diff --git a/drivers/video/console_truetype.c > b/drivers/video/console_truetype.c > index 6859c9fa11..389fa483fc 100644 > --- a/drivers/video/console_truetype.c > +++ b/drivers/video/console_truetype.c > @@ -584,7 +584,7 @@ static struct font_info *console_truetype_find_font(void) > return NULL; > } > > -void vidconsole_list_fonts(void) > +void console_truetype_list_fonts(struct udevice __maybe_unused *dev) You should not need the __maybe_unused here? > { > struct font_info *tab; > > @@ -674,7 +674,7 @@ static void select_metrics(struct udevice *dev, struct > console_tt_metrics *met) > vc_priv->tab_width_frac = VID_TO_POS(met->font_size) * 8 / 2; > } > > -int vidconsole_select_font(struct udevice *dev, const char *name, uint size) > +int console_truetype_select_font(struct udevice *dev, const char *name, uint > size) > { > struct console_tt_priv *priv = dev_get_priv(dev); > struct console_tt_metrics *met; > @@ -763,6 +763,8 @@ struct vidconsole_ops console_truetype_ops = { > .set_row= console_truetype_set_row, > .backspace = console_truetype_backspace, > .entry_start= console_truetype_entry_start, > + .list_fonts = console_truetype_list_fonts, > + .select_font= console_truetype_select_font, > }; > > U_BOOT_DRIVER(vidconsole_truetype) = { > diff --git a/drivers/video/vidconsole-uclass.c > b/drivers/video/vidconsole-uclass.c > index 6bdfb6e37d..5a08fdd689 100644 > --- a/drivers/video/vidconsole-uclass.c > +++ b/drivers/video/vidconsole-uclass.c > @@ -85,6 +85,28 @@ static int vidconsole_back(struct udevice *dev) > return video_sync(dev->parent, false); > } > > +void vidconsole_list_fonts(struct udevice *dev) > +{ > + struct vidconsole_ops *ops = vidconsole_get_ops(dev); > + > + if (ops->select_font) > + ops->list_fonts(dev); > +} > + > +int vidconsole_select_font(struct udevice *dev, const char *name, uint size) > +{ > + struct vidconsole_ops *ops = vidconsole_get_ops(dev); > + int ret; > + > + if (ops->select_font) { > + ret = ops->select_font(dev, name, size); > + if (ret != -ENOSYS) > + return ret; > + } > + > + return 0; > +} > + > /* Move to a newline, scrolling the display if necessary */ > static void vidconsole_newline(struct udevice *dev) > { > diff --git a/include/video.h b/include/video.h > index 43f2e2c02f..91c05fa9f0 100644 > --- a/include/video.h > +++ b/include/video.h > @@ -115,6 +115,7 @@ struct video_priv { > bool flush_dcache; > u8 fg_col_idx; > u8 bg_col_idx; > + struct video_fontdata *fontdata; please update comment for this new member > }; > > /** > diff --git a/include/video_console.h b/include/video_console.h > index d755eb73cf..fc702cc165 100644 > --- a/include/video_console.h > +++ b/include/video_console.h > @@ -133,6 +133,22 @@ struct vidconsole_ops { > * characters. > */ > int (*backspace)(struct udevice *dev); > + > + /** > +* list_fonts() - List the available fonts > +* > +* This shows a list on the console comments again, @dev and Returns > +*/ > + void (*list_fonts)(struct udevice *dev); > + > + /** > +* select_font() - Select a font to use > +* > +* @dev: vidconsole device > +* @name: Font name > +* @size: Size of the font (norminal pixel height) or 0 for default Returns > +*/ > + int (*select_font)(struct udevice *dev, const char *name, uint size); > }; > > /* Get a pointer to the driver operations for a video console device */ > @@ -236,7 +252,7 @@ void
Re: [PATCH v2 6/8] video console: add 12x22 Sun font from linux
On Mon, 13 Feb 2023 at 16:17, Dzmitry Sankouski wrote: > > Modern mobile phones typically have high pixel density. > Bootmenu is hardly readable on those with 8x16 font. > > Signed-off-by: Dzmitry Sankouski > --- > Changes for v2: N/A > > drivers/video/Kconfig |7 + > include/video_font.h |6 + > include/video_font_sun12x22.h | 6158 + > 3 files changed, 6171 insertions(+) > create mode 100644 include/video_font_sun12x22.h Reviewed-by: Simon Glass
Re: [PATCH v2 7/8] video console: add 16x32 Terminus font from linux
On Mon, 13 Feb 2023 at 16:17, Dzmitry Sankouski wrote: > > Modern mobile phones typically have high pixel density. > Bootmenu is hardly readable on those with 8x16 font. > > Signed-off-by: Dzmitry Sankouski > --- > Changes for v2: > - edit for runtime configuration > > drivers/video/Kconfig |7 + > include/video_font.h |6 + > include/video_font_ter16x32.h | 2062 + > 3 files changed, 2075 insertions(+) > create mode 100644 include/video_font_ter16x32.h Reviewed-by: Simon Glass
Please pull u-boot-dm into -next
Hi Tom, This is for the -next branch https://source.denx.de/u-boot/custodians/u-boot-dm/-/pipelines/15198 The following changes since commit faac9dee8e0629326dc122f4624fc4897e3f38b0: Prepare v2023.04-rc2 (2023-02-13 18:39:15 -0500) are available in the Git repository at: git://git.denx.de/u-boot-dm.git tags/dm-next-valentine for you to fetch changes up to 9a8a27a76ad7ab51f19c7f019d7cdac8a3f9f3c9: dm: test: Add a test for the various migration combinations (2023-02-14 09:43:27 -0700) Move U-Boot over to the new schema for driver model tags Simon Glass (11): schemas: Add schema for U-Boot driver model 'phase tags' dm: Add support for handling old u-boot,dm- tags dm: dts: Convert driver model tags to use new schema dm: treewide: Complete migration to new driver model schema dm: doc: Update device tree binding docs for new schema dm: doc: Update documentation for new driver model schema dm: doc: Move to new driver model schema checkpatch: Add a warning for pre-schema driver model tags CI: Add a check for pre-schema driver model tags test: Add a way to set the environment for a pytest dm: test: Add a test for the various migration combinations .azure-pipelines.yml | 12 ++ .gitlab-ci.yml | 9 + arch/arc/dts/abilis_tb100.dts | 2 +- arch/arc/dts/axc001.dtsi | 2 +- arch/arc/dts/axc003.dtsi | 2 +- arch/arc/dts/axs10x_mb.dtsi | 6 +-- arch/arc/dts/emsdp.dts | 2 +- arch/arc/dts/hsdk-common.dtsi | 2 +- arch/arc/dts/iot_devkit.dts| 2 +- arch/arc/dts/nsim.dts | 2 +- arch/arc/dts/skeleton.dtsi | 2 +- arch/arm/dts/am335x-brppt1-mmc-u-boot.dtsi | 48 +++ arch/arm/dts/am335x-brsmarc1.dts | 28 +++--- arch/arm/dts/am335x-brxre1.dts | 22 +-- arch/arm/dts/am335x-evm-u-boot.dtsi | 22 +-- arch/arm/dts/am335x-evmsk-u-boot.dtsi | 4 +- arch/arm/dts/am335x-guardian-u-boot.dtsi | 28 +++--- arch/arm/dts/am335x-pdu001-u-boot.dtsi | 30 +++ arch/arm/dts/am335x-pxm50-u-boot.dtsi | 4 +- arch/arm/dts/am335x-regor-rdk-u-boot.dtsi | 8 ++-- arch/arm/dts/am335x-rut-u-boot.dtsi| 4 +- arch/arm/dts/am335x-sancloud-bbe-lite-u-boot.dtsi | 18 - arch/arm/dts/am335x-shc-u-boot.dtsi | 20 +- arch/arm/dts/am335x-wega-rdk-u-boot.dtsi | 14 +++ arch/arm/dts/am33xx-u-boot.dtsi| 2 +- arch/arm/dts/am3517-evm-u-boot.dtsi | 18 - arch/arm/dts/am4372-generic-u-boot.dtsi| 4 +- arch/arm/dts/am4372-u-boot.dtsi | 20 +- arch/arm/dts/am437x-gp-evm-u-boot.dtsi | 24 ++-- arch/arm/dts/am437x-idk-evm-u-boot.dtsi | 8 ++-- arch/arm/dts/am437x-sk-evm-u-boot.dtsi | 8 ++-- arch/arm/dts/armada-3720-eDPU-u-boot.dtsi | 6 +-- arch/arm/dts/armada-3720-uDPU-u-boot.dtsi | 6 +-- arch/arm/dts/armada-385-atl-x530-u-boot.dtsi | 2 +- arch/arm/dts/armada-385-turris-omnia-u-boot.dtsi | 12 +++--- arch/arm/dts/armada-388-clearfog-u-boot.dtsi | 18 - arch/arm/dts/armada-388-helios4-u-boot.dtsi | 20 +- arch/arm/dts/armada-38x-controlcenterdc-u-boot.dtsi | 12 +++--- arch/arm/dts/armada-ap80x-quad.dtsi | 8 ++-- arch/arm/dts/armada-xp-theadorable-u-boot.dtsi | 2 +- arch/arm/dts/ast2500-evb.dts | 8 ++-- arch/arm/dts/ast2500-u-boot.dtsi | 8 ++-- arch/arm/dts/ast2600-evb.dts | 6 +-- arch/arm/dts/ast2600-u-boot.dtsi | 10 ++--- arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi | 34 - arch/arm/dts/at91-sama5d27_giantboard.dts | 16 arch/arm/dts/at91-sama5d27_som1_ek.dts | 24 ++-- arch/arm/dts/at91-sama5d27_wlsom1_ek-u-boot.dtsi | 20 +- arch/arm/dts/at91-sama5d2_icp-u-boot.dtsi | 18 - arch/arm/dts/at91-sama5d2_ptc_ek.dts | 18 - arch/arm/dts/at91-sama5d2_xplained.dts | 38 +- arch/arm/dts/at91-sama5d3_xplained.dts | 14 +++ arch/arm/dts/at91-sama5d4_xplained.dts | 20 +- arch/arm/dts/at91-sama5d4ek.dts | 20 +- arch/arm/dts/at91-sama7g5ek-u-boot.dtsi | 24 ++-- arch/arm/dts/at91sam9260-smartweb.dts | 4 +- arch/arm/dts/at91sam9260.dtsi | 26 ++--- arch/arm/dts/at91sam9260ek.dts
[PATCH v4 14/16] ARM: tegra: crypto: extend crypto functional
Add support for encryption, decryption and signinig with non-zero key saving backward compatibility. Signed-off-by: Svyatoslav Ryhel --- arch/arm/include/asm/arch-tegra/crypto.h | 47 ++ arch/arm/mach-tegra/crypto.c | 63 +--- arch/arm/mach-tegra/crypto.h | 19 --- 3 files changed, 91 insertions(+), 38 deletions(-) create mode 100644 arch/arm/include/asm/arch-tegra/crypto.h delete mode 100644 arch/arm/mach-tegra/crypto.h diff --git a/arch/arm/include/asm/arch-tegra/crypto.h b/arch/arm/include/asm/arch-tegra/crypto.h new file mode 100644 index 00..7646163b97 --- /dev/null +++ b/arch/arm/include/asm/arch-tegra/crypto.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2011 The Chromium OS Authors. + * (C) Copyright 2010 - 2011 NVIDIA Corporation + */ + +#ifndef _CRYPTO_H_ +#define _CRYPTO_H_ + +/** + * Sign a block of data + * + * \param source Source data + * \param length Size of source data + * \param signatureDestination address for signature, AES_KEY_LENGTH bytes + */ +int sign_data_block(u8 *source, unsigned int length, u8 *signature); + +/** + * Sign an encrypted block of data + * + * \param source Source data + * \param length Size of source data + * \param signatureDestination address for signature, AES_KEY_LENGTH bytes + * \param key AES128 encryption key + */ +int sign_enc_data_block(u8 *source, unsigned int length, u8 *signature, u8 *key); + +/** + * Encrypt a block of data + * + * \param source Source data + * \param length Size of source data + * \param key AES128 encryption key + */ +int encrypt_data_block(u8 *source, unsigned int length, u8 *key); + +/** + * Decrypt a block of data + * + * \param source Source data + * \param length Size of source data + * \param key AES128 encryption key + */ +int decrypt_data_block(u8 *source, unsigned int length, u8 *key); + +#endif /* #ifndef _CRYPTO_H_ */ diff --git a/arch/arm/mach-tegra/crypto.c b/arch/arm/mach-tegra/crypto.c index 1efaa5c3ec..893da35e0b 100644 --- a/arch/arm/mach-tegra/crypto.c +++ b/arch/arm/mach-tegra/crypto.c @@ -7,7 +7,7 @@ #include #include #include -#include "crypto.h" +#include #include "uboot_aes.h" static u8 zero_key[16]; @@ -17,6 +17,7 @@ static u8 zero_key[16]; enum security_op { SECURITY_SIGN = 1 << 0, /* Sign the data */ SECURITY_ENCRYPT= 1 << 1, /* Encrypt the data */ + SECURITY_DECRYPT= 1 << 2, /* Dectypt the data */ }; /** @@ -54,7 +55,7 @@ static void sign_object(u8 *key, u8 *key_schedule, u8 *src, u8 *dst, u8 left[AES128_KEY_LENGTH]; u8 k1[AES128_KEY_LENGTH]; u8 *cbc_chain_data; - unsigned i; + unsigned int i; cbc_chain_data = zero_key; /* Convenient array of 0's for IV */ @@ -92,7 +93,7 @@ static void sign_object(u8 *key, u8 *key_schedule, u8 *src, u8 *dst, } /** - * Encrypt and sign a block of data (depending on security mode). + * Decrypt, encrypt or sign a block of data (depending on security mode). * * \param key Input AES key, length AES128_KEY_LENGTH * \param oper Security operations mask to perform (enum security_op) @@ -100,44 +101,68 @@ static void sign_object(u8 *key, u8 *key_schedule, u8 *src, u8 *dst, * \param length Size of source data * \param sig_dst Destination address for signature, AES128_KEY_LENGTH bytes */ -static int encrypt_and_sign(u8 *key, enum security_op oper, u8 *src, - u32 length, u8 *sig_dst) +static int tegra_crypto_core(u8 *key, enum security_op oper, u8 *src, +u32 length, u8 *sig_dst) { u32 num_aes_blocks; u8 key_schedule[AES128_EXPAND_KEY_LENGTH]; u8 iv[AES128_KEY_LENGTH] = {0}; - debug("encrypt_and_sign: length = %d\n", length); + debug("%s: length = %d\n", __func__, length); - /* -* The only need for a key is for signing/checksum purposes, so -* if not encrypting, expand a key of 0s. -*/ - aes_expand_key(oper & SECURITY_ENCRYPT ? key : zero_key, - AES128_KEY_LENGTH, key_schedule); + aes_expand_key(key, AES128_KEY_LENGTH, key_schedule); num_aes_blocks = (length + AES128_KEY_LENGTH - 1) / AES128_KEY_LENGTH; + if (oper & SECURITY_DECRYPT) { + /* Perform this in place, resulting in src being decrypted. */ + debug("%s: begin decryption\n", __func__); + aes_cbc_decrypt_blocks(AES128_KEY_LENGTH, key_schedule, iv, src, + src, num_aes_blocks); + debug("%s: end decryption\n", __func__); + } + if (oper & SECURITY_ENCRYPT) { /* Perform this in place, resulting in src being encrypted. */ - debug("encrypt_and_sign:
Re: [PATCH v3 61/95] kconfig: Support writing separate SPL files
On Tue, Feb 14, 2023 at 09:58:59AM -0700, Simon Glass wrote: > Hi Tom, > > On Tue, 14 Feb 2023 at 09:31, Tom Rini wrote: > > > > On Sun, Feb 12, 2023 at 04:16:04PM -0700, Simon Glass wrote: > > > > > At present kconfig writes out several files, including: > > > > > >auto.conf - CONFIG settings used by make > > >autoconf.h - header file used by C code > > > > > > This works well but is a bit ugly in places, for example requiring the use > > > of a SPL_TPL_ macro in Makefiles to distinguish between options intended > > > for SPL and U-Boot proper. > > > > > > Update the kconfig tool to also output separate files for each phase: e.g. > > > auto_spl.conf and autoconf_spl.h > > > > > > These are similar to the existing files, but drop the SPL_ prefix so that > > > SPL_TPL_ is not needed. It also allows the CONFIG_IS_ENABLED() macro to be > > > simplified, in a later patch, eventually replacing it with IS_ENABLED(). > > > > > > When CONFIG_FOO is used within SPL, it means that FOO is enabled in that > > > SPL phase. For example if CONFIG_SPL_FOO is enabled in the Kconfig, that > > > means that CONFIG_FOO will be enabled in the SPL phase. So the SPL builds > > > can just use CONFIG_FOO to check it. There is no need to use > > > CONFIG_SPL_FOO or CONFIG_IS_ENABLED() anymore. > > > > > > This of course means that if there is a need to access a PPL symbol from > > > an SPL build, there is no way to do it. To copy with that, we need a > > > CONFIG_PPL_FOO to be visibilty to all SPL builds. > > > > > > So this change also adds new PPL_ output for U-Boot proper (Primary > > > Program Loader). So every CONFIG_FOO that is enabled in PPL also has a > > > CONFIG_PPL_FOO > > > > > > This allows SPL to access the TEXT_BASE for U-Boot proper, for example, so > > > it knows where to load it. There are about 30 places where this is needed, > > > in addition to TEXT_BASE. The environment has the same problem, adding > > > another dozen or so caes in include/config_distro_bootcmd.h but it has > > > been decided to ignore that for now. > > > > > > The feature is controlled by an environment variable, since it seems to be > > > bad form to add flags to the conf tool. > > > > > > Rebuild the autoconf files if the split config is not present. This allows > > > building this commit as part of a chain, without generating build errors. > > > > > > These changes may benefit from some reworking to send upstream, e.g. to > > > use a struct for the 'arg' parameter. > > > > > > Signed-off-by: Simon Glass > > > > This patch, I think, is where my largest problem is. We go from being > > able to say "if CONFIG_SPL_FOO is undefined, it is false" to "we must > > define CONFIG_SPL_FOO to false". There's around 150 cases of this, with > > the series. Why can we not extend the PPL logic (which I'm not super > > happy with, but, I understand and I think an audit of everything > > not-TEXT_BASE should be fairly straight forward), to say that if > > CONFIG_FOO exists and CONFIG_SPL_FOO does not exist, say CONFIG_SPL_FOO > > is now false. > > Well it is all about choices. > > We don't have to add a CONFIG_SPL_xxx to tell Kconfig that the PPL > symbol controls all phases. We can use the conf_nospl file instead. > But then the entire description is not in Kconfig. Of course, we might > expect that some of those things in conf_nospl might end up needing to > be controlled in SPL, so perhaps that file would shrink? Not sure > about that, though. > > It isn't just SPL , BTW. We might have any xPL symbol defined. > > I suppose you are thinking of something like: > > #define CONFIG_IS_ENABLED(x) IS_ENABLED(CONFIG_ ## xpl_prefix ## x) || >( IS_ENABLED(CONFIG_ ## x) && !IS_ENABLED(CONFIG_ SPL_ ## x) && > !IS_ENABLED(CONFIG_TPL_ ##x) ..) > > But how do we deal with Makefiles? We still end up with the SPL_TPL_ stuff. I see it as a very useful feature that today if we don't set CONFIG_xPL_FOO, it evaluates to false, anywhere we need it to. In all of the prep work for split config, I think we've seen one case where we got things wrong (in that it lead to failure). Split config build is doing a whole bunch of things to then remove this feature. And the series intentionally ignores the Makefile design issue / feature of wrapping large chunks with a check for being/not-being in an xPL_BUILD phase. > Yes, adding PPL moves a step forward and reduces the audit to only > uses of PPL, instead of the whole Kconfig. > > This series does get us closer to separate configs (it is really easy > to see what is enabled in each build just by looking at the > auto_xpl.conf files) and I think those 150 exceptions are not a big > price to pay. > > Ultimately I am coming to the view that we should extend the Kconfig > language to support multiple build phases, using a 'phase' property. > Zephyr is going to need it too, fairly soon[1]. > > Regards, > Simon > > [1] https://github.com/zephyrproject-rtos/zephyr/issues/54534 Yes, if the Kconfig language moves
[PATCH v4 16/16] ARM: tegra20: implement BCT patching
This function allows updating bootloader from u-boot on production devices without need in host PC. Be aware! It works only with re-crypt BCT. Tested-by: Robert Eckelmann # ASUS TF101 T20 Signed-off-by: Ramin Khonsari Signed-off-by: Svyatoslav Ryhel --- arch/arm/mach-tegra/Kconfig | 2 +- arch/arm/mach-tegra/tegra20/Makefile | 5 +- arch/arm/mach-tegra/tegra20/bct.c| 79 arch/arm/mach-tegra/tegra20/bct.h| 42 +++ doc/usage/cmd/ebtupdate.rst | 70 5 files changed, 194 insertions(+), 4 deletions(-) create mode 100644 arch/arm/mach-tegra/tegra20/bct.c create mode 100644 arch/arm/mach-tegra/tegra20/bct.h create mode 100644 doc/usage/cmd/ebtupdate.rst diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index 8490d42a7b..464bd0798f 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig @@ -231,7 +231,7 @@ config CMD_ENTERRCM config CMD_EBTUPDATE bool "Enable 'ebtupdate' command" - depends on TEGRA30 + depends on TEGRA20 || TEGRA30 select TEGRA_CRYPTO help Updating u-boot from within u-boot in rather complex or even diff --git a/arch/arm/mach-tegra/tegra20/Makefile b/arch/arm/mach-tegra/tegra20/Makefile index 67454ff5f4..991cabeec5 100644 --- a/arch/arm/mach-tegra/tegra20/Makefile +++ b/arch/arm/mach-tegra/tegra20/Makefile @@ -2,9 +2,8 @@ # # (C) Copyright 2010,2011 Nvidia Corporation. -ifdef CONFIG_SPL_BUILD -obj-y += cpu.o -endif +obj-$(CONFIG_SPL_BUILD) += cpu.o +obj-$(CONFIG_$(SPL_)CMD_EBTUPDATE) += bct.o # The AVP is ARMv4T architecture so we must use special compiler # flags for any startup files it might use. diff --git a/arch/arm/mach-tegra/tegra20/bct.c b/arch/arm/mach-tegra/tegra20/bct.c new file mode 100644 index 00..5eb48990b6 --- /dev/null +++ b/arch/arm/mach-tegra/tegra20/bct.c @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2022, Ramin + * Copyright (c) 2022, Svyatoslav Ryhel + */ + +#include +#include +#include +#include +#include "bct.h" +#include "uboot_aes.h" + +/* + * @param bct boot config table start in RAM + * @param ect bootloader start in RAM + * @param ebt_sizebootloader file size in bytes + * Return: 0, or 1 if failed + */ +static int bct_patch(u8 *bct, u8 *ebt, u32 ebt_size) +{ + struct nvboot_config_table *bct_tbl = NULL; + u8 ebt_hash[AES128_KEY_LENGTH] = { 0 }; + u8 sbk[AES128_KEY_LENGTH] = { 0 }; + u8 *bct_hash = bct; + int ret; + + bct += BCT_HASH; + + memcpy(sbk, (u8 *)(bct + BCT_LENGTH), + NVBOOT_CMAC_AES_HASH_LENGTH * 4); + + ret = decrypt_data_block(bct, BCT_LENGTH, sbk); + if (ret) + return 1; + + ebt_size = roundup(ebt_size, EBT_ALIGNMENT); + + ret = encrypt_data_block(ebt, ebt_size, sbk); + if (ret) + return 1; + + ret = sign_enc_data_block(ebt, ebt_size, ebt_hash, sbk); + if (ret) + return 1; + + bct_tbl = (struct nvboot_config_table *)bct; + + memcpy((u8 *)_tbl->bootloader[0].crypto_hash, + ebt_hash, NVBOOT_CMAC_AES_HASH_LENGTH * 4); + bct_tbl->bootloader[0].entry_point = CONFIG_SPL_TEXT_BASE; + bct_tbl->bootloader[0].load_addr = CONFIG_SPL_TEXT_BASE; + bct_tbl->bootloader[0].length = ebt_size; + + ret = encrypt_data_block(bct, BCT_LENGTH, sbk); + if (ret) + return 1; + + ret = sign_enc_data_block(bct, BCT_LENGTH, bct_hash, sbk); + if (ret) + return 1; + + return 0; +} + +static int do_ebtupdate(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + u32 bct_addr = hextoul(argv[1], NULL); + u32 ebt_addr = hextoul(argv[2], NULL); + u32 ebt_size = hextoul(argv[3], NULL); + + return bct_patch((u8 *)bct_addr, (u8 *)ebt_addr, ebt_size); +} + +U_BOOT_CMD(ebtupdate, 4, 0, do_ebtupdate, + "update bootloader on re-crypted Tegra20 devices", + "" +); diff --git a/arch/arm/mach-tegra/tegra20/bct.h b/arch/arm/mach-tegra/tegra20/bct.h new file mode 100644 index 00..4b78aef7cf --- /dev/null +++ b/arch/arm/mach-tegra/tegra20/bct.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef _BCT_H_ +#define _BCT_H_ + +/* + * Defines the BCT parametres for T20 + */ +#define BCT_LENGTH 0xFE0 +#define BCT_HASH 0x10 +#define EBT_ALIGNMENT 0x10 + +/* + * Defines the CMAC-AES-128 hash length in 32 bit words. (128 bits = 4 words) + */ +#define NVBOOT_CMAC_AES_HASH_LENGTH4 + +/* + * Defines the maximum number of bootloader descriptions in the BCT. + */ +#define NVBOOT_MAX_BOOTLOADERS 4 + +struct nv_bootloader_info { + u32 version; + u32 start_blk; + u32 start_page; + u32 length; + u32
[PATCH v4 15/16] ARM: tegra30: implement BCT patching
From: Ramin Khonsari This function allows updating bootloader from u-boot on production devices without need in host PC. Be aware! It works only with re-crypted BCT. Tested-by: Andreas Westman Dorcsak # ASUS TF T30 Tested-by: Svyatoslav Ryhel # LG P895 T30 Signed-off-by: Ramin Khonsari Signed-off-by: Svyatoslav Ryhel --- arch/arm/mach-tegra/Kconfig | 9 arch/arm/mach-tegra/tegra30/Makefile | 1 + arch/arm/mach-tegra/tegra30/bct.c| 79 arch/arm/mach-tegra/tegra30/bct.h| 42 +++ 4 files changed, 131 insertions(+) create mode 100644 arch/arm/mach-tegra/tegra30/bct.c create mode 100644 arch/arm/mach-tegra/tegra30/bct.h diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index 5b0cd92d9e..8490d42a7b 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig @@ -229,4 +229,13 @@ config CMD_ENTERRCM for mechanical button actuators, or hooking up relays/... to the button. +config CMD_EBTUPDATE + bool "Enable 'ebtupdate' command" + depends on TEGRA30 + select TEGRA_CRYPTO + help + Updating u-boot from within u-boot in rather complex or even + impossible on production devices. To make it easier procedure of + re-cryption was created. If your device was re-crypted choose Y. + endif diff --git a/arch/arm/mach-tegra/tegra30/Makefile b/arch/arm/mach-tegra/tegra30/Makefile index 9f170576e7..28dd486d8d 100644 --- a/arch/arm/mach-tegra/tegra30/Makefile +++ b/arch/arm/mach-tegra/tegra30/Makefile @@ -3,5 +3,6 @@ # Copyright (c) 2010-2012, NVIDIA CORPORATION. All rights reserved. obj-$(CONFIG_SPL_BUILD) += cpu.o +obj-$(CONFIG_$(SPL_)CMD_EBTUPDATE) += bct.o obj-y += clock.o funcmux.o pinmux.o diff --git a/arch/arm/mach-tegra/tegra30/bct.c b/arch/arm/mach-tegra/tegra30/bct.c new file mode 100644 index 00..c56958da69 --- /dev/null +++ b/arch/arm/mach-tegra/tegra30/bct.c @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2022, Ramin + * Copyright (c) 2022, Svyatoslav Ryhel + */ + +#include +#include +#include +#include +#include "bct.h" +#include "uboot_aes.h" + +/* + * @param bct boot config table start in RAM + * @param ect bootloader start in RAM + * @param ebt_sizebootloader file size in bytes + * Return: 0, or 1 if failed + */ +static int bct_patch(u8 *bct, u8 *ebt, u32 ebt_size) +{ + struct nvboot_config_table *bct_tbl = NULL; + u8 ebt_hash[AES128_KEY_LENGTH] = { 0 }; + u8 sbk[AES128_KEY_LENGTH] = { 0 }; + u8 *bct_hash = bct; + int ret; + + bct += BCT_HASH; + + memcpy(sbk, (u8 *)(bct + BCT_LENGTH), + NVBOOT_CMAC_AES_HASH_LENGTH * 4); + + ret = decrypt_data_block(bct, BCT_LENGTH, sbk); + if (ret) + return 1; + + ebt_size = roundup(ebt_size, EBT_ALIGNMENT); + + ret = encrypt_data_block(ebt, ebt_size, sbk); + if (ret) + return 1; + + ret = sign_enc_data_block(ebt, ebt_size, ebt_hash, sbk); + if (ret) + return 1; + + bct_tbl = (struct nvboot_config_table *)bct; + + memcpy((u8 *)_tbl->bootloader[0].crypto_hash, + ebt_hash, NVBOOT_CMAC_AES_HASH_LENGTH * 4); + bct_tbl->bootloader[0].entry_point = CONFIG_SPL_TEXT_BASE; + bct_tbl->bootloader[0].load_addr = CONFIG_SPL_TEXT_BASE; + bct_tbl->bootloader[0].length = ebt_size; + + ret = encrypt_data_block(bct, BCT_LENGTH, sbk); + if (ret) + return 1; + + ret = sign_enc_data_block(bct, BCT_LENGTH, bct_hash, sbk); + if (ret) + return 1; + + return 0; +} + +static int do_ebtupdate(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + u32 bct_addr = hextoul(argv[1], NULL); + u32 ebt_addr = hextoul(argv[2], NULL); + u32 ebt_size = hextoul(argv[3], NULL); + + return bct_patch((u8 *)bct_addr, (u8 *)ebt_addr, ebt_size); +} + +U_BOOT_CMD(ebtupdate, 4, 0, do_ebtupdate, + "update bootloader on re-crypted Tegra30 devices", + "" +); diff --git a/arch/arm/mach-tegra/tegra30/bct.h b/arch/arm/mach-tegra/tegra30/bct.h new file mode 100644 index 00..9797384da3 --- /dev/null +++ b/arch/arm/mach-tegra/tegra30/bct.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef _BCT_H_ +#define _BCT_H_ + +/* + * Defines the BCT parametres for T30 + */ +#define BCT_LENGTH 0x17E0 +#define BCT_HASH 0x10 +#define EBT_ALIGNMENT 0x10 + +/* + * Defines the CMAC-AES-128 hash length in 32 bit words. (128 bits = 4 words) + */ +#define NVBOOT_CMAC_AES_HASH_LENGTH4 + +/* + * Defines the maximum number of bootloader descriptions in the BCT. + */ +#define NVBOOT_MAX_BOOTLOADERS 4 + +struct nv_bootloader_info { + u32 version; + u32 start_blk; +
[PATCH v4 13/16] ARM: tegra: expose crypto module for all Tegra SoCs
Move crypto module from T20 only into common Tegra dir. Signed-off-by: Svyatoslav Ryhel --- arch/arm/mach-tegra/Kconfig| 5 + arch/arm/mach-tegra/Makefile | 1 + arch/arm/mach-tegra/{tegra20 => }/crypto.c | 0 arch/arm/mach-tegra/{tegra20 => }/crypto.h | 0 arch/arm/mach-tegra/tegra20/Kconfig| 1 + arch/arm/mach-tegra/tegra20/Makefile | 2 +- 6 files changed, 8 insertions(+), 1 deletion(-) rename arch/arm/mach-tegra/{tegra20 => }/crypto.c (100%) rename arch/arm/mach-tegra/{tegra20 => }/crypto.h (100%) diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index 4fc79ebadb..5b0cd92d9e 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig @@ -15,6 +15,11 @@ config SPL_SERIAL config TEGRA_CLKRST bool +config TEGRA_CRYPTO + bool "Tegra AES128 crypto module" + select AES + default n + config TEGRA_GP_PADCTRL bool diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index 7165d70a60..9147050b32 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile @@ -16,6 +16,7 @@ obj-$(CONFIG_TEGRA_GP_PADCTRL) += ap.o obj-y += board.o board2.o obj-y += cache.o obj-$(CONFIG_TEGRA_CLKRST) += clock.o +obj-$(CONFIG_$(SPL_)TEGRA_CRYPTO) += crypto.o obj-$(CONFIG_TEGRA_PINCTRL) += pinmux-common.o obj-$(CONFIG_TEGRA_PMC) += powergate.o obj-y += xusb-padctl-dummy.o diff --git a/arch/arm/mach-tegra/tegra20/crypto.c b/arch/arm/mach-tegra/crypto.c similarity index 100% rename from arch/arm/mach-tegra/tegra20/crypto.c rename to arch/arm/mach-tegra/crypto.c diff --git a/arch/arm/mach-tegra/tegra20/crypto.h b/arch/arm/mach-tegra/crypto.h similarity index 100% rename from arch/arm/mach-tegra/tegra20/crypto.h rename to arch/arm/mach-tegra/crypto.h diff --git a/arch/arm/mach-tegra/tegra20/Kconfig b/arch/arm/mach-tegra/tegra20/Kconfig index 955786c0c4..57d11024bf 100644 --- a/arch/arm/mach-tegra/tegra20/Kconfig +++ b/arch/arm/mach-tegra/tegra20/Kconfig @@ -3,6 +3,7 @@ if TEGRA20 config TEGRA_LP0 bool select TEGRA_CLOCK_SCALING + select TEGRA_CRYPTO config TEGRA_PMU bool diff --git a/arch/arm/mach-tegra/tegra20/Makefile b/arch/arm/mach-tegra/tegra20/Makefile index bb17c90cca..67454ff5f4 100644 --- a/arch/arm/mach-tegra/tegra20/Makefile +++ b/arch/arm/mach-tegra/tegra20/Makefile @@ -13,6 +13,6 @@ CFLAGS_warmboot_avp.o = -march=armv4t -U__LINUX_ARM_ARCH__ \ CFLAGS_REMOVE_warmboot_avp.o := $(LTO_CFLAGS) obj-y += clock.o funcmux.o pinmux.o -obj-$(CONFIG_TEGRA_LP0) += warmboot.o crypto.o warmboot_avp.o +obj-$(CONFIG_TEGRA_LP0) += warmboot.o warmboot_avp.o obj-$(CONFIG_TEGRA_CLOCK_SCALING) += emc.o obj-$(CONFIG_TEGRA_PMU) += pmu.o -- 2.37.2
[PATCH v4 12/16] board: tegra30: switch to updated pre-dm i2c write
Configure PMIC voltages for early stages using updated early i2c write. Tested-by: Thierry Reding # Beaver T30 Signed-off-by: Svyatoslav Ryhel Reviewed-by: Simon Glass --- arch/arm/mach-tegra/tegra30/Kconfig | 8 arch/arm/mach-tegra/tegra30/cpu.c | 36 - board/avionic-design/tec-ng/Makefile| 4 +- board/avionic-design/tec-ng/tec-ng-spl.c| 34 board/nvidia/beaver/Makefile| 2 + board/nvidia/beaver/beaver-spl.c| 43 + board/nvidia/cardhu/Makefile| 4 +- board/nvidia/cardhu/cardhu-spl.c| 43 + board/toradex/apalis_t30/Makefile | 2 + board/toradex/apalis_t30/apalis_t30-spl.c | 34 board/toradex/colibri_t30/Makefile | 2 + board/toradex/colibri_t30/colibri_t30-spl.c | 34 12 files changed, 200 insertions(+), 46 deletions(-) create mode 100644 board/avionic-design/tec-ng/tec-ng-spl.c create mode 100644 board/nvidia/beaver/beaver-spl.c create mode 100644 board/nvidia/cardhu/cardhu-spl.c create mode 100644 board/toradex/apalis_t30/apalis_t30-spl.c create mode 100644 board/toradex/colibri_t30/colibri_t30-spl.c diff --git a/arch/arm/mach-tegra/tegra30/Kconfig b/arch/arm/mach-tegra/tegra30/Kconfig index 5619d1cd42..85b8ce294f 100644 --- a/arch/arm/mach-tegra/tegra30/Kconfig +++ b/arch/arm/mach-tegra/tegra30/Kconfig @@ -1,11 +1,5 @@ if TEGRA30 -config TEGRA_VDD_CORE_TPS62361B_SET3 - bool - -config TEGRA_VDD_CORE_TPS62366A_SET1 - bool - choice prompt "Tegra30 board select" optional @@ -17,12 +11,10 @@ config TARGET_APALIS_T30 config TARGET_BEAVER bool "NVIDIA Tegra30 Beaver evaluation board" select BOARD_LATE_INIT - select TEGRA_VDD_CORE_TPS62366A_SET1 config TARGET_CARDHU bool "NVIDIA Tegra30 Cardhu evaluation board" select BOARD_LATE_INIT - select TEGRA_VDD_CORE_TPS62361B_SET3 config TARGET_COLIBRI_T30 bool "Toradex Colibri T30 board" diff --git a/arch/arm/mach-tegra/tegra30/cpu.c b/arch/arm/mach-tegra/tegra30/cpu.c index 6ac45af51a..60bbf13ea5 100644 --- a/arch/arm/mach-tegra/tegra30/cpu.c +++ b/arch/arm/mach-tegra/tegra30/cpu.c @@ -15,20 +15,6 @@ #include #include "../cpu.h" -#define TPS62366A_I2C_ADDR 0xC0 -#define TPS62366A_SET1_REG 0x01 -#define TPS62366A_SET1_DATA(0x4600 | TPS62366A_SET1_REG) - -#define TPS62361B_I2C_ADDR 0xC0 -#define TPS62361B_SET3_REG 0x03 -#define TPS62361B_SET3_DATA(0x4600 | TPS62361B_SET3_REG) - -#define TPS65911_I2C_ADDR 0x5A -#define TPS65911_VDDCTRL_OP_REG0x28 -#define TPS65911_VDDCTRL_SR_REG0x27 -#define TPS65911_VDDCTRL_OP_DATA (0x2400 | TPS65911_VDDCTRL_OP_REG) -#define TPS65911_VDDCTRL_SR_DATA (0x0100 | TPS65911_VDDCTRL_SR_REG) - /* In case this function is not defined */ __weak void pmic_enable_cpu_vdd(void) {} @@ -41,28 +27,6 @@ static void enable_cpu_power_rail(void) reg = readl(>pmc_cntrl); reg |= CPUPWRREQ_OE; writel(reg, >pmc_cntrl); - - /* Set VDD_CORE to 1.200V. */ -#ifdef CONFIG_TEGRA_VDD_CORE_TPS62366A_SET1 - tegra_i2c_ll_write(TPS62366A_I2C_ADDR, - TPS62366A_SET1_DATA); -#endif -#ifdef CONFIG_TEGRA_VDD_CORE_TPS62361B_SET3 - tegra_i2c_ll_write(TPS62361B_I2C_ADDR, - TPS62361B_SET3_DATA); -#endif - udelay(1000); - - /* -* Bring up CPU VDD via the TPS65911x PMIC on the DVC I2C bus. -* First set VDD to 1.0125V, then enable the VDD regulator. -*/ - tegra_i2c_ll_write(TPS65911_I2C_ADDR, - TPS65911_VDDCTRL_OP_DATA); - udelay(1000); - tegra_i2c_ll_write(TPS65911_I2C_ADDR, - TPS65911_VDDCTRL_SR_DATA); - udelay(10 * 1000); } /** diff --git a/board/avionic-design/tec-ng/Makefile b/board/avionic-design/tec-ng/Makefile index 46df14d991..d6890e5797 100644 --- a/board/avionic-design/tec-ng/Makefile +++ b/board/avionic-design/tec-ng/Makefile @@ -3,4 +3,6 @@ # (C) Copyright 2013 # Avionic Design GmbH -obj-y := ../common/tamonten-ng.o +obj-$(CONFIG_SPL_BUILD) += tec-ng-spl.o + +obj-y += ../common/tamonten-ng.o diff --git a/board/avionic-design/tec-ng/tec-ng-spl.c b/board/avionic-design/tec-ng/tec-ng-spl.c new file mode 100644 index 00..6e54464183 --- /dev/null +++ b/board/avionic-design/tec-ng/tec-ng-spl.c @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * (C) Copyright 2010-2013 + * NVIDIA Corporation + * + * (C) Copyright 2021 + * Svyatoslav Ryhel + */ + +#include +#include +#include + +/* I2C addr is in 8 bit */ +#define TPS65911_I2C_ADDR 0x5A +#define TPS65911_VDDCTRL_OP_REG0x28 +#define TPS65911_VDDCTRL_SR_REG0x27 +#define
[PATCH v4 11/16] board: tegra124: switch to updated pre-dm i2c write
Configure PMIC for early stages using updated i2c write. Tested-by: Thierry Reding # Jetson TK1 T124 Signed-off-by: Svyatoslav Ryhel Reviewed-by: Simon Glass --- board/nvidia/venice2/as3722_init.c | 65 board/nvidia/venice2/as3722_init.h | 43 - board/toradex/apalis-tk1/as3722_init.c | 85 ++ board/toradex/apalis-tk1/as3722_init.h | 40 4 files changed, 88 insertions(+), 145 deletions(-) delete mode 100644 board/nvidia/venice2/as3722_init.h delete mode 100644 board/toradex/apalis-tk1/as3722_init.h diff --git a/board/nvidia/venice2/as3722_init.c b/board/nvidia/venice2/as3722_init.c index ba676547d3..395bdd99c7 100644 --- a/board/nvidia/venice2/as3722_init.c +++ b/board/nvidia/venice2/as3722_init.c @@ -9,25 +9,42 @@ #include #include #include -#include "as3722_init.h" -/* AS3722-PMIC-specific early init code - get CPU rails up, etc */ +/* AS3722-PMIC-specific early init regs */ -void tegra_i2c_ll_write_addr(uint addr, uint config) -{ - struct i2c_ctlr *reg = (struct i2c_ctlr *)TEGRA_DVC_BASE; +#define AS3722_I2C_ADDR0x80 - writel(addr, >cmd_addr0); - writel(config, >cnfg); -} +#define AS3722_SD0VOLTAGE_REG 0x00/* CPU */ +#define AS3722_SD1VOLTAGE_REG 0x01/* CORE, already set by OTP */ +#define AS3722_SD6VOLTAGE_REG 0x06/* GPU */ +#define AS3722_SDCONTROL_REG 0x4D -void tegra_i2c_ll_write_data(uint data, uint config) -{ - struct i2c_ctlr *reg = (struct i2c_ctlr *)TEGRA_DVC_BASE; +#define AS3722_LDO2VOLTAGE_REG 0x12/* VPP_FUSE */ +#define AS3722_LDO6VOLTAGE_REG 0x16/* VDD_SDMMC */ +#define AS3722_LDCONTROL_REG 0x4E - writel(data, >cmd_data1); - writel(config, >cnfg); -} +#if defined(CONFIG_TARGET_VENICE2) +#define AS3722_SD0VOLTAGE_DATA (0x2800 | AS3722_SD0VOLTAGE_REG) +#else /* TK1 or Nyan-Big */ +#define AS3722_SD0VOLTAGE_DATA (0x3C00 | AS3722_SD0VOLTAGE_REG) +#endif +#define AS3722_SD0CONTROL_DATA (0x0100 | AS3722_SDCONTROL_REG) + +#if defined(CONFIG_TARGET_JETSON_TK1) || defined(CONFIG_TARGET_CEI_TK1_SOM) +#define AS3722_SD1VOLTAGE_DATA (0x2800 | AS3722_SD1VOLTAGE_REG) +#define AS3722_SD1CONTROL_DATA (0x0200 | AS3722_SDCONTROL_REG) +#endif + +#define AS3722_SD6CONTROL_DATA (0x4000 | AS3722_SDCONTROL_REG) +#define AS3722_SD6VOLTAGE_DATA (0x2800 | AS3722_SD6VOLTAGE_REG) + +#define AS3722_LDO2CONTROL_DATA(0x0400 | AS3722_LDCONTROL_REG) +#define AS3722_LDO2VOLTAGE_DATA(0x1000 | AS3722_LDO2VOLTAGE_REG) + +#define AS3722_LDO6CONTROL_DATA(0x4000 | AS3722_LDCONTROL_REG) +#define AS3722_LDO6VOLTAGE_DATA(0x3F00 | AS3722_LDO6VOLTAGE_REG) + +/* AS3722-PMIC-specific early init code - get CPU rails up, etc */ void pmic_enable_cpu_vdd(void) { @@ -37,8 +54,8 @@ void pmic_enable_cpu_vdd(void) /* Set up VDD_CORE, for boards where OTP is incorrect*/ debug("%s: Setting VDD_CORE via AS3722 reg 1\n", __func__); /* Configure VDD_CORE via the AS3722 PMIC on the PWR I2C bus */ - tegra_i2c_ll_write_addr(AS3722_I2C_ADDR, 2); - tegra_i2c_ll_write_data(AS3722_SD1VOLTAGE_DATA, I2C_SEND_2_BYTES); + tegra_i2c_ll_write(AS3722_I2C_ADDR, + AS3722_SD1VOLTAGE_DATA); /* * Don't write SDCONTROL - it's already 0x7F, i.e. all SDs enabled. * tegra_i2c_ll_write_data(AS3722_SD1CONTROL_DATA, I2C_SEND_2_BYTES); @@ -51,8 +68,8 @@ void pmic_enable_cpu_vdd(void) * Bring up VDD_CPU via the AS3722 PMIC on the PWR I2C bus. * First set VDD to 1.0V, then enable the VDD regulator. */ - tegra_i2c_ll_write_addr(AS3722_I2C_ADDR, 2); - tegra_i2c_ll_write_data(AS3722_SD0VOLTAGE_DATA, I2C_SEND_2_BYTES); + tegra_i2c_ll_write(AS3722_I2C_ADDR, + AS3722_SD0VOLTAGE_DATA); /* * Don't write SDCONTROL - it's already 0x7F, i.e. all SDs enabled. * tegra_i2c_ll_write_data(AS3722_SD0CONTROL_DATA, I2C_SEND_2_BYTES); @@ -64,8 +81,8 @@ void pmic_enable_cpu_vdd(void) * Bring up VDD_GPU via the AS3722 PMIC on the PWR I2C bus. * First set VDD to 1.0V, then enable the VDD regulator. */ - tegra_i2c_ll_write_addr(AS3722_I2C_ADDR, 2); - tegra_i2c_ll_write_data(AS3722_SD6VOLTAGE_DATA, I2C_SEND_2_BYTES); + tegra_i2c_ll_write(AS3722_I2C_ADDR, + AS3722_SD6VOLTAGE_DATA); /* * Don't write SDCONTROL - it's already 0x7F, i.e. all SDs enabled. * tegra_i2c_ll_write_data(AS3722_SD6CONTROL_DATA, I2C_SEND_2_BYTES); @@ -77,8 +94,8 @@ void pmic_enable_cpu_vdd(void) * Bring up VPP_FUSE via the AS3722 PMIC on the PWR I2C bus. * First set VDD to 1.2V, then enable the VDD regulator. */ - tegra_i2c_ll_write_addr(AS3722_I2C_ADDR, 2); - tegra_i2c_ll_write_data(AS3722_LDO2VOLTAGE_DATA, I2C_SEND_2_BYTES); + tegra_i2c_ll_write(AS3722_I2C_ADDR, +
[PATCH v4 10/16] ARM: tegra: create common pre-dm i2c write
This implementation allows pwr i2c writing on early SPL stages when DM is not yet setup. Such writing is needed to configure main voltages of PMIC on early SPL for bootloader to boot properly. Tested-by: Andreas Westman Dorcsak # ASUS TF T30 Tested-by: Robert Eckelmann # ASUS TF101 T20 Tested-by: Svyatoslav Ryhel # LG P895 T30 Tested-by: Thierry Reding # T30 and T124 Signed-off-by: Svyatoslav Ryhel --- arch/arm/include/asm/arch-tegra/tegra_i2c.h | 17 ++ arch/arm/mach-tegra/cpu.h | 1 - arch/arm/mach-tegra/tegra124/cpu.c | 4 +++ arch/arm/mach-tegra/tegra30/cpu.c | 37 +++-- 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/arch/arm/include/asm/arch-tegra/tegra_i2c.h b/arch/arm/include/asm/arch-tegra/tegra_i2c.h index c49f43251d..afec6bbdda 100644 --- a/arch/arm/include/asm/arch-tegra/tegra_i2c.h +++ b/arch/arm/include/asm/arch-tegra/tegra_i2c.h @@ -8,6 +8,7 @@ #ifndef _TEGRA_I2C_H_ #define _TEGRA_I2C_H_ +#include #include struct udevice; @@ -154,4 +155,20 @@ struct i2c_ctlr { */ int tegra_i2c_get_dvc_bus(struct udevice **busp); +/* Pre-dm section used for initial setup of PMIC */ +#define I2C_SEND_2_BYTES 0x0A02 + +static inline void tegra_i2c_ll_write(uint addr, uint data) +{ + struct i2c_ctlr *reg = (struct i2c_ctlr *)TEGRA_DVC_BASE; + + writel(addr, >cmd_addr0); + writel(0x2, >cnfg); + + writel(data, >cmd_data1); + writel(I2C_SEND_2_BYTES, >cnfg); +} + +void pmic_enable_cpu_vdd(void); + #endif /* _TEGRA_I2C_H_ */ diff --git a/arch/arm/mach-tegra/cpu.h b/arch/arm/mach-tegra/cpu.h index d541825441..006aae3d07 100644 --- a/arch/arm/mach-tegra/cpu.h +++ b/arch/arm/mach-tegra/cpu.h @@ -74,4 +74,3 @@ int tegra_get_chip(void); int tegra_get_sku_info(void); int tegra_get_chip_sku(void); void adjust_pllp_out_freqs(void); -void pmic_enable_cpu_vdd(void); diff --git a/arch/arm/mach-tegra/tegra124/cpu.c b/arch/arm/mach-tegra/tegra124/cpu.c index d5f2683b26..b1bfe8fb5e 100644 --- a/arch/arm/mach-tegra/tegra124/cpu.c +++ b/arch/arm/mach-tegra/tegra124/cpu.c @@ -14,10 +14,14 @@ #include #include #include +#include #include #include #include "../cpu.h" +/* In case this function is not defined */ +__weak void pmic_enable_cpu_vdd(void) {} + /* Tegra124-specific CPU init code */ static void enable_cpu_power_rail(void) diff --git a/arch/arm/mach-tegra/tegra30/cpu.c b/arch/arm/mach-tegra/tegra30/cpu.c index 651edd27ee..6ac45af51a 100644 --- a/arch/arm/mach-tegra/tegra30/cpu.c +++ b/arch/arm/mach-tegra/tegra30/cpu.c @@ -15,23 +15,6 @@ #include #include "../cpu.h" -/* Tegra30-specific CPU init code */ -void tegra_i2c_ll_write_addr(uint addr, uint config) -{ - struct i2c_ctlr *reg = (struct i2c_ctlr *)TEGRA_DVC_BASE; - - writel(addr, >cmd_addr0); - writel(config, >cnfg); -} - -void tegra_i2c_ll_write_data(uint data, uint config) -{ - struct i2c_ctlr *reg = (struct i2c_ctlr *)TEGRA_DVC_BASE; - - writel(data, >cmd_data1); - writel(config, >cnfg); -} - #define TPS62366A_I2C_ADDR 0xC0 #define TPS62366A_SET1_REG 0x01 #define TPS62366A_SET1_DATA(0x4600 | TPS62366A_SET1_REG) @@ -45,7 +28,9 @@ void tegra_i2c_ll_write_data(uint data, uint config) #define TPS65911_VDDCTRL_SR_REG0x27 #define TPS65911_VDDCTRL_OP_DATA (0x2400 | TPS65911_VDDCTRL_OP_REG) #define TPS65911_VDDCTRL_SR_DATA (0x0100 | TPS65911_VDDCTRL_SR_REG) -#define I2C_SEND_2_BYTES 0x0A02 + +/* In case this function is not defined */ +__weak void pmic_enable_cpu_vdd(void) {} static void enable_cpu_power_rail(void) { @@ -59,12 +44,12 @@ static void enable_cpu_power_rail(void) /* Set VDD_CORE to 1.200V. */ #ifdef CONFIG_TEGRA_VDD_CORE_TPS62366A_SET1 - tegra_i2c_ll_write_addr(TPS62366A_I2C_ADDR, 2); - tegra_i2c_ll_write_data(TPS62366A_SET1_DATA, I2C_SEND_2_BYTES); + tegra_i2c_ll_write(TPS62366A_I2C_ADDR, + TPS62366A_SET1_DATA); #endif #ifdef CONFIG_TEGRA_VDD_CORE_TPS62361B_SET3 - tegra_i2c_ll_write_addr(TPS62361B_I2C_ADDR, 2); - tegra_i2c_ll_write_data(TPS62361B_SET3_DATA, I2C_SEND_2_BYTES); + tegra_i2c_ll_write(TPS62361B_I2C_ADDR, + TPS62361B_SET3_DATA); #endif udelay(1000); @@ -72,10 +57,11 @@ static void enable_cpu_power_rail(void) * Bring up CPU VDD via the TPS65911x PMIC on the DVC I2C bus. * First set VDD to 1.0125V, then enable the VDD regulator. */ - tegra_i2c_ll_write_addr(TPS65911_I2C_ADDR, 2); - tegra_i2c_ll_write_data(TPS65911_VDDCTRL_OP_DATA, I2C_SEND_2_BYTES); + tegra_i2c_ll_write(TPS65911_I2C_ADDR, + TPS65911_VDDCTRL_OP_DATA); udelay(1000); - tegra_i2c_ll_write_data(TPS65911_VDDCTRL_SR_DATA, I2C_SEND_2_BYTES); + tegra_i2c_ll_write(TPS65911_I2C_ADDR, +
[PATCH v4 09/16] ARM: tegra: add late init support
Late init function allows passing values like identifiers and perform device specific configurations of pre-boot stage. Tested-by: Andreas Westman Dorcsak # ASUS TF T30 Tested-by: Svyatoslav Ryhel # LG P895 T30 Signed-off-by: Svyatoslav Ryhel --- arch/arm/include/asm/arch-tegra/sys_proto.h | 6 ++ arch/arm/mach-tegra/board2.c| 2 ++ 2 files changed, 8 insertions(+) diff --git a/arch/arm/include/asm/arch-tegra/sys_proto.h b/arch/arm/include/asm/arch-tegra/sys_proto.h index c3a2673e6c..56a9a0 100644 --- a/arch/arm/include/asm/arch-tegra/sys_proto.h +++ b/arch/arm/include/asm/arch-tegra/sys_proto.h @@ -31,4 +31,10 @@ int tegra_lcd_pmic_init(int board_id); */ int nvidia_board_init(void); +/** + * nvidia_board_late_init() - perform any board-specific + * init on late stages + */ +void nvidia_board_late_init(void); + #endif diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c index c7a45f4ff8..0df18360ca 100644 --- a/arch/arm/mach-tegra/board2.c +++ b/arch/arm/mach-tegra/board2.c @@ -56,6 +56,7 @@ __weak void gpio_early_init_uart(void) {} __weak void pin_mux_display(void) {} __weak void start_cpu_fan(void) {} __weak void cboot_late_init(void) {} +__weak void nvidia_board_late_init(void) {} #if defined(CONFIG_TEGRA_NAND) __weak void pin_mux_nand(void) @@ -267,6 +268,7 @@ int board_late_init(void) #endif start_cpu_fan(); cboot_late_init(); + nvidia_board_late_init(); return 0; } -- 2.37.2
[PATCH v4 08/16] ARM: tegra: provide default USB gadget setup
From: Maxim Schwalm All Nvidia boards use the same manufacturer, vendor ID and product ID for the gadgets. Make them the defaults to remove some boilerplate from the defconfigs. Inspired by commit e02687bda96c ("sunxi: provide default USB gadget setup") which did the same for Allwinner boards. Tested-by: Thierry Reding # T30 and T124 Signed-off-by: Maxim Schwalm --- configs/beaver_defconfig | 3 --- configs/cei-tk1-som_defconfig | 3 --- configs/dalmore_defconfig | 3 --- configs/jetson-tk1_defconfig | 3 --- configs/nyan-big_defconfig| 3 --- configs/p2371-_defconfig | 3 --- configs/p2371-2180_defconfig | 3 --- configs/p2571_defconfig | 3 --- configs/p3450-_defconfig | 3 --- configs/venice2_defconfig | 3 --- drivers/usb/gadget/Kconfig| 3 +++ 11 files changed, 3 insertions(+), 30 deletions(-) diff --git a/configs/beaver_defconfig b/configs/beaver_defconfig index 0967367e6a..693ccb893d 100644 --- a/configs/beaver_defconfig +++ b/configs/beaver_defconfig @@ -64,8 +64,5 @@ CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="NVIDIA" -CONFIG_USB_GADGET_VENDOR_NUM=0x0955 -CONFIG_USB_GADGET_PRODUCT_NUM=0x701a CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y diff --git a/configs/cei-tk1-som_defconfig b/configs/cei-tk1-som_defconfig index 0c4627aff0..6578ee83d9 100644 --- a/configs/cei-tk1-som_defconfig +++ b/configs/cei-tk1-som_defconfig @@ -70,8 +70,5 @@ CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="NVIDIA" -CONFIG_USB_GADGET_VENDOR_NUM=0x0955 -CONFIG_USB_GADGET_PRODUCT_NUM=0x701a CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y diff --git a/configs/dalmore_defconfig b/configs/dalmore_defconfig index 5d29dae341..4507ddc84b 100644 --- a/configs/dalmore_defconfig +++ b/configs/dalmore_defconfig @@ -60,8 +60,5 @@ CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="NVIDIA" -CONFIG_USB_GADGET_VENDOR_NUM=0x0955 -CONFIG_USB_GADGET_PRODUCT_NUM=0x701a CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y diff --git a/configs/jetson-tk1_defconfig b/configs/jetson-tk1_defconfig index d935e784ab..bcf45458a6 100644 --- a/configs/jetson-tk1_defconfig +++ b/configs/jetson-tk1_defconfig @@ -70,8 +70,5 @@ CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="NVIDIA" -CONFIG_USB_GADGET_VENDOR_NUM=0x0955 -CONFIG_USB_GADGET_PRODUCT_NUM=0x701a CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y diff --git a/configs/nyan-big_defconfig b/configs/nyan-big_defconfig index e2e8bebf6d..fef9141d35 100644 --- a/configs/nyan-big_defconfig +++ b/configs/nyan-big_defconfig @@ -93,9 +93,6 @@ CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="NVIDIA" -CONFIG_USB_GADGET_VENDOR_NUM=0x0955 -CONFIG_USB_GADGET_PRODUCT_NUM=0x701a CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_VIDEO=y diff --git a/configs/p2371-_defconfig b/configs/p2371-_defconfig index e8074914c8..2962a7db75 100644 --- a/configs/p2371-_defconfig +++ b/configs/p2371-_defconfig @@ -48,8 +48,5 @@ CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="NVIDIA" -CONFIG_USB_GADGET_VENDOR_NUM=0x0955 -CONFIG_USB_GADGET_PRODUCT_NUM=0x701a CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y diff --git a/configs/p2371-2180_defconfig b/configs/p2371-2180_defconfig index ea62e18f73..6b44361b5b 100644 --- a/configs/p2371-2180_defconfig +++ b/configs/p2371-2180_defconfig @@ -57,8 +57,5 @@ CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="NVIDIA" -CONFIG_USB_GADGET_VENDOR_NUM=0x0955 -CONFIG_USB_GADGET_PRODUCT_NUM=0x701a CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y diff --git a/configs/p2571_defconfig b/configs/p2571_defconfig index bc3fb3e5ae..00b0dc6109 100644 --- a/configs/p2571_defconfig +++ b/configs/p2571_defconfig @@ -49,8 +49,5 @@ CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="NVIDIA" -CONFIG_USB_GADGET_VENDOR_NUM=0x0955 -CONFIG_USB_GADGET_PRODUCT_NUM=0x701a CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y diff --git a/configs/p3450-_defconfig b/configs/p3450-_defconfig index 8e16afde91..d35bea4220 100644 --- a/configs/p3450-_defconfig +++ b/configs/p3450-_defconfig @@ -61,8 +61,5 @@ CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="NVIDIA" -CONFIG_USB_GADGET_VENDOR_NUM=0x0955 -CONFIG_USB_GADGET_PRODUCT_NUM=0x701a CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y diff --git a/configs/venice2_defconfig b/configs/venice2_defconfig index
[PATCH v4 07/16] spi: tegra20_slink: accept any word length
Original t20 slink could work with commands only fully divisible by 8. This patch removes such restriction, so commands of any bitlength now can be passed and processed. Tested-by: Andreas Westman Dorcsak # ASUS TF600T T30 Tested-by: Svyatoslav Ryhel # LG P895 T30 Tested-by: Thierry Reding # T30 and T124 Signed-off-by: Svyatoslav Ryhel --- drivers/spi/tegra20_slink.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/spi/tegra20_slink.c b/drivers/spi/tegra20_slink.c index 209ba8b0cc..d0e788539e 100644 --- a/drivers/spi/tegra20_slink.c +++ b/drivers/spi/tegra20_slink.c @@ -208,16 +208,14 @@ static int tegra30_spi_xfer(struct udevice *dev, unsigned int bitlen, u32 reg, tmpdout, tmpdin = 0; const u8 *dout = data_out; u8 *din = data_in; - int num_bytes; - int ret; + int num_bytes, overflow; + int ret = 0; debug("%s: slave %u:%u dout %p din %p bitlen %u\n", __func__, dev_seq(bus), spi_chip_select(dev), dout, din, bitlen); - if (bitlen % 8) - return -1; - num_bytes = bitlen / 8; - ret = 0; + num_bytes = DIV_ROUND_UP(bitlen, 8); + overflow = bitlen % 8; reg = readl(>status); writel(reg, >status); /* Clear all SPI events via R/W */ @@ -254,8 +252,13 @@ static int tegra30_spi_xfer(struct udevice *dev, unsigned int bitlen, num_bytes -= bytes; - clrsetbits_le32(>command, SLINK_CMD_BIT_LENGTH_MASK, - bytes * 8 - 1); + if (overflow && !num_bytes) + clrsetbits_le32(>command, SLINK_CMD_BIT_LENGTH_MASK, + (bytes - 1) * 8 + overflow - 1); + else + clrsetbits_le32(>command, SLINK_CMD_BIT_LENGTH_MASK, + bytes * 8 - 1); + writel(tmpdout, >tx_fifo); setbits_le32(>command, SLINK_CMD_GO); -- 2.37.2
[PATCH v4 06/16] ARM: tegra: Fix Tegra PWM parent clock
Default parent clock for the PWM on Tegra is a 32kHz clock and is unable to support the requested PWM period. Fix PWM support on Tegra20, Tegra30, Tegra114, Tegra124 and Tegra210 by updating the parent clock for the PWM to be the PLL_P. This commit is equivalent to Linux kernel commit: https://lore.kernel.org/all/20221010100046.6477-1-jonath...@nvidia.com/ Tested-by: Andreas Westman Dorcsak # ASUS TF T30 Tested-by: Robert Eckelmann # ASUS TF101 T20 Tested-by: Svyatoslav Ryhel # ASUS TF201 T30 Tested-by: Thierry Reding # T30 and T124 Signed-off-by: Svyatoslav Ryhel --- arch/arm/dts/tegra114.dtsi | 2 +- arch/arm/dts/tegra124.dtsi | 2 +- arch/arm/mach-tegra/tegra114/clock.c | 2 +- arch/arm/mach-tegra/tegra124/clock.c | 2 +- arch/arm/mach-tegra/tegra20/clock.c | 2 +- arch/arm/mach-tegra/tegra210/clock.c | 2 +- arch/arm/mach-tegra/tegra30/clock.c | 2 +- drivers/pwm/tegra_pwm.c | 10 ++ 8 files changed, 13 insertions(+), 11 deletions(-) diff --git a/arch/arm/dts/tegra114.dtsi b/arch/arm/dts/tegra114.dtsi index 8932ea3afd..68ee7f3165 100644 --- a/arch/arm/dts/tegra114.dtsi +++ b/arch/arm/dts/tegra114.dtsi @@ -312,7 +312,7 @@ }; pwm: pwm@7000a000 { - compatible = "nvidia,tegra114-pwm", "nvidia,tegra20-pwm"; + compatible = "nvidia,tegra114-pwm"; reg = <0x7000a000 0x100>; #pwm-cells = <2>; clocks = <_car TEGRA114_CLK_PWM>; diff --git a/arch/arm/dts/tegra124.dtsi b/arch/arm/dts/tegra124.dtsi index f473ba28e4..ffec9cae09 100644 --- a/arch/arm/dts/tegra124.dtsi +++ b/arch/arm/dts/tegra124.dtsi @@ -377,7 +377,7 @@ }; pwm: pwm@7000a000 { - compatible = "nvidia,tegra124-pwm", "nvidia,tegra20-pwm"; + compatible = "nvidia,tegra124-pwm", "nvidia,tegra114-pwm"; reg = <0x7000a000 0x100>; #pwm-cells = <2>; clocks = <_car TEGRA124_CLK_PWM>; diff --git a/arch/arm/mach-tegra/tegra114/clock.c b/arch/arm/mach-tegra/tegra114/clock.c index 15c2adc417..8ad71f590f 100644 --- a/arch/arm/mach-tegra/tegra114/clock.c +++ b/arch/arm/mach-tegra/tegra114/clock.c @@ -782,7 +782,7 @@ struct periph_clk_init periph_clk_init_table[] = { { PERIPH_ID_SDMMC2, CLOCK_ID_PERIPH }, { PERIPH_ID_SDMMC3, CLOCK_ID_PERIPH }, { PERIPH_ID_SDMMC4, CLOCK_ID_PERIPH }, - { PERIPH_ID_PWM, CLOCK_ID_SFROM32KHZ }, + { PERIPH_ID_PWM, CLOCK_ID_PERIPH }, { PERIPH_ID_I2C1, CLOCK_ID_PERIPH }, { PERIPH_ID_I2C2, CLOCK_ID_PERIPH }, { PERIPH_ID_I2C3, CLOCK_ID_PERIPH }, diff --git a/arch/arm/mach-tegra/tegra124/clock.c b/arch/arm/mach-tegra/tegra124/clock.c index 415ba15e5d..ca9549a318 100644 --- a/arch/arm/mach-tegra/tegra124/clock.c +++ b/arch/arm/mach-tegra/tegra124/clock.c @@ -1208,7 +1208,7 @@ struct periph_clk_init periph_clk_init_table[] = { { PERIPH_ID_SDMMC2, CLOCK_ID_PERIPH }, { PERIPH_ID_SDMMC3, CLOCK_ID_PERIPH }, { PERIPH_ID_SDMMC4, CLOCK_ID_PERIPH }, - { PERIPH_ID_PWM, CLOCK_ID_SFROM32KHZ }, + { PERIPH_ID_PWM, CLOCK_ID_PERIPH }, { PERIPH_ID_I2C1, CLOCK_ID_PERIPH }, { PERIPH_ID_I2C2, CLOCK_ID_PERIPH }, { PERIPH_ID_I2C3, CLOCK_ID_PERIPH }, diff --git a/arch/arm/mach-tegra/tegra20/clock.c b/arch/arm/mach-tegra/tegra20/clock.c index 593622bfdc..067a9f1a2f 100644 --- a/arch/arm/mach-tegra/tegra20/clock.c +++ b/arch/arm/mach-tegra/tegra20/clock.c @@ -804,7 +804,7 @@ struct periph_clk_init periph_clk_init_table[] = { { PERIPH_ID_SDMMC2, CLOCK_ID_PERIPH }, { PERIPH_ID_SDMMC3, CLOCK_ID_PERIPH }, { PERIPH_ID_SDMMC4, CLOCK_ID_PERIPH }, - { PERIPH_ID_PWM, CLOCK_ID_SFROM32KHZ }, + { PERIPH_ID_PWM, CLOCK_ID_PERIPH }, { PERIPH_ID_DVC_I2C, CLOCK_ID_PERIPH }, { PERIPH_ID_I2C1, CLOCK_ID_PERIPH }, { PERIPH_ID_I2C2, CLOCK_ID_PERIPH }, diff --git a/arch/arm/mach-tegra/tegra210/clock.c b/arch/arm/mach-tegra/tegra210/clock.c index 76fbfef580..900537afbe 100644 --- a/arch/arm/mach-tegra/tegra210/clock.c +++ b/arch/arm/mach-tegra/tegra210/clock.c @@ -1278,7 +1278,7 @@ struct periph_clk_init periph_clk_init_table[] = { { PERIPH_ID_SDMMC2, CLOCK_ID_PERIPH }, { PERIPH_ID_SDMMC3, CLOCK_ID_PERIPH }, { PERIPH_ID_SDMMC4, CLOCK_ID_PERIPH }, - { PERIPH_ID_PWM, CLOCK_ID_SFROM32KHZ }, + { PERIPH_ID_PWM, CLOCK_ID_PERIPH }, { PERIPH_ID_I2C1, CLOCK_ID_PERIPH }, { PERIPH_ID_I2C2, CLOCK_ID_PERIPH }, { PERIPH_ID_I2C3, CLOCK_ID_PERIPH }, diff --git a/arch/arm/mach-tegra/tegra30/clock.c b/arch/arm/mach-tegra/tegra30/clock.c index b66211ce94..1dc9d09dba 100644 --- a/arch/arm/mach-tegra/tegra30/clock.c +++ b/arch/arm/mach-tegra/tegra30/clock.c @@ -884,7 +884,7 @@ struct periph_clk_init periph_clk_init_table[] = { { PERIPH_ID_SDMMC2, CLOCK_ID_PERIPH }, { PERIPH_ID_SDMMC3, CLOCK_ID_PERIPH }, {
[PATCH v4 05/16] ARM: tegra30: add PLLD to pll setup
On T30 unlike T20 dsi panels are wider used on devices and PLLD is used as DISP1 parent more often, so lets enable it as well for this cases. Tested-by: Andreas Westman Dorcsak # ASUS TF700T T30 Tested-by: Svyatoslav Ryhel # HTC One X T30 Tested-by: Thierry Reding # Beaver T30 Signed-off-by: Svyatoslav Ryhel --- arch/arm/mach-tegra/tegra30/clock.c | 41 + 1 file changed, 41 insertions(+) diff --git a/arch/arm/mach-tegra/tegra30/clock.c b/arch/arm/mach-tegra/tegra30/clock.c index dcdd0d0978..b66211ce94 100644 --- a/arch/arm/mach-tegra/tegra30/clock.c +++ b/arch/arm/mach-tegra/tegra30/clock.c @@ -669,7 +669,48 @@ enum clock_id clk_id_to_pll_id(int clk_id) void clock_early_init(void) { + struct clk_rst_ctlr *clkrst = + (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE; + struct clk_pll_info *pllinfo; + u32 data; + tegra30_set_up_pllp(); + + /* +* PLLD output frequency set to 925Mhz +*/ + switch (clock_get_osc_freq()) { + case CLOCK_OSC_FREQ_12_0: /* OSC is 12Mhz */ + case CLOCK_OSC_FREQ_48_0: /* OSC is 48Mhz */ + clock_set_rate(CLOCK_ID_DISPLAY, 925, 12, 0, 12); + break; + + case CLOCK_OSC_FREQ_26_0: /* OSC is 26Mhz */ + clock_set_rate(CLOCK_ID_DISPLAY, 925, 26, 0, 12); + break; + + case CLOCK_OSC_FREQ_13_0: /* OSC is 13Mhz */ + case CLOCK_OSC_FREQ_16_8: /* OSC is 16.8Mhz */ + clock_set_rate(CLOCK_ID_DISPLAY, 925, 13, 0, 12); + break; + + case CLOCK_OSC_FREQ_19_2: + case CLOCK_OSC_FREQ_38_4: + default: + /* +* These are not supported. It is too early to print a +* message and the UART likely won't work anyway due to the +* oscillator being wrong. +*/ + break; + } + + /* PLLD_MISC: Set CLKENABLE, CPCON 12, LFCON 1, and enable lock */ + pllinfo = _pll_info_table[CLOCK_ID_DISPLAY]; + data = (12 << pllinfo->kcp_shift) | (1 << pllinfo->kvco_shift); + data |= (1 << PLLD_CLKENABLE) | (1 << pllinfo->lock_ena); + writel(data, >crc_pll[CLOCK_ID_DISPLAY].pll_misc); + udelay(2); } void arch_timer_init(void) -- 2.37.2
[PATCH v4 04/16] ARM: tegra: clock: add clock_decode_pair helper
Get periph clock id and its parent from device tree. This works by looking up the peripheral's 'clocks' node and reading out the second and fourth cells, which are the peripheral and PLL clock numbers. Tested-by: Andreas Westman Dorcsak # ASUS TF T30 Tested-by: Robert Eckelmann # ASUS TF101 T20 Tested-by: Svyatoslav Ryhel # HTC One X Signed-off-by: Svyatoslav Ryhel --- arch/arm/include/asm/arch-tegra/clock.h | 13 + arch/arm/mach-tegra/clock.c | 23 +++ 2 files changed, 36 insertions(+) diff --git a/arch/arm/include/asm/arch-tegra/clock.h b/arch/arm/include/asm/arch-tegra/clock.h index 2270501406..61ef81e7fe 100644 --- a/arch/arm/include/asm/arch-tegra/clock.h +++ b/arch/arm/include/asm/arch-tegra/clock.h @@ -270,6 +270,19 @@ void clock_ll_start_uart(enum periph_id periph_id); */ int clock_decode_periph_id(struct udevice *dev); +/** + * Get periph clock id and its parent from device tree. + * + * This works by looking up the peripheral's 'clocks' node and reading out + * the second and fourth cells, which are the peripheral and PLL clock numbers. + * + * @param dev udevice associated with FDT node + * @param clk_id pointer to int array of 2 values + * first is periph clock, second is + * its PLL parent according to FDT. + */ +int clock_decode_pair(struct udevice *dev, int *clk_id); + /** * Checks if the oscillator bypass is enabled (XOBP bit) * diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c index 11bffc1701..966009f375 100644 --- a/arch/arm/mach-tegra/clock.c +++ b/arch/arm/mach-tegra/clock.c @@ -678,6 +678,29 @@ int clock_decode_periph_id(struct udevice *dev) assert(clock_periph_id_isvalid(id)); return id; } + +/* + * Get periph clock id and its parent from device tree. + * + * @param dev udevice associated with FDT node + * @param clk_id pointer to u32 array of 2 values + * first is periph clock, second is + * its PLL parent according to FDT. + */ +int clock_decode_pair(struct udevice *dev, int *clk_id) +{ + u32 cell[4]; + int err; + + err = dev_read_u32_array(dev, "clocks", cell, ARRAY_SIZE(cell)); + if (err) + return -EINVAL; + + clk_id[0] = clk_id_to_periph_id(cell[1]); + clk_id[1] = clk_id_to_pll_id(cell[3]); + + return 0; +} #endif /* CONFIG_IS_ENABLED(OF_CONTROL) */ int clock_verify(void) -- 2.37.2
[PATCH v4 03/16] ARM: tegra: clock: add clk_id_to_pll_id helper
This function allows to convert a device tree clock ID to PLL ID. Tested-by: Andreas Westman Dorcsak # ASUS TF T30 Tested-by: Robert Eckelmann # ASUS TF101 T20 Tested-by: Svyatoslav Ryhel # HTC One X Signed-off-by: Svyatoslav Ryhel --- arch/arm/include/asm/arch-tegra/clock.h | 8 ++ arch/arm/mach-tegra/tegra114/clock.c| 37 arch/arm/mach-tegra/tegra124/clock.c| 38 + arch/arm/mach-tegra/tegra20/clock.c | 37 arch/arm/mach-tegra/tegra210/clock.c| 37 arch/arm/mach-tegra/tegra30/clock.c | 37 6 files changed, 194 insertions(+) diff --git a/arch/arm/include/asm/arch-tegra/clock.h b/arch/arm/include/asm/arch-tegra/clock.h index 1dd5d0742c..2270501406 100644 --- a/arch/arm/include/asm/arch-tegra/clock.h +++ b/arch/arm/include/asm/arch-tegra/clock.h @@ -354,6 +354,14 @@ int get_periph_clock_source(enum periph_id periph_id, */ enum periph_id clk_id_to_periph_id(int clk_id); +/* + * Convert a device tree clock ID to our PLL ID. + * + * @param clk_id Clock ID according to tegra device tree binding + * Return: clock ID, or CLOCK_ID_NONE if the clock ID is invalid + */ +enum clock_id clk_id_to_pll_id(int clk_id); + /** * Set the output frequency you want for each PLL clock. * PLL output frequencies are programmed by setting their N, M and P values. diff --git a/arch/arm/mach-tegra/tegra114/clock.c b/arch/arm/mach-tegra/tegra114/clock.c index 143f86863f..15c2adc417 100644 --- a/arch/arm/mach-tegra/tegra114/clock.c +++ b/arch/arm/mach-tegra/tegra114/clock.c @@ -19,6 +19,8 @@ #include #include +#include + /* * Clock types that we can use as a source. The Tegra114 has muxes for the * peripheral clocks, and in most cases there are four options for the clock @@ -646,6 +648,41 @@ enum periph_id clk_id_to_periph_id(int clk_id) return clk_id; } } + +/* + * Convert a device tree clock ID to our PLL ID. + * + * @param clk_id Clock ID according to tegra114 device tree binding + * Return: clock ID, or CLOCK_ID_NONE if the clock ID is invalid + */ +enum clock_id clk_id_to_pll_id(int clk_id) +{ + switch (clk_id) { + case TEGRA114_CLK_PLL_C: + return CLOCK_ID_CGENERAL; + case TEGRA114_CLK_PLL_M: + return CLOCK_ID_MEMORY; + case TEGRA114_CLK_PLL_P: + return CLOCK_ID_PERIPH; + case TEGRA114_CLK_PLL_A: + return CLOCK_ID_AUDIO; + case TEGRA114_CLK_PLL_U: + return CLOCK_ID_USB; + case TEGRA114_CLK_PLL_D: + case TEGRA114_CLK_PLL_D_OUT0: + return CLOCK_ID_DISPLAY; + case TEGRA114_CLK_PLL_X: + return CLOCK_ID_XCPU; + case TEGRA114_CLK_PLL_E_OUT0: + return CLOCK_ID_EPCI; + case TEGRA114_CLK_CLK_32K: + return CLOCK_ID_32KHZ; + case TEGRA114_CLK_CLK_M: + return CLOCK_ID_CLK_M; + default: + return CLOCK_ID_NONE; + } +} #endif /* CONFIG_IS_ENABLED(OF_CONTROL) */ void clock_early_init(void) diff --git a/arch/arm/mach-tegra/tegra124/clock.c b/arch/arm/mach-tegra/tegra124/clock.c index da38b26c27..415ba15e5d 100644 --- a/arch/arm/mach-tegra/tegra124/clock.c +++ b/arch/arm/mach-tegra/tegra124/clock.c @@ -19,6 +19,9 @@ #include #include +#include +#include + /* * Clock types that we can use as a source. The Tegra124 has muxes for the * peripheral clocks, and in most cases there are four options for the clock @@ -826,6 +829,41 @@ enum periph_id clk_id_to_periph_id(int clk_id) return clk_id; } } + +/* + * Convert a device tree clock ID to our PLL ID. + * + * @param clk_id Clock ID according to tegra124 device tree binding + * Return: clock ID, or CLOCK_ID_NONE if the clock ID is invalid + */ +enum clock_id clk_id_to_pll_id(int clk_id) +{ + switch (clk_id) { + case TEGRA124_CLK_PLL_C: + return CLOCK_ID_CGENERAL; + case TEGRA124_CLK_PLL_M: + return CLOCK_ID_MEMORY; + case TEGRA124_CLK_PLL_P: + return CLOCK_ID_PERIPH; + case TEGRA124_CLK_PLL_A: + return CLOCK_ID_AUDIO; + case TEGRA124_CLK_PLL_U: + return CLOCK_ID_USB; + case TEGRA124_CLK_PLL_D: + case TEGRA124_CLK_PLL_D_OUT0: + return CLOCK_ID_DISPLAY; + case TEGRA124_CLK_PLL_X: + return CLOCK_ID_XCPU; + case TEGRA124_CLK_PLL_E: + return CLOCK_ID_EPCI; + case TEGRA124_CLK_CLK_32K: + return CLOCK_ID_32KHZ; + case TEGRA124_CLK_CLK_M: + return CLOCK_ID_CLK_M; + default: + return CLOCK_ID_NONE; + } +} #endif /* CONFIG_IS_ENABLED(OF_CONTROL) */ void clock_early_init(void) diff --git a/arch/arm/mach-tegra/tegra20/clock.c b/arch/arm/mach-tegra/tegra20/clock.c index
[PATCH v4 02/16] ARM: t20/t30: swap host1x and disp1 clock parents
According to mainline clock tables and TRM HOST1X parent is PLLC, while DISP1 usually uses PLLP as parent clock. Tested-by: Andreas Westman Dorcsak # ASUS TF T30 Tested-by: Robert Eckelmann # ASUS TF101 T20 Tested-by: Svyatoslav Ryhel # LG P895 T30 Tested-by: Thierry Reding # Beaver T30 Signed-off-by: Svyatoslav Ryhel --- arch/arm/mach-tegra/tegra20/clock.c | 4 ++-- arch/arm/mach-tegra/tegra30/clock.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-tegra/tegra20/clock.c b/arch/arm/mach-tegra/tegra20/clock.c index 8c127430aa..0316073d1a 100644 --- a/arch/arm/mach-tegra/tegra20/clock.c +++ b/arch/arm/mach-tegra/tegra20/clock.c @@ -760,8 +760,8 @@ struct periph_clk_init periph_clk_init_table[] = { { PERIPH_ID_SBC2, CLOCK_ID_PERIPH }, { PERIPH_ID_SBC3, CLOCK_ID_PERIPH }, { PERIPH_ID_SBC4, CLOCK_ID_PERIPH }, - { PERIPH_ID_HOST1X, CLOCK_ID_PERIPH }, - { PERIPH_ID_DISP1, CLOCK_ID_CGENERAL }, + { PERIPH_ID_HOST1X, CLOCK_ID_CGENERAL }, + { PERIPH_ID_DISP1, CLOCK_ID_PERIPH }, { PERIPH_ID_NDFLASH, CLOCK_ID_PERIPH }, { PERIPH_ID_SDMMC1, CLOCK_ID_PERIPH }, { PERIPH_ID_SDMMC2, CLOCK_ID_PERIPH }, diff --git a/arch/arm/mach-tegra/tegra30/clock.c b/arch/arm/mach-tegra/tegra30/clock.c index 04ad5c504d..e5c2fd542c 100644 --- a/arch/arm/mach-tegra/tegra30/clock.c +++ b/arch/arm/mach-tegra/tegra30/clock.c @@ -799,8 +799,8 @@ struct periph_clk_init periph_clk_init_table[] = { { PERIPH_ID_SBC4, CLOCK_ID_PERIPH }, { PERIPH_ID_SBC5, CLOCK_ID_PERIPH }, { PERIPH_ID_SBC6, CLOCK_ID_PERIPH }, - { PERIPH_ID_HOST1X, CLOCK_ID_PERIPH }, - { PERIPH_ID_DISP1, CLOCK_ID_CGENERAL }, + { PERIPH_ID_HOST1X, CLOCK_ID_CGENERAL }, + { PERIPH_ID_DISP1, CLOCK_ID_PERIPH }, { PERIPH_ID_NDFLASH, CLOCK_ID_PERIPH }, { PERIPH_ID_SDMMC1, CLOCK_ID_PERIPH }, { PERIPH_ID_SDMMC2, CLOCK_ID_PERIPH }, -- 2.37.2
[PATCH v4 01/16] tegra30: clock: add EXTPERIPH
This mappings were missing for some reason. Tested-by: Svyatoslav Ryhel # LG P895 T30 Signed-off-by: Svyatoslav Ryhel Reviewed-by: Simon Glass --- arch/arm/include/asm/arch-tegra30/clock-tables.h | 6 +++--- arch/arm/mach-tegra/tegra30/clock.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/include/asm/arch-tegra30/clock-tables.h b/arch/arm/include/asm/arch-tegra30/clock-tables.h index 8588009c61..6c899ff64c 100644 --- a/arch/arm/include/asm/arch-tegra30/clock-tables.h +++ b/arch/arm/include/asm/arch-tegra30/clock-tables.h @@ -190,9 +190,9 @@ enum periph_id { PERIPH_ID_ACTMON, /* 24 */ - PERIPH_ID_EX_RESERVED24, - PERIPH_ID_EX_RESERVED25, - PERIPH_ID_EX_RESERVED26, + PERIPH_ID_EXTPERIPH1, + PERIPH_ID_EXTPERIPH2, + PERIPH_ID_EXTPERIPH3, PERIPH_ID_EX_RESERVED27, PERIPH_ID_SATA, PERIPH_ID_HDA, diff --git a/arch/arm/mach-tegra/tegra30/clock.c b/arch/arm/mach-tegra/tegra30/clock.c index 449b66e3b2..04ad5c504d 100644 --- a/arch/arm/mach-tegra/tegra30/clock.c +++ b/arch/arm/mach-tegra/tegra30/clock.c @@ -377,9 +377,9 @@ static s8 periph_id_to_internal_id[PERIPH_ID_COUNT] = { PERIPHC_ACTMON, /* 24 */ - NONE(RESERVED24), - NONE(RESERVED25), - NONE(RESERVED26), + PERIPHC_EXTPERIPH1, + PERIPHC_EXTPERIPH2, + PERIPHC_EXTPERIPH3, NONE(RESERVED27), PERIPHC_SATA, PERIPHC_HDA, -- 2.37.2
[PATCH v4 00/16] General Tegra improvements
List of changes in patch set: - add missing EXTPERIPH clocks for t30 - swap host1x and disp1 clock parents (as they should be) - add clk_id_to_pll_id and clock_decode_pair helpers to use dts deeper (in tegra clocks often go in pair child - parent) - include PLLD setup in T30 (DISP1 may use it as parent on some devices) - fix Tegra PWM parent clock inline with linux - Tegra SLINK: patch to accept any word length (unlike 8bit aligned which was before) - provide default USB gadget setup for existing Nvidia boards - add late init function to be able to configure pre-boot stage (like uncovering serial number or setting mac address) - create common pre-dm i2c write for PMIC (used on T30 and T124 to configure basic PMIC voltages required to boot like cpu and core voltages) - expose crypto module for all Tegra SoCs and implement BCT patching (ability to update bootloader from u-boot on production devices without need in host PC) --- Changelog from v3 - added tested-by Changelog from v2 - fixed T114 TEGRA114_CLK_PLL_E_OUT0 - adjusted pre-dm i2c write commit description - added description file for ebtupdate command - minor improvements of bct.c comments Changelog from v1 - rebased to latest u-boot master - PLLD setup for T30 moved specifically into T30 area --- Maxim Schwalm (1): ARM: tegra: provide default USB gadget setup Ramin Khonsari (1): ARM: tegra30: implement BCT patching Svyatoslav Ryhel (14): tegra30: clock: add EXTPERIPH ARM: t20/t30: swap host1x and disp1 clock parents ARM: tegra: clock: add clk_id_to_pll_id helper ARM: tegra: clock: add clock_decode_pair helper ARM: tegra30: add PLLD to pll setup ARM: tegra: Fix Tegra PWM parent clock spi: tegra20_slink: accept any word length ARM: tegra: add late init support ARM: tegra: create common pre-dm i2c write board: tegra124: switch to updated pre-dm i2c write board: tegra30: switch to updated pre-dm i2c write ARM: tegra: expose crypto module for all Tegra SoCs ARM: tegra: crypto: extend crypto functional ARM: tegra20: implement BCT patching arch/arm/dts/tegra114.dtsi| 2 +- arch/arm/dts/tegra124.dtsi| 2 +- arch/arm/include/asm/arch-tegra/clock.h | 21 + arch/arm/include/asm/arch-tegra/crypto.h | 47 ++ arch/arm/include/asm/arch-tegra/sys_proto.h | 6 ++ arch/arm/include/asm/arch-tegra/tegra_i2c.h | 17 .../include/asm/arch-tegra30/clock-tables.h | 6 +- arch/arm/mach-tegra/Kconfig | 14 +++ arch/arm/mach-tegra/Makefile | 1 + arch/arm/mach-tegra/board2.c | 2 + arch/arm/mach-tegra/clock.c | 23 + arch/arm/mach-tegra/cpu.h | 1 - arch/arm/mach-tegra/{tegra20 => }/crypto.c| 63 + arch/arm/mach-tegra/tegra114/clock.c | 39 +++- arch/arm/mach-tegra/tegra124/clock.c | 40 - arch/arm/mach-tegra/tegra124/cpu.c| 4 + arch/arm/mach-tegra/tegra20/Kconfig | 1 + arch/arm/mach-tegra/tegra20/Makefile | 7 +- arch/arm/mach-tegra/tegra20/bct.c | 79 arch/arm/mach-tegra/tegra20/bct.h | 42 + arch/arm/mach-tegra/tegra20/clock.c | 43 - arch/arm/mach-tegra/tegra20/crypto.h | 19 arch/arm/mach-tegra/tegra210/clock.c | 39 +++- arch/arm/mach-tegra/tegra30/Kconfig | 8 -- arch/arm/mach-tegra/tegra30/Makefile | 1 + arch/arm/mach-tegra/tegra30/bct.c | 79 arch/arm/mach-tegra/tegra30/bct.h | 42 + arch/arm/mach-tegra/tegra30/clock.c | 90 +-- arch/arm/mach-tegra/tegra30/cpu.c | 55 +--- board/avionic-design/tec-ng/Makefile | 4 +- board/avionic-design/tec-ng/tec-ng-spl.c | 34 +++ board/nvidia/beaver/Makefile | 2 + board/nvidia/beaver/beaver-spl.c | 43 + board/nvidia/cardhu/Makefile | 4 +- board/nvidia/cardhu/cardhu-spl.c | 43 + board/nvidia/venice2/as3722_init.c| 65 +- board/nvidia/venice2/as3722_init.h| 43 - board/toradex/apalis-tk1/as3722_init.c| 85 ++ board/toradex/apalis-tk1/as3722_init.h| 40 - board/toradex/apalis_t30/Makefile | 2 + board/toradex/apalis_t30/apalis_t30-spl.c | 34 +++ board/toradex/colibri_t30/Makefile| 2 + board/toradex/colibri_t30/colibri_t30-spl.c | 34 +++ configs/beaver_defconfig | 3 - configs/cei-tk1-som_defconfig | 3 - configs/dalmore_defconfig | 3 - configs/jetson-tk1_defconfig | 3 - configs/nyan-big_defconfig| 3 - configs/p2371-_defconfig | 3 -
Re: imx8mp EQOS regression in dwc_eth_qos,c
Am 13.02.23 um 22:20 schrieb Marek Vasut: On 2/13/23 22:04, Fabio Estevam wrote: Adding Marek, who has sent some EQOS patches recently. On Mon, Feb 13, 2023 at 6:02 PM Elmar Psilog wrote: Hello, Think I found a regression in EQOS driver with fixed-phy. Maybe someone with a imx8mp board might check that use case to confirm? That would be great. While ethernet was working in v2022.04 a "ping" in v2023.01 returns ERROR: no/invalid property! invalid speed 0 eqos_adjust_link() failed: -22 FAILED although devicetree/hardware kept unchanged. This happens because in file fixed.c in in function fixedphy_config() the call val = ofnode_read_u32_default(node, "speed", 0); returns 0 instead of 1000 and also the duplex is not set. Found that in file/function dwc_eth_qos.c / eqos_start() the line eqos->phy->node = eqos->phy_of_node; is responsible for losing the information. Don't know what magic happens here - so I can't fix it - I just followed the data. So all works well and even the parsing of old and new fixed-link devicetree works til that line. After that I don't get speed anymore. Maybe you can have a look at this? Try this patch (needs CONFIG_FIXED_PHY=y) : diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index d488bd0c288..592af53b352 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -791,9 +791,21 @@ static int eqos_start(struct udevice *dev) */ if (!eqos->phy) { int addr = -1; - addr = eqos_get_phy_addr(eqos, dev); - eqos->phy = phy_connect(eqos->mii, addr, dev, - eqos->config->interface(dev)); + ofnode fixed_node; + + if (IS_ENABLED(CONFIG_PHY_FIXED)) { + fixed_node = ofnode_find_subnode(dev_ofnode(dev), + "fixed-link"); + if (ofnode_valid(fixed_node)) { + eqos->phy = fixed_phy_create(dev_ofnode(dev)); + } + + if (!eqos->phy) { + addr = eqos_get_phy_addr(eqos, dev); + eqos->phy = phy_connect(eqos->mii, addr, dev, + eqos->config->interface(dev)); + } + if (!eqos->phy) { pr_err("phy_connect() failed"); goto err_stop_resets; Thanks Fabio for forwarding and Marek for the quick patch! Don't get this exactly. Bit confused about the closing "}" in if(IS_ENABLED) seems to be missed (or an else path)? Where exactly should this be? From the insertion it looks like you mean: + if (IS_ENABLED(CONFIG_PHY_FIXED)) { + fixed_node = ofnode_find_subnode(dev_ofnode(dev), + "fixed-link"); + if (ofnode_valid(fixed_node)) { + eqos->phy = fixed_phy_create(dev_ofnode(dev)); + } + } + if (!eqos->phy) { + addr = eqos_get_phy_addr(eqos, dev); + eqos->phy = phy_connect(eqos->mii, addr, dev, eqos->config->interface(dev)); + } But that doesn't solve the issue. The magic line eqos->phy->node = eqos->phy_of_node; will still executed. Likely a different issue but connected to EQOS: I am wondering why the clocks for ethernet look so much different if FEC is not configured. Shouldn't be the case, right? At least imx8mp.dtsi doesn't tell about any 24MHz clock. Also counter is "0"? Well, EQOS works with uncommenting the line above and this clock, but why? clk_dump returns on NXP EVK board with FEC configured: 2 1 | | |-- sys_pll1_266m 2 0 | | | |-- nand_usdhc_bus 2 4 | | | `-- enet_axi 2 2 | | | |-- enet1_root_clk 2 2 | | | `-- sim_enet_root_clk ... 10 1 | | `-- sys_pll2_bypass 10 3 | | `-- sys_pll2_out 5000 2 | | |-- sys_pll2_50m 5000 2 | | | `-- enet_phy_ref 1 2 | | |-- sys_pll2_100m 1 2 | | | `-- enet_timer 12500 2 | | |-- sys_pll2_125m 12500 2 | | | `-- enet_ref 1 0 | | |-- sys_pll2_166m and without FEC configured: 2400 0 | |-- enet_axi 2400 0 | | |-- enet1_root_clk 2400 0 | | `-- sim_enet_root_clk ... 2400 0 | |-- enet_ref 2400 0 | |-- enet_timer 2400 0 | |-- enet_phy_ref
Re: [PATCH v3 61/95] kconfig: Support writing separate SPL files
Hi Tom, On Tue, 14 Feb 2023 at 09:31, Tom Rini wrote: > > On Sun, Feb 12, 2023 at 04:16:04PM -0700, Simon Glass wrote: > > > At present kconfig writes out several files, including: > > > >auto.conf - CONFIG settings used by make > >autoconf.h - header file used by C code > > > > This works well but is a bit ugly in places, for example requiring the use > > of a SPL_TPL_ macro in Makefiles to distinguish between options intended > > for SPL and U-Boot proper. > > > > Update the kconfig tool to also output separate files for each phase: e.g. > > auto_spl.conf and autoconf_spl.h > > > > These are similar to the existing files, but drop the SPL_ prefix so that > > SPL_TPL_ is not needed. It also allows the CONFIG_IS_ENABLED() macro to be > > simplified, in a later patch, eventually replacing it with IS_ENABLED(). > > > > When CONFIG_FOO is used within SPL, it means that FOO is enabled in that > > SPL phase. For example if CONFIG_SPL_FOO is enabled in the Kconfig, that > > means that CONFIG_FOO will be enabled in the SPL phase. So the SPL builds > > can just use CONFIG_FOO to check it. There is no need to use > > CONFIG_SPL_FOO or CONFIG_IS_ENABLED() anymore. > > > > This of course means that if there is a need to access a PPL symbol from > > an SPL build, there is no way to do it. To copy with that, we need a > > CONFIG_PPL_FOO to be visibilty to all SPL builds. > > > > So this change also adds new PPL_ output for U-Boot proper (Primary > > Program Loader). So every CONFIG_FOO that is enabled in PPL also has a > > CONFIG_PPL_FOO > > > > This allows SPL to access the TEXT_BASE for U-Boot proper, for example, so > > it knows where to load it. There are about 30 places where this is needed, > > in addition to TEXT_BASE. The environment has the same problem, adding > > another dozen or so caes in include/config_distro_bootcmd.h but it has > > been decided to ignore that for now. > > > > The feature is controlled by an environment variable, since it seems to be > > bad form to add flags to the conf tool. > > > > Rebuild the autoconf files if the split config is not present. This allows > > building this commit as part of a chain, without generating build errors. > > > > These changes may benefit from some reworking to send upstream, e.g. to > > use a struct for the 'arg' parameter. > > > > Signed-off-by: Simon Glass > > This patch, I think, is where my largest problem is. We go from being > able to say "if CONFIG_SPL_FOO is undefined, it is false" to "we must > define CONFIG_SPL_FOO to false". There's around 150 cases of this, with > the series. Why can we not extend the PPL logic (which I'm not super > happy with, but, I understand and I think an audit of everything > not-TEXT_BASE should be fairly straight forward), to say that if > CONFIG_FOO exists and CONFIG_SPL_FOO does not exist, say CONFIG_SPL_FOO > is now false. Well it is all about choices. We don't have to add a CONFIG_SPL_xxx to tell Kconfig that the PPL symbol controls all phases. We can use the conf_nospl file instead. But then the entire description is not in Kconfig. Of course, we might expect that some of those things in conf_nospl might end up needing to be controlled in SPL, so perhaps that file would shrink? Not sure about that, though. It isn't just SPL , BTW. We might have any xPL symbol defined. I suppose you are thinking of something like: #define CONFIG_IS_ENABLED(x) IS_ENABLED(CONFIG_ ## xpl_prefix ## x) || ( IS_ENABLED(CONFIG_ ## x) && !IS_ENABLED(CONFIG_ SPL_ ## x) && !IS_ENABLED(CONFIG_TPL_ ##x) ..) But how do we deal with Makefiles? We still end up with the SPL_TPL_ stuff. Yes, adding PPL moves a step forward and reduces the audit to only uses of PPL, instead of the whole Kconfig. This series does get us closer to separate configs (it is really easy to see what is enabled in each build just by looking at the auto_xpl.conf files) and I think those 150 exceptions are not a big price to pay. Ultimately I am coming to the view that we should extend the Kconfig language to support multiple build phases, using a 'phase' property. Zephyr is going to need it too, fairly soon[1]. Regards, Simon [1] https://github.com/zephyrproject-rtos/zephyr/issues/54534
Re: [PATCH v3 65/95] omap: Correct an SPL build error with watchdog
On Tue, Feb 14, 2023 at 11:34:47AM -0500, Tom Rini wrote: > On Sun, Feb 12, 2023 at 04:16:08PM -0700, Simon Glass wrote: > > The logic here is strange since the call to hw_watchdog_init() depends on > > CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG but the code it calls is only > > enabled if !CONFIG_IS_ENABLED(WDT). This seems to work, but with split > > config we get a build error in SPL with CONFIG_WATCHDOG, since it is > > interpreted as CONFIG_SPL_WATCHDOG. > > > > To mimic the behaviour before split config takes effect, use the > > PPL_WATCHDOG symbol. > > > > Signed-off-by: Simon Glass > > --- > > > > (no changes since v1) > > > > arch/arm/mach-omap2/boot-common.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/arm/mach-omap2/boot-common.c > > b/arch/arm/mach-omap2/boot-common.c > > index 9a342a1bf95..401d12c6ca3 100644 > > --- a/arch/arm/mach-omap2/boot-common.c > > +++ b/arch/arm/mach-omap2/boot-common.c > > @@ -302,7 +302,7 @@ void spl_board_init(void) > > #if defined(CONFIG_AM33XX) && defined(CONFIG_SPL_MUSB_NEW) > > arch_misc_init(); > > #endif > > -#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) > > +#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_PPL_WATCHDOG) > > hw_watchdog_init(); > > #endif > > #ifdef CONFIG_AM33XX > > No, we want watchdog enabled in SPL. Or perhaps, the same question as in the socfpga patch also applies here. -- Tom signature.asc Description: PGP signature
Re: [PATCH v3 68/95] socfpga: Use the correct condition for SYS_L2_PL310
On Sun, Feb 12, 2023 at 04:16:11PM -0700, Simon Glass wrote: > Update this to use the PPL condition instead, so that nothing changes when > building for SPL with split config. > > Signed-off-by: Simon Glass > --- > > (no changes since v1) > > arch/arm/mach-socfpga/misc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/mach-socfpga/misc.c b/arch/arm/mach-socfpga/misc.c > index 5b5a81a255d..b09b898051b 100644 > --- a/arch/arm/mach-socfpga/misc.c > +++ b/arch/arm/mach-socfpga/misc.c > @@ -32,7 +32,7 @@ phys_addr_t socfpga_clkmgr_base __section(".data"); > phys_addr_t socfpga_rstmgr_base __section(".data"); > phys_addr_t socfpga_sysmgr_base __section(".data"); > > -#ifdef CONFIG_SYS_L2_PL310 > +#ifdef CONFIG_PPL_SYS_L2_PL310 > static const struct pl310_regs *const pl310 = > (struct pl310_regs *)CFG_SYS_PL310_BASE; > #endif > @@ -66,7 +66,7 @@ void enable_caches(void) > #endif > } > > -#ifdef CONFIG_SYS_L2_PL310 > +#ifdef CONFIG_PPL_SYS_L2_PL310 > void v7_outer_cache_enable(void) > { > struct udevice *dev; Why can we not continue to use CONFIG_SYS_L2_PL310 in this case? -- Tom signature.asc Description: PGP signature
Re: [PATCH v3 65/95] omap: Correct an SPL build error with watchdog
On Sun, Feb 12, 2023 at 04:16:08PM -0700, Simon Glass wrote: > The logic here is strange since the call to hw_watchdog_init() depends on > CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG but the code it calls is only > enabled if !CONFIG_IS_ENABLED(WDT). This seems to work, but with split > config we get a build error in SPL with CONFIG_WATCHDOG, since it is > interpreted as CONFIG_SPL_WATCHDOG. > > To mimic the behaviour before split config takes effect, use the > PPL_WATCHDOG symbol. > > Signed-off-by: Simon Glass > --- > > (no changes since v1) > > arch/arm/mach-omap2/boot-common.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm/mach-omap2/boot-common.c > b/arch/arm/mach-omap2/boot-common.c > index 9a342a1bf95..401d12c6ca3 100644 > --- a/arch/arm/mach-omap2/boot-common.c > +++ b/arch/arm/mach-omap2/boot-common.c > @@ -302,7 +302,7 @@ void spl_board_init(void) > #if defined(CONFIG_AM33XX) && defined(CONFIG_SPL_MUSB_NEW) > arch_misc_init(); > #endif > -#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) > +#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_PPL_WATCHDOG) > hw_watchdog_init(); > #endif > #ifdef CONFIG_AM33XX No, we want watchdog enabled in SPL. -- Tom signature.asc Description: PGP signature
Re: [PATCH v3 09/95] Correct SPL uses of MULTIPLEXER
On Sun, Feb 12, 2023 at 04:15:12PM -0700, Simon Glass wrote: > This converts 3 usages of this option to the non-SPL form, since there is > no SPL_MULTIPLEXER defined in Kconfig > > Signed-off-by: Simon Glass Reviewed-by: Tom Rini -- Tom signature.asc Description: PGP signature
Re: [PATCH v3 61/95] kconfig: Support writing separate SPL files
On Sun, Feb 12, 2023 at 04:16:04PM -0700, Simon Glass wrote: > At present kconfig writes out several files, including: > >auto.conf - CONFIG settings used by make >autoconf.h - header file used by C code > > This works well but is a bit ugly in places, for example requiring the use > of a SPL_TPL_ macro in Makefiles to distinguish between options intended > for SPL and U-Boot proper. > > Update the kconfig tool to also output separate files for each phase: e.g. > auto_spl.conf and autoconf_spl.h > > These are similar to the existing files, but drop the SPL_ prefix so that > SPL_TPL_ is not needed. It also allows the CONFIG_IS_ENABLED() macro to be > simplified, in a later patch, eventually replacing it with IS_ENABLED(). > > When CONFIG_FOO is used within SPL, it means that FOO is enabled in that > SPL phase. For example if CONFIG_SPL_FOO is enabled in the Kconfig, that > means that CONFIG_FOO will be enabled in the SPL phase. So the SPL builds > can just use CONFIG_FOO to check it. There is no need to use > CONFIG_SPL_FOO or CONFIG_IS_ENABLED() anymore. > > This of course means that if there is a need to access a PPL symbol from > an SPL build, there is no way to do it. To copy with that, we need a > CONFIG_PPL_FOO to be visibilty to all SPL builds. > > So this change also adds new PPL_ output for U-Boot proper (Primary > Program Loader). So every CONFIG_FOO that is enabled in PPL also has a > CONFIG_PPL_FOO > > This allows SPL to access the TEXT_BASE for U-Boot proper, for example, so > it knows where to load it. There are about 30 places where this is needed, > in addition to TEXT_BASE. The environment has the same problem, adding > another dozen or so caes in include/config_distro_bootcmd.h but it has > been decided to ignore that for now. > > The feature is controlled by an environment variable, since it seems to be > bad form to add flags to the conf tool. > > Rebuild the autoconf files if the split config is not present. This allows > building this commit as part of a chain, without generating build errors. > > These changes may benefit from some reworking to send upstream, e.g. to > use a struct for the 'arg' parameter. > > Signed-off-by: Simon Glass This patch, I think, is where my largest problem is. We go from being able to say "if CONFIG_SPL_FOO is undefined, it is false" to "we must define CONFIG_SPL_FOO to false". There's around 150 cases of this, with the series. Why can we not extend the PPL logic (which I'm not super happy with, but, I understand and I think an audit of everything not-TEXT_BASE should be fairly straight forward), to say that if CONFIG_FOO exists and CONFIG_SPL_FOO does not exist, say CONFIG_SPL_FOO is now false. -- Tom signature.asc Description: PGP signature
Re: [PATCH v3 11/95] Correct SPL use of PHY_CADENCE_SIERRA
On Sun, Feb 12, 2023 at 04:15:14PM -0700, Simon Glass wrote: > This converts 1 usage of this option to the non-SPL form, since there is > no SPL_PHY_CADENCE_SIERRA defined in Kconfig > > Signed-off-by: Simon Glass > --- > > (no changes since v1) > > drivers/phy/cadence/Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/phy/cadence/Makefile b/drivers/phy/cadence/Makefile > index af63b32d9f5..c247feb8262 100644 > --- a/drivers/phy/cadence/Makefile > +++ b/drivers/phy/cadence/Makefile > @@ -1,2 +1,2 @@ > -obj-$(CONFIG_$(SPL_)PHY_CADENCE_SIERRA) += phy-cadence-sierra.o > +obj-$(CONFIG_PHY_CADENCE_SIERRA) += phy-cadence-sierra.o > obj-$(CONFIG_$(SPL_)PHY_CADENCE_TORRENT) += phy-cadence-torrent.o This, and then PHY_CADENCE_TORRENT take this the wrong direction, both symbols should be false for non-PPL builds. -- Tom signature.asc Description: PGP signature
Re: [PATCH v2 0/8] vidconsole: refactoring and support for wider fonts
Hi, I'll rebase it вт, 14 февр. 2023 г. в 16:14, Simon Glass : > > Hi Dzmitry, > > On Mon, 13 Feb 2023 at 10:03, Dzmitry Sankouski wrote: > > > > Modern mobile phones typically have high pixel density. > > Bootmenu is hardly readable on those with 8x16 font. > > > > This patch series aims to add wider fonts for devices with high ppi. > > > > Add 16x32, 12x22 fonts from linux, and allow font size configuration. > > > > There was significant changes in version 3: > > - fix video tests failures > > - add runtime font size configuration > > - add test for 12x22 font > > > > Dzmitry Sankouski (8): > > video console: unite normal and rotated files > > video console: refactoring and optimization > > video console: add support for fonts wider than 1 byte > > video console: add select font logic to vidconsole uclass driver > > video console: allow font size configuration at runtime > > video console: add 12x22 Sun font from linux > > video console: add 16x32 Terminus font from linux > > video console: add 12x22 console simple font test > > > > cmd/Kconfig |8 + > > cmd/Makefile |2 +- > > cmd/font.c|7 +- > > common/splash.c |7 +- > > configs/qemu-x86_defconfig|1 + > > configs/sandbox_defconfig |3 + > > drivers/video/Kconfig | 38 +- > > drivers/video/Makefile|3 +- > > drivers/video/console_normal.c| 178 - > > drivers/video/console_rotate.c| 497 --- > > drivers/video/console_simple.c| 638 +++ > > drivers/video/console_truetype.c |6 +- > > drivers/video/vidconsole-uclass.c | 22 + > > include/video.h |1 + > > include/video_console.h | 18 +- > > include/video_font.h | 31 +- > > include/video_font_4x6.h | 11 +- > > include/video_font_8x16.h | 4624 ++ > > include/video_font_data.h | 4644 +- > > include/video_font_sun12x22.h | 6158 + > > include/video_font_ter16x32.h | 2062 ++ > > test/dm/video.c | 41 + > > 22 files changed, 13681 insertions(+), 5319 deletions(-) > > delete mode 100644 drivers/video/console_normal.c > > delete mode 100644 drivers/video/console_rotate.c > > create mode 100644 drivers/video/console_simple.c > > create mode 100644 include/video_font_8x16.h > > create mode 100644 include/video_font_sun12x22.h > > create mode 100644 include/video_font_ter16x32.h > > > > -- > > 2.30.2 > > > > I am unable to apply these. Can you please check that they are against > -master or -next ? > > Thanks, > Simon
RE: [PATCH v3 00/16] General Tegra improvements
Usually best to have the original author make sure all of the patches have all the attributes required, so if you wouldn't mind, I'll take v4 when it's ready. Thanks! Tom -Original Message- From: Svyatoslav Ryhel Sent: Tuesday, February 14, 2023 7:15 AM To: Thierry Reding ; Tom Warren Cc: Marcel Ziswiler ; Allen Martin ; Jagan Teki ; Lukasz Majewski ; Marek Vasut ; Ramin Khonsari ; Maxim Schwalm ; Dmitry Osipenko ; u-boot@lists.denx.de Subject: Re: [PATCH v3 00/16] General Tegra improvements External email: Use caution opening links or attachments Thierry, thank you very much for a quick test. Tom, should I amend patches and upload the next iteration of patchset with Thierry's tested-by or, if no more objections/comments there are, you will add Thierry's tested-by on your own? Best regards. Svyatoslav R. вт, 14 лют. 2023 р. о 16:00 Thierry Reding пише: > > On Fri, Feb 03, 2023 at 11:26:24AM +0200, Svyatoslav Ryhel wrote: > > List of changes in patch set: > > - add missing EXTPERIPH clocks for t30 > > - swap host1x and disp1 clock parents (as they should be) > > - add clk_id_to_pll_id and clock_decode_pair helpers to use > >dts deeper (in tegra clocks often go in pair child - parent) > > - include PLLD setup in T30 (DISP1 may use it as parent on > >some device) > > - fix Tegra PWM parent clock inline with linux > > - Tegra SLINK: patch to accept any word length (unlike 8bit > >aligned which was before) > > - provide default USB gadget setup for existing Nvidia boards > > - add late init function to be able to configure pre-boot stage > >(like uncovering serial number or setting mac address) > > - create common pre-dm i2c write for PMIC (used on T30 and T124 > >to configure basic PMIC voltages required to boot like cpu and > >core voltages) > > - expose crypto module for all Tegra SoCs and implement BCT patching > >(ability to update bootloader from u-boot on production devices > >without need in host PC) > > > > --- > > Changelog from v2 > > - fixed T114 TEGRA114_CLK_PLL_E_OUT0 > > - adjusted pre-dm i2c write commit description > > - added description file for ebtupdate command > > - minor improvements of bct.c comments > > > > Changelog from v1 > > - rebased to latest u-boot master > > - PLLD setup for T30 moved specifically into T30 area > > --- > > > > Maxim Schwalm (1): > > ARM: tegra: provide default USB gadget setup > > > > Ramin Khonsari (1): > > ARM: tegra30: implement BCT patching > > > > Svyatoslav Ryhel (14): > > tegra30: clock: add EXTPERIPH > > ARM: t20/t30: swap host1x and disp1 clock parents > > ARM: tegra: clock: add clk_id_to_pll_id helper > > ARM: tegra: clock: add clock_decode_pair helper > > ARM: tegra30: add PLLD to pll setup > > ARM: tegra: Fix Tegra PWM parent clock > > spi: tegra20_slink: accept any word length > > ARM: tegra: add late init support > > ARM: tegra: create common pre-dm i2c write > > board: tegra124: switch to updated pre-dm i2c write > > board: tegra30: switch to updated pre-dm i2c write > > ARM: tegra: expose crypto module for all Tegra SoCs > > ARM: tegra: crypto: extend crypto functional > > ARM: tegra20: implement BCT patching > > > > arch/arm/dts/tegra114.dtsi| 2 +- > > arch/arm/dts/tegra124.dtsi| 2 +- > > arch/arm/include/asm/arch-tegra/clock.h | 21 + > > arch/arm/include/asm/arch-tegra/crypto.h | 47 ++ > > arch/arm/include/asm/arch-tegra/sys_proto.h | 6 ++ > > arch/arm/include/asm/arch-tegra/tegra_i2c.h | 17 > > .../include/asm/arch-tegra30/clock-tables.h | 6 +- > > arch/arm/mach-tegra/Kconfig | 14 +++ > > arch/arm/mach-tegra/Makefile | 1 + > > arch/arm/mach-tegra/board2.c | 2 + > > arch/arm/mach-tegra/clock.c | 23 + > > arch/arm/mach-tegra/cpu.h | 1 - > > arch/arm/mach-tegra/{tegra20 => }/crypto.c| 63 + > > arch/arm/mach-tegra/tegra114/clock.c | 39 +++- > > arch/arm/mach-tegra/tegra124/clock.c | 40 - > > arch/arm/mach-tegra/tegra124/cpu.c| 4 + > > arch/arm/mach-tegra/tegra20/Kconfig | 1 + > > arch/arm/mach-tegra/tegra20/Makefile | 7 +- > > arch/arm/mach-tegra/tegra20/bct.c | 79 > > arch/arm/mach-tegra/tegra20/bct.h | 42 + > > arch/arm/mach-tegra/tegra20/clock.c | 43 - > > arch/arm/mach-tegra/tegra20/crypto.h | 19 > > arch/arm/mach-tegra/tegra210/clock.c | 39 +++- > > arch/arm/mach-tegra/tegra30/Kconfig | 8 -- > > arch/arm/mach-tegra/tegra30/Makefile | 1 + > > arch/arm/mach-tegra/tegra30/bct.c | 79 > > arch/arm/mach-tegra/tegra30/bct.h | 42 + > > arch/arm/mach-tegra/tegra30/clock.c | 90 +--
Re: [PATCH v1 1/2] ARM: configs: add bitbang feature for npcm8xx
On Tue, Feb 14, 2023 at 04:20:35PM +0800, Jim Liu wrote: > Signed-off-by: Jim Liu > --- > configs/arbel_evb_defconfig | 3 +++ > include/configs/arbel.h | 1 + > 2 files changed, 4 insertions(+) > > diff --git a/configs/arbel_evb_defconfig b/configs/arbel_evb_defconfig > index 8f8a603b50..ac4bb40193 100644 > --- a/configs/arbel_evb_defconfig > +++ b/configs/arbel_evb_defconfig > @@ -92,3 +92,6 @@ CONFIG_NPCM_AES=y > CONFIG_NPCM_OTP=y > CONFIG_DM_REGULATOR=y > CONFIG_DM_REGULATOR_NPCM8XX=y > +CONFIG_BITBANGMII=y > +CONFIG_PHY_ADDR_ENABLE=y > +CONFIG_PHY_ADDR=0 > diff --git a/include/configs/arbel.h b/include/configs/arbel.h > index 8e27fb52a1..d009543ff5 100644 > --- a/include/configs/arbel.h > +++ b/include/configs/arbel.h > @@ -10,6 +10,7 @@ > #define CFG_SYS_BOOTMAPSZ(20 << 20) > #define CFG_SYS_INIT_RAM_ADDRCFG_SYS_SDRAM_BASE > #define CFG_SYS_INIT_RAM_SIZE0x8000 > +#define CONFIG_BITBANGMII_MULTI No "#define CONFIG" in board config.h files, this won't pass CI. -- Tom signature.asc Description: PGP signature
Fwd: New Defects reported by Coverity Scan for Das U-Boot
-- Forwarded message - From: Date: Mon, Feb 13, 2023, 6:50 PM Subject: New Defects reported by Coverity Scan for Das U-Boot To: Hi, Please find the latest report on new defect(s) introduced to Das U-Boot found with Coverity Scan. 2 new defect(s) introduced to Das U-Boot found with Coverity Scan. 3 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan. New defect(s) Reported-by: Coverity Scan Showing 2 of 2 defect(s) ** CID 436073: Resource leaks (RESOURCE_LEAK) /tools/proftool.c: 1853 in make_flamegraph() *** CID 436073: Resource leaks (RESOURCE_LEAK) /tools/proftool.c: 1853 in make_flamegraph() 1847 1848if (make_flame_tree(out_format, )) 1849return -1; 1850 1851*str = '\0'; 1852if (output_tree(fout, out_format, tree, str, sizeof(str), 0)) >>> CID 436073: Resource leaks (RESOURCE_LEAK) >>> Variable "tree" going out of scope leaks the storage it points to. 1853return -1; 1854 1855return 0; 1856 } 1857 1858 /** ** CID 436072: Insecure data handling (TAINTED_SCALAR) *** CID 436072: Insecure data handling (TAINTED_SCALAR) /tools/proftool.c: 515 in read_trace() 509 switch (hdr.type) { 510 case TRACE_CHUNK_FUNCS: 511 /* Ignored at present */ 512 break; 513 514 case TRACE_CHUNK_CALLS: >>> CID 436072: Insecure data handling (TAINTED_SCALAR) >>> Passing tainted expression "hdr.rec_count" to "read_calls", which uses it as an allocation size. 515 if (read_calls(fin, hdr.rec_count)) 516 return 1; 517 break; 518 } 519 } 520 return 0; -- Tom signature.asc Description: PGP signature
Re: [PATCH v3 00/16] General Tegra improvements
Thierry, thank you very much for a quick test. Tom, should I amend patches and upload the next iteration of patchset with Thierry's tested-by or, if no more objections/comments there are, you will add Thierry's tested-by on your own? Best regards. Svyatoslav R. вт, 14 лют. 2023 р. о 16:00 Thierry Reding пише: > > On Fri, Feb 03, 2023 at 11:26:24AM +0200, Svyatoslav Ryhel wrote: > > List of changes in patch set: > > - add missing EXTPERIPH clocks for t30 > > - swap host1x and disp1 clock parents (as they should be) > > - add clk_id_to_pll_id and clock_decode_pair helpers to use > >dts deeper (in tegra clocks often go in pair child - parent) > > - include PLLD setup in T30 (DISP1 may use it as parent on > >some device) > > - fix Tegra PWM parent clock inline with linux > > - Tegra SLINK: patch to accept any word length (unlike 8bit > >aligned which was before) > > - provide default USB gadget setup for existing Nvidia boards > > - add late init function to be able to configure pre-boot stage > >(like uncovering serial number or setting mac address) > > - create common pre-dm i2c write for PMIC (used on T30 and T124 > >to configure basic PMIC voltages required to boot like cpu and > >core voltages) > > - expose crypto module for all Tegra SoCs and implement BCT patching > >(ability to update bootloader from u-boot on production devices > >without need in host PC) > > > > --- > > Changelog from v2 > > - fixed T114 TEGRA114_CLK_PLL_E_OUT0 > > - adjusted pre-dm i2c write commit description > > - added description file for ebtupdate command > > - minor improvements of bct.c comments > > > > Changelog from v1 > > - rebased to latest u-boot master > > - PLLD setup for T30 moved specifically into T30 area > > --- > > > > Maxim Schwalm (1): > > ARM: tegra: provide default USB gadget setup > > > > Ramin Khonsari (1): > > ARM: tegra30: implement BCT patching > > > > Svyatoslav Ryhel (14): > > tegra30: clock: add EXTPERIPH > > ARM: t20/t30: swap host1x and disp1 clock parents > > ARM: tegra: clock: add clk_id_to_pll_id helper > > ARM: tegra: clock: add clock_decode_pair helper > > ARM: tegra30: add PLLD to pll setup > > ARM: tegra: Fix Tegra PWM parent clock > > spi: tegra20_slink: accept any word length > > ARM: tegra: add late init support > > ARM: tegra: create common pre-dm i2c write > > board: tegra124: switch to updated pre-dm i2c write > > board: tegra30: switch to updated pre-dm i2c write > > ARM: tegra: expose crypto module for all Tegra SoCs > > ARM: tegra: crypto: extend crypto functional > > ARM: tegra20: implement BCT patching > > > > arch/arm/dts/tegra114.dtsi| 2 +- > > arch/arm/dts/tegra124.dtsi| 2 +- > > arch/arm/include/asm/arch-tegra/clock.h | 21 + > > arch/arm/include/asm/arch-tegra/crypto.h | 47 ++ > > arch/arm/include/asm/arch-tegra/sys_proto.h | 6 ++ > > arch/arm/include/asm/arch-tegra/tegra_i2c.h | 17 > > .../include/asm/arch-tegra30/clock-tables.h | 6 +- > > arch/arm/mach-tegra/Kconfig | 14 +++ > > arch/arm/mach-tegra/Makefile | 1 + > > arch/arm/mach-tegra/board2.c | 2 + > > arch/arm/mach-tegra/clock.c | 23 + > > arch/arm/mach-tegra/cpu.h | 1 - > > arch/arm/mach-tegra/{tegra20 => }/crypto.c| 63 + > > arch/arm/mach-tegra/tegra114/clock.c | 39 +++- > > arch/arm/mach-tegra/tegra124/clock.c | 40 - > > arch/arm/mach-tegra/tegra124/cpu.c| 4 + > > arch/arm/mach-tegra/tegra20/Kconfig | 1 + > > arch/arm/mach-tegra/tegra20/Makefile | 7 +- > > arch/arm/mach-tegra/tegra20/bct.c | 79 > > arch/arm/mach-tegra/tegra20/bct.h | 42 + > > arch/arm/mach-tegra/tegra20/clock.c | 43 - > > arch/arm/mach-tegra/tegra20/crypto.h | 19 > > arch/arm/mach-tegra/tegra210/clock.c | 39 +++- > > arch/arm/mach-tegra/tegra30/Kconfig | 8 -- > > arch/arm/mach-tegra/tegra30/Makefile | 1 + > > arch/arm/mach-tegra/tegra30/bct.c | 79 > > arch/arm/mach-tegra/tegra30/bct.h | 42 + > > arch/arm/mach-tegra/tegra30/clock.c | 90 +-- > > arch/arm/mach-tegra/tegra30/cpu.c | 55 +--- > > board/avionic-design/tec-ng/Makefile | 4 +- > > board/avionic-design/tec-ng/tec-ng-spl.c | 34 +++ > > board/nvidia/beaver/Makefile | 2 + > > board/nvidia/beaver/beaver-spl.c | 43 + > > board/nvidia/cardhu/Makefile | 4 +- > > board/nvidia/cardhu/cardhu-spl.c | 43 + > > board/nvidia/venice2/as3722_init.c| 65 +- > > board/nvidia/venice2/as3722_init.h| 43 -
Re: [PATCH v3 00/16] General Tegra improvements
On Fri, Feb 03, 2023 at 11:26:24AM +0200, Svyatoslav Ryhel wrote: > List of changes in patch set: > - add missing EXTPERIPH clocks for t30 > - swap host1x and disp1 clock parents (as they should be) > - add clk_id_to_pll_id and clock_decode_pair helpers to use >dts deeper (in tegra clocks often go in pair child - parent) > - include PLLD setup in T30 (DISP1 may use it as parent on >some device) > - fix Tegra PWM parent clock inline with linux > - Tegra SLINK: patch to accept any word length (unlike 8bit >aligned which was before) > - provide default USB gadget setup for existing Nvidia boards > - add late init function to be able to configure pre-boot stage >(like uncovering serial number or setting mac address) > - create common pre-dm i2c write for PMIC (used on T30 and T124 >to configure basic PMIC voltages required to boot like cpu and >core voltages) > - expose crypto module for all Tegra SoCs and implement BCT patching >(ability to update bootloader from u-boot on production devices >without need in host PC) > > --- > Changelog from v2 > - fixed T114 TEGRA114_CLK_PLL_E_OUT0 > - adjusted pre-dm i2c write commit description > - added description file for ebtupdate command > - minor improvements of bct.c comments > > Changelog from v1 > - rebased to latest u-boot master > - PLLD setup for T30 moved specifically into T30 area > --- > > Maxim Schwalm (1): > ARM: tegra: provide default USB gadget setup > > Ramin Khonsari (1): > ARM: tegra30: implement BCT patching > > Svyatoslav Ryhel (14): > tegra30: clock: add EXTPERIPH > ARM: t20/t30: swap host1x and disp1 clock parents > ARM: tegra: clock: add clk_id_to_pll_id helper > ARM: tegra: clock: add clock_decode_pair helper > ARM: tegra30: add PLLD to pll setup > ARM: tegra: Fix Tegra PWM parent clock > spi: tegra20_slink: accept any word length > ARM: tegra: add late init support > ARM: tegra: create common pre-dm i2c write > board: tegra124: switch to updated pre-dm i2c write > board: tegra30: switch to updated pre-dm i2c write > ARM: tegra: expose crypto module for all Tegra SoCs > ARM: tegra: crypto: extend crypto functional > ARM: tegra20: implement BCT patching > > arch/arm/dts/tegra114.dtsi| 2 +- > arch/arm/dts/tegra124.dtsi| 2 +- > arch/arm/include/asm/arch-tegra/clock.h | 21 + > arch/arm/include/asm/arch-tegra/crypto.h | 47 ++ > arch/arm/include/asm/arch-tegra/sys_proto.h | 6 ++ > arch/arm/include/asm/arch-tegra/tegra_i2c.h | 17 > .../include/asm/arch-tegra30/clock-tables.h | 6 +- > arch/arm/mach-tegra/Kconfig | 14 +++ > arch/arm/mach-tegra/Makefile | 1 + > arch/arm/mach-tegra/board2.c | 2 + > arch/arm/mach-tegra/clock.c | 23 + > arch/arm/mach-tegra/cpu.h | 1 - > arch/arm/mach-tegra/{tegra20 => }/crypto.c| 63 + > arch/arm/mach-tegra/tegra114/clock.c | 39 +++- > arch/arm/mach-tegra/tegra124/clock.c | 40 - > arch/arm/mach-tegra/tegra124/cpu.c| 4 + > arch/arm/mach-tegra/tegra20/Kconfig | 1 + > arch/arm/mach-tegra/tegra20/Makefile | 7 +- > arch/arm/mach-tegra/tegra20/bct.c | 79 > arch/arm/mach-tegra/tegra20/bct.h | 42 + > arch/arm/mach-tegra/tegra20/clock.c | 43 - > arch/arm/mach-tegra/tegra20/crypto.h | 19 > arch/arm/mach-tegra/tegra210/clock.c | 39 +++- > arch/arm/mach-tegra/tegra30/Kconfig | 8 -- > arch/arm/mach-tegra/tegra30/Makefile | 1 + > arch/arm/mach-tegra/tegra30/bct.c | 79 > arch/arm/mach-tegra/tegra30/bct.h | 42 + > arch/arm/mach-tegra/tegra30/clock.c | 90 +-- > arch/arm/mach-tegra/tegra30/cpu.c | 55 +--- > board/avionic-design/tec-ng/Makefile | 4 +- > board/avionic-design/tec-ng/tec-ng-spl.c | 34 +++ > board/nvidia/beaver/Makefile | 2 + > board/nvidia/beaver/beaver-spl.c | 43 + > board/nvidia/cardhu/Makefile | 4 +- > board/nvidia/cardhu/cardhu-spl.c | 43 + > board/nvidia/venice2/as3722_init.c| 65 +- > board/nvidia/venice2/as3722_init.h| 43 - > board/toradex/apalis-tk1/as3722_init.c| 85 ++ > board/toradex/apalis-tk1/as3722_init.h| 40 - > board/toradex/apalis_t30/Makefile | 2 + > board/toradex/apalis_t30/apalis_t30-spl.c | 34 +++ > board/toradex/colibri_t30/Makefile| 2 + > board/toradex/colibri_t30/colibri_t30-spl.c | 34 +++ > configs/beaver_defconfig | 3 - > configs/cei-tk1-som_defconfig | 3 - >
[PATCH 2/2] arm64: Reduce PT size estimation complexity
From: Marc Zyngier count_required_pts()'s complexity is high if mappings are not using the largest possible block size (due to some other requirement such as tracking dirty pages, for example). Let's switch to a method that follows the pattern established with the add_map() helper, and make it almost instantaneous instead of taking a large amount of time if 2MB mappings are in use instead of 1GB. Signed-off-by: Marc Zyngier Signed-off-by: Pierre-Clément Tosi [ Paul: pick from the Android tree. Fixup Pierre's commit. Rebase to the upstream ] Signed-off-by: Ying-Chun Liu (PaulLiu) Cc: Tom Rini Link: https://android.googlesource.com/platform/external/u-boot/+/5d756d147e31a1cdaaa261a50e526404ca5968f5 Link: https://android.googlesource.com/platform/external/u-boot/+/6be9330601d81545c7c941e3609f35bf68a09059 --- arch/arm/cpu/armv8/cache_v8.c | 109 +++--- 1 file changed, 34 insertions(+), 75 deletions(-) diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c index 876344e1b4..697334086f 100644 --- a/arch/arm/cpu/armv8/cache_v8.c +++ b/arch/arm/cpu/armv8/cache_v8.c @@ -352,98 +352,57 @@ static void add_map(struct mm_region *map) (u64 *)gd->arch.tlb_addr, attrs); } -enum pte_type { - PTE_INVAL, - PTE_BLOCK, - PTE_LEVEL, -}; - -/* - * This is a recursively called function to count the number of - * page tables we need to cover a particular PTE range. If you - * call this with level = -1 you basically get the full 48 bit - * coverage. - */ -static int count_required_pts(u64 addr, int level, u64 maxaddr) +static void count_range(u64 virt, u64 size, int level, int *cntp) { - int levelshift = level2shift(level); - u64 levelsize = 1ULL << levelshift; - u64 levelmask = levelsize - 1; - u64 levelend = addr + levelsize; - int r = 0; - int i; - enum pte_type pte_type = PTE_INVAL; + u64 map_size = BIT_ULL(level2shift(level)); + int i, idx; - for (i = 0; mem_map[i].size || mem_map[i].attrs; i++) { - struct mm_region *map = _map[i]; - u64 start = map->virt; - u64 end = start + map->size; + idx = (virt >> level2shift(level)) & (MAX_PTE_ENTRIES - 1); + for (i = idx; size; i++) { + u64 next_size; - /* Check if the PTE would overlap with the map */ - if (max(addr, start) <= min(levelend, end)) { - start = max(addr, start); - end = min(levelend, end); + if (level >= 1 && + size >= map_size && !(virt & (map_size - 1))) { + virt += map_size; + size -= map_size; - /* We need a sub-pt for this level */ - if ((start & levelmask) || (end & levelmask)) { - pte_type = PTE_LEVEL; - break; - } + continue; + } - /* Lv0 can not do block PTEs, so do levels here too */ - if (level <= 0) { - pte_type = PTE_LEVEL; - break; - } + /* Going one level down */ + (*cntp)++; + next_size = min(map_size - (virt & (map_size - 1)), size); - /* PTE is active, but fits into a block */ - pte_type = PTE_BLOCK; - } - } + count_range(virt, next_size, level + 1, cntp); - /* -* Block PTEs at this level are already covered by the parent page -* table, so we only need to count sub page tables. -*/ - if (pte_type == PTE_LEVEL) { - int sublevel = level + 1; - u64 sublevelsize = 1ULL << level2shift(sublevel); - - /* Account for the new sub page table ... */ - r = 1; - - /* ... and for all child page tables that one might have */ - for (i = 0; i < MAX_PTE_ENTRIES; i++) { - r += count_required_pts(addr, sublevel, maxaddr); - addr += sublevelsize; - - if (addr >= maxaddr) { - /* -* We reached the end of address space, no need -* to look any further. -*/ - break; - } - } + virt += next_size; + size -= next_size; } - - return r; } -/* Returns the estimated required size of all page tables */ -__weak u64 get_page_table_size(void) +static int count_ranges(void) { - u64 one_pt = MAX_PTE_ENTRIES * sizeof(u64); - u64 size = 0; + int i, count = 0, level = 0;
[PATCH 1/2] arm64: Reduce add_map() complexity
From: Marc Zyngier In the add_map() function, for each level it populates, it iterates from the root of the PT tree, making it ineficient if a mapping needs to occur past level 1. Instead, replace it with a recursive (and much simpler) algorithm that keeps the complexity as low as possible. With this, mapping 512GB at level 2 goes from several seconds down to not measurable on an A55 machine. We keep the block mappings at level 1 for now though. Signed-off-by: Marc Zyngier Signed-off-by: Pierre-Clément Tosi [ Paul: pick from the Android tree. Fixup Pierre's commit. Rebase to the upstream ] Signed-off-by: Ying-Chun Liu (PaulLiu) Cc: Tom Rini Link: https://android.googlesource.com/platform/external/u-boot/+/96ad729cf4cab53bdff8222bb3eb256f38b5c3a6 Link: https://android.googlesource.com/platform/external/u-boot/+/6be9330601d81545c7c941e3609f35bf68a09059 --- arch/arm/cpu/armv8/cache_v8.c | 94 +-- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c index f333ad8889..876344e1b4 100644 --- a/arch/arm/cpu/armv8/cache_v8.c +++ b/arch/arm/cpu/armv8/cache_v8.c @@ -299,61 +299,59 @@ static void split_block(u64 *pte, int level) set_pte_table(pte, new_table); } -/* Add one mm_region map entry to the page tables */ -static void add_map(struct mm_region *map) +static void map_range(u64 virt, u64 phys, u64 size, int level, + u64 *table, u64 attrs) { - u64 *pte; - u64 virt = map->virt; - u64 phys = map->phys; - u64 size = map->size; - u64 attrs = map->attrs | PTE_TYPE_BLOCK | PTE_BLOCK_AF; - u64 blocksize; - int level; - u64 *new_table; + u64 map_size = BIT_ULL(level2shift(level)); + int i, idx; - while (size) { - pte = find_pte(virt, 0); - if (pte && (pte_type(pte) == PTE_TYPE_FAULT)) { - debug("Creating table for virt 0x%llx\n", virt); - new_table = create_table(); - set_pte_table(pte, new_table); - } + idx = (virt >> level2shift(level)) & (MAX_PTE_ENTRIES - 1); + for (i = idx; size; i++) { + u64 next_size, *next_table; - for (level = 1; level < 4; level++) { - pte = find_pte(virt, level); - if (!pte) - panic("pte not found\n"); - - blocksize = 1ULL << level2shift(level); - debug("Checking if pte fits for virt=%llx size=%llx blocksize=%llx\n", - virt, size, blocksize); - if (size >= blocksize && !(virt & (blocksize - 1))) { - /* Page fits, create block PTE */ - debug("Setting PTE %p to block virt=%llx\n", - pte, virt); - if (level == 3) - *pte = phys | attrs | PTE_TYPE_PAGE; - else - *pte = phys | attrs; - virt += blocksize; - phys += blocksize; - size -= blocksize; - break; - } else if (pte_type(pte) == PTE_TYPE_FAULT) { - /* Page doesn't fit, create subpages */ - debug("Creating subtable for virt 0x%llx blksize=%llx\n", - virt, blocksize); - new_table = create_table(); - set_pte_table(pte, new_table); - } else if (pte_type(pte) == PTE_TYPE_BLOCK) { - debug("Split block into subtable for virt 0x%llx blksize=0x%llx\n", - virt, blocksize); - split_block(pte, level); - } + if (level >= 1 && + size >= map_size && !(virt & (map_size - 1))) { + if (level == 3) + table[i] = phys | attrs | PTE_TYPE_PAGE; + else + table[i] = phys | attrs; + + virt += map_size; + phys += map_size; + size -= map_size; + + continue; } + + /* Going one level down */ + if (pte_type([i]) == PTE_TYPE_FAULT) + set_pte_table([i], create_table()); + + next_table = (u64 *)(table[i] & GENMASK_ULL(47, PAGE_SHIFT)); + next_size = min(map_size - (virt & (map_size - 1)), size); + + map_range(virt, phys, next_size, level + 1, next_table, attrs); +
[PATCH 0/2] Reduce the complexity of add_map() and count_required_pts()
Reduce the complexity of add_map() and count_required_pts() to gain better performance. Marc Zyngier (2): arm64: Reduce add_map() complexity arm64: Reduce PT size estimation complexity arch/arm/cpu/armv8/cache_v8.c | 201 +- 1 file changed, 79 insertions(+), 122 deletions(-) -- 2.39.1
RE: [PATCH v1 1/1] fpga: zynqmppl: fix fpga loads command for unencrypted use case
Acked-by: Ashok Reddy Soma Thanks, Ashok > -Original Message- > From: Neal Frager > Sent: Tuesday, February 14, 2023 6:50 PM > To: u-boot@lists.denx.de; git-dev (AMD-Xilinx) > Cc: Simek, Michal ; Soma, Ashok Reddy > ; Manne, Nava kishore > ; Erkiaga Elorza, Ibai elo...@amd.com>; Frager, Neal > Subject: [PATCH v1 1/1] fpga: zynqmppl: fix fpga loads command for > unencrypted use case > > When using the fpga loads command, the driver is passing the AES > encryption key address is all cases. However, for the authenticated, but not > encrypted use case, there is no AES encryption key, and this value is 0. > > When AES encryption is not used on the fpga bitstream, the pmufw assumes > that the AES key address is a bitstream size value like what is used by the > unsecure fpga load command. > > To fix the problem, this patch checks to see if the AES key address is zero. > If the AES key address is zero, it means that AES is not being used on the > bitstream and the bitstream size should be passed instead. Thus, matching > the fpga load functionality. > > Signed-off-by: Neal Frager > --- > drivers/fpga/zynqmppl.c | 12 +--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/fpga/zynqmppl.c b/drivers/fpga/zynqmppl.c index > 6b394869db..718c04b22c 100644 > --- a/drivers/fpga/zynqmppl.c > +++ b/drivers/fpga/zynqmppl.c > @@ -278,10 +278,16 @@ static int zynqmp_loads(xilinx_desc *desc, const > void *buf, size_t bsize, > buf_lo = lower_32_bits((ulong)buf); > buf_hi = upper_32_bits((ulong)buf); > > - ret = xilinx_pm_request(PM_FPGA_LOAD, buf_lo, > + if ((u32)(uintptr_t)fpga_sec_info->userkey_addr) > + ret = xilinx_pm_request(PM_FPGA_LOAD, buf_lo, > buf_hi, > - (u32)(uintptr_t)fpga_sec_info->userkey_addr, > - flag, ret_payload); > + (u32)(uintptr_t)fpga_sec_info- > >userkey_addr, > + flag, ret_payload); > + else > + ret = xilinx_pm_request(PM_FPGA_LOAD, buf_lo, > + buf_hi, (u32)bsize, > + flag, ret_payload); > + > if (ret) > puts("PL FPGA LOAD fail\n"); > else > -- > 2.17.1
[PATCH v1 1/1] fpga: zynqmppl: fix fpga loads command for unencrypted use case
When using the fpga loads command, the driver is passing the AES encryption key address is all cases. However, for the authenticated, but not encrypted use case, there is no AES encryption key, and this value is 0. When AES encryption is not used on the fpga bitstream, the pmufw assumes that the AES key address is a bitstream size value like what is used by the unsecure fpga load command. To fix the problem, this patch checks to see if the AES key address is zero. If the AES key address is zero, it means that AES is not being used on the bitstream and the bitstream size should be passed instead. Thus, matching the fpga load functionality. Signed-off-by: Neal Frager --- drivers/fpga/zynqmppl.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/fpga/zynqmppl.c b/drivers/fpga/zynqmppl.c index 6b394869db..718c04b22c 100644 --- a/drivers/fpga/zynqmppl.c +++ b/drivers/fpga/zynqmppl.c @@ -278,10 +278,16 @@ static int zynqmp_loads(xilinx_desc *desc, const void *buf, size_t bsize, buf_lo = lower_32_bits((ulong)buf); buf_hi = upper_32_bits((ulong)buf); - ret = xilinx_pm_request(PM_FPGA_LOAD, buf_lo, + if ((u32)(uintptr_t)fpga_sec_info->userkey_addr) + ret = xilinx_pm_request(PM_FPGA_LOAD, buf_lo, buf_hi, -(u32)(uintptr_t)fpga_sec_info->userkey_addr, -flag, ret_payload); + (u32)(uintptr_t)fpga_sec_info->userkey_addr, + flag, ret_payload); + else + ret = xilinx_pm_request(PM_FPGA_LOAD, buf_lo, + buf_hi, (u32)bsize, + flag, ret_payload); + if (ret) puts("PL FPGA LOAD fail\n"); else -- 2.17.1
Re: [PATCH v2 0/8] vidconsole: refactoring and support for wider fonts
Hi Dzmitry, On Mon, 13 Feb 2023 at 10:03, Dzmitry Sankouski wrote: > > Modern mobile phones typically have high pixel density. > Bootmenu is hardly readable on those with 8x16 font. > > This patch series aims to add wider fonts for devices with high ppi. > > Add 16x32, 12x22 fonts from linux, and allow font size configuration. > > There was significant changes in version 3: > - fix video tests failures > - add runtime font size configuration > - add test for 12x22 font > > Dzmitry Sankouski (8): > video console: unite normal and rotated files > video console: refactoring and optimization > video console: add support for fonts wider than 1 byte > video console: add select font logic to vidconsole uclass driver > video console: allow font size configuration at runtime > video console: add 12x22 Sun font from linux > video console: add 16x32 Terminus font from linux > video console: add 12x22 console simple font test > > cmd/Kconfig |8 + > cmd/Makefile |2 +- > cmd/font.c|7 +- > common/splash.c |7 +- > configs/qemu-x86_defconfig|1 + > configs/sandbox_defconfig |3 + > drivers/video/Kconfig | 38 +- > drivers/video/Makefile|3 +- > drivers/video/console_normal.c| 178 - > drivers/video/console_rotate.c| 497 --- > drivers/video/console_simple.c| 638 +++ > drivers/video/console_truetype.c |6 +- > drivers/video/vidconsole-uclass.c | 22 + > include/video.h |1 + > include/video_console.h | 18 +- > include/video_font.h | 31 +- > include/video_font_4x6.h | 11 +- > include/video_font_8x16.h | 4624 ++ > include/video_font_data.h | 4644 +- > include/video_font_sun12x22.h | 6158 + > include/video_font_ter16x32.h | 2062 ++ > test/dm/video.c | 41 + > 22 files changed, 13681 insertions(+), 5319 deletions(-) > delete mode 100644 drivers/video/console_normal.c > delete mode 100644 drivers/video/console_rotate.c > create mode 100644 drivers/video/console_simple.c > create mode 100644 include/video_font_8x16.h > create mode 100644 include/video_font_sun12x22.h > create mode 100644 include/video_font_ter16x32.h > > -- > 2.30.2 > I am unable to apply these. Can you please check that they are against -master or -next ? Thanks, Simon
[PATCH v2 2/2] riscv: ae350: Adjust the memory layout of ae350
Adjust the initial stack pointer address to 0x1000(256M) Signed-off-by: Leo Yu-Chi Liang --- Change v1 -> v2: * Modify the address from 0x100(16MB) to 0x1000(256MB) --- configs/ae350_rv32_spl_defconfig | 6 +++--- configs/ae350_rv32_spl_xip_defconfig | 6 +++--- configs/ae350_rv64_spl_defconfig | 6 +++--- configs/ae350_rv64_spl_xip_defconfig | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/configs/ae350_rv32_spl_defconfig b/configs/ae350_rv32_spl_defconfig index e328308e097..f2fe276c5c8 100644 --- a/configs/ae350_rv32_spl_defconfig +++ b/configs/ae350_rv32_spl_defconfig @@ -1,7 +1,9 @@ CONFIG_RISCV=y -CONFIG_TEXT_BASE=0x0120 +CONFIG_TEXT_BASE=0x0180 CONFIG_SYS_MALLOC_LEN=0x8 CONFIG_NR_DRAM_BANKS=2 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000 CONFIG_ENV_SECT_SIZE=0x1000 CONFIG_DEFAULT_DEVICE_TREE="ae350_32" CONFIG_SYS_PROMPT="RISC-V # " @@ -12,8 +14,6 @@ CONFIG_TARGET_AE350=y CONFIG_RISCV_SMODE=y # CONFIG_AVAILABLE_HARTS is not set CONFIG_DISTRO_DEFAULTS=y -CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y -CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x00 CONFIG_SYS_MONITOR_LEN=786432 CONFIG_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x0020 diff --git a/configs/ae350_rv32_spl_xip_defconfig b/configs/ae350_rv32_spl_xip_defconfig index da8edf44d4c..4ed5e2cad99 100644 --- a/configs/ae350_rv32_spl_xip_defconfig +++ b/configs/ae350_rv32_spl_xip_defconfig @@ -1,7 +1,9 @@ CONFIG_RISCV=y -CONFIG_TEXT_BASE=0x0120 +CONFIG_TEXT_BASE=0x0180 CONFIG_SYS_MALLOC_LEN=0x8 CONFIG_NR_DRAM_BANKS=2 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000 CONFIG_ENV_SECT_SIZE=0x1000 CONFIG_DEFAULT_DEVICE_TREE="ae350_32" CONFIG_SPL_TEXT_BASE=0x8000 @@ -13,8 +15,6 @@ CONFIG_TARGET_AE350=y CONFIG_RISCV_SMODE=y CONFIG_SPL_XIP=y CONFIG_DISTRO_DEFAULTS=y -CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y -CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x00 CONFIG_SYS_MONITOR_LEN=786432 CONFIG_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x8001 diff --git a/configs/ae350_rv64_spl_defconfig b/configs/ae350_rv64_spl_defconfig index 9c5018c4462..90dfc7d02ee 100644 --- a/configs/ae350_rv64_spl_defconfig +++ b/configs/ae350_rv64_spl_defconfig @@ -1,7 +1,9 @@ CONFIG_RISCV=y -CONFIG_TEXT_BASE=0x0120 +CONFIG_TEXT_BASE=0x0180 CONFIG_SYS_MALLOC_LEN=0x8 CONFIG_NR_DRAM_BANKS=2 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000 CONFIG_ENV_SECT_SIZE=0x1000 CONFIG_DEFAULT_DEVICE_TREE="ae350_64" CONFIG_SYS_PROMPT="RISC-V # " @@ -13,8 +15,6 @@ CONFIG_ARCH_RV64I=y CONFIG_RISCV_SMODE=y # CONFIG_AVAILABLE_HARTS is not set CONFIG_DISTRO_DEFAULTS=y -CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y -CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xfffe70 CONFIG_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x0020 CONFIG_SYS_MONITOR_BASE=0x8800 diff --git a/configs/ae350_rv64_spl_xip_defconfig b/configs/ae350_rv64_spl_xip_defconfig index 9351deffa3b..f174638f692 100644 --- a/configs/ae350_rv64_spl_xip_defconfig +++ b/configs/ae350_rv64_spl_xip_defconfig @@ -1,7 +1,9 @@ CONFIG_RISCV=y -CONFIG_TEXT_BASE=0x0120 +CONFIG_TEXT_BASE=0x0180 CONFIG_SYS_MALLOC_LEN=0x8 CONFIG_NR_DRAM_BANKS=2 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000 CONFIG_ENV_SECT_SIZE=0x1000 CONFIG_DEFAULT_DEVICE_TREE="ae350_64" CONFIG_SPL_TEXT_BASE=0x8000 @@ -14,8 +16,6 @@ CONFIG_ARCH_RV64I=y CONFIG_RISCV_SMODE=y CONFIG_SPL_XIP=y CONFIG_DISTRO_DEFAULTS=y -CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y -CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xfffe70 CONFIG_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x8001 CONFIG_SYS_MONITOR_BASE=0x8800 -- 2.38.0.68.ge85701b4af.dirty
[PATCH v2 1/2] riscv: Rename Andes cpu and board names
The current ae350-related defconfigs could also support newer Andes CPU IP, so modify the names of CPU from ax25 to andesv5, and board name from ax25-ae350 to ae350. Signed-off-by: Leo Yu-Chi Liang Reviewed-by: Yu Chien Peter Lin Reviewed-by: Rick Chen --- arch/riscv/Kconfig | 8 arch/riscv/cpu/{ax25 => andesv5}/Kconfig | 0 arch/riscv/cpu/{ax25 => andesv5}/Makefile| 0 arch/riscv/cpu/{ax25 => andesv5}/cache.c | 0 arch/riscv/cpu/{ax25 => andesv5}/cpu.c | 0 arch/riscv/cpu/{ax25 => andesv5}/spl.c | 0 arch/riscv/dts/Makefile | 2 +- board/AndesTech/{ax25-ae350 => ae350}/Kconfig| 8 .../AndesTech/{ax25-ae350 => ae350}/MAINTAINERS | 6 +++--- board/AndesTech/{ax25-ae350 => ae350}/Makefile | 2 +- .../{ax25-ae350/ax25-ae350.c => ae350/ae350.c} | 0 configs/ae350_rv32_defconfig | 2 +- configs/ae350_rv32_spl_defconfig | 2 +- configs/ae350_rv32_spl_xip_defconfig | 2 +- configs/ae350_rv32_xip_defconfig | 2 +- configs/ae350_rv64_defconfig | 2 +- configs/ae350_rv64_spl_defconfig | 2 +- configs/ae350_rv64_spl_xip_defconfig | 2 +- configs/ae350_rv64_xip_defconfig | 2 +- .../AndesTech/{ax25-ae350.rst => ae350.rst} | 16 doc/board/AndesTech/index.rst| 2 +- include/configs/{ax25-ae350.h => ae350.h}| 0 22 files changed, 30 insertions(+), 30 deletions(-) rename arch/riscv/cpu/{ax25 => andesv5}/Kconfig (100%) rename arch/riscv/cpu/{ax25 => andesv5}/Makefile (100%) rename arch/riscv/cpu/{ax25 => andesv5}/cache.c (100%) rename arch/riscv/cpu/{ax25 => andesv5}/cpu.c (100%) rename arch/riscv/cpu/{ax25 => andesv5}/spl.c (100%) rename board/AndesTech/{ax25-ae350 => ae350}/Kconfig (88%) rename board/AndesTech/{ax25-ae350 => ae350}/MAINTAINERS (80%) rename board/AndesTech/{ax25-ae350 => ae350}/Makefile (87%) rename board/AndesTech/{ax25-ae350/ax25-ae350.c => ae350/ae350.c} (100%) rename doc/board/AndesTech/{ax25-ae350.rst => ae350.rst} (98%) rename include/configs/{ax25-ae350.h => ae350.h} (100%) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index ebc4bef220e..48ca4ff4c4e 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -8,8 +8,8 @@ choice prompt "Target select" optional -config TARGET_AX25_AE350 - bool "Support ax25-ae350" +config TARGET_AE350 + bool "Support ae350" config TARGET_MICROCHIP_ICICLE bool "Support Microchip PolarFire-SoC Icicle Board" @@ -58,7 +58,7 @@ config SPL_SYS_DCACHE_OFF Do not enable data cache in SPL. # board-specific options below -source "board/AndesTech/ax25-ae350/Kconfig" +source "board/AndesTech/ae350/Kconfig" source "board/emulation/qemu-riscv/Kconfig" source "board/microchip/mpfs_icicle/Kconfig" source "board/sifive/unleashed/Kconfig" @@ -67,7 +67,7 @@ source "board/openpiton/riscv64/Kconfig" source "board/sipeed/maix/Kconfig" # platform-specific options below -source "arch/riscv/cpu/ax25/Kconfig" +source "arch/riscv/cpu/andesv5/Kconfig" source "arch/riscv/cpu/fu540/Kconfig" source "arch/riscv/cpu/fu740/Kconfig" source "arch/riscv/cpu/generic/Kconfig" diff --git a/arch/riscv/cpu/ax25/Kconfig b/arch/riscv/cpu/andesv5/Kconfig similarity index 100% rename from arch/riscv/cpu/ax25/Kconfig rename to arch/riscv/cpu/andesv5/Kconfig diff --git a/arch/riscv/cpu/ax25/Makefile b/arch/riscv/cpu/andesv5/Makefile similarity index 100% rename from arch/riscv/cpu/ax25/Makefile rename to arch/riscv/cpu/andesv5/Makefile diff --git a/arch/riscv/cpu/ax25/cache.c b/arch/riscv/cpu/andesv5/cache.c similarity index 100% rename from arch/riscv/cpu/ax25/cache.c rename to arch/riscv/cpu/andesv5/cache.c diff --git a/arch/riscv/cpu/ax25/cpu.c b/arch/riscv/cpu/andesv5/cpu.c similarity index 100% rename from arch/riscv/cpu/ax25/cpu.c rename to arch/riscv/cpu/andesv5/cpu.c diff --git a/arch/riscv/cpu/ax25/spl.c b/arch/riscv/cpu/andesv5/spl.c similarity index 100% rename from arch/riscv/cpu/ax25/spl.c rename to arch/riscv/cpu/andesv5/spl.c diff --git a/arch/riscv/dts/Makefile b/arch/riscv/dts/Makefile index 5c15a0f303a..c576c55767f 100644 --- a/arch/riscv/dts/Makefile +++ b/arch/riscv/dts/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0+ -dtb-$(CONFIG_TARGET_AX25_AE350) += ae350_32.dtb ae350_64.dtb +dtb-$(CONFIG_TARGET_AE350) += ae350_32.dtb ae350_64.dtb dtb-$(CONFIG_TARGET_MICROCHIP_ICICLE) += microchip-mpfs-icicle-kit.dtb dtb-$(CONFIG_TARGET_QEMU_VIRT) += qemu-virt32.dtb qemu-virt64.dtb dtb-$(CONFIG_TARGET_OPENPITON_RISCV64) += openpiton-riscv64.dtb diff --git a/board/AndesTech/ax25-ae350/Kconfig b/board/AndesTech/ae350/Kconfig similarity index 88% rename from board/AndesTech/ax25-ae350/Kconfig rename to board/AndesTech/ae350/Kconfig index 4bb33b07936..75815bf99aa 100644 ---
Re: [PATCH] efi_loader: update SetVariable attribute check
On 2/14/23 10:19, Masahisa Kojima wrote: UEFI specification v2.10 says that EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and EFI_UNSUPPORTED should be returned in SetVariable variable service. Current implementation returns EFI_INVALID_PARAMETER, let's fix the return value. Together with above change, this commit also updates the SetVariable attribute check to be aligned with the EDK2 reference implementation. Signed-off-by: Masahisa Kojima --- lib/efi_loader/efi_variable.c | 30 +++--- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index 4c85cfa607..1076ff7585 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -230,9 +230,28 @@ efi_status_t efi_set_variable_int(const u16 *variable_name, u64 time = 0; enum efi_auth_var_type var_type; - if (!variable_name || !*variable_name || !vendor || - ((attributes & EFI_VARIABLE_RUNTIME_ACCESS) && -!(attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS))) + if (!variable_name || !*variable_name || !vendor) + return EFI_INVALID_PARAMETER; + + if (data_size != 0 && !data) We tend to not use '!= 0' and ' == 0' in logical constraints. You could use if (data_size && !data) instead. + return EFI_INVALID_PARAMETER; + + /* EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated */ + if (attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS || + ((attributes & EFI_VARIABLE_MASK) == 0)) !(attributes & EFI_VARIABLE_MASK) + return EFI_UNSUPPORTED; + + /* Make sure if runtime bit is set, boot service bit is set also */ + if ((attributes & +(EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == + EFI_VARIABLE_RUNTIME_ACCESS) + return EFI_INVALID_PARAMETER; + + /* only EFI_VARIABLE_NON_VOLATILE attribute is invalid */ + if ((attributes & EFI_VARIABLE_MASK) == EFI_VARIABLE_NON_VOLATILE) + return EFI_INVALID_PARAMETER; + + if (attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) return EFI_INVALID_PARAMETER; Variables with flags NV, BS, RT, HR, name HwErrRec, and GUID EFI_HARDWARE_ERROR_VARIABLE are allowable according to the UEFI spec. Why do we return EFI_INVALID_PARAMETER here? Please, sort the checks above such that all EFI_INVALID_PARAMETER are together followed by EFI_UNSUPPORTED. Best regards Heinrich /* check if a variable exists */ @@ -281,8 +300,6 @@ efi_status_t efi_set_variable_int(const u16 *variable_name, /* authenticate a variable */ if (IS_ENABLED(CONFIG_EFI_SECURE_BOOT)) { - if (attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) - return EFI_INVALID_PARAMETER; if (attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) { u32 env_attr; @@ -300,8 +317,7 @@ efi_status_t efi_set_variable_int(const u16 *variable_name, } } else { if (attributes & - (EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | -EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)) { + EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) { EFI_PRINT("Secure boot is not configured\n"); return EFI_INVALID_PARAMETER; }
Re: [RFC][PATCH] board: rockchip: add Radxa ROCK5B Rk3588 board
Hi Eugen, On 2023-02-14 11:26, Eugen Hristev wrote: > On 2/6/23 14:14, Jonas Karlman wrote: >> Hi Eugen, >> On 2023-02-06 12:59, Eugen Hristev wrote: >>> ROCK 5B is a Rockchip RK3588 based SBC (Single Board Computer) by Radxa. >>> >>> There are tree variants depending on the DRAM size : 4G, 8G and 16G. >>> >>> Specification: >>> >>> Rockchip Rk3588 SoC >>> 4x ARM Cortex-A76, 4x ARM Cortex-A55 >>> 4/8/16GB memory LPDDR4x >>> Mali G610MC4 GPU >>> MIPI CSI 2 multiple lanes connector >>> eMMC module connector >>> uSD slot (up to 128GB) >>> 2x USB 2.0, 2x USB 3.0 >>> 2x HDMI output, 1x HDMI input >>> Ethernet port >>> 40-pin IO header including UART, SPI, I2C and 5V DC power in >>> USB PD over USB Type-C >>> Size: 85mm x 54mm >>> >>> Signed-off-by: Eugen Hristev >>> --- >>> >>> Hi, >>> >>> This patch is based on top of Jagan's series >>> https://lists.denx.de/pipermail/u-boot/2023-January/506156.html >>> And fixes from Jonas Karlman which I cherrypicked >>> The DT is identical with current linux-next. >>> >>> One thing which is not working as expected is the DRAM size detection, >>> the rock5b has 16 GiB but Uboot only reports 4 GiB. >>> >>> The DRAM driver used is the one from Jagan's series. >>> >>> Jagan, maybe you can tell me how is this driver working on your Edgeble >>> board >>> and how the detection works there for you ? >> >> With the SDRAM series at [1] it should hopefylly detect the correct ram size. >> I will send a v2 rebased on u-boot master later today, a CONFIG_ to CFG_ >> change. >> >> [1] >> https://patchwork.ozlabs.org/project/uboot/cover/20230116161459.1307591-1-jo...@kwiboo.se/>>> >> Regards, >> Jonas >> > > Hi Jonas, Jagan, > > Have you tested the rk3588 with 16 GiB of DRAM ? > If the DRAM bank discovered is [0, 4 ] , U-boot will reserve an > area for trust and for optee, and place two areas in kernel's DTB : > [20 , f000 ] and [1 , 4 ] > > And this cause the kernel to crash very early. > > Downstream U-boot appears to get the banks from ATAGs and has three areas: > > [ 20 , f000 ] (size: 0xefe0) > [1 , 3 fc00 ] (size: 0x2fc00) > [3 fc50 , 3 fff0 ] (size: 0x03a0) > > So maybe you have any idea why the gap at 3 fc00 until 3 fc50 > and the gap at 3 fff0 up to 4 ? I have only tested running u-boot and not linux on my rk3588 8GB board. The TRM does not mention any address mapping within [1 , 9 ]. Also try without TEE, the area reserved by vendor u-boot may be something optee will use. U-Boot mainline does not reserve a memory area when TEE is used. Regards, Jonas > > Thanks, > > Eugen > > > > [snip]
Re: [PATCH v3 01/95] mtd: Drop unused kb9202_nand driver
Hi Simon On Mon, Feb 13, 2023 at 12:17 AM Simon Glass wrote: > > This is not used since time out of mind. > > Drop the driver and Kconfig option. > > Signed-off-by: Simon Glass > --- > > (no changes since v1) > > drivers/mtd/nand/raw/Makefile | 1 - > drivers/mtd/nand/raw/kb9202_nand.c | 134 - > 2 files changed, 135 deletions(-) > delete mode 100644 drivers/mtd/nand/raw/kb9202_nand.c > > diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile > index 666323e2219..add2b4cf655 100644 > --- a/drivers/mtd/nand/raw/Makefile > +++ b/drivers/mtd/nand/raw/Makefile > @@ -56,7 +56,6 @@ obj-$(CONFIG_NAND_DENALI) += denali.o > obj-$(CONFIG_NAND_DENALI_DT) += denali_dt.o > obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o > obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o > -obj-$(CONFIG_NAND_KB9202) += kb9202_nand.o > obj-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o > obj-$(CONFIG_NAND_KMETER1) += kmeter1_nand.o > obj-$(CONFIG_NAND_LPC32XX_MLC) += lpc32xx_nand_mlc.o > diff --git a/drivers/mtd/nand/raw/kb9202_nand.c > b/drivers/mtd/nand/raw/kb9202_nand.c > deleted file mode 100644 > index 9d26532c780..000 > --- a/drivers/mtd/nand/raw/kb9202_nand.c > +++ /dev/null > @@ -1,134 +0,0 @@ > -// SPDX-License-Identifier: GPL-2.0+ > -/* > - * (C) Copyright 2006 > - * KwikByte > - * > - * (C) Copyright 2009 > - * Matthias Kaehlcke > - */ > - > -#include > -#include > -#include > -#include > -#include > - > -#include > - > -/* > - * hardware specific access to control-lines > - */ > - > -#define MASK_ALE(1 << 22) /* our ALE is A22 */ > -#define MASK_CLE(1 << 21) /* our CLE is A21 */ > - > -#define KB9202_NAND_NCE (1 << 28) /* EN* on D28 */ > -#define KB9202_NAND_BUSY (1 << 29) /* RB* on D29 */ > - > -#define KB9202_SMC2_NWS (1 << 2) > -#define KB9202_SMC2_TDF (1 << 8) > -#define KB9202_SMC2_RWSETUP (1 << 24) > -#define KB9202_SMC2_RWHOLD (1 << 29) > - > -/* > - * Board-specific function to access device control signals > - */ > -static void kb9202_nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned > int ctrl) > -{ > - struct nand_chip *this = mtd_to_nand(mtd); > - > - if (ctrl & NAND_CTRL_CHANGE) { > - ulong IO_ADDR_W = (ulong) this->IO_ADDR_W; > - > - /* clear ALE and CLE bits */ > - IO_ADDR_W &= ~(MASK_ALE | MASK_CLE); > - > - if (ctrl & NAND_CLE) > - IO_ADDR_W |= MASK_CLE; > - > - if (ctrl & NAND_ALE) > - IO_ADDR_W |= MASK_ALE; > - > - this->IO_ADDR_W = (void *) IO_ADDR_W; > - > - if (ctrl & NAND_NCE) > - writel(KB9202_NAND_NCE, AT91C_PIOC_CODR); > - else > - writel(KB9202_NAND_NCE, AT91C_PIOC_SODR); > - } > - > - if (cmd != NAND_CMD_NONE) > - writeb(cmd, this->IO_ADDR_W); > -} > - > - > -/* > - * Board-specific function to access the device ready signal. > - */ > -static int kb9202_nand_ready(struct mtd_info *mtd) > -{ > - return readl(AT91C_PIOC_PDSR) & KB9202_NAND_BUSY; > -} > - > - > -/* > - * Board-specific NAND init. Copied from include/linux/mtd/nand.h for > reference. > - * > - * struct nand_chip - NAND Private Flash Chip Data > - * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of > the flash device > - * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of > the flash device > - * @hwcontrol: [BOARDSPECIFIC] hardwarespecific function for > accesing control-lines > - * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for > accesing device ready/busy line > - * If set to NULL no access to ready/busy is available > and the ready/busy information > - * is read from the chip status register > - * @enable_hwecc: [BOARDSPECIFIC] function to enable (reset) hardware > ecc generator. Must only > - * be provided if a hardware ECC is available > - * @eccmode: [BOARDSPECIFIC] mode of ecc, see defines > - * @chip_delay:[BOARDSPECIFIC] chip dependent delay for > transfering data from array to read regs (tR) > - * @options: [BOARDSPECIFIC] various chip options. They can partly > be set to inform nand_scan about > - * special functionality. See the defines for further > explanation > -*/ > -/* > - * This routine initializes controller and GPIOs. > - */ > -int board_nand_init(struct nand_chip *nand) > -{ > - unsigned int value; > - > - nand->ecc.mode = NAND_ECC_SOFT; > - nand->cmd_ctrl = kb9202_nand_hwcontrol; > - nand->dev_ready = kb9202_nand_ready; > - > - /* in case running outside of bootloader */ > - writel(1 << AT91C_ID_PIOC, AT91C_PMC_PCER); > - > - /* setup nand flash access (allow ample margin) */ > - /* 4 wait states, 1 setup, 1 hold,
Re: [PATCH] mtd: spinand: Fix display of unknown raw ID
Hi On Tue, Feb 14, 2023 at 9:14 AM Frieder Schrempf wrote: > > On 13.02.23 18:30, Patrice Chotard wrote: > > In case ID is not found in manufacturer table, the raw ID is > > printed using %*phN format which is not supported by lib/vsprintf.c. > > The information displayed doesn't reflect the raw ID return by the > > unknown spi-nand. > > > > Use %02x format instead, as done in spi-nor-core.c. > > > > For example, before this patch: > > ERROR: spi-nand: spi_nand flash@0: unknown raw ID f74ec040 > > after > > ERROR: spi-nand: spi_nand flash@0: unknown raw ID 00 c2 26 03 > > > > Fixes: 0a6d6bae0386 ("mtd: nand: Add core infrastructure to support SPI > > NANDs") > > > > Signed-off-by: Patrice Chotard > > Reviewed-by: Frieder Schrempf Acked-by: Michael Trimarchi -- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 mich...@amarulasolutions.com __ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 i...@amarulasolutions.com www.amarulasolutions.com