drivers/net/oa_tc6: Add driver for the Microchip LAN865x SPI MAC-PHY

Add driver for the LAN865x 10BASE-T1S SPI MAC-PHY.
The driver is a lower-half driver to the OA-TC6 base driver.

Signed-off-by: michal matias <mich4l.matias@gmail.com>
This commit is contained in:
michal matias
2025-08-25 01:45:18 +02:00
committed by Xiang Xiao
parent fbb3b6d07b
commit 0f498005f0
7 changed files with 833 additions and 0 deletions
+4
View File
@@ -27,5 +27,9 @@ if(CONFIG_NET_OA_TC6)
list(APPEND SRCS oa_tc6_ncv7410.c)
endif()
if(CONFIG_NET_OA_TC6_LAN865X)
list(APPEND SRCS oa_tc6_lan865x.c)
endif()
target_sources(drivers PRIVATE ${SRCS})
endif()
+12
View File
@@ -23,4 +23,16 @@ config NET_OA_TC6_NCV7410_LEDS
---help---
Setup DIO0 to blink on TX/RX and DIO1 to reflect the LCTL bit in the PHY CONTROL register (Up/Down).
config NET_OA_TC6_LAN865X
bool "Microchip LAN865x 10BASE-T1S SPI MAC-PHY Support"
default n
config NET_OA_TC6_LAN865X_MAC
int "LAN865x lower 3 bytes of MAC address"
default 0
range 0 16777215
depends on NET_OA_TC6_LAN865X
---help---
LAN865x does not have a factory-assigned MAC address, it has to be provided externally
endif
+4
View File
@@ -28,6 +28,10 @@ ifeq ($(CONFIG_NET_OA_TC6_NCV7410),y)
CSRCS += oa_tc6_ncv7410.c
endif
ifeq ($(CONFIG_NET_OA_TC6_LAN865X),y)
CSRCS += oa_tc6_lan865x.c
endif
DEPPATH += --dep-path net/oa_tc6
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)drivers$(DELIM)net$(DELIM)oa_tc6
VPATH += :net/oa_tc6
+9
View File
@@ -36,6 +36,10 @@
#include "oa_tc6_ncv7410.h"
#endif
#ifdef CONFIG_NET_OA_TC6_LAN865X
#include "oa_tc6_lan865x.h"
#endif
#include "oa_tc6.h"
/****************************************************************************
@@ -1080,6 +1084,11 @@ static int oa_tc6_init_by_id(FAR struct spi_dev_s *spi,
case OA_TC6_NCV7410_PHYID:
ninfo("Info: Detected NCV7410 or NCN26010\n");
return ncv7410_initialize(spi, config);
#endif
#ifdef CONFIG_NET_OA_TC6_LAN865X
case OA_TC6_LAN865X_PHYID:
ninfo("Info: Detected LAN865x\n");
return lan865x_initialize(spi, config);
#endif
default:
nerr("Error: Unknown PHYID 0x%08lX. "
File diff suppressed because it is too large Load Diff
+59
View File
@@ -0,0 +1,59 @@
/****************************************************************************
* drivers/net/oa_tc6/oa_tc6_lan865x.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 __DRIVERS_NET_OA_TC6_LAN865X_H
#define __DRIVERS_NET_OA_TC6_LAN865X_H
/****************************************************************************
* Included Files
****************************************************************************/
#include "oa_tc6.h"
/****************************************************************************
* Preprocessor Macros
****************************************************************************/
#define OA_TC6_LAN865X_PHYID 0x0007C1B4U
/* Registers specific to the LAN865x */
#define LAN865X_MAC_NCR_MMS 1
#define LAN865X_MAC_NCR_ADDR 0x0U
#define LAN865X_MAC_NCR_REGID OA_TC6_MAKE_REGID(LAN865X_MAC_NCR_MMS, LAN865X_MAC_NCR_ADDR)
#define LAN865X_MAC_NCR_TXEN_POS 3
#define LAN865X_MAC_NCR_RXEN_POS 2
#define LAN865X_MAC_NCFGR_MMS 1
#define LAN865X_MAC_NCFGR_ADDR 0x1U
#define LAN865X_MAC_NCFGR_REGID OA_TC6_MAKE_REGID(LAN865X_MAC_NCFGR_MMS, LAN865X_MAC_NCFGR_ADDR)
#define LAN865X_MAC_NCFGR_EFRHD_POS 25
#define LAN865X_MAC_NCFGR_CAF_POS 4
#define LAN865X_MAC_SAB1_MMS 1
#define LAN865X_MAC_SAB1_ADDR 0x22U
#define LAN865X_MAC_SAB1_REGID OA_TC6_MAKE_REGID(LAN865X_MAC_SAB1_MMS, LAN865X_MAC_SAB1_ADDR)
#define LAN865X_MAC_SAB_REGID(i) OA_TC6_MAKE_REGID(LAN865X_MAC_SAB1_MMS, LAN865X_MAC_SAB1_ADDR + 2 * (i - 1))
#define LAN865X_MAC_SAT_REGID(i) OA_TC6_MAKE_REGID(LAN865X_MAC_SAB1_MMS, LAN865X_MAC_SAB1_ADDR + 2 * (i - 1) + 1)
#endif /* __DRIVERS_NET_OA_TC6_LAN865X_H */