Skip to content

Extending SPIF BD SFDP support #20

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

Merged
merged 9 commits into from
Aug 21, 2018
Merged

Extending SPIF BD SFDP support #20

merged 9 commits into from
Aug 21, 2018

Conversation

offirko
Copy link
Contributor

@offirko offirko commented Aug 16, 2018

No description provided.

@offirko
Copy link
Contributor Author

offirko commented Aug 16, 2018

Hello: @geky, @bulislaw , @donatieng , @ARMmbed/mbed-os-maintainers , @dannybenor , @davidsaada - I'd appreciate your review of SPIF Block Device extended SFDP support

@geky
Copy link
Contributor

geky commented Aug 16, 2018

Hey @offirko, quick question. How does this relate to qspif-blockdevice and ARMmbed/mbed-os#7774?

@offirko
Copy link
Contributor Author

offirko commented Aug 16, 2018

@geky, AFAIU the planned steps by order are:

  1. Merge SPIF changes into external Repo - (Extending SPIF BD SFDP support Extending SPIF BD SFDP support  #20)
  2. Moving SD, SPIF and FLASHIAP moved into Mbed OS (Add default block device support (SD, SPIF and FLASHIAP) mbed-os#7774)
  3. Merge qspif-blockdevice into master

@dannybenor - please correct me if I'm wrong

Copy link
Contributor

@geky geky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍 (I was only able to do a rough review)

Will need to see the outcome for dual mode support.

bd_size_t SPIFBlockDevice::get_erase_size() const
{
// return minimal erase size supported by all regions (0 if none exists)
return _min_common_erase_size;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should assert if there's no common erase size? Most of the existing code doesn't expect errors from this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SFDP's JEDEC Standard specifies several examples where memory is divided into several sector regions - some of them support only 4KB erase, and some only 64KB erase - I think we shouldn't assert at such case:
image

Copy link
Contributor

@davidsaada davidsaada Aug 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@geky Maybe this seems harsh, but shouldn't we deprecate this function (the one that doesn't accept the address as parameter)? We have this problem in other cases as well (FlashIAP for instance).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does LittleFS call then? LittleFS only support fixed-size blocks, but that's the majority of the storage devices (especially larger ones).

My thought was if the blockdevice-level get_erase_size gets called on a device without a common block size then it's an error (shouldn't use a block-based filesystem on a block device without a common block size).

I double checked with LittleFS and FAT and it looks like both will error if get_erase_size returns 0, so maybe returning zero is a good idea.

/*********************************************/
/************** Local Functions **************/
/*********************************************/
static unsigned int local_math_power(int base, int exp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use std::pow? Then we could potentially share code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think std::pow operates on float/double and would have required casting (not too critical)..
Also, using this small local function made it possible for me to avoid including <math.h> or "mbed.h"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you're right, I missed that there is no int overload... It was a small thought anyways

@offirko offirko merged commit a821b69 into master Aug 21, 2018
@geky
Copy link
Contributor

geky commented Aug 21, 2018

Sorry, had to revert the namespace mbed. It broke compatibility, which was being relied on by CI: 662c4a6

Was this the only blockdevice being moved into the mbed namespace?

@deepikabhavnani has some plans to move to correct namespacing, but this will probably need to be a separate set of work:
ARMmbed/mbed-os#7760

@offirko
Copy link
Contributor Author

offirko commented Aug 22, 2018

@geky - thanks for reverting namespace ... missed that with all the namespace recent flipflops
I'll make sure to remove it from QSPIFBlockDEvice as well. This is the only additional BD I know of that was placed in mbed namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants