-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fby35: ji: Dynamic set spi frequency (#2040)
Summary: - Support dynamic set spi frequency function in driver. Note that re-init(**spi_nor_re_init**) action is needed after frequency-set(**spi_nor_set_freq**). - Set spi1-cs0 default frequency from 50M to 5M. - Modify spi1-cs0 from 5M to 50M in runtime only if using PVT2 system. TestPlan: - BuildCode: PASS - Measure PVT1 and PVT2 BIOS update frequency: PASS Pull Request resolved: #2040 Reviewed By: jagpalgill Differential Revision: D64942542 fbshipit-source-id: f19931ef50ca7f71784bed53083491042702e9c7
- Loading branch information
1 parent
58c436e
commit dda7c9e
Showing
6 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
...731033db477f806f5bff2e1ca5d4b2ba7/0083-spi-aspeed-Support-dynamic-set-spi-frequency.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
From 4187e66745fd164a85a9b5b1f2a64a639f5ae2ef Mon Sep 17 00:00:00 2001 | ||
From: MouchenHung <[email protected]> | ||
Date: Fri, 25 Oct 2024 10:36:47 +0800 | ||
Subject: [PATCH] spi: Support dynamic set spi frequency | ||
|
||
--- | ||
drivers/flash/spi_nor_multi_dev.c | 8 ++++++++ | ||
include/drivers/spi_nor.h | 1 + | ||
2 files changed, 9 insertions(+) | ||
|
||
diff --git a/drivers/flash/spi_nor_multi_dev.c b/drivers/flash/spi_nor_multi_dev.c | ||
index 6595161c07..5dae866362 100644 | ||
--- a/drivers/flash/spi_nor_multi_dev.c | ||
+++ b/drivers/flash/spi_nor_multi_dev.c | ||
@@ -1713,6 +1713,14 @@ int spi_nor_re_init(const struct device *dev) | ||
return spi_nor_configure(dev); | ||
} | ||
|
||
+int spi_nor_set_freq(const struct device *dev, uint32_t freq) | ||
+{ | ||
+ struct spi_nor_data *data = dev->data; | ||
+ data->spi_cfg.frequency = freq; | ||
+ | ||
+ return 0; | ||
+} | ||
+ | ||
/** | ||
* @brief Initialize and configure the flash | ||
* | ||
diff --git a/include/drivers/spi_nor.h b/include/drivers/spi_nor.h | ||
index 42e13a9cff..aea16b6f96 100644 | ||
--- a/include/drivers/spi_nor.h | ||
+++ b/include/drivers/spi_nor.h | ||
@@ -141,6 +141,7 @@ struct spi_nor_op_info { | ||
|
||
int spi_nor_config_4byte_mode(const struct device *dev, bool en4b); | ||
int spi_nor_re_init(const struct device *dev); | ||
+int spi_nor_set_freq(const struct device *dev, uint32_t freq); | ||
int spi_nor_erase_by_cmd(const struct device *dev, off_t addr, | ||
size_t size, uint8_t cmd); | ||
int spi_nor_get_erase_sz(const struct device *dev, uint8_t cmd); | ||
-- | ||
2.17.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef PLAT_SPI_H | ||
#define PLAT_SPI_H | ||
|
||
void switch_spi_freq(); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters