Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1556)

Unified Diff: target/stm32f746g-disco/init.c

Issue 1324223002: move stmf7 sdram code to /platform (Closed) Base URL: https://github.com/travisg/lk.git@master
Patch Set: review fixes Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « target/stm32746g-eval2/sdram.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: target/stm32f746g-disco/init.c
diff --git a/target/stm32f746g-disco/init.c b/target/stm32f746g-disco/init.c
index 3d21c7913873a6a6955abf980a3c4ef9e52146bb..99cc66fb2ce678807b78c81db1f4f059c4e1e97c 100644
--- a/target/stm32f746g-disco/init.c
+++ b/target/stm32f746g-disco/init.c
@@ -27,6 +27,7 @@
#include <compiler.h>
#include <dev/gpio.h>
#include <platform/stm32.h>
+#include <platform/sdram.h>
#include <platform/gpio.h>
#include <target/debugconfig.h>
#include <target/gpioconfig.h>
@@ -44,6 +45,15 @@ void target_early_init(void)
/* now that the uart gpios are configured, enable the debug uart */
stm32_debug_early_init();
+
+#if defined(ENABLE_SDRAM)
+ /* initialize sdram */
+ sdram_config_t sdram_config;
+ sdram_config.bus_width = SDRAM_BUS_WIDTH_16;
+ sdram_config.cas_latency = SDRAM_CAS_LATENCY_2;
+ sdram_config.col_bits_num = SDRAM_COLUMN_BITS_8;
+ stm32_sdram_init(&sdram_config);
+#endif
}
void target_init(void)
@@ -51,3 +61,58 @@ void target_init(void)
stm32_debug_init();
}
+
+/**
+ * @brief Initializes SDRAM GPIO.
+ * @retval None
+ */
+/* called back from stm32_sdram_init */
+void stm_sdram_GPIO_init(void)
+{
+ GPIO_InitTypeDef gpio_init_structure;
+
+ /* Enable GPIOs clock */
+ __HAL_RCC_GPIOC_CLK_ENABLE();
+ __HAL_RCC_GPIOD_CLK_ENABLE();
+ __HAL_RCC_GPIOE_CLK_ENABLE();
+ __HAL_RCC_GPIOF_CLK_ENABLE();
+ __HAL_RCC_GPIOG_CLK_ENABLE();
+ __HAL_RCC_GPIOH_CLK_ENABLE();
+
+ /* Common GPIO configuration */
+ gpio_init_structure.Mode = GPIO_MODE_AF_PP;
+ gpio_init_structure.Pull = GPIO_PULLUP;
+ gpio_init_structure.Speed = GPIO_SPEED_FAST;
+ gpio_init_structure.Alternate = GPIO_AF12_FMC;
+
+ /* GPIOC configuration */
+ gpio_init_structure.Pin = GPIO_PIN_3;
+ HAL_GPIO_Init(GPIOC, &gpio_init_structure);
+
+ /* GPIOD configuration */
+ gpio_init_structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_3 | GPIO_PIN_8| GPIO_PIN_9 | GPIO_PIN_10 |\
+ GPIO_PIN_14 | GPIO_PIN_15;
+ HAL_GPIO_Init(GPIOD, &gpio_init_structure);
+
+ /* GPIOE configuration */
+ gpio_init_structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_7| GPIO_PIN_8 | GPIO_PIN_9 |\
+ GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 |\
+ GPIO_PIN_15;
+ HAL_GPIO_Init(GPIOE, &gpio_init_structure);
+
+ /* GPIOF configuration */
+ gpio_init_structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2| GPIO_PIN_3 | GPIO_PIN_4 |\
+ GPIO_PIN_5 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 |\
+ GPIO_PIN_15;
+ HAL_GPIO_Init(GPIOF, &gpio_init_structure);
+
+ /* GPIOG configuration */
+ gpio_init_structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4| GPIO_PIN_5 | GPIO_PIN_8 |\
+ GPIO_PIN_15;
+ HAL_GPIO_Init(GPIOG, &gpio_init_structure);
+
+ /* GPIOH configuration */
+ gpio_init_structure.Pin = GPIO_PIN_3 | GPIO_PIN_5;
+ HAL_GPIO_Init(GPIOH, &gpio_init_structure);
+}
+
« no previous file with comments | « target/stm32746g-eval2/sdram.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698