From 8762c4d1dfa4f53c9598014da11fbbddae7884e3 Mon Sep 17 00:00:00 2001 From: wanlei Date: Thu, 7 Mar 2024 12:18:22 +0800 Subject: [PATCH] fix(spi_flash): replace gpio_hal_iomux_func_sel --- components/hal/esp32/include/hal/gpio_ll.h | 18 ++++++++++++------ components/hal/esp32c2/include/hal/gpio_ll.h | 18 ++++++++++++------ components/hal/esp32c3/include/hal/gpio_ll.h | 16 +++++++++++----- components/hal/esp32c5/include/hal/gpio_ll.h | 4 +++- components/hal/esp32c6/include/hal/gpio_ll.h | 4 +++- components/hal/esp32c61/include/hal/gpio_ll.h | 4 +++- components/hal/esp32h2/include/hal/gpio_ll.h | 6 ++++-- components/hal/esp32p4/include/hal/gpio_ll.h | 1 + components/hal/esp32s2/include/hal/gpio_ll.h | 18 ++++++++++++------ components/hal/esp32s3/include/hal/gpio_ll.h | 16 +++++++++++----- components/spi_flash/esp_flash_spi_init.c | 13 ++++++------- 11 files changed, 78 insertions(+), 40 deletions(-) diff --git a/components/hal/esp32/include/hal/gpio_ll.h b/components/hal/esp32/include/hal/gpio_ll.h index 3839e39360..6ab6dfd4da 100644 --- a/components/hal/esp32/include/hal/gpio_ll.h +++ b/components/hal/esp32/include/hal/gpio_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -353,6 +353,7 @@ static inline void gpio_ll_input_disable(gpio_dev_t *hw, uint32_t gpio_num) * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ +__attribute__((always_inline)) static inline void gpio_ll_input_enable(gpio_dev_t *hw, uint32_t gpio_num) { PIN_INPUT_ENABLE(DR_REG_IO_MUX_BASE + GPIO_PIN_MUX_REG_OFFSET[gpio_num]); @@ -384,7 +385,8 @@ static inline void gpio_ll_output_disable(gpio_dev_t *hw, uint32_t gpio_num) * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ -static inline __attribute__((always_inline)) void gpio_ll_output_enable(gpio_dev_t *hw, uint32_t gpio_num) +__attribute__((always_inline)) +static inline void gpio_ll_output_enable(gpio_dev_t *hw, uint32_t gpio_num) { if (gpio_num < 32) { hw->enable_w1ts = (0x1 << gpio_num); @@ -443,7 +445,8 @@ static inline void gpio_ll_sleep_output_enable(gpio_dev_t *hw, uint32_t gpio_num * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ -static inline __attribute__((always_inline)) void gpio_ll_od_disable(gpio_dev_t *hw, uint32_t gpio_num) +__attribute__((always_inline)) +static inline void gpio_ll_od_disable(gpio_dev_t *hw, uint32_t gpio_num) { hw->pin[gpio_num].pad_driver = 0; } @@ -466,7 +469,8 @@ static inline void gpio_ll_od_enable(gpio_dev_t *hw, uint32_t gpio_num) * @param gpio_num GPIO number * @param func Function to assign to the pin */ -static inline __attribute__((always_inline)) void gpio_ll_func_sel(gpio_dev_t *hw, uint8_t gpio_num, uint32_t func) +__attribute__((always_inline)) +static inline void gpio_ll_func_sel(gpio_dev_t *hw, uint8_t gpio_num, uint32_t func) { PIN_FUNC_SELECT(DR_REG_IO_MUX_BASE + GPIO_PIN_MUX_REG_OFFSET[gpio_num], func); } @@ -672,7 +676,8 @@ static inline void gpio_ll_iomux_in(gpio_dev_t *hw, uint32_t gpio, uint32_t sign * @param pin_name Pin name to configure * @param func Function to assign to the pin */ -static inline __attribute__((always_inline)) void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func) +__attribute__((always_inline)) +static inline void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func) { PIN_FUNC_SELECT(pin_name, func); } @@ -684,7 +689,8 @@ static inline __attribute__((always_inline)) void gpio_ll_iomux_func_sel(uint32_ * @param val Control value * @param shift write mask shift of control value */ -static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) +__attribute__((always_inline)) +static inline void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) { SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift); } diff --git a/components/hal/esp32c2/include/hal/gpio_ll.h b/components/hal/esp32c2/include/hal/gpio_ll.h index 6728126155..124e789bb3 100644 --- a/components/hal/esp32c2/include/hal/gpio_ll.h +++ b/components/hal/esp32c2/include/hal/gpio_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -216,6 +216,7 @@ static inline void gpio_ll_input_disable(gpio_dev_t *hw, uint32_t gpio_num) * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ +__attribute__((always_inline)) static inline void gpio_ll_input_enable(gpio_dev_t *hw, uint32_t gpio_num) { PIN_INPUT_ENABLE(IO_MUX_GPIO0_REG + (gpio_num * 4)); @@ -264,7 +265,8 @@ static inline void gpio_ll_output_disable(gpio_dev_t *hw, uint32_t gpio_num) * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ -static inline __attribute__((always_inline)) void gpio_ll_output_enable(gpio_dev_t *hw, uint32_t gpio_num) +__attribute__((always_inline)) +static inline void gpio_ll_output_enable(gpio_dev_t *hw, uint32_t gpio_num) { hw->enable_w1ts.enable_w1ts = (0x1 << gpio_num); } @@ -275,7 +277,8 @@ static inline __attribute__((always_inline)) void gpio_ll_output_enable(gpio_dev * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ -static inline __attribute__((always_inline)) void gpio_ll_od_disable(gpio_dev_t *hw, uint32_t gpio_num) +__attribute__((always_inline)) +static inline void gpio_ll_od_disable(gpio_dev_t *hw, uint32_t gpio_num) { hw->pin[gpio_num].pad_driver = 0; } @@ -298,7 +301,8 @@ static inline void gpio_ll_od_enable(gpio_dev_t *hw, uint32_t gpio_num) * @param gpio_num GPIO number * @param func Function to assign to the pin */ -static inline __attribute__((always_inline)) void gpio_ll_func_sel(gpio_dev_t *hw, uint8_t gpio_num, uint32_t func) +__attribute__((always_inline)) +static inline void gpio_ll_func_sel(gpio_dev_t *hw, uint8_t gpio_num, uint32_t func) { PIN_FUNC_SELECT(IO_MUX_GPIO0_REG + (gpio_num * 4), func); } @@ -488,7 +492,8 @@ static inline void gpio_ll_iomux_in(gpio_dev_t *hw, uint32_t gpio, uint32_t sign * @param pin_name Pin name to configure * @param func Function to assign to the pin */ -static inline __attribute__((always_inline)) void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func) +__attribute__((always_inline)) +static inline void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func) { PIN_FUNC_SELECT(pin_name, func); } @@ -500,7 +505,8 @@ static inline __attribute__((always_inline)) void gpio_ll_iomux_func_sel(uint32_ * @param val Control value * @param shift write mask shift of control value */ -static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) +__attribute__((always_inline)) +static inline void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) { SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift); } diff --git a/components/hal/esp32c3/include/hal/gpio_ll.h b/components/hal/esp32c3/include/hal/gpio_ll.h index e698799f69..3708bcc6d6 100644 --- a/components/hal/esp32c3/include/hal/gpio_ll.h +++ b/components/hal/esp32c3/include/hal/gpio_ll.h @@ -224,6 +224,7 @@ static inline void gpio_ll_input_disable(gpio_dev_t *hw, uint32_t gpio_num) * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ +__attribute__((always_inline)) static inline void gpio_ll_input_enable(gpio_dev_t *hw, uint32_t gpio_num) { PIN_INPUT_ENABLE(IO_MUX_GPIO0_REG + (gpio_num * 4)); @@ -272,7 +273,8 @@ static inline void gpio_ll_output_disable(gpio_dev_t *hw, uint32_t gpio_num) * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ -static inline __attribute__((always_inline)) void gpio_ll_output_enable(gpio_dev_t *hw, uint32_t gpio_num) +__attribute__((always_inline)) +static inline void gpio_ll_output_enable(gpio_dev_t *hw, uint32_t gpio_num) { hw->enable_w1ts.enable_w1ts = (0x1 << gpio_num); } @@ -283,7 +285,8 @@ static inline __attribute__((always_inline)) void gpio_ll_output_enable(gpio_dev * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ -static inline __attribute__((always_inline)) void gpio_ll_od_disable(gpio_dev_t *hw, uint32_t gpio_num) +__attribute__((always_inline)) +static inline void gpio_ll_od_disable(gpio_dev_t *hw, uint32_t gpio_num) { hw->pin[gpio_num].pad_driver = 0; } @@ -306,7 +309,8 @@ static inline void gpio_ll_od_enable(gpio_dev_t *hw, uint32_t gpio_num) * @param gpio_num GPIO number * @param func Function to assign to the pin */ -static inline __attribute__((always_inline)) void gpio_ll_func_sel(gpio_dev_t *hw, uint8_t gpio_num, uint32_t func) +__attribute__((always_inline)) +static inline void gpio_ll_func_sel(gpio_dev_t *hw, uint8_t gpio_num, uint32_t func) { // Disable USB Serial JTAG if pins 18 or pins 19 needs to select an IOMUX function if (gpio_num == USB_INT_PHY0_DM_GPIO_NUM || gpio_num == USB_INT_PHY0_DP_GPIO_NUM) { @@ -510,7 +514,8 @@ static inline void gpio_ll_iomux_in(gpio_dev_t *hw, uint32_t gpio, uint32_t sign * @param pin_name Pin name to configure * @param func Function to assign to the pin */ -static inline __attribute__((always_inline)) void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func) +__attribute__((always_inline)) +static inline void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func) { // Disable USB Serial JTAG if pins 18 or pins 19 needs to select an IOMUX function if (pin_name == IO_MUX_GPIO18_REG || pin_name == IO_MUX_GPIO19_REG) { @@ -526,7 +531,8 @@ static inline __attribute__((always_inline)) void gpio_ll_iomux_func_sel(uint32_ * @param val Control value * @param shift write mask shift of control value */ -static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) +__attribute__((always_inline)) +static inline void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) { SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift); } diff --git a/components/hal/esp32c5/include/hal/gpio_ll.h b/components/hal/esp32c5/include/hal/gpio_ll.h index 75d809bc73..dc2268eb95 100644 --- a/components/hal/esp32c5/include/hal/gpio_ll.h +++ b/components/hal/esp32c5/include/hal/gpio_ll.h @@ -236,6 +236,7 @@ static inline void gpio_ll_input_disable(gpio_dev_t *hw, uint32_t gpio_num) * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ +__attribute__((always_inline)) static inline void gpio_ll_input_enable(gpio_dev_t *hw, uint32_t gpio_num) { IO_MUX.gpio[gpio_num].fun_ie = 1; @@ -503,7 +504,8 @@ static inline void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func) * @param val Control value * @param shift write mask shift of control value */ -static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) +__attribute__((always_inline)) +static inline void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) { SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift); } diff --git a/components/hal/esp32c6/include/hal/gpio_ll.h b/components/hal/esp32c6/include/hal/gpio_ll.h index 0b701fde43..c9310380c4 100644 --- a/components/hal/esp32c6/include/hal/gpio_ll.h +++ b/components/hal/esp32c6/include/hal/gpio_ll.h @@ -232,6 +232,7 @@ static inline void gpio_ll_input_disable(gpio_dev_t *hw, uint32_t gpio_num) * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ +__attribute__((always_inline)) static inline void gpio_ll_input_enable(gpio_dev_t *hw, uint32_t gpio_num) { PIN_INPUT_ENABLE(IO_MUX_GPIO0_REG + (gpio_num * 4)); @@ -465,7 +466,8 @@ static inline void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func) * @param val Control value * @param shift write mask shift of control value */ -static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) +__attribute__((always_inline)) +static inline void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) { SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift); } diff --git a/components/hal/esp32c61/include/hal/gpio_ll.h b/components/hal/esp32c61/include/hal/gpio_ll.h index f722b13909..f872f3648f 100644 --- a/components/hal/esp32c61/include/hal/gpio_ll.h +++ b/components/hal/esp32c61/include/hal/gpio_ll.h @@ -230,6 +230,7 @@ static inline void gpio_ll_input_disable(gpio_dev_t *hw, uint32_t gpio_num) * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ +__attribute__((always_inline)) static inline void gpio_ll_input_enable(gpio_dev_t *hw, uint32_t gpio_num) { IO_MUX.gpion[gpio_num].gpion_fun_ie = 1; @@ -464,7 +465,8 @@ static inline void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func) * @param val Control value * @param shift write mask shift of control value */ -static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) +__attribute__((always_inline)) +static inline void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) { SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift); } diff --git a/components/hal/esp32h2/include/hal/gpio_ll.h b/components/hal/esp32h2/include/hal/gpio_ll.h index 96da5be885..945ec27d2e 100644 --- a/components/hal/esp32h2/include/hal/gpio_ll.h +++ b/components/hal/esp32h2/include/hal/gpio_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -232,6 +232,7 @@ static inline void gpio_ll_input_disable(gpio_dev_t *hw, gpio_num_t gpio_num) * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ +__attribute__((always_inline)) static inline void gpio_ll_input_enable(gpio_dev_t *hw, gpio_num_t gpio_num) { PIN_INPUT_ENABLE(IO_MUX_GPIO0_REG + (gpio_num * 4)); @@ -542,7 +543,8 @@ static inline void gpio_ll_iomux_out(gpio_dev_t *hw, uint8_t gpio_num, int func, * @param val Control value * @param shift write mask shift of control value */ -static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) +__attribute__((always_inline)) +static inline void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) { SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift); } diff --git a/components/hal/esp32p4/include/hal/gpio_ll.h b/components/hal/esp32p4/include/hal/gpio_ll.h index ff3e0ea90e..7eea6c7369 100644 --- a/components/hal/esp32p4/include/hal/gpio_ll.h +++ b/components/hal/esp32p4/include/hal/gpio_ll.h @@ -244,6 +244,7 @@ static inline void gpio_ll_input_disable(gpio_dev_t *hw, uint32_t gpio_num) * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ +__attribute__((always_inline)) static inline void gpio_ll_input_enable(gpio_dev_t *hw, uint32_t gpio_num) { IO_MUX.gpio[gpio_num].fun_ie = 1; diff --git a/components/hal/esp32s2/include/hal/gpio_ll.h b/components/hal/esp32s2/include/hal/gpio_ll.h index 5c7e68c487..6bd0d72f1b 100644 --- a/components/hal/esp32s2/include/hal/gpio_ll.h +++ b/components/hal/esp32s2/include/hal/gpio_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -218,6 +218,7 @@ static inline void gpio_ll_input_disable(gpio_dev_t *hw, uint32_t gpio_num) * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ +__attribute__((always_inline)) static inline void gpio_ll_input_enable(gpio_dev_t *hw, uint32_t gpio_num) { PIN_INPUT_ENABLE(IO_MUX_GPIO0_REG + (gpio_num * 4)); @@ -271,7 +272,8 @@ static inline void gpio_ll_output_disable(gpio_dev_t *hw, uint32_t gpio_num) * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ -static inline __attribute__((always_inline)) void gpio_ll_output_enable(gpio_dev_t *hw, uint32_t gpio_num) +__attribute__((always_inline)) +static inline void gpio_ll_output_enable(gpio_dev_t *hw, uint32_t gpio_num) { if (gpio_num < 32) { hw->enable_w1ts = (0x1 << gpio_num); @@ -286,7 +288,8 @@ static inline __attribute__((always_inline)) void gpio_ll_output_enable(gpio_dev * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ -static inline __attribute__((always_inline)) void gpio_ll_od_disable(gpio_dev_t *hw, uint32_t gpio_num) +__attribute__((always_inline)) +static inline void gpio_ll_od_disable(gpio_dev_t *hw, uint32_t gpio_num) { hw->pin[gpio_num].pad_driver = 0; } @@ -309,7 +312,8 @@ static inline void gpio_ll_od_enable(gpio_dev_t *hw, uint32_t gpio_num) * @param gpio_num GPIO number * @param func Function to assign to the pin */ -static inline __attribute__((always_inline)) void gpio_ll_func_sel(gpio_dev_t *hw, uint8_t gpio_num, uint32_t func) +__attribute__((always_inline)) +static inline void gpio_ll_func_sel(gpio_dev_t *hw, uint8_t gpio_num, uint32_t func) { PIN_FUNC_SELECT(IO_MUX_GPIO0_REG + (gpio_num * 4), func); } @@ -503,7 +507,8 @@ static inline void gpio_ll_iomux_in(gpio_dev_t *hw, uint32_t gpio, uint32_t sign * @param pin_name Pin name to configure * @param func Function to assign to the pin */ -static inline __attribute__((always_inline)) void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func) +__attribute__((always_inline)) +static inline void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func) { PIN_FUNC_SELECT(pin_name, func); } @@ -515,7 +520,8 @@ static inline __attribute__((always_inline)) void gpio_ll_iomux_func_sel(uint32_ * @param val Control value * @param shift write mask shift of control value */ -static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) +__attribute__((always_inline)) +static inline void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) { SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift); } diff --git a/components/hal/esp32s3/include/hal/gpio_ll.h b/components/hal/esp32s3/include/hal/gpio_ll.h index d555f78c67..d306dac319 100644 --- a/components/hal/esp32s3/include/hal/gpio_ll.h +++ b/components/hal/esp32s3/include/hal/gpio_ll.h @@ -231,6 +231,7 @@ static inline void gpio_ll_input_disable(gpio_dev_t *hw, uint32_t gpio_num) * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ +__attribute__((always_inline)) static inline void gpio_ll_input_enable(gpio_dev_t *hw, uint32_t gpio_num) { PIN_INPUT_ENABLE(IO_MUX_GPIO0_REG + (gpio_num * 4)); @@ -284,7 +285,8 @@ static inline void gpio_ll_output_disable(gpio_dev_t *hw, uint32_t gpio_num) * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ -static inline __attribute__((always_inline)) void gpio_ll_output_enable(gpio_dev_t *hw, uint32_t gpio_num) +__attribute__((always_inline)) +static inline void gpio_ll_output_enable(gpio_dev_t *hw, uint32_t gpio_num) { if (gpio_num < 32) { hw->enable_w1ts = (0x1 << gpio_num); @@ -299,7 +301,8 @@ static inline __attribute__((always_inline)) void gpio_ll_output_enable(gpio_dev * @param hw Peripheral GPIO hardware instance address. * @param gpio_num GPIO number */ -static inline __attribute__((always_inline)) void gpio_ll_od_disable(gpio_dev_t *hw, uint32_t gpio_num) +__attribute__((always_inline)) +static inline void gpio_ll_od_disable(gpio_dev_t *hw, uint32_t gpio_num) { hw->pin[gpio_num].pad_driver = 0; } @@ -322,7 +325,8 @@ static inline void gpio_ll_od_enable(gpio_dev_t *hw, uint32_t gpio_num) * @param gpio_num GPIO number * @param func Function to assign to the pin */ -static inline __attribute__((always_inline)) void gpio_ll_func_sel(gpio_dev_t *hw, uint8_t gpio_num, uint32_t func) +__attribute__((always_inline)) +static inline void gpio_ll_func_sel(gpio_dev_t *hw, uint8_t gpio_num, uint32_t func) { if (gpio_num == USB_INT_PHY0_DM_GPIO_NUM || gpio_num == USB_INT_PHY0_DP_GPIO_NUM) { CLEAR_PERI_REG_MASK(USB_SERIAL_JTAG_CONF0_REG, USB_SERIAL_JTAG_USB_PAD_ENABLE); @@ -529,7 +533,8 @@ static inline void gpio_ll_iomux_in(gpio_dev_t *hw, uint32_t gpio, uint32_t sign * @param pin_name Pin name to configure * @param func Function to assign to the pin */ -static inline __attribute__((always_inline)) void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func) +__attribute__((always_inline)) +static inline void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func) { if (pin_name == IO_MUX_GPIO19_REG || pin_name == IO_MUX_GPIO20_REG) { CLEAR_PERI_REG_MASK(USB_SERIAL_JTAG_CONF0_REG, USB_SERIAL_JTAG_USB_PAD_ENABLE); @@ -544,7 +549,8 @@ static inline __attribute__((always_inline)) void gpio_ll_iomux_func_sel(uint32_ * @param val Control value * @param shift write mask shift of control value */ -static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) +__attribute__((always_inline)) +static inline void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) { SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift); } diff --git a/components/spi_flash/esp_flash_spi_init.c b/components/spi_flash/esp_flash_spi_init.c index 8ba9a8d9f1..46f43874b8 100644 --- a/components/spi_flash/esp_flash_spi_init.c +++ b/components/spi_flash/esp_flash_spi_init.c @@ -131,7 +131,6 @@ static IRAM_ATTR NOINLINE_ATTR void cs_initialize(esp_flash_t *chip, const esp_f int spics_in = spi_periph_signal[config->host_id].spics_in; int spics_out = spi_periph_signal[config->host_id].spics_out[cs_id]; int spics_func = spi_periph_signal[config->host_id].func; - uint32_t iomux_reg = GPIO_PIN_MUX_REG[cs_io_num]; gpio_hal_context_t gpio_hal = { .dev = GPIO_HAL_GET_HW(GPIO_PORT_0) }; @@ -139,9 +138,9 @@ static IRAM_ATTR NOINLINE_ATTR void cs_initialize(esp_flash_t *chip, const esp_f //To avoid the panic caused by flash data line conflicts during cs line //initialization, disable the cache temporarily chip->os_func->start(chip->os_func_data); - PIN_INPUT_ENABLE(iomux_reg); + gpio_hal_input_enable(&gpio_hal, cs_io_num); if (use_iomux) { - gpio_hal_iomux_func_sel(iomux_reg, spics_func); + gpio_hal_func_sel(&gpio_hal, cs_io_num, spics_func); } else { gpio_hal_output_enable(&gpio_hal, cs_io_num); gpio_hal_od_disable(&gpio_hal, cs_io_num); @@ -149,7 +148,7 @@ static IRAM_ATTR NOINLINE_ATTR void cs_initialize(esp_flash_t *chip, const esp_f if (cs_id == 0) { esp_rom_gpio_connect_in_signal(cs_io_num, spics_in, false); } - gpio_hal_iomux_func_sel(iomux_reg, PIN_FUNC_GPIO); + gpio_hal_func_sel(&gpio_hal, cs_io_num, PIN_FUNC_GPIO); } chip->os_func->end(chip->os_func_data); } @@ -317,14 +316,14 @@ static void s_esp_flash_choose_correct_mode(memspi_host_config_t *cfg) static const char *mode = FLASH_MODE_STRING; if (bootloader_flash_is_octal_mode_enabled()) { #if !CONFIG_ESPTOOLPY_FLASHMODE_OPI - ESP_EARLY_LOGW(TAG, "Octal flash chip is using but %s mode is selected, will automatically swich to Octal mode", mode); + ESP_EARLY_LOGW(TAG, "Octal flash chip is using but %s mode is selected, will automatically switch to Octal mode", mode); cfg->octal_mode_en = 1; cfg->default_io_mode = SPI_FLASH_OPI_STR; default_chip.read_mode = SPI_FLASH_OPI_STR; #endif } else { #if CONFIG_ESPTOOLPY_FLASHMODE_OPI - ESP_EARLY_LOGW(TAG, "Quad flash chip is using but %s flash mode is selected, will automatically swich to DIO mode", mode); + ESP_EARLY_LOGW(TAG, "Quad flash chip is using but %s flash mode is selected, will automatically switch to DIO mode", mode); cfg->octal_mode_en = 0; cfg->default_io_mode = SPI_FLASH_DIO; default_chip.read_mode = SPI_FLASH_DIO; @@ -357,7 +356,7 @@ esp_err_t esp_flash_init_default_chip(void) #endif - // For chips need time tuning, get value directely from system here. + // For chips need time tuning, get value directly from system here. #if SOC_SPI_MEM_SUPPORT_TIMING_TUNING if (spi_flash_timing_is_tuned()) { cfg.using_timing_tuning = 1;