@@ -678,7 +678,12 @@ static enum ethernet_hw_caps eth_smsc_get_caps(const struct device *dev)
678
678
{
679
679
ARG_UNUSED (dev );
680
680
681
- return ETHERNET_LINK_10BASE_T | ETHERNET_LINK_100BASE_T ;
681
+ return (ETHERNET_LINK_10BASE_T
682
+ | ETHERNET_LINK_100BASE_T
683
+ #if defined(CONFIG_NET_PROMISCUOUS_MODE )
684
+ | ETHERNET_PROMISC_MODE
685
+ #endif
686
+ );
682
687
}
683
688
684
689
static int eth_tx (const struct device * dev , struct net_pkt * pkt )
@@ -696,6 +701,42 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt)
696
701
return smsc_send_pkt (sc , tx_buffer , len );
697
702
}
698
703
704
+ static int eth_smsc_set_config (const struct device * dev ,
705
+ enum ethernet_config_type type ,
706
+ const struct ethernet_config * config )
707
+ {
708
+ struct eth_context * data = dev -> data ;
709
+ struct smsc_data * sc = & data -> sc ;
710
+ uint8_t reg_val ;
711
+ int ret = 0 ;
712
+
713
+ (void ) reg_val ;
714
+
715
+ switch (type ) {
716
+ #if defined(CONFIG_NET_PROMISCUOUS_MODE )
717
+ case ETHERNET_CONFIG_TYPE_PROMISC_MODE :
718
+ SMSC_LOCK (sc );
719
+ smsc_select_bank (sc , 0 );
720
+ reg_val = smsc_read_1 (sc , RCR );
721
+ if (config -> promisc_mode && !(reg_val & RCR_PRMS )) {
722
+ smsc_write_1 (sc , RCR , reg_val | RCR_PRMS );
723
+ } else if (!config -> promisc_mode && (reg_val & RCR_PRMS )) {
724
+ smsc_write_1 (sc , RCR , reg_val & ~RCR_PRMS );
725
+ } else {
726
+ ret = - EALREADY ;
727
+ }
728
+ SMSC_UNLOCK (sc );
729
+ break ;
730
+ #endif
731
+
732
+ default :
733
+ ret = - ENOTSUP ;
734
+ break ;
735
+ }
736
+
737
+ return ret ;
738
+ }
739
+
699
740
static void eth_initialize (struct net_if * iface )
700
741
{
701
742
const struct device * dev = net_if_get_device (iface );
@@ -725,9 +766,10 @@ static void eth_initialize(struct net_if *iface)
725
766
}
726
767
727
768
static const struct ethernet_api api_funcs = {
728
- .iface_api .init = eth_initialize ,
769
+ .iface_api .init = eth_initialize ,
729
770
.get_capabilities = eth_smsc_get_caps ,
730
- .send = eth_tx ,
771
+ .set_config = eth_smsc_set_config ,
772
+ .send = eth_tx ,
731
773
};
732
774
733
775
static void eth_smsc_isr (const struct device * dev )
0 commit comments