This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 214d02f417119997bebfc162dc8b622a5f361446 Author: dechao_gong <[email protected]> AuthorDate: Thu Aug 13 10:09:28 2026 +0800 arch/arm/rtl8720f: add SPI master driver support Wire the shared Ameba SPI (DesignWare SSI) driver (arch/arm/src/common/ameba/ameba_spi.c) into the RTL8720F build and expose the SPI0/SPI1 masters at /dev/spiN. Add the per-chip ameba_spi_chip.h with the RTL8720F controller bases (0x401C1000 / 0x401C2000, non-secure aliases), the group-0 SPI clock masks, the per-signal crossbar pad-mux codes (RTL8720F has no generic PINMUX_FUNCTION_SPI), and the SYS_PLL-based ip_clk computation (REG_LSYS_CKD_SYS_PLL_GRP0 HPERI divider). The chip header declares the SYS_PLL_ClkGet() query its AMEBA_SPI_IPCLK() uses, since RTL8720F has no PLL_ClkGet(). Compile the common driver and the SDK fwlib SSI RAM source under CONFIG_AMEBA_SPI, register the bus in the board bring-up, and add an "spi" board configuration exercising the system/spi spitool. Assisted-by: Claude <[email protected]> Signed-off-by: dechao_gong <[email protected]> --- .../arm/rtl8720f/boards/rtl8720f_evb/index.rst | 19 ++++ arch/arm/src/rtl8720f/CMakeLists.txt | 12 +++ arch/arm/src/rtl8720f/Kconfig | 5 +- arch/arm/src/rtl8720f/Make.defs | 4 + arch/arm/src/rtl8720f/ameba_board.mk | 8 ++ arch/arm/src/rtl8720f/ameba_spi_chip.h | 108 +++++++++++++++++++++ .../rtl8720f/rtl8720f_evb/configs/spi/defconfig | 50 ++++++++++ .../arm/rtl8720f/rtl8720f_evb/src/CMakeLists.txt | 7 +- boards/arm/rtl8720f/rtl8720f_evb/src/Makefile | 6 +- .../rtl8720f/rtl8720f_evb/src/rtl8720f_bringup.c | 10 ++ .../rtl8720f_evb/src/rtl8720f_rtl8720f_evb.h | 12 +++ .../arm/rtl8720f/rtl8720f_evb/src/rtl8720f_spi.c | 100 +++++++++++++++++++ 12 files changed, 337 insertions(+), 4 deletions(-) diff --git a/Documentation/platforms/arm/rtl8720f/boards/rtl8720f_evb/index.rst b/Documentation/platforms/arm/rtl8720f/boards/rtl8720f_evb/index.rst index 183664de23e..ad657b4a4b5 100644 --- a/Documentation/platforms/arm/rtl8720f/boards/rtl8720f_evb/index.rst +++ b/Documentation/platforms/arm/rtl8720f/boards/rtl8720f_evb/index.rst @@ -37,6 +37,8 @@ Supported in this NuttX port: directly on the SDK fwlib register layer * I2C master buses exposed as ``/dev/i2cN`` character devices, driven directly on the SDK fwlib register layer +* SPI master buses exposed as ``/dev/spiN`` character devices, driven directly + on the SDK fwlib register layer Buttons and LEDs ================ @@ -106,6 +108,23 @@ pull-ups on SCL/SDA. Probe a bus with the tool:: nsh> i2c dev -b 0 0x03 0x77 # scan /dev/i2c0 for devices +spi +--- + +Minimal NSH with the SPI master driver and the ``spi`` tool +(``system/spi``) enabled (no Wi-Fi). The board registers SPI0 at +``/dev/spi0`` from its table (see +``boards/arm/rtl8720f/rtl8720f_evb/src/rtl8720f_spi.c``) with CLK/MOSI/MISO on +PA14/PA15/PA16 and a software chip-select on PA17. Edit that table -- +controller, CLK/MOSI/MISO pads and CS pad -- to match a board's wiring; the +pads use the same ``AMEBA_PA()`` encoding as the GPIO table (RTL8720F drives +all GPIO through a single port A controller) and are muxed to the SPI function +through the SDK ROM, while the chip-select is driven as a plain GPIO. Note +that not every pad can carry every SPI signal -- pick pads the SDK pin mux +actually routes to the controller. Exercise a bus with the tool:: + + nsh> spi exch -b 0 -x 4 deadbeef # full-duplex transfer on /dev/spi0 + nsh --- diff --git a/arch/arm/src/rtl8720f/CMakeLists.txt b/arch/arm/src/rtl8720f/CMakeLists.txt index a972f9765c0..4f705205b7a 100644 --- a/arch/arm/src/rtl8720f/CMakeLists.txt +++ b/arch/arm/src/rtl8720f/CMakeLists.txt @@ -58,6 +58,10 @@ if(CONFIG_AMEBA_I2C) list(APPEND SRCS ${AMEBA_COMMON}/ameba_i2c.c) endif() +if(CONFIG_AMEBA_SPI) + list(APPEND SRCS ${AMEBA_COMMON}/ameba_spi.c) +endif() + target_include_directories(arch PRIVATE ${AMEBA_COMMON}) target_sources(arch PRIVATE ${SRCS}) @@ -119,6 +123,14 @@ if(CONFIG_AMEBA_I2C) list(APPEND AMEBA_FWLIB_SRCS ${AMEBA_SOC}/fwlib/ram_common/ameba_i2c.c) endif() +# SPI (DesignWare SSI) register layer. The SPI driver +# (arch/.../common/ameba/ameba_spi.c) calls the fwlib SSI API; the data tables +# and helpers it indexes live in this RAM source and must be compiled in +# (--gc-sections drops the unused DMA/interrupt helpers). +if(CONFIG_AMEBA_SPI) + list(APPEND AMEBA_FWLIB_SRCS ${AMEBA_SOC}/fwlib/ram_common/ameba_spi.c) +endif() + # Silence a couple of warnings the vendored SDK sources trip under NuttX's # warning set, scoped to this fwlib compile only (never relaxing NuttX's own): # -Wno-int-conversion: the SDK passes NULL to irq_register()'s u32 "Data" diff --git a/arch/arm/src/rtl8720f/Kconfig b/arch/arm/src/rtl8720f/Kconfig index 76e9c1d74bc..124b2f0131e 100644 --- a/arch/arm/src/rtl8720f/Kconfig +++ b/arch/arm/src/rtl8720f/Kconfig @@ -82,8 +82,9 @@ config RTL8720F_FLASH_FS endmenu # RTL8720F Storage -# Shared Ameba peripheral drivers (GPIO, ...) live in the common IC-agnostic -# tree and are configured through one Kconfig reused by every Ameba chip. +# Shared Ameba peripheral drivers (GPIO, UART, I2C, SPI, ...) live in the +# common IC-agnostic tree and are configured through one Kconfig reused by +# every Ameba chip. source "arch/arm/src/common/ameba/Kconfig" diff --git a/arch/arm/src/rtl8720f/Make.defs b/arch/arm/src/rtl8720f/Make.defs index 1069e461e9c..7f56d819fe4 100644 --- a/arch/arm/src/rtl8720f/Make.defs +++ b/arch/arm/src/rtl8720f/Make.defs @@ -68,6 +68,10 @@ ifeq ($(CONFIG_AMEBA_I2C),y) CHIP_CSRCS += ameba_i2c.c endif +ifeq ($(CONFIG_AMEBA_SPI),y) +CHIP_CSRCS += ameba_spi.c +endif + ############################################################################ # Realtek RTL8720F SDK integration # diff --git a/arch/arm/src/rtl8720f/ameba_board.mk b/arch/arm/src/rtl8720f/ameba_board.mk index bd7a629c6f0..7d686573d29 100644 --- a/arch/arm/src/rtl8720f/ameba_board.mk +++ b/arch/arm/src/rtl8720f/ameba_board.mk @@ -136,6 +136,14 @@ ifeq ($(CONFIG_AMEBA_I2C),y) AMEBA_FWLIB_SRCS += $(AMEBA_SOC)/fwlib/ram_common/ameba_i2c.c endif +# SPI (DesignWare SSI) register layer. The SPI driver +# (arch/.../common/ameba/ameba_spi.c) calls the fwlib SSI API; the data tables +# and helpers it indexes live in this RAM source and must be compiled in +# (--gc-sections drops the unused DMA/interrupt helpers). +ifeq ($(CONFIG_AMEBA_SPI),y) +AMEBA_FWLIB_SRCS += $(AMEBA_SOC)/fwlib/ram_common/ameba_spi.c +endif + # -Wno-int-conversion: the vendored SDK passes NULL to irq_register()'s u32 # "Data" (interrupt context) argument in many places -- an intentional # NULL-as-context idiom. Silence -Wint-conversion for the SDK fwlib sources diff --git a/arch/arm/src/rtl8720f/ameba_spi_chip.h b/arch/arm/src/rtl8720f/ameba_spi_chip.h new file mode 100644 index 00000000000..809fdac1358 --- /dev/null +++ b/arch/arm/src/rtl8720f/ameba_spi_chip.h @@ -0,0 +1,108 @@ +/**************************************************************************** + * arch/arm/src/rtl8720f/ameba_spi_chip.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_SRC_RTL8720F_AMEBA_SPI_CHIP_H +#define __ARCH_ARM_SRC_RTL8720F_AMEBA_SPI_CHIP_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <stdint.h> + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Per-chip SPI wiring for RTL8720F. The shared driver + * (arch/arm/src/common/ameba/ameba_spi.c) includes this header to learn how + * many SPI (DesignWare SSI) controllers the chip exposes and, for each, its + * register base, peripheral-clock masks and crossbar pad-mux codes. See the + * amebadplus (rtl8721dx) header for the field-by-field contract; only the + * RTL8720F-specific values (from the RTL8720F fwlib) are noted here: + * + * 1. Two high-speed SSI masters, SPI0 and SPI1, in the PERI_HCLK domain. + * The bases below are the NON-secure aliases (SPI0/1_REG_BASE in + * hal_platform.h, 0x401C_1000 / 0x401C_2000); the secure aliases + * (0x501C_xxxx) must not be used from the non-secure world. + * + * 2. APBPeriph_SPIx (function) and APBPeriph_SPIx_CLOCK masks live in + * REG_LSYS_FEN_GRP0 / REG_LSYS_CKE_GRP0 (group selector bit30 == 0), + * SPI0 at bit14 and SPI1 at bit15 -- identical to amebadplus. + * + * 3. Pad mux: RTL8720F has NO generic PINMUX_FUNCTION_SPI code, so every + * signal uses its per-signal code from ameba_pinmux.h + * (SPI0 CLK/MISO/MOSI/CS = 37/38/39/40, SPI1 = 41/42/43/44). The CS + * entries are informational: this driver drives CS as a plain GPIO. + */ + +#define AMEBA_NSPI 2 + +/* NON-secure SPI register bases (SPI0_REG_BASE / SPI1_REG_BASE). */ + +#define AMEBA_SPI_BASES { 0x401c1000ul, 0x401c2000ul } + +/* APBPeriph_SPIx (function) and APBPeriph_SPIx_CLOCK masks. Equal on this + * chip; kept as two lists so chips where they differ can supply both. The + * group selector (bit30) is 0 for the SPI block on RTL8720F. + */ + +#define AMEBA_SPI_APBPERIPH \ + { (((uint32_t)0 << 30) | ((uint32_t)1 << 14)), \ + (((uint32_t)0 << 30) | ((uint32_t)1 << 15)) } + +#define AMEBA_SPI_APBPERIPH_CLK \ + { (((uint32_t)0 << 30) | ((uint32_t)1 << 14)), \ + (((uint32_t)0 << 30) | ((uint32_t)1 << 15)) } + +/* Crossbar pad-mux function codes, one list per signal, indexed by + * controller. RTL8720F uses per-signal codes for both controllers: + * SPI0 CLK=37 / MISO=38 / MOSI=39 / CS=40, SPI1 CLK=41 / MISO=42 / + * MOSI=43 / CS=44. + */ + +#define AMEBA_SPI_CLKFID { 37, 41 } /* SPI0_CLK, SPI1_CLK */ +#define AMEBA_SPI_MOSIFID { 39, 43 } /* SPI0_MOSI, SPI1_MOSI */ +#define AMEBA_SPI_MISOFID { 38, 42 } /* SPI0_MISO, SPI1_MISO */ +#define AMEBA_SPI_CSFID { 40, 44 } /* SPI0_CS, SPI1_CS */ + +/* SSI peripheral clock: ip_clk = SYS_PLL_ClkGet() / (HPERI divider + 1), the + * frequency the SPI baud divider divides down to make SCLK. On RTL8720F the + * HPERI divider is bits[7:4] of REG_LSYS_CKD_SYS_PLL_GRP0 in the system- + * control block (non-secure alias SYSTEM_CTRL_BASE 0x40801000 + 0x0250), + * used when the HPERI source is SYS_PLL (the SDK default for the 100 MHz SPI + * bus clock). BOTH the register address and the field position are + * chip-specific -- amebadplus uses PLL_ClkGet() with bits[10:8] of a + * different register -- so the whole computation lives here rather than in + * the shared driver. + */ + +extern uint32_t SYS_PLL_ClkGet(void); + +#define AMEBA_SPI_CKD_SYS_PLL 0x40801250ul +#define AMEBA_SPI_IPCLK() \ + (SYS_PLL_ClkGet() / \ + ((((*(volatile uint32_t *)AMEBA_SPI_CKD_SYS_PLL) >> 4) & 0xf) + 1)) + +#endif /* __ARCH_ARM_SRC_RTL8720F_AMEBA_SPI_CHIP_H */ diff --git a/boards/arm/rtl8720f/rtl8720f_evb/configs/spi/defconfig b/boards/arm/rtl8720f/rtl8720f_evb/configs/spi/defconfig new file mode 100644 index 00000000000..0db3323aa1e --- /dev/null +++ b/boards/arm/rtl8720f/rtl8720f_evb/configs/spi/defconfig @@ -0,0 +1,50 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_DEBUG_WARN is not set +CONFIG_AMEBA_SPI=y +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="rtl8720f_evb" +CONFIG_ARCH_BOARD_RTL8720F_EVB=y +CONFIG_ARCH_CHIP="rtl8720f" +CONFIG_ARCH_CHIP_RTL8720F=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARMV8M_SYSTICK=y +CONFIG_BUILTIN=y +CONFIG_DEBUG_ASSERTIONS=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEFAULT_TASK_STACKSIZE=4096 +CONFIG_EXAMPLES_HELLO=y +CONFIG_FS_PROCFS=y +CONFIG_FS_TMPFS=y +CONFIG_IDLETHREAD_STACKSIZE=4096 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LIBC_MEMFD_ERROR=y +CONFIG_MM_DEFAULT_ALIGNMENT=32 +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_RAM_SIZE=262144 +CONFIG_RAM_START=0x30008000 +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_HPWORKPRIORITY=192 +CONFIG_SCHED_LPWORK=y +CONFIG_STACK_COLORATION=y +CONFIG_START_DAY=16 +CONFIG_START_MONTH=6 +CONFIG_START_YEAR=2026 +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_NSH_STACKSIZE=2500 +CONFIG_SYSTEM_SPITOOL=y +CONFIG_TIMER=y +CONFIG_TIMER_ARCH=y +CONFIG_USEC_PER_TICK=1000 diff --git a/boards/arm/rtl8720f/rtl8720f_evb/src/CMakeLists.txt b/boards/arm/rtl8720f/rtl8720f_evb/src/CMakeLists.txt index 1746ab388de..bb933ffb1c1 100644 --- a/boards/arm/rtl8720f/rtl8720f_evb/src/CMakeLists.txt +++ b/boards/arm/rtl8720f/rtl8720f_evb/src/CMakeLists.txt @@ -34,11 +34,16 @@ if(CONFIG_AMEBA_I2C) list(APPEND SRCS rtl8720f_i2c.c) endif() +if(CONFIG_AMEBA_SPI) + list(APPEND SRCS rtl8720f_spi.c) +endif() + target_sources(board PRIVATE ${SRCS}) if(CONFIG_AMEBA_GPIO OR CONFIG_AMEBA_UART - OR CONFIG_AMEBA_I2C) + OR CONFIG_AMEBA_I2C + OR CONFIG_AMEBA_SPI) # The board pin tables pull in the shared drivers' public headers from # arch/arm/src/common/ameba/, not on the default board include path. target_include_directories(board diff --git a/boards/arm/rtl8720f/rtl8720f_evb/src/Makefile b/boards/arm/rtl8720f/rtl8720f_evb/src/Makefile index 67cf764902c..17f442412dd 100644 --- a/boards/arm/rtl8720f/rtl8720f_evb/src/Makefile +++ b/boards/arm/rtl8720f/rtl8720f_evb/src/Makefile @@ -36,10 +36,14 @@ ifeq ($(CONFIG_AMEBA_I2C),y) CSRCS += rtl8720f_i2c.c endif +ifeq ($(CONFIG_AMEBA_SPI),y) +CSRCS += rtl8720f_spi.c +endif + # The board pin tables pull in the shared drivers' public headers from # arch/arm/src/common/ameba/, which is not on the default board include path. -ifneq ($(CONFIG_AMEBA_GPIO)$(CONFIG_AMEBA_UART)$(CONFIG_AMEBA_I2C),) +ifneq ($(CONFIG_AMEBA_GPIO)$(CONFIG_AMEBA_UART)$(CONFIG_AMEBA_I2C)$(CONFIG_AMEBA_SPI),) CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)arm$(DELIM)src$(DELIM)common$(DELIM)ameba endif diff --git a/boards/arm/rtl8720f/rtl8720f_evb/src/rtl8720f_bringup.c b/boards/arm/rtl8720f/rtl8720f_evb/src/rtl8720f_bringup.c index 8069c6090e3..f559600d244 100644 --- a/boards/arm/rtl8720f/rtl8720f_evb/src/rtl8720f_bringup.c +++ b/boards/arm/rtl8720f/rtl8720f_evb/src/rtl8720f_bringup.c @@ -150,6 +150,16 @@ int rtl8720f_bringup(void) } #endif +#ifdef CONFIG_AMEBA_SPI + /* Register the board's SPI master buses at /dev/spiN. */ + + ret = rtl8720f_spi_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: rtl8720f_spi_initialize failed: %d\n", ret); + } +#endif + /* Install the inter-core HW IPC-semaphore RTOS hooks LAST -- after all the * flash / WHC bring-up above, and just before this (board_late_initialize) * path returns and nx_start() hands off to the init task. diff --git a/boards/arm/rtl8720f/rtl8720f_evb/src/rtl8720f_rtl8720f_evb.h b/boards/arm/rtl8720f/rtl8720f_evb/src/rtl8720f_rtl8720f_evb.h index 610e31a285f..d0c201feda4 100644 --- a/boards/arm/rtl8720f/rtl8720f_evb/src/rtl8720f_rtl8720f_evb.h +++ b/boards/arm/rtl8720f/rtl8720f_evb/src/rtl8720f_rtl8720f_evb.h @@ -55,6 +55,18 @@ void rtl8720f_boardinitialize(void); int rtl8720f_bringup(void); +#ifdef CONFIG_AMEBA_SPI +/**************************************************************************** + * Name: rtl8720f_spi_initialize + * + * Description: + * Register the board's SPI master buses at /dev/spiN. + * + ****************************************************************************/ + +int rtl8720f_spi_initialize(void); +#endif + #ifdef CONFIG_RTL8720F_WIFI /**************************************************************************** * Name: rtl8720f_wifi_initialize diff --git a/boards/arm/rtl8720f/rtl8720f_evb/src/rtl8720f_spi.c b/boards/arm/rtl8720f/rtl8720f_evb/src/rtl8720f_spi.c new file mode 100644 index 00000000000..95b49397f96 --- /dev/null +++ b/boards/arm/rtl8720f/rtl8720f_evb/src/rtl8720f_spi.c @@ -0,0 +1,100 @@ +/**************************************************************************** + * boards/arm/rtl8720f/rtl8720f_evb/src/rtl8720f_spi.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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 + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <sys/param.h> +#include <syslog.h> +#include <errno.h> + +#include "ameba_gpio.h" +#include "ameba_spi.h" +#include "rtl8720f_rtl8720f_evb.h" + +#ifdef CONFIG_AMEBA_SPI + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/* One entry per SPI bus exposed to NuttX at /dev/spiN. The CLK/MOSI/MISO/CS + * pads below are examples used by the `spi` config (system/spi spitool); + * adjust them to match your board's wiring. + */ + +struct rtl8720f_spi_s +{ + int bus; /* Controller index (AMEBA_SPI0/AMEBA_SPI1) */ + uint8_t clkpin; /* SCLK pad (AMEBA_PA()/AMEBA_PB() encoding) */ + uint8_t mosipin; /* MOSI pad */ + uint8_t misopin; /* MISO pad */ + uint8_t cspin; /* Chip-select pad (software CS GPIO) */ +}; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const struct rtl8720f_spi_s g_spi_buses[] = +{ + { + AMEBA_SPI0, AMEBA_PA(14), AMEBA_PA(15), AMEBA_PA(16), AMEBA_PA(17) + }, +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: rtl8720f_spi_initialize + * + * Description: + * Register the board's SPI master buses at /dev/spiN. + * + ****************************************************************************/ + +int rtl8720f_spi_initialize(void) +{ + int i; + + for (i = 0; i < (int)nitems(g_spi_buses); i++) + { + if (ameba_spi_register(g_spi_buses[i].bus, g_spi_buses[i].clkpin, + g_spi_buses[i].mosipin, g_spi_buses[i].misopin, + g_spi_buses[i].cspin) == NULL) + { + syslog(LOG_ERR, + "ERROR: ameba_spi_register(/dev/spi%d) failed\n", + g_spi_buses[i].bus); + return -ENODEV; + } + } + + return OK; +} + +#endif /* CONFIG_AMEBA_SPI */
