-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for NXP P1021 eSPI and TPM (and fixes for eLBC NAND) #302
Conversation
f7df3b6
to
48b7e17
Compare
…he boot partition from external flash.
…override of the `WOLFBOOT_SHA_BLOCK_SIZE`. ``` wolfBoot HAL Init Flash Init: Ret 0, ID 0x76207620 Part: Active 0, Address 0 Boot partition: 200000 Image size 3964 Firmware Valid Loading 3964 bytes to RAM at 1E000000 Booting at 1E000000 ```
while (blks--) { | ||
/* wait till TX fifo has room */ | ||
while ((get32(ESPI_SPIE) & ESPI_SPIE_TNF) == 0); | ||
reg = *((uint32_t*)tx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you can ensure all transactions are going to be multiples of 4, especially with the TPM's with unknown wait states. This logic will over-read tx* and over-write rx* when sz is not a multiple of 4. Recommend to add logic to handle the last transaction into a stack uint32_t variable and simply memcpy the data back into rx. Make sure the extra tx data are known values (like 0's).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, this needs fixed up, since I WILL add wait state support, since customer is using a Microchip ATTPM20.
tx += 4; | ||
set32(ESPI_SPIE, ESPI_SPIE_TNF); /* clear event */ | ||
|
||
udelay(5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try busy checking the DON bit (17) in the event register? This should be set when the last bit is transmitted, which means the RNE should be set soon after.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I tried using DON also. No luck
include/spi_drv.h
Outdated
#endif | ||
|
||
#ifdef WOLFBOOT_TPM | ||
int spi_xfer(int cs, const uint8_t* tx, uint8_t* rx, uint32_t sz); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrmmm. I think we may need an interface that allows continued transactions where the CS does not get deserted, specifically when the total size of the transaction is unknown at the beginning, like with wait states.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree and the eSPI has the ability to assert / dessert the CS separately.
…l TLB's). Improve udelay to use timebase. Fix L1 cache line sizes. Fix L2ADDR to enable all 256KB. Use `do_boot` not the jump to function pointer. Switch PPC test app linker script to use `WOLFBOOT_LOAD_ADDRESS`.
…Remove execute bits on files. Make stage1 PIC. Disable L1/L2 for first stage. Add PLT/GOT to .data region.
…ng the CS asserted.
@@ -123,12 +123,10 @@ Also see MPC8544ERM | |||
|
|||
_reset: | |||
|
|||
#ifdef DEBUG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jpbland1 for spotting this. It was on purpose for release testing. I will investigate impact of this.
PART_BOOT_EXT
to correctly load the boot partition from external flash.WOLFBOOT_SHA_BLOCK_SIZE
.spi_xfer
to include a "continue" flag to allow leaving the CS asserted.do_boot
not the jump to function pointer.WOLFBOOT_LOAD_ADDRESS
.0xFFFFF000
) in stage1 linker script.