18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (c) 2003-2012 Broadcom Corporation
38c2ecf20Sopenharmony_ci * All Rights Reserved
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * This software is available to you under a choice of one of two
68c2ecf20Sopenharmony_ci * licenses.  You may choose to be licensed under the terms of the GNU
78c2ecf20Sopenharmony_ci * General Public License (GPL) Version 2, available from the file
88c2ecf20Sopenharmony_ci * COPYING in the main directory of this source tree, or the Broadcom
98c2ecf20Sopenharmony_ci * license below:
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
128c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions
138c2ecf20Sopenharmony_ci * are met:
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright
168c2ecf20Sopenharmony_ci *    notice, this list of conditions and the following disclaimer.
178c2ecf20Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright
188c2ecf20Sopenharmony_ci *    notice, this list of conditions and the following disclaimer in
198c2ecf20Sopenharmony_ci *    the documentation and/or other materials provided with the
208c2ecf20Sopenharmony_ci *    distribution.
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
238c2ecf20Sopenharmony_ci * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
248c2ecf20Sopenharmony_ci * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
258c2ecf20Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
268c2ecf20Sopenharmony_ci * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
278c2ecf20Sopenharmony_ci * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
288c2ecf20Sopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
298c2ecf20Sopenharmony_ci * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
308c2ecf20Sopenharmony_ci * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
318c2ecf20Sopenharmony_ci * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
328c2ecf20Sopenharmony_ci * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#include <asm/cpu-info.h>
368c2ecf20Sopenharmony_ci#include <linux/irq.h>
378c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#include <asm/cpu.h>
408c2ecf20Sopenharmony_ci#include <asm/mipsregs.h>
418c2ecf20Sopenharmony_ci#include <asm/netlogic/xlr/fmn.h>
428c2ecf20Sopenharmony_ci#include <asm/netlogic/xlr/xlr.h>
438c2ecf20Sopenharmony_ci#include <asm/netlogic/common.h>
448c2ecf20Sopenharmony_ci#include <asm/netlogic/haldefs.h>
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_cistruct xlr_board_fmn_config xlr_board_fmn_config;
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cistatic void __maybe_unused print_credit_config(struct xlr_fmn_info *fmn_info)
498c2ecf20Sopenharmony_ci{
508c2ecf20Sopenharmony_ci	int bkt;
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci	pr_info("Bucket size :\n");
538c2ecf20Sopenharmony_ci	pr_info("Station\t: Size\n");
548c2ecf20Sopenharmony_ci	for (bkt = 0; bkt < 16; bkt++)
558c2ecf20Sopenharmony_ci		pr_info(" %d  %d  %d  %d  %d  %d  %d %d\n",
568c2ecf20Sopenharmony_ci			xlr_board_fmn_config.bucket_size[(bkt * 8) + 0],
578c2ecf20Sopenharmony_ci			xlr_board_fmn_config.bucket_size[(bkt * 8) + 1],
588c2ecf20Sopenharmony_ci			xlr_board_fmn_config.bucket_size[(bkt * 8) + 2],
598c2ecf20Sopenharmony_ci			xlr_board_fmn_config.bucket_size[(bkt * 8) + 3],
608c2ecf20Sopenharmony_ci			xlr_board_fmn_config.bucket_size[(bkt * 8) + 4],
618c2ecf20Sopenharmony_ci			xlr_board_fmn_config.bucket_size[(bkt * 8) + 5],
628c2ecf20Sopenharmony_ci			xlr_board_fmn_config.bucket_size[(bkt * 8) + 6],
638c2ecf20Sopenharmony_ci			xlr_board_fmn_config.bucket_size[(bkt * 8) + 7]);
648c2ecf20Sopenharmony_ci	pr_info("\n");
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci	pr_info("Credits distribution :\n");
678c2ecf20Sopenharmony_ci	pr_info("Station\t: Size\n");
688c2ecf20Sopenharmony_ci	for (bkt = 0; bkt < 16; bkt++)
698c2ecf20Sopenharmony_ci		pr_info(" %d  %d  %d  %d  %d  %d  %d %d\n",
708c2ecf20Sopenharmony_ci			fmn_info->credit_config[(bkt * 8) + 0],
718c2ecf20Sopenharmony_ci			fmn_info->credit_config[(bkt * 8) + 1],
728c2ecf20Sopenharmony_ci			fmn_info->credit_config[(bkt * 8) + 2],
738c2ecf20Sopenharmony_ci			fmn_info->credit_config[(bkt * 8) + 3],
748c2ecf20Sopenharmony_ci			fmn_info->credit_config[(bkt * 8) + 4],
758c2ecf20Sopenharmony_ci			fmn_info->credit_config[(bkt * 8) + 5],
768c2ecf20Sopenharmony_ci			fmn_info->credit_config[(bkt * 8) + 6],
778c2ecf20Sopenharmony_ci			fmn_info->credit_config[(bkt * 8) + 7]);
788c2ecf20Sopenharmony_ci	pr_info("\n");
798c2ecf20Sopenharmony_ci}
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_cistatic void check_credit_distribution(void)
828c2ecf20Sopenharmony_ci{
838c2ecf20Sopenharmony_ci	struct xlr_board_fmn_config *cfg = &xlr_board_fmn_config;
848c2ecf20Sopenharmony_ci	int bkt, n, total_credits, ncores;
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci	ncores = hweight32(nlm_current_node()->coremask);
878c2ecf20Sopenharmony_ci	for (bkt = 0; bkt < 128; bkt++) {
888c2ecf20Sopenharmony_ci		total_credits = 0;
898c2ecf20Sopenharmony_ci		for (n = 0; n < ncores; n++)
908c2ecf20Sopenharmony_ci			total_credits += cfg->cpu[n].credit_config[bkt];
918c2ecf20Sopenharmony_ci		total_credits += cfg->gmac[0].credit_config[bkt];
928c2ecf20Sopenharmony_ci		total_credits += cfg->gmac[1].credit_config[bkt];
938c2ecf20Sopenharmony_ci		total_credits += cfg->dma.credit_config[bkt];
948c2ecf20Sopenharmony_ci		total_credits += cfg->cmp.credit_config[bkt];
958c2ecf20Sopenharmony_ci		total_credits += cfg->sae.credit_config[bkt];
968c2ecf20Sopenharmony_ci		total_credits += cfg->xgmac[0].credit_config[bkt];
978c2ecf20Sopenharmony_ci		total_credits += cfg->xgmac[1].credit_config[bkt];
988c2ecf20Sopenharmony_ci		if (total_credits > cfg->bucket_size[bkt])
998c2ecf20Sopenharmony_ci			pr_err("ERROR: Bucket %d: credits (%d) > size (%d)\n",
1008c2ecf20Sopenharmony_ci				bkt, total_credits, cfg->bucket_size[bkt]);
1018c2ecf20Sopenharmony_ci	}
1028c2ecf20Sopenharmony_ci	pr_info("Credit distribution complete.\n");
1038c2ecf20Sopenharmony_ci}
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci/**
1068c2ecf20Sopenharmony_ci * Configure bucket size and credits for a device. 'size' is the size of
1078c2ecf20Sopenharmony_ci * the buckets for the device. This size is distributed among all the CPUs
1088c2ecf20Sopenharmony_ci * so that all of them can send messages to the device.
1098c2ecf20Sopenharmony_ci *
1108c2ecf20Sopenharmony_ci * The device is also given 'cpu_credits' to send messages to the CPUs
1118c2ecf20Sopenharmony_ci *
1128c2ecf20Sopenharmony_ci * @dev_info: FMN information structure for each devices
1138c2ecf20Sopenharmony_ci * @start_stn_id: Starting station id of dev_info
1148c2ecf20Sopenharmony_ci * @end_stn_id: End station id of dev_info
1158c2ecf20Sopenharmony_ci * @num_buckets: Total number of buckets for den_info
1168c2ecf20Sopenharmony_ci * @cpu_credits: Allowed credits to cpu for each devices pointing by dev_info
1178c2ecf20Sopenharmony_ci * @size: Size of the each buckets in the device station
1188c2ecf20Sopenharmony_ci */
1198c2ecf20Sopenharmony_cistatic void setup_fmn_cc(struct xlr_fmn_info *dev_info, int start_stn_id,
1208c2ecf20Sopenharmony_ci		int end_stn_id, int num_buckets, int cpu_credits, int size)
1218c2ecf20Sopenharmony_ci{
1228c2ecf20Sopenharmony_ci	int i, j, num_core, n, credits_per_cpu;
1238c2ecf20Sopenharmony_ci	struct xlr_fmn_info *cpu = xlr_board_fmn_config.cpu;
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci	num_core = hweight32(nlm_current_node()->coremask);
1268c2ecf20Sopenharmony_ci	dev_info->num_buckets	= num_buckets;
1278c2ecf20Sopenharmony_ci	dev_info->start_stn_id	= start_stn_id;
1288c2ecf20Sopenharmony_ci	dev_info->end_stn_id	= end_stn_id;
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci	n = num_core;
1318c2ecf20Sopenharmony_ci	if (num_core == 3)
1328c2ecf20Sopenharmony_ci		n = 4;
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci	for (i = start_stn_id; i <= end_stn_id; i++) {
1358c2ecf20Sopenharmony_ci		xlr_board_fmn_config.bucket_size[i] = size;
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci		/* Dividing device credits equally to cpus */
1388c2ecf20Sopenharmony_ci		credits_per_cpu = size / n;
1398c2ecf20Sopenharmony_ci		for (j = 0; j < num_core; j++)
1408c2ecf20Sopenharmony_ci			cpu[j].credit_config[i] = credits_per_cpu;
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci		/* credits left to distribute */
1438c2ecf20Sopenharmony_ci		credits_per_cpu = size - (credits_per_cpu * num_core);
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci		/* distribute the remaining credits (if any), among cores */
1468c2ecf20Sopenharmony_ci		for (j = 0; (j < num_core) && (credits_per_cpu >= 4); j++) {
1478c2ecf20Sopenharmony_ci			cpu[j].credit_config[i] += 4;
1488c2ecf20Sopenharmony_ci			credits_per_cpu -= 4;
1498c2ecf20Sopenharmony_ci		}
1508c2ecf20Sopenharmony_ci	}
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci	/* Distributing cpu per bucket credits to devices */
1538c2ecf20Sopenharmony_ci	for (i = 0; i < num_core; i++) {
1548c2ecf20Sopenharmony_ci		for (j = 0; j < FMN_CORE_NBUCKETS; j++)
1558c2ecf20Sopenharmony_ci			dev_info->credit_config[(i * 8) + j] = cpu_credits;
1568c2ecf20Sopenharmony_ci	}
1578c2ecf20Sopenharmony_ci}
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci/*
1608c2ecf20Sopenharmony_ci * Each core has 256 slots and 8 buckets,
1618c2ecf20Sopenharmony_ci * Configure the 8 buckets each with 32 slots
1628c2ecf20Sopenharmony_ci */
1638c2ecf20Sopenharmony_cistatic void setup_cpu_fmninfo(struct xlr_fmn_info *cpu, int num_core)
1648c2ecf20Sopenharmony_ci{
1658c2ecf20Sopenharmony_ci	int i, j;
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci	for (i = 0; i < num_core; i++) {
1688c2ecf20Sopenharmony_ci		cpu[i].start_stn_id	= (8 * i);
1698c2ecf20Sopenharmony_ci		cpu[i].end_stn_id	= (8 * i + 8);
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci		for (j = cpu[i].start_stn_id; j < cpu[i].end_stn_id; j++)
1728c2ecf20Sopenharmony_ci			xlr_board_fmn_config.bucket_size[j] = 32;
1738c2ecf20Sopenharmony_ci	}
1748c2ecf20Sopenharmony_ci}
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci/**
1778c2ecf20Sopenharmony_ci * Setup the FMN details for each devices according to the device available
1788c2ecf20Sopenharmony_ci * in each variant of XLR/XLS processor
1798c2ecf20Sopenharmony_ci */
1808c2ecf20Sopenharmony_civoid xlr_board_info_setup(void)
1818c2ecf20Sopenharmony_ci{
1828c2ecf20Sopenharmony_ci	struct xlr_fmn_info *cpu = xlr_board_fmn_config.cpu;
1838c2ecf20Sopenharmony_ci	struct xlr_fmn_info *gmac = xlr_board_fmn_config.gmac;
1848c2ecf20Sopenharmony_ci	struct xlr_fmn_info *xgmac = xlr_board_fmn_config.xgmac;
1858c2ecf20Sopenharmony_ci	struct xlr_fmn_info *dma = &xlr_board_fmn_config.dma;
1868c2ecf20Sopenharmony_ci	struct xlr_fmn_info *cmp = &xlr_board_fmn_config.cmp;
1878c2ecf20Sopenharmony_ci	struct xlr_fmn_info *sae = &xlr_board_fmn_config.sae;
1888c2ecf20Sopenharmony_ci	int processor_id, num_core;
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci	num_core = hweight32(nlm_current_node()->coremask);
1918c2ecf20Sopenharmony_ci	processor_id = read_c0_prid() & PRID_IMP_MASK;
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci	setup_cpu_fmninfo(cpu, num_core);
1948c2ecf20Sopenharmony_ci	switch (processor_id) {
1958c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLS104:
1968c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLS108:
1978c2ecf20Sopenharmony_ci		setup_fmn_cc(&gmac[0], FMN_STNID_GMAC0,
1988c2ecf20Sopenharmony_ci					FMN_STNID_GMAC0_TX3, 8, 16, 32);
1998c2ecf20Sopenharmony_ci		setup_fmn_cc(dma, FMN_STNID_DMA_0,
2008c2ecf20Sopenharmony_ci					FMN_STNID_DMA_3, 4, 8, 64);
2018c2ecf20Sopenharmony_ci		setup_fmn_cc(sae, FMN_STNID_SEC0,
2028c2ecf20Sopenharmony_ci					FMN_STNID_SEC1, 2, 8, 128);
2038c2ecf20Sopenharmony_ci		break;
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLS204:
2068c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLS208:
2078c2ecf20Sopenharmony_ci		setup_fmn_cc(&gmac[0], FMN_STNID_GMAC0,
2088c2ecf20Sopenharmony_ci					FMN_STNID_GMAC0_TX3, 8, 16, 32);
2098c2ecf20Sopenharmony_ci		setup_fmn_cc(dma, FMN_STNID_DMA_0,
2108c2ecf20Sopenharmony_ci					FMN_STNID_DMA_3, 4, 8, 64);
2118c2ecf20Sopenharmony_ci		setup_fmn_cc(sae, FMN_STNID_SEC0,
2128c2ecf20Sopenharmony_ci					FMN_STNID_SEC1, 2, 8, 128);
2138c2ecf20Sopenharmony_ci		break;
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLS404:
2168c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLS408:
2178c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLS404B:
2188c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLS408B:
2198c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLS416B:
2208c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLS608B:
2218c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLS616B:
2228c2ecf20Sopenharmony_ci		setup_fmn_cc(&gmac[0], FMN_STNID_GMAC0,
2238c2ecf20Sopenharmony_ci					FMN_STNID_GMAC0_TX3, 8, 8, 32);
2248c2ecf20Sopenharmony_ci		setup_fmn_cc(&gmac[1], FMN_STNID_GMAC1_FR_0,
2258c2ecf20Sopenharmony_ci					FMN_STNID_GMAC1_TX3, 8, 8, 32);
2268c2ecf20Sopenharmony_ci		setup_fmn_cc(dma, FMN_STNID_DMA_0,
2278c2ecf20Sopenharmony_ci					FMN_STNID_DMA_3, 4, 4, 64);
2288c2ecf20Sopenharmony_ci		setup_fmn_cc(cmp, FMN_STNID_CMP_0,
2298c2ecf20Sopenharmony_ci					FMN_STNID_CMP_3, 4, 4, 64);
2308c2ecf20Sopenharmony_ci		setup_fmn_cc(sae, FMN_STNID_SEC0,
2318c2ecf20Sopenharmony_ci					FMN_STNID_SEC1, 2, 8, 128);
2328c2ecf20Sopenharmony_ci		break;
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLS412B:
2358c2ecf20Sopenharmony_ci		setup_fmn_cc(&gmac[0], FMN_STNID_GMAC0,
2368c2ecf20Sopenharmony_ci					FMN_STNID_GMAC0_TX3, 8, 8, 32);
2378c2ecf20Sopenharmony_ci		setup_fmn_cc(&gmac[1], FMN_STNID_GMAC1_FR_0,
2388c2ecf20Sopenharmony_ci					FMN_STNID_GMAC1_TX3, 8, 8, 32);
2398c2ecf20Sopenharmony_ci		setup_fmn_cc(dma, FMN_STNID_DMA_0,
2408c2ecf20Sopenharmony_ci					FMN_STNID_DMA_3, 4, 4, 64);
2418c2ecf20Sopenharmony_ci		setup_fmn_cc(cmp, FMN_STNID_CMP_0,
2428c2ecf20Sopenharmony_ci					FMN_STNID_CMP_3, 4, 4, 64);
2438c2ecf20Sopenharmony_ci		setup_fmn_cc(sae, FMN_STNID_SEC0,
2448c2ecf20Sopenharmony_ci					FMN_STNID_SEC1, 2, 8, 128);
2458c2ecf20Sopenharmony_ci		break;
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLR308:
2488c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLR308C:
2498c2ecf20Sopenharmony_ci		setup_fmn_cc(&gmac[0], FMN_STNID_GMAC0,
2508c2ecf20Sopenharmony_ci					FMN_STNID_GMAC0_TX3, 8, 16, 32);
2518c2ecf20Sopenharmony_ci		setup_fmn_cc(dma, FMN_STNID_DMA_0,
2528c2ecf20Sopenharmony_ci					FMN_STNID_DMA_3, 4, 8, 64);
2538c2ecf20Sopenharmony_ci		setup_fmn_cc(sae, FMN_STNID_SEC0,
2548c2ecf20Sopenharmony_ci					FMN_STNID_SEC1, 2, 4, 128);
2558c2ecf20Sopenharmony_ci		break;
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLR532:
2588c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLR532C:
2598c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLR516C:
2608c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLR508C:
2618c2ecf20Sopenharmony_ci		setup_fmn_cc(&gmac[0], FMN_STNID_GMAC0,
2628c2ecf20Sopenharmony_ci					FMN_STNID_GMAC0_TX3, 8, 16, 32);
2638c2ecf20Sopenharmony_ci		setup_fmn_cc(dma, FMN_STNID_DMA_0,
2648c2ecf20Sopenharmony_ci					FMN_STNID_DMA_3, 4, 8, 64);
2658c2ecf20Sopenharmony_ci		setup_fmn_cc(sae, FMN_STNID_SEC0,
2668c2ecf20Sopenharmony_ci					FMN_STNID_SEC1, 2, 4, 128);
2678c2ecf20Sopenharmony_ci		break;
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLR732:
2708c2ecf20Sopenharmony_ci	case PRID_IMP_NETLOGIC_XLR716:
2718c2ecf20Sopenharmony_ci		setup_fmn_cc(&xgmac[0], FMN_STNID_XMAC0_00_TX,
2728c2ecf20Sopenharmony_ci					FMN_STNID_XMAC0_15_TX, 8, 0, 32);
2738c2ecf20Sopenharmony_ci		setup_fmn_cc(&xgmac[1], FMN_STNID_XMAC1_00_TX,
2748c2ecf20Sopenharmony_ci					FMN_STNID_XMAC1_15_TX, 8, 0, 32);
2758c2ecf20Sopenharmony_ci		setup_fmn_cc(&gmac[0], FMN_STNID_GMAC0,
2768c2ecf20Sopenharmony_ci					FMN_STNID_GMAC0_TX3, 8, 24, 32);
2778c2ecf20Sopenharmony_ci		setup_fmn_cc(dma, FMN_STNID_DMA_0,
2788c2ecf20Sopenharmony_ci					FMN_STNID_DMA_3, 4, 4, 64);
2798c2ecf20Sopenharmony_ci		setup_fmn_cc(sae, FMN_STNID_SEC0,
2808c2ecf20Sopenharmony_ci					FMN_STNID_SEC1, 2, 4, 128);
2818c2ecf20Sopenharmony_ci		break;
2828c2ecf20Sopenharmony_ci	default:
2838c2ecf20Sopenharmony_ci		pr_err("Unknown CPU with processor ID [%d]\n", processor_id);
2848c2ecf20Sopenharmony_ci		pr_err("Error: Cannot initialize FMN credits.\n");
2858c2ecf20Sopenharmony_ci	}
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci	check_credit_distribution();
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci#if 0 /* debug */
2908c2ecf20Sopenharmony_ci	print_credit_config(&cpu[0]);
2918c2ecf20Sopenharmony_ci	print_credit_config(&gmac[0]);
2928c2ecf20Sopenharmony_ci#endif
2938c2ecf20Sopenharmony_ci}
294