diff --git a/os/arch/arm/src/Makefile b/os/arch/arm/src/Makefile index f957ba62ab..d8b0603203 100644 --- a/os/arch/arm/src/Makefile +++ b/os/arch/arm/src/Makefile @@ -104,6 +104,7 @@ else CFLAGS += -I$(ARCH_SRCDIR)/common CFLAGS += -I$(ARCH_SRCDIR)/$(ARCH_SUBDIR) CFLAGS += -I$(TOPDIR)/kernel + CFLAGS += -I$(TOPDIR)/board/common endif endif diff --git a/os/arch/arm/src/amebasmart/Make.defs b/os/arch/arm/src/amebasmart/Make.defs index 32d081bcca..661a9e9702 100644 --- a/os/arch/arm/src/amebasmart/Make.defs +++ b/os/arch/arm/src/amebasmart/Make.defs @@ -201,6 +201,7 @@ endif ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/ +CFLAGS += -I$(TOPDIR)/board/common CFLAGS += -I$(TOPDIR)/board/$(CONFIG_ARCH_BOARD)/include CFLAGS += -I$(TOPDIR)/board/$(CONFIG_ARCH_BOARD)/src/component/soc/amebad2/fwlib/include CFLAGS += -I$(TOPDIR)/board/$(CONFIG_ARCH_BOARD)/src/component/soc/amebad2/cmsis @@ -309,4 +310,3 @@ else #EXTRA_LIBS += $(TOPDIR)/board/ endif endif - diff --git a/os/arch/arm/src/amebasmart/amebasmart_i2c.c b/os/arch/arm/src/amebasmart/amebasmart_i2c.c index aa64638f52..27a656da8f 100644 --- a/os/arch/arm/src/amebasmart/amebasmart_i2c.c +++ b/os/arch/arm/src/amebasmart/amebasmart_i2c.c @@ -41,7 +41,7 @@ #include #include "PinNames.h" -#include "board_pins.h" +#include #include "up_arch.h" #include "ameba_i2c.h" @@ -172,7 +172,7 @@ typedef struct i2c_m i2c_t; struct amebasmart_i2c_priv_s { const struct i2c_ops_s *ops; /* Standard I2C operations */ - const struct amebasmart_i2c_config_s *config; /* Port configuration */ + struct amebasmart_i2c_config_s *config; /* Port configuration */ int refs; /* Referernce count */ sem_t sem_excl; /* Mutual exclusion semaphore */ #ifndef CONFIG_I2C_POLLED @@ -302,8 +302,6 @@ static const struct amebasmart_i2c_config_s amebasmart_i2c0_config = { //.busy_idle = CONFIG_I2C0_BUSYIDLE, //.filtscl = CONFIG_I2C0_FILTSCL, //.filtsda = CONFIG_I2C0_FILTSDA, - .scl_pin = I2C0_SCL, - .sda_pin = I2C0_SDA, #ifndef CONFIG_I2C_SLAVE .mode = AMEBASMART_I2C_MASTER, #else @@ -334,8 +332,6 @@ static const struct amebasmart_i2c_config_s amebasmart_i2c1_config = { //.busy_idle = CONFIG_I2C1_BUSYIDLE, //.filtscl = CONFIG_I2C1_FILTSCL, //.filtsda = CONFIG_I2C1_FILTSDA, - .scl_pin = I2C1_SCL, - .sda_pin = I2C1_SDA, #ifndef CONFIG_I2C_SLAVE .mode = AMEBASMART_I2C_MASTER, #else @@ -366,8 +362,6 @@ static const struct amebasmart_i2c_config_s amebasmart_i2c2_config = { //.busy_idle = CONFIG_I2C2_BUSYIDLE, //.filtscl = CONFIG_I2C2_FILTSCL, //.filtsda = CONFIG_I2C2_FILTSDA, - .scl_pin = I2C2_SCL, - .sda_pin = I2C2_SDA, #ifndef CONFIG_I2C_SLAVE .mode = AMEBASMART_I2C_MASTER, #else @@ -1150,6 +1144,9 @@ static int amebasmart_i2c_transfer(FAR struct i2c_dev_s *dev, FAR struct i2c_msg * ************************************************************************************/ +/* Global I2C initialization completion flags */ +static volatile bool g_i2c_board_init_complete = false; /* Board I2C initialization complete */ + FAR struct i2c_dev_s *up_i2cinitialize(int port) { struct amebasmart_i2c_priv_s *priv = NULL; @@ -1159,16 +1156,25 @@ FAR struct i2c_dev_s *up_i2cinitialize(int port) #ifdef CONFIG_AMEBASMART_I2C0 if (port == 0) { priv = (struct amebasmart_i2c_priv_s *)&amebasmart_i2c0_priv; + lldbg("\n"); + priv->config->scl_pin = I2C_PIN(I2C0, I2C_SCL); + priv->config->sda_pin = I2C_PIN(I2C0, I2C_SDA); } else #endif #ifdef CONFIG_AMEBASMART_I2C1 if (port == 1) { priv = (struct amebasmart_i2c_priv_s *)&amebasmart_i2c1_priv; + + priv->config->scl_pin = I2C_PIN(I2C1, I2C_SCL); + priv->config->sda_pin = I2C_PIN(I2C1, I2C_SDA); } else #endif #ifdef CONFIG_AMEBASMART_I2C2 if (port == 2) { priv = (struct amebasmart_i2c_priv_s *)&amebasmart_i2c2_priv; + + priv->config->scl_pin = I2C_PIN(I2C2, I2C_SCL); + priv->config->sda_pin = I2C_PIN(I2C2, I2C_SDA); } else #endif { @@ -1180,9 +1186,10 @@ FAR struct i2c_dev_s *up_i2cinitialize(int port) if (priv->i2c_object != NULL) { return (struct i2c_dev_s *)priv; } -/* Initialize private data for the first time, increment reference count, - * power-up hardware and configure GPIOs. - */ + + /* Initialize private data for the first time, increment reference count, + * power-up hardware and configure GPIOs. + */ flags = enter_critical_section(); if ((volatile int)priv->refs++ == 0) { diff --git a/os/arch/arm/src/amebasmart/amebasmart_i2s.c b/os/arch/arm/src/amebasmart/amebasmart_i2s.c index beba4952d2..bd33a4008d 100644 --- a/os/arch/arm/src/amebasmart/amebasmart_i2s.c +++ b/os/arch/arm/src/amebasmart/amebasmart_i2s.c @@ -52,7 +52,7 @@ #include "PinNames.h" #include "i2s_api.h" -#include "board_pins.h" +#include /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -216,12 +216,7 @@ struct amebasmart_i2s_s { }; #ifdef CONFIG_AMEBASMART_I2S2 /* I2S device structures */ -static const struct amebasmart_i2s_config_s amebasmart_i2s2_config = { - .i2s_mclk_pin = I2S2_MCLK, - .i2s_sclk_pin = I2S2_SCLK, - .i2s_ws_pin = I2S2_WS, - .i2s_sd_tx_pin = I2S2_SD_TX, - .i2s_sd_rx_pin = I2S2_SD_RX, +static struct amebasmart_i2s_config_s amebasmart_i2s2_config = { .i2s_idx = I2S_NUM_2, .rxenab = 0, @@ -230,12 +225,7 @@ static const struct amebasmart_i2s_config_s amebasmart_i2s2_config = { #endif #ifdef CONFIG_AMEBASMART_I2S3 -static const struct amebasmart_i2s_config_s amebasmart_i2s3_config = { - .i2s_mclk_pin = I2S3_MCLK, - .i2s_sclk_pin = I2S3_SCLK, - .i2s_ws_pin = I2S3_WS, - .i2s_sd_tx_pin = I2S3_SD_TX, - .i2s_sd_rx_pin = I2S3_SD_RX, +static struct amebasmart_i2s_config_s amebasmart_i2s3_config = { .i2s_idx = I2S_NUM_3, .rxenab = 1, @@ -1811,11 +1801,23 @@ struct i2s_dev_s *amebasmart_i2s_initialize(uint16_t port) #ifdef CONFIG_AMEBASMART_I2S2 if (port == I2S_NUM_2) { hw_config_s = (struct amebasmart_i2s_config_s *)&amebasmart_i2s2_config; + + hw_config_s->i2s_mclk_pin = I2S_PIN(I2S2, I2S_MCLK); + hw_config_s->i2s_sclk_pin = I2S_PIN(I2S2, I2S_SCLK); + hw_config_s->i2s_ws_pin = I2S_PIN(I2S2, I2S_WS); + hw_config_s->i2s_sd_tx_pin = I2S_PIN(I2S2, I2S_SD_TX); + hw_config_s->i2s_sd_rx_pin = I2S_PIN(I2S2, I2S_SD_RX); } else #endif #ifdef CONFIG_AMEBASMART_I2S3 if (port == I2S_NUM_3) { hw_config_s = (struct amebasmart_i2s_config_s *)&amebasmart_i2s3_config; + + hw_config_s->i2s_mclk_pin = I2S_PIN(I2S3, I2S_MCLK); + hw_config_s->i2s_sclk_pin = I2S_PIN(I2S3, I2S_SCLK); + hw_config_s->i2s_ws_pin = I2S_PIN(I2S3, I2S_WS); + hw_config_s->i2s_sd_tx_pin = I2S_PIN(I2S3, I2S_SD_TX); + hw_config_s->i2s_sd_rx_pin = I2S_PIN(I2S3, I2S_SD_RX); } else #endif { diff --git a/os/arch/arm/src/amebasmart/amebasmart_serial.c b/os/arch/arm/src/amebasmart/amebasmart_serial.c index 3b50baf119..6fe184a796 100644 --- a/os/arch/arm/src/amebasmart/amebasmart_serial.c +++ b/os/arch/arm/src/amebasmart/amebasmart_serial.c @@ -84,7 +84,7 @@ #include "serial_api.h" #include "PinNames.h" -#include "board_pins.h" +#include #include "objects.h" #include "ameba_uart.h" #include "tinyara/kmalloc.h" @@ -234,6 +234,8 @@ struct rtl8730e_up_dev_s { #ifdef CONFIG_SERIAL_OFLOWCONTROL uint8_t oflow:1; /* output flow control (CTS) enabled */ #endif + uint8_t uart_type:3; /* identifies the uart type */ + uint8_t tx_level; }; @@ -348,11 +350,10 @@ static struct rtl8730e_up_dev_s g_uart0priv = { #endif .baud = CONFIG_UART0_BAUD, .irq = RTL8730E_UART0_IRQ, - .tx = UART0_TX, - .rx = UART0_RX, .FlowControl = FlowControlNone, .txint_enable = false, .rxint_enable = false, + .uart_type = 0, }; static uart_dev_t g_uart0port = { @@ -382,11 +383,10 @@ static struct rtl8730e_up_dev_s g_uart1priv = { #endif .baud = CONFIG_UART1_BAUD, .irq = RTL8730E_UART1_IRQ, - .tx = UART1_TX, - .rx = UART1_RX, .FlowControl = FlowControlNone, .txint_enable = false, .rxint_enable = false, + .uart_type = 1, }; static uart_dev_t g_uart1port = { @@ -416,13 +416,10 @@ static struct rtl8730e_up_dev_s g_uart2priv = { #endif .baud = CONFIG_UART2_BAUD, .irq = RTL8730E_UART2_IRQ, - .tx = UART2_TX, - .rx = UART2_RX, - .rts = UART2_RTS, - .cts = UART2_CTS, .FlowControl = FlowControlNone, .txint_enable = false, .rxint_enable = false, + .uart_type = 2, }; static uart_dev_t g_uart2port = { @@ -484,11 +481,10 @@ static struct rtl8730e_up_dev_s g_uart4priv = { #endif .baud = CONFIG_UART4_BAUD, .irq = RTL8730E_UART_LOG_IRQ, - .tx = UART4_TX, - .rx = UART4_RX, .FlowControl = FlowControlNone, .txint_enable = false, .rxint_enable = false, + .uart_type = 4, }; static uart_dev_t g_uart4port = { @@ -830,6 +826,15 @@ static int rtl8730e_up_setup(struct uart_dev_s *dev) { struct rtl8730e_up_dev_s *priv = (struct rtl8730e_up_dev_s *)dev->priv; DEBUGASSERT(priv); + +#ifdef CONFIG_RTL8730E_UART4 + if (priv->uart_type == 4) { + priv->tx = UART_PIN(UART4, UART_TX); + priv->rx = UART_PIN(UART4, UART_RX); + } +#endif + + DEBUGASSERT(!sdrv[uart_index_get(priv->tx)]); sdrv[uart_index_get(priv->tx)] = (serial_t *)kmm_malloc(sizeof(serial_t)); DEBUGASSERT(sdrv[uart_index_get(priv->tx)]); @@ -868,8 +873,32 @@ static int rtl8730e_up_setup_pin(struct uart_dev_s *dev) struct rtl8730e_up_dev_s *priv = (struct rtl8730e_up_dev_s *)dev->priv; DEBUGASSERT(priv); - serial_pin_init(priv->tx, priv->rx); - return OK; +#ifdef CONFIG_RTL8730E_UART0 + if (priv->uart_type == 0) { + priv->tx = UART_PIN(UART0, UART_TX); + priv->rx = UART_PIN(UART0, UART_RX); + } +#endif + +#ifdef CONFIG_RTL8730E_UART1 + if (priv->uart_type == 1) { +#if defined(CONFIG_RTL8730E_BOARD_AIL) || defined(CONFIG_RTL8730E_BOARD_AILP) || defined(CONFIG_RTL8730E_BOARD_AILPW) || defined(CONFIG_RTL8730E_BOARD_AID) + priv->tx = UART_PIN(UART1, UART_TX); + priv->rx = UART_PIN(UART1, UART_RX); +#endif + } +#endif + +#ifdef CONFIG_RTL8730E_UART2 + if (priv->uart_type == 2) { + priv->tx = UART_PIN(UART2, UART_TX); + priv->rx = UART_PIN(UART2, UART_RX); + priv->cts = UART_PIN(UART2, UART_CTS); + priv->rts = UART_PIN(UART2, UART_RTS); + } +#endif + serial_pin_init(priv->tx, priv->rx); + return OK; } /**************************************************************************** @@ -1244,7 +1273,6 @@ void up_serialinit(void) /* Register the console */ uart_register("/dev/console", &CONSOLE_DEV); #endif - /* Register all UARTs */ #ifdef TTYS0_DEV /* Default LOGUART(UART4) is already running and could not be reinit or stopped */ @@ -1268,6 +1296,7 @@ void up_serialinit(void) pmu_register_sleep_callback(PMU_LOGUART_DEVICE, (PSM_HOOK_FUN)rtk_loguart_suspend, NULL, (PSM_HOOK_FUN)rtk_loguart_resume, NULL); pmu_register_sleep_callback(PMU_UART1_DEVICE, (PSM_HOOK_FUN)rtk_uart_suspend, NULL, (PSM_HOOK_FUN)rtk_uart_resume, NULL); #endif + } /**************************************************************************** @@ -1426,5 +1455,3 @@ int up_getc(void) return ch; } #endif /* USE_SERIALDRIVER */ - - diff --git a/os/arch/arm/src/amebasmart/amebasmart_spi.c b/os/arch/arm/src/amebasmart/amebasmart_spi.c index 3932ee2db7..6d57ef3166 100644 --- a/os/arch/arm/src/amebasmart/amebasmart_spi.c +++ b/os/arch/arm/src/amebasmart/amebasmart_spi.c @@ -41,7 +41,7 @@ #include "chip.h" -#include "board_pins.h" +#include #include "amebasmart_spi.h" #include "PinNames.h" #include "spi_api.h" @@ -235,13 +235,6 @@ static struct amebasmart_spidev_s g_spi0dev = { .spi_object = {0}, .refs = 0, .spi_idx = MBED_SPI0, - .spi_mosi = SPI0_MOSI, - .spi_miso = SPI0_MISO, - .spi_sclk = SPI0_SCLK, - .spi_cs0 = SPI0_CS0, -#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI0_CS) - .spi_cs1 = SPI0_CS1, -#endif .nbits = 8, .mode = SPIDEV_MODE0, .role = AMEBASMART_SPI_MASTER, @@ -294,13 +287,6 @@ static struct amebasmart_spidev_s g_spi1dev = { .spi_object = {0}, .refs = 0, .spi_idx = MBED_SPI1, - .spi_mosi = SPI1_MOSI, - .spi_miso = SPI1_MISO, - .spi_sclk = SPI1_SCLK, - .spi_cs0 = SPI1_CS0, -#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI1_CS) - .spi_cs1 = SPI1_CS1, -#endif .nbits = 8, .mode = SPIDEV_MODE0, .role = AMEBASMART_SPI_MASTER @@ -1558,6 +1544,13 @@ FAR struct spi_dev_s *up_spiinitialize(int port) priv = &g_spi0dev; + priv->spi_mosi = SPI_PIN(SPI0, SPI_MOSI); + priv->spi_miso = SPI_PIN(SPI0, SPI_MISO); + priv->spi_sclk = SPI_PIN(SPI0, SPI_SCLK); + priv->spi_cs0 = SPI_PIN(SPI0, SPI_CS0); +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI0_CS) + priv->spi_cs1 = SPI_PIN(SPI0, SPI_CS1); +#endif if (priv->refs > 0) { dbg("SPI port%d has been initialized before!\n", port); leave_critical_section(flags); @@ -1579,6 +1572,14 @@ FAR struct spi_dev_s *up_spiinitialize(int port) priv = &g_spi1dev; + priv->spi_mosi = SPI_PIN(SPI1, SPI_MOSI); + priv->spi_miso = SPI_PIN(SPI1, SPI_MISO); + priv->spi_sclk = SPI_PIN(SPI1, SPI_SCLK); + priv->spi_cs0 = SPI_PIN(SPI1, SPI_CS0); +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI1_CS) + priv->spi_cs1 = SPI_PIN(SPI1, SPI_CS1); +#endif + if (priv->refs > 0) { dbg("SPI port%d has been initialized before!\n", port); leave_critical_section(flags); diff --git a/os/board/common/board_pins.h b/os/board/common/board_pins.h new file mode 100644 index 0000000000..d007d19820 --- /dev/null +++ b/os/board/common/board_pins.h @@ -0,0 +1,138 @@ +/**************************************************************************** + * + * Copyright 2025 Samsung Electronics All Rights Reserved. + * + * 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. + * + ****************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ +/* File name: board_pins.h */ + +#ifndef BOARD_PINS_H +#define BOARD_PINS_H + +#include "PinNames.h" +#include "ameba_pinmux.h" +#include "basic_types.h" +#include "ameba_gpio.h" +#include "ameba_pinmap.h" + +#ifdef CONFIG_RTL8730E_BOARD_AIL +#include "rtl8730e_ail_board_pins.h" +#endif + +#ifdef CONFIG_RTL8730E_BOARD_AILP +#include "rtl8730e_ailp_board_pins.h" +#endif + +#ifdef CONFIG_RTL8730E_BOARD_AID +#include "rtl8730e_aid_board_pins.h" +#endif + +#ifdef CONFIG_RTL8730E_BOARD_AILPW +#include "rtl8730e_ailpw_board_pins.h" +#endif + + +/* Wakeup pins configuration */ +#define WAKEPIN_0 ((u32)0x00000000) /*!< see aon_wakepin */ +#define WAKEPIN_1 ((u32)0x00000001) /*!< see aon_wakepin */ +#define WAKEPIN_2 ((u32)0x00000002) /*!< see aon_wakepin */ +#define WAKEPIN_3 ((u32)0x00000003) /*!< see aon_wakepin */ + +#define IS_UART0_TX(tx) ((tx == PA_3) || (tx == PA_14) || (tx == PA_29) || (tx == PB_6)) +#define IS_UART1_TX(tx) ((tx == PA_5) || (tx == PA_10) || (tx == PA_25) || (tx == PB_11) || (tx == PB_20) || (tx == PB_30)) +#define IS_UART2_TX(tx) ((tx == PA_8) || (tx == PA_12) || (tx == PA_23) || (tx == PB_22)) +#define IS_UART4_TX(tx) (tx == PB_24) + +// --------------------- +// Pin Attributes +// --------------------- +#define PIN_NONE 0xFF // marker for unused pins +#define GPIO_PIN_SIZE 3 + +typedef enum { + PULL_NONE = 0, + PULL_UP, + PULL_DOWN +} pin_pull_t; + + +typedef struct { + u16 PinName; // physical pin ID (GPIO Px_y) + u8 NormalPull; // pull-up/down/none + u8 SleepPull; // pull-up/down/none +} pin_desc_t; + +typedef enum { + UART_RX = 0, + UART_TX, + UART_CTS, + UART_RTS +} UART_PinRole_t; + +typedef enum { + I2C_SCL = 0, + I2C_SDA +} I2C_PinRole_t; + +typedef enum { + I2S_MCLK = 0, + I2S_SCLK, + I2S_WS, + I2S_SD_TX, + I2S_SD_RX +} I2S_PinRole_t; + +typedef enum { + SPI_MOSI = 0, + SPI_MISO, + SPI_SCLK, + SPI_CS0, + SPI_CS1 +} SPI_PinRole_t; + +typedef enum { + IST415_RESET_PIN = 0, + IST415_I2C_PIN +} IST415_PinRole_t; + +typedef enum { + LCD_ST7789_RESET = 0, + LCD_ST7789_BACKLIGHT, + LCD_ST7789_CMDDATA +} LCD_ST7789_PinRole_t; + +typedef enum { + GPIO_MODE_IN = 0, + GPIO_MODE_OUT, + GPIO_MODE +} GPIO_PinRole_t; + +//============================================================================== +#define UART_PIN(INDEX, PIN_ROLE) pin_table[INDEX##_INDEX + PIN_ROLE].PinName +#define I2C_PIN(INDEX, PIN_ROLE) pin_table[INDEX##_INDEX + PIN_ROLE].PinName +#define SPI_PIN(INDEX, PIN_ROLE) pin_table[INDEX##_INDEX + PIN_ROLE].PinName +#define IST415_PIN(INDEX, PIN_ROLE) pin_table[INDEX##_INDEX + PIN_ROLE].PinName +#define LCD_ST7789_PIN(INDEX, PIN_ROLE) pin_table[INDEX##_INDEX + PIN_ROLE].PinName +#define I2S_PIN(INDEX, PIN_ROLE) pin_table[INDEX##_INDEX + PIN_ROLE].PinName +#define GPIO_PINS(INDEX, PIN_ROLE) pin_table[INDEX##_INDEX + PIN_ROLE].PinName + +#define GPIO_PIN_NORMALPULL(INDEX, PIN_ROLE) pin_table[INDEX##_INDEX + PIN_ROLE].NormalPull +#define GPIO_PIN_SLEEPPULL(INDEX, PIN_ROLE) pin_table[INDEX##_INDEX + PIN_ROLE].SleepPull +extern const pin_desc_t pin_table[]; + +#endif // BOARD_PINS_H diff --git a/os/board/rtl8730e/include/board_pins.h b/os/board/rtl8730e/include/board_pins.h deleted file mode 100644 index 745e38bdb1..0000000000 --- a/os/board/rtl8730e/include/board_pins.h +++ /dev/null @@ -1,247 +0,0 @@ -/**************************************************************************** - * - * Copyright 2025 Samsung Electronics All Rights Reserved. - * - * 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. - * - ****************************************************************************/ - -/************************************************************************************ - * Included Files - ************************************************************************************/ -/* File name: board_pins.h */ - -#ifndef BOARD_PINS_H -#define BOARD_PINS_H - -#include "PinNames.h" -#include "ameba_pinmux.h" - -/* UART pins configuration */ -#ifdef CONFIG_RTL8730E_UART0 -#define UART0_TX PA_3 -#define UART0_RX PA_2 -#endif - -#ifdef CONFIG_RTL8730E_UART1 -#if defined(CONFIG_RTL8730E_BOARD_AIL) || defined(CONFIG_RTL8730E_BOARD_AILP) || defined(CONFIG_RTL8730E_BOARD_AILPW) -#define UART1_TX PA_10 -#define UART1_RX PA_9 -#elif defined(CONFIG_RTL8730E_BOARD_AID) -#define UART1_TX PA_5 -#define UART1_RX PA_4 -#else -#error Not Supported, Please check the board type configure -#endif -#endif // CONFIG_RTL8730E_UART1 - -#ifdef CONFIG_RTL8730E_UART2 -#define UART2_TX PB_22 -#define UART2_RX PB_21 -#define UART2_RTS PB_20 -#define UART2_CTS PB_19 -#endif - -#ifdef CONFIG_RTL8730E_UART4 -#define UART4_TX PB_24 -#define UART4_RX PB_23 -#endif - -/* SPI pins configuration */ -#ifdef CONFIG_AMEBASMART_SPI -#ifdef CONFIG_AMEBASMART_SPI0 -#define SPI0_MOSI PB_4 -#define SPI0_MISO PB_3 -#define SPI0_SCLK PB_6 -#define SPI0_CS0 PB_5 -#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI0_CS) -#define SPI0_CS1 PB_31 -#endif -#endif // CONFIG_AMEBASMART_SPI0 - -#ifdef CONFIG_AMEBASMART_SPI1 -#define SPI1_MOSI PB_28 -#define SPI1_MISO PB_27 -#define SPI1_SCLK PB_25 -#define SPI1_CS0 PB_26 -#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI0_CS) -#define SPI1_CS1 PB_29 -#endif -#endif // CONFIG_AMEBASMART_SPI1 -#endif // CONFIG_AMEBASMART_SPI - -/* I2C pins configuration */ -#ifdef CONFIG_AMEBASMART_I2C -#ifdef CONFIG_AMEBASMART_I2C0 -#if defined(CONFIG_RTL8730E_BOARD_AIL) || defined(CONFIG_RTL8730E_BOARD_AILP) || defined(CONFIG_RTL8730E_BOARD_AILPW) -#define I2C0_SCL PB_30 -#define I2C0_SDA PB_29 -#else -#error Not Supported, Please check the board type configure -#endif -#endif // CONFIG_AMEBASMART_I2C0 - -#ifdef CONFIG_AMEBASMART_I2C1 -#if defined(CONFIG_RTL8730E_BOARD_AIL) || defined(CONFIG_RTL8730E_BOARD_AILP) || defined(CONFIG_RTL8730E_BOARD_AILPW) -#define I2C1_SCL PA_4 -#define I2C1_SDA PA_3 -#else -#error Not Supported, Please check the board type configure -#endif -#endif // CONFIG_AMEBASMART_I2C1 - -#ifdef CONFIG_AMEBASMART_I2C2 -#define I2C2_SCL PA_29 -#define I2C2_SDA PA_28 -#endif // CONFIG_AMEBASMART_I2C2 -#endif // CONFIG_AMEBASMART_I2C - -/* IST415 pins configuration */ -#if defined(CONFIG_TOUCH_IST415) -#if defined(CONFIG_RTL8730E_BOARD_AIL) || defined(CONFIG_RTL8730E_BOARD_AILP) || defined(CONFIG_RTL8730E_BOARD_AILPW) -#define IST415_GPIO_RESET_PIN PA_5 -#define IST415_GPIO_I2C_PIN PA_4 -#else -#error Not Supported, Please check the board type configure -#endif -#endif - -/* GPIO pins configuration */ -#define GPIO_PIN_LIST { \ - {PA_23, PIN_INPUT, PullDown }, \ - \ - /* PB_20 is gpio pin number for LED */ \ - {PB_20, PIN_OUTPUT, PullDown }, \ - {PB_22, PIN_INPUT, PullUp } \ - } - -/* Power control pins configuration */ -#define PWR_PIN_00 {_PA_0, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_01 {_PA_1, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_02 {_PA_2, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA pull up 10k -#define PWR_PIN_03 {_PA_3, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA pull up 10k -#define PWR_PIN_04 {_PA_4, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA pull up 4.7k -#define PWR_PIN_05 {_PA_5, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // SDA pull up 4.7k & pull down 9.1k -#define PWR_PIN_06 {_PA_6, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_07 {_PA_7, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_08 {_PA_8, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_09 {_PA_9, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA pull up 10k -#define PWR_PIN_10 {_PA_10, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA pull up 10k -#define PWR_PIN_11 {_PA_11, GPIO_PuPd_UP, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_12 {_PA_12, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_13 {_PA_13, GPIO_PuPd_UP, GPIO_PuPd_UP} // RTK SWD_DATA -#define PWR_PIN_14 {_PA_14, GPIO_PuPd_UP, GPIO_PuPd_UP} // RTK SWD_CLK -#define PWR_PIN_15 {_PA_15, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // SDA pull down 4.7k -#define PWR_PIN_16 {_PA_16, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL} // RTK QA board need pull up -#define PWR_PIN_17 {_PA_17, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // NA -#define PWR_PIN_18 {_PA_18, GPIO_PuPd_UP, GPIO_PuPd_DOWN} // NA -#define PWR_PIN_19 {_PA_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // NA -#define PWR_PIN_20 {_PA_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // NA -#define PWR_PIN_21 {_PA_21, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // NA -#define PWR_PIN_22 {_PA_22, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL} // SDA AMP-RESET -#define PWR_PIN_23 {_PA_23, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // SDA pull down 4.7k -#define PWR_PIN_24 {_PA_24, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA pull up 100k -#define PWR_PIN_25 {_PA_25, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA pull up 10k -#define PWR_PIN_26 {_PA_26, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_27 {_PA_27, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_28 {_PA_28, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA pull up 4.7k -#define PWR_PIN_29 {_PA_29, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA pull up 4.7k -#define PWR_PIN_30 {_PA_30, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // NA -#define PWR_PIN_31 {_PA_31, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // NA -#define PWR_PIN_32 {_PB_0, GPIO_PuPd_UP, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_33 {_PB_1, GPIO_PuPd_UP, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_34 {_PB_2, GPIO_PuPd_UP, GPIO_PuPd_DOWN} // NA -#define PWR_PIN_35 {_PB_3, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // SDA NPU SPI0_MISO -#define PWR_PIN_36 {_PB_4, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // SDA NPU SPI0_MOSI -#define PWR_PIN_37 {_PB_5, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA NPU SPI0_CS pull up 4.7k -#define PWR_PIN_38 {_PB_6, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // SDA NPU SPI0_CLK -#define PWR_PIN_39 {_PB_7, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_40 {_PB_8, GPIO_PuPd_UP, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_41 {_PB_9, GPIO_PuPd_UP, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_42 {_PB_10, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL} // SDA AMP-I2S -#if defined(CONFIG_LCD_PWM_INVERSION) -#define PWR_PIN_43 {_PB_11, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // SDA AILite+W LCD PWN -#else -#define PWR_PIN_43 {_PB_11, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA AILite+W LCD PWN -#endif -#define PWR_PIN_44 {_PB_12, GPIO_PuPd_UP, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_45 {_PB_13, GPIO_PuPd_UP, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_46 {_PB_14, GPIO_PuPd_UP, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_47 {_PB_15, GPIO_PuPd_UP, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_48 {_PB_16, GPIO_PuPd_UP, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_49 {_PB_17, GPIO_PuPd_UP, GPIO_PuPd_UP} // RTL8730ELH -#define PWR_PIN_50 {_PB_18, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // RTL8730ELH -#define PWR_PIN_51 {_PB_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // NA -#define PWR_PIN_52 {_PB_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // SDA pull down 10k -#define PWR_PIN_53 {_PB_21, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL} // SDA AMP-I2S -#define PWR_PIN_54 {_PB_22, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA pull up 10k; RTK TM_DIS -#define PWR_PIN_55 {_PB_23, GPIO_PuPd_UP, GPIO_PuPd_UP} // RTK UART_LOG_RXD -#define PWR_PIN_56 {_PB_24, GPIO_PuPd_UP, GPIO_PuPd_UP} // RTK UART_LOG_TXD internal pull up 80k -#define PWR_PIN_57 {_PB_25, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // SDA Ext-Flash SPI1_CLK -#define PWR_PIN_58 {_PB_26, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA Ext-Flash SPI1_CS pull up 4.7k -#define PWR_PIN_59 {_PB_27, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA Ext-Flash SPI1_MISO -#define PWR_PIN_60 {_PB_28, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA Ext-Flash SPI0_MOSI -#define PWR_PIN_61 {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL} // SDA pull up 4.7k -#define PWR_PIN_62 {_PB_30, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL} // SDA pull up 4.7k -#define PWR_PIN_63 {_PB_31, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN} // SDA pull down 4.7k -#define PWR_PIN_64 {_PC_0, GPIO_PuPd_UP, GPIO_PuPd_UP} // SDA pull up 4.7k -#define PWR_PIN_65 {_PC_1, GPIO_PuPd_UP, GPIO_PuPd_UP} // RTK Int-Flash SPI_FLASH_DATA -#define PWR_PIN_66 {_PC_2, GPIO_PuPd_UP, GPIO_PuPd_DOWN} // RTK Int-Flash SPI_FLASH_CLK pull down for PG or 50uA -#define PWR_PIN_67 {_PC_3, GPIO_PuPd_UP, GPIO_PuPd_UP} // RTK Int-Flash SPI_FLASH_DATA -#define PWR_PIN_68 {_PC_4, GPIO_PuPd_UP, GPIO_PuPd_UP} // RTK Int-Flash SPI_FLASH_DATA -#define PWR_PIN_69 {_PC_5, GPIO_PuPd_UP, GPIO_PuPd_UP} // RTK Int-Flash SPI_FLASH_DATA -#define PWR_PIN_70 {_PC_6, GPIO_PuPd_UP, GPIO_PuPd_UP} // RTK Int-Flash SPI_FLASH_CS -#define PWR_PIN_71 {_PNC, GPIO_PuPd_KEEP, GPIO_PuPd_KEEP} // table end - -/* Wakeup pins configuration */ -#define WAKEPIN_0 ((u32)0x00000000) /*!< see aon_wakepin */ -#define WAKEPIN_1 ((u32)0x00000001) /*!< see aon_wakepin */ -#define WAKEPIN_2 ((u32)0x00000002) /*!< see aon_wakepin */ -#define WAKEPIN_3 ((u32)0x00000003) /*!< see aon_wakepin */ - -#define IS_UART0_TX(tx) ((tx == PA_3) || (tx == PA_14) || (tx == PA_29) || (tx == PB_6)) -#define IS_UART1_TX(tx) ((tx == PA_5) || (tx == PA_10) || (tx == PA_25) || (tx == PB_11) || (tx == PB_20) || (tx == PB_30)) -#define IS_UART2_TX(tx) ((tx == PA_8) || (tx == PA_12) || (tx == PA_23) || (tx == PB_22)) -#define IS_UART4_TX(tx) (tx == PB_24) - -/* I2S2 pins configuration */ -#ifdef CONFIG_AMEBASMART_I2S -#ifdef CONFIG_AMEBASMART_I2S2 -#define I2S2_MCLK NULL -#define I2S2_SCLK PB_21 -#define I2S2_WS PA_16 -#define I2S2_SD_TX PB_10 -#define I2S2_SD_RX PB_19 -#endif // CONFIG_AMEBASMART_I2S2 - -#ifdef CONFIG_AMEBASMART_I2S3 -#define I2S3_MCLK PA_15 -#define I2S3_SCLK PA_14 -#define I2S3_WS PA_13 -#define I2S3_SD_TX PB_11 -#define I2S3_SD_RX PB_20 -#endif // CONFIG_AMEBASMART_I2S3 -#endif // CONFIG_AMEBASMART_I2S - -/* LCD ST7789 pins configuration */ -#ifdef CONFIG_LCD_ST7789 -#if defined(CONFIG_RTL8730E_BOARD_AIL) || defined(CONFIG_RTL8730E_BOARD_AILP) || defined(CONFIG_RTL8730E_BOARD_AILPW) -#error "ERROR, Not supported this revision" -#else -#define LCD_ST7789_GPIO_PIN_RESET PB_11 -#define LCD_ST7789_GPIO_PIN_BACKLIGHT PA_9 -#define LCD_ST7789_GPIO_PIN_CMDDATA PA_10 -#endif -#endif // CONFIG_LCD_ST7789 - -#endif // BOARD_PINS_H diff --git a/os/board/rtl8730e/include/rtl8730e_aid_board_pins.h b/os/board/rtl8730e/include/rtl8730e_aid_board_pins.h new file mode 100644 index 0000000000..9edb65f41c --- /dev/null +++ b/os/board/rtl8730e/include/rtl8730e_aid_board_pins.h @@ -0,0 +1,174 @@ +/**************************************************************************** + * + * Copyright 2025 Samsung Electronics All Rights Reserved. + * + * 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. + * + ****************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ +/* File name: rtl8730e_aid_board_pins.h */ + +#ifndef RTL8730E_AID_BOARD_PINS_H +#define RTL8730E_AID_BOARD_PINS_H + +//========================================UART======================================= +#define UART0_INDEX 0 +#ifdef CONFIG_RTL8730E_UART0 +#define NUM_OF_PINS_UART0 2 +#else +#define NUM_OF_PINS_UART0 0 +#endif + +#define UART1_INDEX (UART0_INDEX + NUM_OF_PINS_UART0) + +#ifdef CONFIG_RTL8730E_UART1 +#define NUM_OF_PINS_UART1 2 +#else +#define NUM_OF_PINS_UART1 0 +#endif + +#define UART2_INDEX (UART1_INDEX + NUM_OF_PINS_UART1) + +#ifdef CONFIG_RTL8730E_UART2 +#define NUM_OF_PINS_UART2 4 +#else +#define NUM_OF_PINS_UART2 0 +#endif + +#define UART4_INDEX (UART2_INDEX + NUM_OF_PINS_UART2) + +#ifdef CONFIG_RTL8730E_UART4 +#define NUM_OF_PINS_UART4 2 +#else +#define NUM_OF_PINS_UART4 0 +#endif + +#define UART_NEXT (UART4_INDEX + NUM_OF_PINS_UART4) + +//========================================I2C======================================= +#define I2C0_INDEX UART_NEXT + +#ifdef CONFIG_AMEBASMART_I2C + +#ifdef CONFIG_AMEBASMART_I2C0 +#error Not Supported, Please check the board type configure +#else +#define NUM_OF_PINS_I2C0 0 +#endif + +#define I2C1_INDEX (I2C0_INDEX + NUM_OF_PINS_I2C0) + +#ifdef CONFIG_AMEBASMART_I2C1 +#error Not Supported, Please check the board type configure +#else +#define NUM_OF_PINS_I2C1 0 +#endif + +#define I2C2_INDEX (I2C1_INDEX + NUM_OF_PINS_I2C1) + +#ifdef CONFIG_AMEBASMART_I2C2 +#define NUM_OF_PINS_I2C2 2 +#else +#define NUM_OF_PINS_I2C2 0 +#endif + +#define I2C_NEXT (I2C2_INDEX + NUM_OF_PINS_I2C2) + +#else +#define I2C_NEXT UART_NEXT + +#endif // CONFIG_AMEBASMART_I2C + +//=====================================SPI========================================= +#define SPI0_INDEX I2C_NEXT + +#ifdef CONFIG_AMEBASMART_SPI0 +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI0_CS) +#define NUM_OF_PINS_SPI0 5 +#else +#define NUM_OF_PINS_SPI0 4 +#endif +#else +#define NUM_OF_PINS_SPI0 0 +#endif + +#define SPI1_INDEX (SPI0_INDEX + NUM_OF_PINS_SPI0) + +#ifdef CONFIG_AMEBASMART_SPI1 +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI1_CS) +#define NUM_OF_PINS_SPI1 5 +#else +#define NUM_OF_PINS_SPI1 4 +#endif +#else +#define NUM_OF_PINS_SPI1 0 +#endif + +#define SPI_NEXT (SPI1_INDEX + NUM_OF_PINS_SPI1) + +//=====================================IST415========================================= +#define IST415_INDEX SPI_NEXT + +#if defined(CONFIG_TOUCH_IST415) +#error Not Supported, Please check the board type configure +#else +#define NUM_OF_PINS_IST415 0 +#endif + +#define IST415_NEXT (IST415_INDEX + NUM_OF_PINS_IST415) + +//=====================================LCD_ST7789========================================= +#define LCD_ST7789_INDEX IST415_NEXT + +#ifdef CONFIG_LCD_ST7789 +#define NUM_OF_PINS_LCD_ST7789 3 +#else +#define NUM_OF_PINS_LCD_ST7789 0 +#endif + +#define LCD_ST7789_NEXT (LCD_ST7789_INDEX + NUM_OF_PINS_LCD_ST7789) + +//=====================================I2S========================================= +/* I2S2 pins configuration */ + +#define I2S2_INDEX LCD_ST7789_NEXT + +#ifdef CONFIG_AMEBASMART_I2S +#ifdef CONFIG_AMEBASMART_I2S2 +#define NUM_OF_PINS_I2S2 5 +#else +#define NUM_OF_PINS_I2S2 0 +#endif + +#define I2S3_INDEX (I2S2_INDEX + NUM_OF_PINS_I2S2) + +#ifdef CONFIG_AMEBASMART_I2S3 +#define NUM_OF_PINS_I2S3 5 +#else +#define NUM_OF_PINS_I2S3 0 +#endif + +#define I2S_NEXT (I2S3_INDEX + NUM_OF_PINS_I2S3) +#else +#define I2S_NEXT I2S2_INDEX +#endif + +//=====================================GPIO========================================= +#define GPIO_INDEX I2S_NEXT +#define NUM_OF_PINS_GPIO 3 +#define GPIO_NEXT (GPIO_INDEX + NUM_OF_PINS_GPIO) + +#endif // RTL8730E_AIL_BOARD_PINS_H diff --git a/os/board/rtl8730e/include/rtl8730e_ail_board_pins.h b/os/board/rtl8730e/include/rtl8730e_ail_board_pins.h new file mode 100644 index 0000000000..b3640ca7e3 --- /dev/null +++ b/os/board/rtl8730e/include/rtl8730e_ail_board_pins.h @@ -0,0 +1,174 @@ +/**************************************************************************** + * + * Copyright 2025 Samsung Electronics All Rights Reserved. + * + * 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. + * + ****************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ +/* File name: rtl8730e_ail_board_pins.h */ + +#ifndef RTL8730E_AIL_BOARD_PINS_H +#define RTL8730E_AIL_BOARD_PINS_H + +//========================================UART======================================= +#define UART0_INDEX 0 +#ifdef CONFIG_RTL8730E_UART0 +#define NUM_OF_PINS_UART0 2 +#else +#define NUM_OF_PINS_UART0 0 +#endif + +#define UART1_INDEX (UART0_INDEX + NUM_OF_PINS_UART0) + +#ifdef CONFIG_RTL8730E_UART1 +#define NUM_OF_PINS_UART1 2 +#else +#define NUM_OF_PINS_UART1 0 +#endif + +#define UART2_INDEX (UART1_INDEX + NUM_OF_PINS_UART1) + +#ifdef CONFIG_RTL8730E_UART2 +#define NUM_OF_PINS_UART2 4 +#else +#define NUM_OF_PINS_UART2 0 +#endif + +#define UART4_INDEX (UART2_INDEX + NUM_OF_PINS_UART2) + +#ifdef CONFIG_RTL8730E_UART4 +#define NUM_OF_PINS_UART4 2 +#else +#define NUM_OF_PINS_UART4 0 +#endif + +#define UART_NEXT (UART4_INDEX + NUM_OF_PINS_UART4) + +//========================================I2C======================================= +#define I2C0_INDEX UART_NEXT + +#ifdef CONFIG_AMEBASMART_I2C + +#ifdef CONFIG_AMEBASMART_I2C0 +#define NUM_OF_PINS_I2C0 2 +#else +#define NUM_OF_PINS_I2C0 0 +#endif + +#define I2C1_INDEX (I2C0_INDEX + NUM_OF_PINS_I2C0) + +#ifdef CONFIG_AMEBASMART_I2C1 +#define NUM_OF_PINS_I2C1 2 +#else +#define NUM_OF_PINS_I2C1 0 +#endif + +#define I2C2_INDEX (I2C1_INDEX + NUM_OF_PINS_I2C1) + +#ifdef CONFIG_AMEBASMART_I2C2 +#define NUM_OF_PINS_I2C2 2 +#else +#define NUM_OF_PINS_I2C2 0 +#endif + +#define I2C_NEXT (I2C2_INDEX + NUM_OF_PINS_I2C2) + +#else +#define I2C_NEXT UART_NEXT + +#endif // CONFIG_AMEBASMART_I2C + +//=====================================SPI========================================= +#define SPI0_INDEX I2C_NEXT + +#ifdef CONFIG_AMEBASMART_SPI0 +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI0_CS) +#define NUM_OF_PINS_SPI0 5 +#else +#define NUM_OF_PINS_SPI0 4 +#endif +#else +#define NUM_OF_PINS_SPI0 0 +#endif + +#define SPI1_INDEX (SPI0_INDEX + NUM_OF_PINS_SPI0) + +#ifdef CONFIG_AMEBASMART_SPI1 +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI1_CS) +#define NUM_OF_PINS_SPI1 5 +#else +#define NUM_OF_PINS_SPI1 4 +#endif +#else +#define NUM_OF_PINS_SPI1 0 +#endif + +#define SPI_NEXT (SPI1_INDEX + NUM_OF_PINS_SPI1) + +//=====================================IST415========================================= +#define IST415_INDEX SPI_NEXT + +#if defined(CONFIG_TOUCH_IST415) +#define NUM_OF_PINS_IST415 2 +#else +#define NUM_OF_PINS_IST415 0 +#endif + +#define IST415_NEXT (IST415_INDEX + NUM_OF_PINS_IST415) + +//=====================================LCD_ST7789========================================= +#define LCD_ST7789_INDEX IST415_NEXT + +#ifdef CONFIG_LCD_ST7789 +#error Not supported revision +#else +#define NUM_OF_PINS_LCD_ST7789 0 +#endif + +#define LCD_ST7789_NEXT (LCD_ST7789_INDEX + NUM_OF_PINS_LCD_ST7789) + +//=====================================I2S========================================= +/* I2S2 pins configuration */ + +#define I2S2_INDEX LCD_ST7789_NEXT + +#ifdef CONFIG_AMEBASMART_I2S +#ifdef CONFIG_AMEBASMART_I2S2 +#define NUM_OF_PINS_I2S2 5 +#else +#define NUM_OF_PINS_I2S2 0 +#endif + +#define I2S3_INDEX (I2S2_INDEX + NUM_OF_PINS_I2S2) + +#ifdef CONFIG_AMEBASMART_I2S3 +#define NUM_OF_PINS_I2S3 5 +#else +#define NUM_OF_PINS_I2S3 0 +#endif + +#define I2S_NEXT (I2S3_INDEX + NUM_OF_PINS_I2S3) +#else +#define I2S_NEXT I2S2_INDEX +#endif + +//=====================================GPIO========================================= +#define GPIO_INDEX I2S_NEXT +#define NUM_OF_PINS_GPIO 3 +#define GPIO_NEXT (GPIO_INDEX + NUM_OF_PINS_GPIO) + +#endif // RTL8730E_AIL_BOARD_PINS_H diff --git a/os/board/rtl8730e/include/rtl8730e_ailp_board_pins.h b/os/board/rtl8730e/include/rtl8730e_ailp_board_pins.h new file mode 100644 index 0000000000..52b81d5a1e --- /dev/null +++ b/os/board/rtl8730e/include/rtl8730e_ailp_board_pins.h @@ -0,0 +1,174 @@ +/**************************************************************************** + * + * Copyright 2025 Samsung Electronics All Rights Reserved. + * + * 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. + * + ****************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ +/* File name: rtl8730e_ailp_board_pins.h */ + +#ifndef RTL8730E_AILP_BOARD_PINS_H +#define RTL8730E_AILP_BOARD_PINS_H + +//========================================UART======================================= +#define UART0_INDEX 0 +#ifdef CONFIG_RTL8730E_UART0 +#define NUM_OF_PINS_UART0 2 +#else +#define NUM_OF_PINS_UART0 0 +#endif + +#define UART1_INDEX (UART0_INDEX + NUM_OF_PINS_UART0) + +#ifdef CONFIG_RTL8730E_UART1 +#define NUM_OF_PINS_UART1 2 +#else +#define NUM_OF_PINS_UART1 0 +#endif + +#define UART2_INDEX (UART1_INDEX + NUM_OF_PINS_UART1) + +#ifdef CONFIG_RTL8730E_UART2 +#define NUM_OF_PINS_UART2 4 +#else +#define NUM_OF_PINS_UART2 0 +#endif + +#define UART4_INDEX (UART2_INDEX + NUM_OF_PINS_UART2) + +#ifdef CONFIG_RTL8730E_UART4 +#define NUM_OF_PINS_UART4 2 +#else +#define NUM_OF_PINS_UART4 0 +#endif + +#define UART_NEXT (UART4_INDEX + NUM_OF_PINS_UART4) + +//========================================I2C======================================= +#define I2C0_INDEX UART_NEXT + +#ifdef CONFIG_AMEBASMART_I2C + +#ifdef CONFIG_AMEBASMART_I2C0 +#define NUM_OF_PINS_I2C0 2 +#else +#define NUM_OF_PINS_I2C0 0 +#endif + +#define I2C1_INDEX (I2C0_INDEX + NUM_OF_PINS_I2C0) + +#ifdef CONFIG_AMEBASMART_I2C1 +#define NUM_OF_PINS_I2C1 2 +#else +#define NUM_OF_PINS_I2C1 0 +#endif + +#define I2C2_INDEX (I2C1_INDEX + NUM_OF_PINS_I2C1) + +#ifdef CONFIG_AMEBASMART_I2C2 +#define NUM_OF_PINS_I2C2 2 +#else +#define NUM_OF_PINS_I2C2 0 +#endif + +#define I2C_NEXT (I2C2_INDEX + NUM_OF_PINS_I2C2) + +#else +#define I2C_NEXT UART_NEXT + +#endif // CONFIG_AMEBASMART_I2C + +//=====================================SPI========================================= +#define SPI0_INDEX I2C_NEXT + +#ifdef CONFIG_AMEBASMART_SPI0 +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI0_CS) +#define NUM_OF_PINS_SPI0 5 +#else +#define NUM_OF_PINS_SPI0 4 +#endif +#else +#define NUM_OF_PINS_SPI0 0 +#endif + +#define SPI1_INDEX (SPI0_INDEX + NUM_OF_PINS_SPI0) + +#ifdef CONFIG_AMEBASMART_SPI1 +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI1_CS) +#define NUM_OF_PINS_SPI1 5 +#else +#define NUM_OF_PINS_SPI1 4 +#endif +#else +#define NUM_OF_PINS_SPI1 0 +#endif + +#define SPI_NEXT (SPI1_INDEX + NUM_OF_PINS_SPI1) + +//=====================================IST415========================================= +#define IST415_INDEX SPI_NEXT + +#if defined(CONFIG_TOUCH_IST415) +#define NUM_OF_PINS_IST415 2 +#else +#define NUM_OF_PINS_IST415 0 +#endif + +#define IST415_NEXT (IST415_INDEX + NUM_OF_PINS_IST415) + +//=====================================LCD_ST7789========================================= +#define LCD_ST7789_INDEX IST415_NEXT + +#ifdef CONFIG_LCD_ST7789 +#error Not supported revision +#else +#define NUM_OF_PINS_LCD_ST7789 0 +#endif + +#define LCD_ST7789_NEXT (LCD_ST7789_INDEX + NUM_OF_PINS_LCD_ST7789) + +//=====================================I2S========================================= +/* I2S2 pins configuration */ + +#define I2S2_INDEX LCD_ST7789_NEXT + +#ifdef CONFIG_AMEBASMART_I2S +#ifdef CONFIG_AMEBASMART_I2S2 +#define NUM_OF_PINS_I2S2 5 +#else +#define NUM_OF_PINS_I2S2 0 +#endif + +#define I2S3_INDEX (I2S2_INDEX + NUM_OF_PINS_I2S2) + +#ifdef CONFIG_AMEBASMART_I2S3 +#define NUM_OF_PINS_I2S3 5 +#else +#define NUM_OF_PINS_I2S3 0 +#endif + +#define I2S_NEXT (I2S3_INDEX + NUM_OF_PINS_I2S3) +#else +#define I2S_NEXT I2S2_INDEX +#endif + +//=====================================GPIO========================================= +#define GPIO_INDEX I2S_NEXT +#define NUM_OF_PINS_GPIO 3 +#define GPIO_NEXT (GPIO_INDEX + NUM_OF_PINS_GPIO) + +#endif // RTL8730E_AILP_BOARD_PINS_H diff --git a/os/board/rtl8730e/include/rtl8730e_ailpw_board_pins.h b/os/board/rtl8730e/include/rtl8730e_ailpw_board_pins.h new file mode 100644 index 0000000000..430af545ea --- /dev/null +++ b/os/board/rtl8730e/include/rtl8730e_ailpw_board_pins.h @@ -0,0 +1,174 @@ +/**************************************************************************** + * + * Copyright 2025 Samsung Electronics All Rights Reserved. + * + * 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. + * + ****************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ +/* File name: rtl8730e_ailpw_board_pins.h */ + +#ifndef RTL8730E_AILPW_BOARD_PINS_H +#define RTL8730E_AILPW_BOARD_PINS_H + +//========================================UART======================================= +#define UART0_INDEX 0 +#ifdef CONFIG_RTL8730E_UART0 +#define NUM_OF_PINS_UART0 2 +#else +#define NUM_OF_PINS_UART0 0 +#endif + +#define UART1_INDEX (UART0_INDEX + NUM_OF_PINS_UART0) + +#ifdef CONFIG_RTL8730E_UART1 +#define NUM_OF_PINS_UART1 2 +#else +#define NUM_OF_PINS_UART1 0 +#endif + +#define UART2_INDEX (UART1_INDEX + NUM_OF_PINS_UART1) + +#ifdef CONFIG_RTL8730E_UART2 +#define NUM_OF_PINS_UART2 4 +#else +#define NUM_OF_PINS_UART2 0 +#endif + +#define UART4_INDEX (UART2_INDEX + NUM_OF_PINS_UART2) + +#ifdef CONFIG_RTL8730E_UART4 +#define NUM_OF_PINS_UART4 2 +#else +#define NUM_OF_PINS_UART4 0 +#endif + +#define UART_NEXT (UART4_INDEX + NUM_OF_PINS_UART4) + +//========================================I2C======================================= +#define I2C0_INDEX UART_NEXT + +#ifdef CONFIG_AMEBASMART_I2C + +#ifdef CONFIG_AMEBASMART_I2C0 +#define NUM_OF_PINS_I2C0 2 +#else +#define NUM_OF_PINS_I2C0 0 +#endif + +#define I2C1_INDEX (I2C0_INDEX + NUM_OF_PINS_I2C0) + +#ifdef CONFIG_AMEBASMART_I2C1 +#define NUM_OF_PINS_I2C1 2 +#else +#define NUM_OF_PINS_I2C1 0 +#endif + +#define I2C2_INDEX (I2C1_INDEX + NUM_OF_PINS_I2C1) + +#ifdef CONFIG_AMEBASMART_I2C2 +#define NUM_OF_PINS_I2C2 2 +#else +#define NUM_OF_PINS_I2C2 0 +#endif + +#define I2C_NEXT (I2C2_INDEX + NUM_OF_PINS_I2C2) + +#else +#define I2C_NEXT UART_NEXT + +#endif // CONFIG_AMEBASMART_I2C + +//=====================================SPI========================================= +#define SPI0_INDEX I2C_NEXT + +#ifdef CONFIG_AMEBASMART_SPI0 +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI0_CS) +#define NUM_OF_PINS_SPI0 5 +#else +#define NUM_OF_PINS_SPI0 4 +#endif +#else +#define NUM_OF_PINS_SPI0 0 +#endif + +#define SPI1_INDEX (SPI0_INDEX + NUM_OF_PINS_SPI0) + +#ifdef CONFIG_AMEBASMART_SPI1 +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI1_CS) +#define NUM_OF_PINS_SPI1 5 +#else +#define NUM_OF_PINS_SPI1 4 +#endif +#else +#define NUM_OF_PINS_SPI1 0 +#endif + +#define SPI_NEXT (SPI1_INDEX + NUM_OF_PINS_SPI1) + +//=====================================IST415========================================= +#define IST415_INDEX SPI_NEXT + +#if defined(CONFIG_TOUCH_IST415) +#define NUM_OF_PINS_IST415 2 +#else +#define NUM_OF_PINS_IST415 0 +#endif + +#define IST415_NEXT (IST415_INDEX + NUM_OF_PINS_IST415) + +//=====================================LCD_ST7789========================================= +#define LCD_ST7789_INDEX IST415_NEXT + +#ifdef CONFIG_LCD_ST7789 +#error Not supported revision +#else +#define NUM_OF_PINS_LCD_ST7789 0 +#endif + +#define LCD_ST7789_NEXT (LCD_ST7789_INDEX + NUM_OF_PINS_LCD_ST7789) + +//=====================================I2S========================================= +/* I2S2 pins configuration */ + +#define I2S2_INDEX LCD_ST7789_NEXT + +#ifdef CONFIG_AMEBASMART_I2S +#ifdef CONFIG_AMEBASMART_I2S2 +#define NUM_OF_PINS_I2S2 5 +#else +#define NUM_OF_PINS_I2S2 0 +#endif + +#define I2S3_INDEX (I2S2_INDEX + NUM_OF_PINS_I2S2) + +#ifdef CONFIG_AMEBASMART_I2S3 +#define NUM_OF_PINS_I2S3 5 +#else +#define NUM_OF_PINS_I2S3 0 +#endif + +#define I2S_NEXT (I2S3_INDEX + NUM_OF_PINS_I2S3) +#else +#define I2S_NEXT I2S2_INDEX +#endif + +//=====================================GPIO========================================= +#define GPIO_INDEX I2S_NEXT +#define NUM_OF_PINS_GPIO 3 +#define GPIO_NEXT (GPIO_INDEX + NUM_OF_PINS_GPIO) + +#endif // RTL8730E_AIL_BOARD_PINS_H diff --git a/os/board/rtl8730e/src/Make.defs b/os/board/rtl8730e/src/Make.defs index 9723903119..6da0ac44a1 100644 --- a/os/board/rtl8730e/src/Make.defs +++ b/os/board/rtl8730e/src/Make.defs @@ -52,6 +52,10 @@ CSRCS += rtl8730e_boot.c CSRCS += rtl8730e_logtask.c CSRCS += rtl8730e_i2schar.c +CSRCS += rtl8730e_ail_board_pins.c +CSRCS += rtl8730e_ailp_board_pins.c +CSRCS += rtl8730e_ailpw_board_pins.c +CSRCS += rtl8730e_aid_board_pins.c ifeq ($(CONFIG_AUDIO_ALC1019),y) CSRCS += rtl8730e_alc1019.c diff --git a/os/board/rtl8730e/src/component/soc/amebad2/fwlib/ram_hp/ameba_pinmap.c b/os/board/rtl8730e/src/component/soc/amebad2/fwlib/ram_hp/ameba_pinmap.c index d3b356552f..23658fdc8d 100755 --- a/os/board/rtl8730e/src/component/soc/amebad2/fwlib/ram_hp/ameba_pinmap.c +++ b/os/board/rtl8730e/src/component/soc/amebad2/fwlib/ram_hp/ameba_pinmap.c @@ -20,6 +20,7 @@ */ #include "ameba_soc.h" +#include /** * @brief Config all pins to the right function and pull state based on pmap_func table. diff --git a/os/board/rtl8730e/src/component/usrcfg/rtl8730e/ameba_pinmapcfg.c b/os/board/rtl8730e/src/component/usrcfg/rtl8730e/ameba_pinmapcfg.c index c968ab50b9..9ca906e547 100755 --- a/os/board/rtl8730e/src/component/usrcfg/rtl8730e/ameba_pinmapcfg.c +++ b/os/board/rtl8730e/src/component/usrcfg/rtl8730e/ameba_pinmapcfg.c @@ -20,86 +20,13 @@ */ #include "ameba_soc.h" -#include "board_pins.h" +#include /* KM0 without KM4 ON: 4.30mA */ /* KM0 CG without KM4 ON: 135uA */ /* DSLP(RTC, KEYSCAN OFF, TOUCH OFF): 2uA under power supply, but 7uA under current meter */ /* DSLP(RTC+KEYSCAN, TOUCH OFF): 3uA under power supply */ /* DSLP(RTC+KEYSCAN+TOUCH): 3.9uA under power supply (peak is 3.7mA) */ -const PMAP_TypeDef pmap_func[] = { - PWR_PIN_00, - PWR_PIN_01, - PWR_PIN_02, - PWR_PIN_03, - PWR_PIN_04, - PWR_PIN_05, - PWR_PIN_06, - PWR_PIN_07, - PWR_PIN_08, - PWR_PIN_09, - PWR_PIN_10, - PWR_PIN_11, - PWR_PIN_12, - PWR_PIN_13, - PWR_PIN_14, - PWR_PIN_15, - PWR_PIN_16, - PWR_PIN_17, - PWR_PIN_18, - PWR_PIN_19, - PWR_PIN_20, - PWR_PIN_21, - PWR_PIN_22, - PWR_PIN_23, - PWR_PIN_24, - PWR_PIN_25, - PWR_PIN_26, - PWR_PIN_27, - PWR_PIN_28, - PWR_PIN_29, - PWR_PIN_30, - PWR_PIN_31, - PWR_PIN_32, - PWR_PIN_33, - PWR_PIN_34, - PWR_PIN_35, - PWR_PIN_36, - PWR_PIN_37, - PWR_PIN_38, - PWR_PIN_39, - PWR_PIN_40, - PWR_PIN_41, - PWR_PIN_42, - PWR_PIN_43, - PWR_PIN_44, - PWR_PIN_45, - PWR_PIN_46, - PWR_PIN_47, - PWR_PIN_48, - PWR_PIN_49, - PWR_PIN_50, - PWR_PIN_51, - PWR_PIN_52, - PWR_PIN_53, - PWR_PIN_54, - PWR_PIN_55, - PWR_PIN_56, - PWR_PIN_57, - PWR_PIN_58, - PWR_PIN_59, - PWR_PIN_60, - PWR_PIN_61, - PWR_PIN_62, - PWR_PIN_63, - PWR_PIN_64, - PWR_PIN_65, - PWR_PIN_66, - PWR_PIN_67, - PWR_PIN_68, - PWR_PIN_69, - PWR_PIN_70, - PWR_PIN_71, -}; +PMAP_TypeDef *pmap_func = pin_table; /******************* (C) COPYRIGHT 2016 Realtek Semiconductor *****END OF FILE****/ diff --git a/os/board/rtl8730e/src/component/usrcfg/rtl8730e/ameba_sleepcfg.c b/os/board/rtl8730e/src/component/usrcfg/rtl8730e/ameba_sleepcfg.c index 6b71e93897..faf7a03d6e 100755 --- a/os/board/rtl8730e/src/component/usrcfg/rtl8730e/ameba_sleepcfg.c +++ b/os/board/rtl8730e/src/component/usrcfg/rtl8730e/ameba_sleepcfg.c @@ -19,7 +19,7 @@ */ #include "ameba_soc.h" -#include "board_pins.h" +#include #ifdef CONFIG_SOC_PS_MODULE diff --git a/os/board/rtl8730e/src/component/usrcfg/rtl8730e/include/ameba_pinmapcfg.h b/os/board/rtl8730e/src/component/usrcfg/rtl8730e/include/ameba_pinmapcfg.h index 2279ae2b4d..49cb9fce7c 100644 --- a/os/board/rtl8730e/src/component/usrcfg/rtl8730e/include/ameba_pinmapcfg.h +++ b/os/board/rtl8730e/src/component/usrcfg/rtl8730e/include/ameba_pinmapcfg.h @@ -10,7 +10,6 @@ #ifndef _AMEBA_PINMAPCFG_H_ #define _AMEBA_PINMAPCFG_H_ -extern const PMAP_TypeDef pmap_func[]; - +extern PMAP_TypeDef *pmap_func; #endif /******************* (C) COPYRIGHT 2016 Realtek Semiconductor *****END OF FILE****/ diff --git a/os/board/rtl8730e/src/rtl8730e_aid_board_pins.c b/os/board/rtl8730e/src/rtl8730e_aid_board_pins.c new file mode 100644 index 0000000000..b0b3a49597 --- /dev/null +++ b/os/board/rtl8730e/src/rtl8730e_aid_board_pins.c @@ -0,0 +1,220 @@ +/**************************************************************************** + * + * Copyright 2025 Samsung Electronics All Rights Reserved. + * + * 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. + * + ****************************************************************************/ + +#include + +// ------------------- +// Unified Pin Table +// ------------------- + +const pin_desc_t pin_table[] = { + // ============ UART ============ +#ifdef CONFIG_RTL8730E_UART0 + // UART0 + {_PA_2, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifdef CONFIG_RTL8730E_UART1 + // UART1 + {_PA_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_5, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, +#endif +#ifdef CONFIG_RTL8730E_UART2 + // UART2 + {_PB_21, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_22, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, +#endif +#ifdef CONFIG_RTL8730E_UART4 + //UART4 + {_PB_23, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_24, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif + // ============ I2C ============ + // I2C +#ifdef CONFIG_AMEBASMART_I2C0 + // I2C0 + {_PB_30, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, +#endif +#ifdef CONFIG_AMEBASMART_I2C1 + // I2C1 + {_PA_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifdef CONFIG_AMEBASMART_I2C2 + //I2C2 + {_PA_29, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif + // ============ SPI ============ +#ifdef CONFIG_AMEBASMART_SPI0 + // SPI0 + {_PB_4, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MOSI + {_PB_3, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MISO + {_PB_6, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_5, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI0_CS) + {_PB_31, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k +#endif +#endif +#ifdef CONFIG_AMEBASMART_SPI1 + // SPI1 + {_PB_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_27, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_25, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_26, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI1_CS) + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA pull up 4.7k +#endif +#endif +#ifdef CONFIG_LCD_ST7789 + //LCD_ST7789 + {_PB_11, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA AILite+W LCD PWN + {_PA_9, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 10k + {_PA_10, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 10k +#endif +#ifdef CONFIG_AMEBASMART_I2S2 + //I2S + {NULL, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_21, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PA_16, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // RTK QA board need pull up + {_PB_10, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA AMP-I2S + {_PB_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA +#endif +#ifdef CONFIG_AMEBASMART_I2S3 + {_PA_15, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k + {_PA_14, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_CLK + {_PA_13, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_DATA + {_PB_11, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA AILite+W LCD PWN + {_PB_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 10k +#endif + //GPIO + {_PA_23, GPIO_MODE_IN, GPIO_PuPd_UP}, // SDA pull down 4.7k + {_PB_20, GPIO_MODE_OUT, GPIO_PuPd_UP}, // SDA pull down 10k + {_PB_22, GPIO_MODE_IN, GPIO_PuPd_DOWN}, // SDA pull up 10k; RTK TM_DIS + // ============ PWM ============ + // PWM + // PWM0 + {_PA_0, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_1, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_RTL8730E_UART0 + {_PA_2, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifndef CONFIG_RTL8730E_UART1 +#ifndef CONFIG_RTL8730E_BOARD_AID + {_PA_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_5, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, +#endif +#endif + {_PA_6, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_7, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_8, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_RTL8730E_UART1 + {_PA_9, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_10, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif + {_PA_12, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_AMEBASMART_I2S3 + {_PA_13, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_DATA + {_PA_14, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_CLK + {_PA_15, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k +#endif +#ifndef CONFIG_AMEBASMART_I2S2 + {_PA_16, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // RTK QA board need pull up +#endif + {_PA_17, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_18, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // NA + {_PA_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_21, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_22, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA AMP-RESET + {_PA_24, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 100k + {_PA_25, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 10k + {_PA_26, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_27, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_AMEBASMART_I2C2 + {_PA_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_29, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif + {_PA_30, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_31, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PB_0, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_1, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_2, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // NA +#ifndef CONFIG_AMEBASMART_SPI0 + {_PB_3, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MISO + {_PB_4, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MOSI + {_PB_5, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_6, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, +#endif + {_PB_7, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_8, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_9, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_AMEBASMART_I2S2 + {_PB_10, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA AMP-I2S +#endif +#ifndef CONFIG_AMEBASMART_I2S3 + {_PB_11, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA AILite+W LCD PWN +#endif + {_PB_12, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_13, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_14, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_15, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_16, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_17, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTL8730ELH + {_PB_18, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_RTL8730E_UART2 + {_PB_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_21, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_22, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifndef CONFIG_RTL8730E_UART4 + {_PB_23, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_24, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifndef CONFIG_AMEBASMART_SPI1 + {_PB_25, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_26, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_27, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#if !defined(CONFIG_SPI_CS) && !defined(CONFIG_AMEBASMART_SPI1_CS) + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA pull up 4.7k +#endif +#endif +#ifndef CONFIG_AMEBASMART_I2C0 + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_30, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, +#endif +#ifndef CONFIG_AMEBASMART_SPI0 +#if !defined(CONFIG_SPI_CS) && !defined(CONFIG_AMEBASMART_SPI0_CS) + {_PB_31, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k +#endif +#endif + {_PC_0, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 4.7k + {_PC_1, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_2, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTK Int-Flash SPI_FLASH_CLK pull down for PG or 50uA + {_PC_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_5, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_6, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_CS + {_PNC, GPIO_PuPd_KEEP, GPIO_PuPd_KEEP}, // table end +}; diff --git a/os/board/rtl8730e/src/rtl8730e_ail_board_pins.c b/os/board/rtl8730e/src/rtl8730e_ail_board_pins.c new file mode 100644 index 0000000000..9bab565604 --- /dev/null +++ b/os/board/rtl8730e/src/rtl8730e_ail_board_pins.c @@ -0,0 +1,218 @@ +/**************************************************************************** + * + * Copyright 2025 Samsung Electronics All Rights Reserved. + * + * 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. + * + ****************************************************************************/ + +#include + +// ------------------- +// Unified Pin Table +// ------------------- + +const pin_desc_t pin_table[] = { + // ============ UART ============ +#ifdef CONFIG_RTL8730E_UART0 + // UART0 + {_PA_2, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifdef CONFIG_RTL8730E_UART1 + // UART1 + {_PA_9, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_10, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifdef CONFIG_RTL8730E_UART2 + // UART2 + {_PB_21, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_22, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, +#endif +#ifdef CONFIG_RTL8730E_UART4 + //UART4 + {_PB_23, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_24, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif + // ============ I2C ============ + // I2C +#ifdef CONFIG_AMEBASMART_I2C0 + // I2C0 + {_PB_30, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, +#endif +#ifdef CONFIG_AMEBASMART_I2C1 + // I2C1 + {_PA_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifdef CONFIG_AMEBASMART_I2C2 + //I2C2 + {_PA_29, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif + // ============ SPI ============ +#ifdef CONFIG_AMEBASMART_SPI0 + // SPI0 + {_PB_4, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MOSI + {_PB_3, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MISO + {_PB_6, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_5, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI0_CS) + {_PB_31, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k +#endif +#endif +#ifdef CONFIG_AMEBASMART_SPI1 + // SPI1 + {_PB_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_27, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_25, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_26, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI1_CS) + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA pull up 4.7k +#endif +#endif + // ============ IST415 ========= +#if defined(CONFIG_TOUCH_IST415) + //IST415 + {_PA_5, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull up 4.7k & pull down 9.1k + {_PA_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 4.7k +#endif +#ifdef CONFIG_AMEBASMART_I2S2 + //I2S + {NULL, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_21, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PA_16, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // RTK QA board need pull up + {_PB_10, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA AMP-I2S + {_PB_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA +#endif +#ifdef CONFIG_AMEBASMART_I2S3 + {_PA_15, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k + {_PA_14, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_CLK + {_PA_13, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_DATA + {_PB_11, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA AILite+W LCD PWN + {_PB_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 10k +#endif + //GPIO + {_PA_23, GPIO_MODE_IN, GPIO_PuPd_UP}, // SDA pull down 4.7k + {_PB_20, GPIO_MODE_OUT, GPIO_PuPd_UP}, // SDA pull down 10k + {_PB_22, GPIO_MODE_IN, GPIO_PuPd_DOWN}, // SDA pull up 10k; RTK TM_DIS + // ============ PWM ============ + // PWM + // PWM0 + {_PA_0, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_1, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_RTL8730E_UART0 + {_PA_2, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifndef CONFIG_RTL8730E_UART1 +#ifndef CONFIG_RTL8730E_BOARD_AID + {_PA_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_5, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, +#endif +#endif + {_PA_6, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_7, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_8, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_RTL8730E_UART1 +#endif + {_PA_12, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_AMEBASMART_I2S3 + {_PA_13, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_DATA + {_PA_14, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_CLK + {_PA_15, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k +#endif +#ifndef CONFIG_AMEBASMART_I2S2 + {_PA_16, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // RTK QA board need pull up +#endif + {_PA_17, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_18, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // NA + {_PA_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_21, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_22, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA AMP-RESET + {_PA_24, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 100k + {_PA_25, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 10k + {_PA_26, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_27, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_AMEBASMART_I2C2 + {_PA_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_29, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif + {_PA_30, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_31, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PB_0, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_1, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_2, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // NA +#ifndef CONFIG_AMEBASMART_SPI0 + {_PB_3, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MISO + {_PB_4, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MOSI + {_PB_5, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_6, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, +#endif + {_PB_7, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_8, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_9, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_AMEBASMART_I2S2 + {_PB_10, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA AMP-I2S +#endif +#ifndef CONFIG_AMEBASMART_I2S3 + {_PB_11, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA AILite+W LCD PWN +#endif + {_PB_12, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_13, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_14, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_15, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_16, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_17, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTL8730ELH + {_PB_18, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_RTL8730E_UART2 + {_PB_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_21, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_22, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifndef CONFIG_RTL8730E_UART4 + {_PB_23, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_24, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifndef CONFIG_AMEBASMART_SPI1 + {_PB_25, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_26, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_27, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#if !defined(CONFIG_SPI_CS) && !defined(CONFIG_AMEBASMART_SPI1_CS) + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA pull up 4.7k +#endif +#endif +#ifndef CONFIG_AMEBASMART_I2C0 + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_30, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, +#endif +#ifndef CONFIG_AMEBASMART_SPI0 +#if !defined(CONFIG_SPI_CS) && !defined(CONFIG_AMEBASMART_SPI0_CS) + {_PB_31, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k +#endif +#endif + {_PC_0, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 4.7k + {_PC_1, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_2, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTK Int-Flash SPI_FLASH_CLK pull down for PG or 50uA + {_PC_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_5, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_6, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_CS + {_PNC, GPIO_PuPd_KEEP, GPIO_PuPd_KEEP}, // table end +}; diff --git a/os/board/rtl8730e/src/rtl8730e_ailp_board_pins.c b/os/board/rtl8730e/src/rtl8730e_ailp_board_pins.c new file mode 100644 index 0000000000..d402eed878 --- /dev/null +++ b/os/board/rtl8730e/src/rtl8730e_ailp_board_pins.c @@ -0,0 +1,214 @@ +/**************************************************************************** + * + * Copyright 2025 Samsung Electronics All Rights Reserved. + * + * 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. + * + ****************************************************************************/ + +#include + +// ------------------- +// Unified Pin Table +// ------------------- + +const pin_desc_t pin_table[] = { + // ============ UART ============ +#ifdef CONFIG_RTL8730E_UART0 + // UART0 + {_PA_2, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifdef CONFIG_RTL8730E_UART1 + // UART1 + {_PA_9, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_10, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifdef CONFIG_RTL8730E_UART2 + // UART2 + {_PB_21, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_22, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, +#endif +#ifdef CONFIG_RTL8730E_UART4 + //UART4 + {_PB_23, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_24, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif + // ============ I2C ============ + // I2C +#ifdef CONFIG_AMEBASMART_I2C0 + // I2C0 + {_PB_30, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, +#endif +#ifdef CONFIG_AMEBASMART_I2C1 + // I2C1 + {_PA_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifdef CONFIG_AMEBASMART_I2C2 + //I2C2 + {_PA_29, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif + // ============ SPI ============ +#ifdef CONFIG_AMEBASMART_SPI0 + // SPI0 + {_PB_4, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MOSI + {_PB_3, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MISO + {_PB_6, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_5, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI0_CS) + {_PB_31, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k +#endif +#endif +#ifdef CONFIG_AMEBASMART_SPI1 + // SPI1 + {_PB_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_27, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_25, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_26, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI1_CS) + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA pull up 4.7k +#endif +#endif + // ============ IST415 ========= +#if defined(CONFIG_TOUCH_IST415) + //IST415 + {_PA_5, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull up 4.7k & pull down 9.1k + {_PA_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 4.7k +#endif +#ifdef CONFIG_AMEBASMART_I2S2 + //I2S + {NULL, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_21, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PA_16, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // RTK QA board need pull up + {_PB_10, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA AMP-I2S + {_PB_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA +#endif +#ifdef CONFIG_AMEBASMART_I2S3 + {_PA_15, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k + {_PA_14, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_CLK + {_PA_13, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_DATA + {_PB_11, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA AILite+W LCD PWN + {_PB_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 10k +#endif + //GPIO + {_PA_23, GPIO_MODE_IN, GPIO_PuPd_UP}, // SDA pull down 4.7k + {_PB_20, GPIO_MODE_OUT, GPIO_PuPd_UP}, // SDA pull down 10k + {_PB_22, GPIO_MODE_IN, GPIO_PuPd_DOWN}, // SDA pull up 10k; RTK TM_DIS + // ============ PWM ============ + // PWM + // PWM0 + {_PA_0, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_1, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_RTL8730E_UART0 + {_PA_2, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifndef CONFIG_RTL8730E_UART1 + {_PA_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_5, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, +#endif + {_PA_6, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_7, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_8, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_12, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_AMEBASMART_I2S3 + {_PA_13, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_DATA + {_PA_14, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_CLK + {_PA_15, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k +#endif +#ifndef CONFIG_AMEBASMART_I2S2 + {_PA_16, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // RTK QA board need pull up +#endif + {_PA_17, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_18, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // NA + {_PA_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_21, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_22, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA AMP-RESET + {_PA_24, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 100k + {_PA_25, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 10k + {_PA_26, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_27, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_AMEBASMART_I2C2 + {_PA_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_29, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif + {_PA_30, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_31, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PB_0, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_1, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_2, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // NA +#ifndef CONFIG_AMEBASMART_SPI0 + {_PB_3, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MISO + {_PB_4, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MOSI + {_PB_5, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_6, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, +#endif + {_PB_7, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_8, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_9, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_AMEBASMART_I2S2 + {_PB_10, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA AMP-I2S +#endif +#ifndef CONFIG_AMEBASMART_I2S3 + {_PB_11, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA AILite+W LCD PWN +#endif + {_PB_12, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_13, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_14, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_15, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_16, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_17, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTL8730ELH + {_PB_18, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_RTL8730E_UART2 + {_PB_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_21, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_22, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifndef CONFIG_RTL8730E_UART4 + {_PB_23, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_24, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifndef CONFIG_AMEBASMART_SPI1 + {_PB_25, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_26, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_27, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#if !defined(CONFIG_SPI_CS) && !defined(CONFIG_AMEBASMART_SPI1_CS) + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA pull up 4.7k +#endif +#endif +#ifndef CONFIG_AMEBASMART_I2C0 + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_30, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, +#endif +#ifndef CONFIG_AMEBASMART_SPI0 +#if !defined(CONFIG_SPI_CS) && !defined(CONFIG_AMEBASMART_SPI0_CS) + {_PB_31, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k +#endif +#endif + {_PC_0, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 4.7k + {_PC_1, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_2, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTK Int-Flash SPI_FLASH_CLK pull down for PG or 50uA + {_PC_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_5, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_6, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_CS + {_PNC, GPIO_PuPd_KEEP, GPIO_PuPd_KEEP}, // table end +}; diff --git a/os/board/rtl8730e/src/rtl8730e_ailpw_board_pins.c b/os/board/rtl8730e/src/rtl8730e_ailpw_board_pins.c new file mode 100644 index 0000000000..e9ac9b7765 --- /dev/null +++ b/os/board/rtl8730e/src/rtl8730e_ailpw_board_pins.c @@ -0,0 +1,216 @@ +/**************************************************************************** + * + * Copyright 2025 Samsung Electronics All Rights Reserved. + * + * 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. + * + ****************************************************************************/ + +#include + +// ------------------- +// Unified Pin Table +// ------------------- + +const pin_desc_t pin_table[] = { + // ============ UART ============ +#ifdef CONFIG_RTL8730E_UART0 + // UART0 + {_PA_2, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifdef CONFIG_RTL8730E_UART1 + // UART1 + {_PA_9, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_10, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifdef CONFIG_RTL8730E_UART2 + // UART2 + {_PB_21, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_22, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, +#endif +#ifdef CONFIG_RTL8730E_UART4 + //UART4 + {_PB_23, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_24, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif + // ============ I2C ============ + // I2C +#ifdef CONFIG_AMEBASMART_I2C0 + // I2C0 + {_PB_30, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, +#endif +#ifdef CONFIG_AMEBASMART_I2C1 + // I2C1 + {_PA_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifdef CONFIG_AMEBASMART_I2C2 + //I2C2 + {_PA_29, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif + // ============ SPI ============ +#ifdef CONFIG_AMEBASMART_SPI0 + // SPI0 + {_PB_4, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MOSI + {_PB_3, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MISO + {_PB_6, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_5, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI0_CS) + {_PB_31, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k +#endif +#endif +#ifdef CONFIG_AMEBASMART_SPI1 + // SPI1 + {_PB_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_27, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_25, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_26, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#if defined(CONFIG_SPI_CS) && defined(CONFIG_AMEBASMART_SPI1_CS) + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA pull up 4.7k +#endif +#endif + // ============ IST415 ========= +#if defined(CONFIG_TOUCH_IST415) + //IST415 + {_PA_5, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull up 4.7k & pull down 9.1k + {_PA_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 4.7k +#endif +#ifdef CONFIG_AMEBASMART_I2S2 + //I2S + {NULL, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_21, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PA_16, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // RTK QA board need pull up + {_PB_10, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA AMP-I2S + {_PB_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA +#endif +#ifdef CONFIG_AMEBASMART_I2S3 + {_PA_15, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k + {_PA_14, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_CLK + {_PA_13, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_DATA + {_PB_11, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA AILite+W LCD PWN + {_PB_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 10k +#endif + //GPIO + {_PA_23, GPIO_MODE_IN, GPIO_PuPd_UP}, // SDA pull down 4.7k + {_PB_20, GPIO_MODE_OUT, GPIO_PuPd_UP}, // SDA pull down 10k + {_PB_22, GPIO_MODE_IN, GPIO_PuPd_DOWN}, // SDA pull up 10k; RTK TM_DIS + // ============ PWM ============ + // PWM + // PWM0 + {_PA_0, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_1, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_RTL8730E_UART0 + {_PA_2, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifndef CONFIG_RTL8730E_UART1 +#ifndef CONFIG_RTL8730E_BOARD_AID + {_PA_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_5, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, +#endif +#endif + {_PA_6, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_7, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_8, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_12, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_AMEBASMART_I2S3 + {_PA_13, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_DATA + {_PA_14, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK SWD_CLK + {_PA_15, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k +#endif +#ifndef CONFIG_AMEBASMART_I2S2 + {_PA_16, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // RTK QA board need pull up +#endif + {_PA_17, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_18, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // NA + {_PA_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_21, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_22, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA AMP-RESET + {_PA_24, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 100k + {_PA_25, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 10k + {_PA_26, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PA_27, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_AMEBASMART_I2C2 + {_PA_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PA_29, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif + {_PA_30, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PA_31, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // NA + {_PB_0, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_1, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_2, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // NA +#ifndef CONFIG_AMEBASMART_SPI0 + {_PB_3, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MISO + {_PB_4, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA NPU SPI0_MOSI + {_PB_5, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_6, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, +#endif + {_PB_7, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_8, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_9, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_AMEBASMART_I2S2 + {_PB_10, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA AMP-I2S +#endif +#ifndef CONFIG_AMEBASMART_I2S3 + {_PB_11, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA AILite+W LCD PWN +#endif + {_PB_12, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_13, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_14, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_15, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_16, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTL8730ELH + {_PB_17, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTL8730ELH + {_PB_18, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // RTL8730ELH +#ifndef CONFIG_RTL8730E_UART2 + {_PB_19, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_20, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_21, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_22, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifndef CONFIG_RTL8730E_UART4 + {_PB_23, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_24, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#endif +#ifndef CONFIG_AMEBASMART_SPI1 + {_PB_25, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, + {_PB_26, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_27, GPIO_PuPd_UP, GPIO_PuPd_UP}, + {_PB_28, GPIO_PuPd_UP, GPIO_PuPd_UP}, +#if !defined(CONFIG_SPI_CS) && !defined(CONFIG_AMEBASMART_SPI1_CS) + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, // SDA pull up 4.7k +#endif +#endif +#ifndef CONFIG_AMEBASMART_I2C0 + {_PB_29, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, + {_PB_30, GPIO_PuPd_NOPULL, GPIO_PuPd_NOPULL}, +#endif +#ifndef CONFIG_AMEBASMART_SPI0 +#if !defined(CONFIG_SPI_CS) && !defined(CONFIG_AMEBASMART_SPI0_CS) + {_PB_31, GPIO_PuPd_DOWN, GPIO_PuPd_DOWN}, // SDA pull down 4.7k +#endif +#endif + {_PC_0, GPIO_PuPd_UP, GPIO_PuPd_UP}, // SDA pull up 4.7k + {_PC_1, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_2, GPIO_PuPd_UP, GPIO_PuPd_DOWN}, // RTK Int-Flash SPI_FLASH_CLK pull down for PG or 50uA + {_PC_3, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_4, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_5, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_DATA + {_PC_6, GPIO_PuPd_UP, GPIO_PuPd_UP}, // RTK Int-Flash SPI_FLASH_CS + {_PNC, GPIO_PuPd_KEEP, GPIO_PuPd_KEEP}, // table end +}; diff --git a/os/board/rtl8730e/src/rtl8730e_boot.c b/os/board/rtl8730e/src/rtl8730e_boot.c index c2ff5a4c06..07d41902ba 100644 --- a/os/board/rtl8730e/src/rtl8730e_boot.c +++ b/os/board/rtl8730e/src/rtl8730e_boot.c @@ -79,7 +79,7 @@ #include "common.h" #endif -#include "board_pins.h" +#include #include "up_internal.h" #include "amebasmart_boot.h" #include "ameba_soc.h" @@ -106,6 +106,8 @@ extern int i2schar_devinit(void); /************************************************************************************ * Public Functions ************************************************************************************/ + + #ifdef CONFIG_PRODCONFIG static int up_check_prod(void) { @@ -251,6 +253,7 @@ void board_i2c_initialize(void) } #endif #endif + #ifdef CONFIG_PM i2c_pminitialize(); #endif @@ -263,17 +266,11 @@ void board_gpio_initialize(void) int i; struct gpio_lowerhalf_s *lower; - struct { - u32 pinname; - u32 pinmode; - u32 pinpull; - - } pins[] = GPIO_PIN_LIST; - - for (i = 0; i < sizeof(pins) / sizeof(*pins); i++) { - lower = amebasmart_gpio_lowerhalf(pins[i].pinname, pins[i].pinmode, pins[i].pinpull); - gpio_register(pins[i].pinname, lower); + for (i = 0; i < GPIO_PIN_SIZE; i++) { + lower = amebasmart_gpio_lowerhalf(GPIO_PINS(GPIO, i), GPIO_PIN_NORMALPULL(GPIO, i), GPIO_PIN_SLEEPPULL(GPIO, i)); + gpio_register(GPIO_PINS(GPIO, i), lower); } + #ifdef CONFIG_PM gpio_pminitialize(); #endif @@ -432,6 +429,7 @@ void board_initialize(void) #endif #if defined(CONFIG_TOUCH_IST415) + /* Initialize touch driver */ rtl8730e_ist415_initialize(); #endif @@ -511,4 +509,3 @@ int board_app_initialize(void) { return OK; } - diff --git a/os/board/rtl8730e/src/rtl8730e_ist415.c b/os/board/rtl8730e/src/rtl8730e_ist415.c index ff45732522..f2ea9c09e2 100644 --- a/os/board/rtl8730e/src/rtl8730e_ist415.c +++ b/os/board/rtl8730e/src/rtl8730e_ist415.c @@ -32,7 +32,7 @@ #include "objects.h" #include "gpio_irq_api.h" #include "PinNames.h" -#include "board_pins.h" +#include #include "gpio_api.h" #define PIN_LOW 0 @@ -119,23 +119,23 @@ static void rtl8730e_ist415_power_off(struct ist415_config_s *dev) struct rtl8730e_ist415_s *priv = (struct rtl8730e_ist415_s *)dev->priv; struct amebasmart_i2c_priv_s *priv_i2c = (struct amebasmart_i2c_priv_s *)priv->i2c; amebasmart_i2c_deinit(priv_i2c); - GPIO_WriteBit(IST415_GPIO_RESET_PIN, PIN_LOW); + GPIO_WriteBit(IST415_PIN(IST415, IST415_RESET_PIN), PIN_LOW); } static void rtl8730e_ist415_power_on(struct ist415_config_s *dev) { struct rtl8730e_ist415_s *priv = (struct rtl8730e_ist415_s *)dev->priv; struct amebasmart_i2c_priv_s *priv_i2c = (struct amebasmart_i2c_priv_s *)priv->i2c; - GPIO_WriteBit(IST415_GPIO_RESET_PIN, PIN_HIGH); + GPIO_WriteBit(IST415_PIN(IST415, IST415_RESET_PIN), PIN_HIGH); DelayMs(1); /* Wait for stable voltage before i2c commands issued */ amebasmart_i2c_init(priv_i2c); } static void rtl8730e_ist415_gpio_init(void) { - Pinmux_Config(IST415_GPIO_RESET_PIN, PINMUX_FUNCTION_GPIO); + Pinmux_Config(IST415_PIN(IST415, IST415_RESET_PIN), PINMUX_FUNCTION_GPIO); GPIO_InitTypeDef TouchResetPin; - TouchResetPin.GPIO_Pin = IST415_GPIO_RESET_PIN; + TouchResetPin.GPIO_Pin = IST415_PIN(IST415, IST415_RESET_PIN); TouchResetPin.GPIO_PuPd = GPIO_PuPd_NOPULL; TouchResetPin.GPIO_Mode = GPIO_Mode_OUT; GPIO_Init(&TouchResetPin); @@ -175,7 +175,7 @@ void rtl8730e_ist415_initialize(void) } priv->i2c = i2c; /* Workaround: IC20 write hang issue */ - gpio_irq_init(&priv->data_ready, IST415_GPIO_I2C_PIN, rtl8730e_ist415_irq_handler, (uint32_t)0); + gpio_irq_init(&priv->data_ready, IST415_PIN(IST415, IST415_I2C_PIN), rtl8730e_ist415_irq_handler, (uint32_t)0); gpio_irq_set(&priv->data_ready, IRQ_FALL, 1); if (ist415_initialize(TOUCH_DEV_PATH, i2c, dev) < 0) { diff --git a/os/board/rtl8730e/src/rtl8730e_st7789.c b/os/board/rtl8730e/src/rtl8730e_st7789.c index 8e6329de47..59d5e4c410 100644 --- a/os/board/rtl8730e/src/rtl8730e_st7789.c +++ b/os/board/rtl8730e/src/rtl8730e_st7789.c @@ -24,7 +24,7 @@ #include #include "objects.h" #include "PinNames.h" -#include "board_pins.h" +#include #include "gpio_api.h" #include "pwmout_api.h" @@ -112,4 +112,3 @@ void rtl8730_st7789_initialize(void) lcddbg("LCD driver register success\n"); } } -