drivers: ethernet: adin2111: move OA buffers out from device data
Move OA-related TX and RX buffers out from the device data. Don't define the buffers without the `spi-oa` property. That saves ~32KB when using generic spi protocol. Rearrange device data fields to reduce byte holes found with Pahole. Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
This commit is contained in:
parent
2eaae36220
commit
104a019913
2 changed files with 19 additions and 9 deletions
|
|
@ -1515,6 +1515,8 @@ static const struct ethernet_api adin2111_port_api = {
|
|||
#define ADIN2111_STR(x) #x
|
||||
#define ADIN2111_XSTR(x) ADIN2111_STR(x)
|
||||
|
||||
#define ADIN2111_DEF_BUF(name, size) static uint8_t __aligned(4) name[size]
|
||||
|
||||
#define ADIN2111_MDIO_PHY_BY_ADDR(adin_n, phy_addr) \
|
||||
DEVICE_DT_GET(DT_CHILD(DT_INST_CHILD(adin_n, mdio), ethernet_phy_##phy_addr))
|
||||
|
||||
|
|
@ -1538,7 +1540,12 @@ static const struct ethernet_api adin2111_port_api = {
|
|||
|
||||
#define ADIN2111_SPI_OPERATION ((uint16_t)(SPI_OP_MODE_MASTER | SPI_TRANSFER_MSB | SPI_WORD_SET(8)))
|
||||
#define ADIN2111_MAC_INITIALIZE(inst, dev_id, ifaces, name) \
|
||||
static uint8_t __aligned(4) name##_buffer_##inst[CONFIG_ETH_ADIN2111_BUFFER_SIZE]; \
|
||||
ADIN2111_DEF_BUF(name##_buffer_##inst, CONFIG_ETH_ADIN2111_BUFFER_SIZE); \
|
||||
COND_CODE_1(DT_INST_PROP(inst, spi_oa), \
|
||||
( \
|
||||
ADIN2111_DEF_BUF(name##_oa_tx_buf_##inst, ADIN2111_OA_BUF_SZ); \
|
||||
ADIN2111_DEF_BUF(name##_oa_rx_buf_##inst, ADIN2111_OA_BUF_SZ); \
|
||||
), ()) \
|
||||
static const struct adin2111_config name##_config_##inst = { \
|
||||
.id = dev_id, \
|
||||
.spi = SPI_DT_SPEC_INST_GET(inst, ADIN2111_SPI_OPERATION, 0), \
|
||||
|
|
@ -1554,6 +1561,10 @@ static const struct ethernet_api adin2111_port_api = {
|
|||
.oa = DT_INST_PROP(inst, spi_oa), \
|
||||
.oa_prot = DT_INST_PROP(inst, spi_oa_protection), \
|
||||
.oa_cps = 64, \
|
||||
.oa_tx_buf = COND_CODE_1(DT_INST_PROP(inst, spi_oa), \
|
||||
(name##_oa_tx_buf_##inst), (NULL)), \
|
||||
.oa_rx_buf = COND_CODE_1(DT_INST_PROP(inst, spi_oa), \
|
||||
(name##_oa_rx_buf_##inst), (NULL)), \
|
||||
}; \
|
||||
/* adin */ \
|
||||
DEVICE_DT_DEFINE(DT_DRV_INST(inst), adin2111_init, NULL, \
|
||||
|
|
|
|||
|
|
@ -229,22 +229,21 @@ struct adin2111_config {
|
|||
};
|
||||
|
||||
struct adin2111_data {
|
||||
/* Port 0: PHY 1, Port 1: PHY 2 */
|
||||
const struct device *port[2];
|
||||
struct gpio_callback gpio_int_callback;
|
||||
struct k_sem offload_sem;
|
||||
struct k_mutex lock;
|
||||
struct k_sem offload_sem;
|
||||
uint32_t imask0;
|
||||
uint32_t imask1;
|
||||
uint16_t ifaces_left_to_init;
|
||||
uint8_t *buf;
|
||||
/* Port 0: PHY 1, Port 1: PHY 2 */
|
||||
const struct device *port[2];
|
||||
uint8_t *oa_tx_buf;
|
||||
uint8_t *oa_rx_buf;
|
||||
uint16_t ifaces_left_to_init;
|
||||
uint16_t scur;
|
||||
struct gpio_callback gpio_int_callback;
|
||||
bool oa;
|
||||
bool oa_prot;
|
||||
uint8_t oa_cps;
|
||||
uint8_t oa_tx_buf[ADIN2111_OA_BUF_SZ];
|
||||
uint8_t oa_rx_buf[ADIN2111_OA_BUF_SZ];
|
||||
|
||||
K_KERNEL_STACK_MEMBER(rx_thread_stack, CONFIG_ETH_ADIN2111_IRQ_THREAD_STACK_SIZE);
|
||||
struct k_thread rx_thread;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue