ocelot.c (2c55d703391acf7e9101da596d0c15ee03b318a3) ocelot.c (6505b68056558357dc979d11921ed45cfd68ed69)
1// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2/*
3 * Microsemi Ocelot Switch driver
4 *
5 * Copyright (c) 2017 Microsemi Corporation
6 */
7#include <linux/dsa/ocelot.h>
8#include <linux/if_bridge.h>

--- 2724 unchanged lines hidden (view full) ---

2733 spin_lock_init(&ocelot->ptp_clock_lock);
2734 spin_lock_init(&ocelot->ts_id_lock);
2735
2736 ocelot->owq = alloc_ordered_workqueue("ocelot-owq", 0);
2737 if (!ocelot->owq)
2738 return -ENOMEM;
2739
2740 ret = ocelot_stats_init(ocelot);
1// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2/*
3 * Microsemi Ocelot Switch driver
4 *
5 * Copyright (c) 2017 Microsemi Corporation
6 */
7#include <linux/dsa/ocelot.h>
8#include <linux/if_bridge.h>

--- 2724 unchanged lines hidden (view full) ---

2733 spin_lock_init(&ocelot->ptp_clock_lock);
2734 spin_lock_init(&ocelot->ts_id_lock);
2735
2736 ocelot->owq = alloc_ordered_workqueue("ocelot-owq", 0);
2737 if (!ocelot->owq)
2738 return -ENOMEM;
2739
2740 ret = ocelot_stats_init(ocelot);
2741 if (ret) {
2742 destroy_workqueue(ocelot->owq);
2743 return ret;
2744 }
2741 if (ret)
2742 goto err_stats_init;
2745
2746 INIT_LIST_HEAD(&ocelot->multicast);
2747 INIT_LIST_HEAD(&ocelot->pgids);
2748 INIT_LIST_HEAD(&ocelot->vlans);
2749 INIT_LIST_HEAD(&ocelot->lag_fdbs);
2750 ocelot_detect_features(ocelot);
2751 ocelot_mact_init(ocelot);
2752 ocelot_vlan_init(ocelot);
2753 ocelot_vcap_init(ocelot);
2754 ocelot_cpu_port_init(ocelot);
2755
2756 if (ocelot->ops->psfp_init)
2757 ocelot->ops->psfp_init(ocelot);
2758
2743
2744 INIT_LIST_HEAD(&ocelot->multicast);
2745 INIT_LIST_HEAD(&ocelot->pgids);
2746 INIT_LIST_HEAD(&ocelot->vlans);
2747 INIT_LIST_HEAD(&ocelot->lag_fdbs);
2748 ocelot_detect_features(ocelot);
2749 ocelot_mact_init(ocelot);
2750 ocelot_vlan_init(ocelot);
2751 ocelot_vcap_init(ocelot);
2752 ocelot_cpu_port_init(ocelot);
2753
2754 if (ocelot->ops->psfp_init)
2755 ocelot->ops->psfp_init(ocelot);
2756
2757 if (ocelot->mm_supported) {
2758 ret = ocelot_mm_init(ocelot);
2759 if (ret)
2760 goto err_mm_init;
2761 }
2762
2759 for (port = 0; port < ocelot->num_phys_ports; port++) {
2760 /* Clear all counters (5 groups) */
2761 ocelot_write(ocelot, SYS_STAT_CFG_STAT_VIEW(port) |
2762 SYS_STAT_CFG_STAT_CLEAR_SHOT(0x7f),
2763 SYS_STAT_CFG);
2764 }
2765
2766 /* Only use S-Tag */

--- 81 unchanged lines hidden (view full) ---

2848 ANA_CPUQ_CFG_CPUQ_IGMP(6) |
2849 ANA_CPUQ_CFG_CPUQ_MLD(6), ANA_CPUQ_CFG);
2850 for (i = 0; i < 16; i++)
2851 ocelot_write_rix(ocelot, ANA_CPUQ_8021_CFG_CPUQ_GARP_VAL(6) |
2852 ANA_CPUQ_8021_CFG_CPUQ_BPDU_VAL(6),
2853 ANA_CPUQ_8021_CFG, i);
2854
2855 return 0;
2763 for (port = 0; port < ocelot->num_phys_ports; port++) {
2764 /* Clear all counters (5 groups) */
2765 ocelot_write(ocelot, SYS_STAT_CFG_STAT_VIEW(port) |
2766 SYS_STAT_CFG_STAT_CLEAR_SHOT(0x7f),
2767 SYS_STAT_CFG);
2768 }
2769
2770 /* Only use S-Tag */

--- 81 unchanged lines hidden (view full) ---

2852 ANA_CPUQ_CFG_CPUQ_IGMP(6) |
2853 ANA_CPUQ_CFG_CPUQ_MLD(6), ANA_CPUQ_CFG);
2854 for (i = 0; i < 16; i++)
2855 ocelot_write_rix(ocelot, ANA_CPUQ_8021_CFG_CPUQ_GARP_VAL(6) |
2856 ANA_CPUQ_8021_CFG_CPUQ_BPDU_VAL(6),
2857 ANA_CPUQ_8021_CFG, i);
2858
2859 return 0;
2860
2861err_mm_init:
2862 ocelot_stats_deinit(ocelot);
2863err_stats_init:
2864 destroy_workqueue(ocelot->owq);
2865 return ret;
2856}
2857EXPORT_SYMBOL(ocelot_init);
2858
2859void ocelot_deinit(struct ocelot *ocelot)
2860{
2861 ocelot_stats_deinit(ocelot);
2862 destroy_workqueue(ocelot->owq);
2863}
2864EXPORT_SYMBOL(ocelot_deinit);
2865
2866void ocelot_deinit_port(struct ocelot *ocelot, int port)
2867{
2868 struct ocelot_port *ocelot_port = ocelot->ports[port];
2869
2870 skb_queue_purge(&ocelot_port->tx_skbs);
2871}
2872EXPORT_SYMBOL(ocelot_deinit_port);
2873
2874MODULE_LICENSE("Dual MIT/GPL");
2866}
2867EXPORT_SYMBOL(ocelot_init);
2868
2869void ocelot_deinit(struct ocelot *ocelot)
2870{
2871 ocelot_stats_deinit(ocelot);
2872 destroy_workqueue(ocelot->owq);
2873}
2874EXPORT_SYMBOL(ocelot_deinit);
2875
2876void ocelot_deinit_port(struct ocelot *ocelot, int port)
2877{
2878 struct ocelot_port *ocelot_port = ocelot->ports[port];
2879
2880 skb_queue_purge(&ocelot_port->tx_skbs);
2881}
2882EXPORT_SYMBOL(ocelot_deinit_port);
2883
2884MODULE_LICENSE("Dual MIT/GPL");