mbed-ce / mbed-os

Arm Mbed OS is a platform operating system designed for the internet of things
https://mbed.com
Other
37 stars 12 forks source link

Add power management block device driver for changing the power mode of Flash #284

Closed daniel-0723 closed 5 days ago

daniel-0723 commented 3 weeks ago

Summary of changes

Usually, Nor Flash has more than one power mode, such as high performance mode, low power mode and deep down mode. But in QSPIF block device driver, it is not very easy to change Flash power mode. The PowerManagementBlockDevice class provides an API to change the Flash power mode if the underlying block device doesn’t support such a behavior, which is only support the MX25R6435F of QSPIF block device temporarily. But users can add codes for other power modes of other types of Flash. powermanagement

Impact of changes

Migration actions required

Documentation


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[x] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[x] Tests / results supplied as part of this PR

mbedgt: test suite report:



Reviewers


multiplemonomials commented 2 weeks ago

So I've been thinking. I really appreciate the work that you guys at Macronix are doing to add support for your stuff into Mbed. However... I am not convinced this change belongs inside the Mbed OS main repository. It only supports specific models of flash, and these features aren't really usable on the vast majority of boards sold with Mbed.

What if, instead, we made an official Macronix flash library in the mbed-ce-libraries organization? We could put this code there and you guys could work on it freely, and it wouldn't require making PRs into Mbed itself? But, users who want those features could easily import the library. Does that sound OK?

multiplemonomials commented 5 days ago

Hi @daniel-0723 , after consideration I decided to add this code to a new repo outside of the Mbed source tree: https://github.com/mbed-ce-libraries-examples/MacronixFlash

I have given you access so that you can update this code as needed. Also, I refactored the code so that it extends QSPIFBlockDevice. I think it's a lot simpler now as it only contains three functions. But feel free to add any other changes that you wish to!

targetplatform_nametest suiteresultelapsed_time (sec)copy_method
DISCO_L475VG_IOT01A-GCC_ARMDISCO_L475VG_IOT01Astorage-blockdevice-tests-tests-blockdevice-power_management_block_deviceOK9.71default
mbedgt: test suite results: 1 OK