18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci * for more details.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/init.h>
108c2ecf20Sopenharmony_ci#include <linux/kernel.h>
118c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
128c2ecf20Sopenharmony_ci#include <linux/export.h>
138c2ecf20Sopenharmony_ci#include <bcm63xx_dev_enet.h>
148c2ecf20Sopenharmony_ci#include <bcm63xx_io.h>
158c2ecf20Sopenharmony_ci#include <bcm63xx_regs.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_cistatic const unsigned long bcm6348_regs_enetdmac[] = {
188c2ecf20Sopenharmony_ci	[ENETDMAC_CHANCFG]	= ENETDMAC_CHANCFG_REG,
198c2ecf20Sopenharmony_ci	[ENETDMAC_IR]		= ENETDMAC_IR_REG,
208c2ecf20Sopenharmony_ci	[ENETDMAC_IRMASK]	= ENETDMAC_IRMASK_REG,
218c2ecf20Sopenharmony_ci	[ENETDMAC_MAXBURST]	= ENETDMAC_MAXBURST_REG,
228c2ecf20Sopenharmony_ci};
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistatic const unsigned long bcm6345_regs_enetdmac[] = {
258c2ecf20Sopenharmony_ci	[ENETDMAC_CHANCFG]	= ENETDMA_6345_CHANCFG_REG,
268c2ecf20Sopenharmony_ci	[ENETDMAC_IR]		= ENETDMA_6345_IR_REG,
278c2ecf20Sopenharmony_ci	[ENETDMAC_IRMASK]	= ENETDMA_6345_IRMASK_REG,
288c2ecf20Sopenharmony_ci	[ENETDMAC_MAXBURST]	= ENETDMA_6345_MAXBURST_REG,
298c2ecf20Sopenharmony_ci	[ENETDMAC_BUFALLOC]	= ENETDMA_6345_BUFALLOC_REG,
308c2ecf20Sopenharmony_ci	[ENETDMAC_RSTART]	= ENETDMA_6345_RSTART_REG,
318c2ecf20Sopenharmony_ci	[ENETDMAC_FC]		= ENETDMA_6345_FC_REG,
328c2ecf20Sopenharmony_ci	[ENETDMAC_LEN]		= ENETDMA_6345_LEN_REG,
338c2ecf20Sopenharmony_ci};
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciconst unsigned long *bcm63xx_regs_enetdmac;
368c2ecf20Sopenharmony_ciEXPORT_SYMBOL(bcm63xx_regs_enetdmac);
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistatic __init void bcm63xx_enetdmac_regs_init(void)
398c2ecf20Sopenharmony_ci{
408c2ecf20Sopenharmony_ci	if (BCMCPU_IS_6345())
418c2ecf20Sopenharmony_ci		bcm63xx_regs_enetdmac = bcm6345_regs_enetdmac;
428c2ecf20Sopenharmony_ci	else
438c2ecf20Sopenharmony_ci		bcm63xx_regs_enetdmac = bcm6348_regs_enetdmac;
448c2ecf20Sopenharmony_ci}
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_cistatic struct resource shared_res[] = {
478c2ecf20Sopenharmony_ci	{
488c2ecf20Sopenharmony_ci		.start		= -1, /* filled at runtime */
498c2ecf20Sopenharmony_ci		.end		= -1, /* filled at runtime */
508c2ecf20Sopenharmony_ci		.flags		= IORESOURCE_MEM,
518c2ecf20Sopenharmony_ci	},
528c2ecf20Sopenharmony_ci	{
538c2ecf20Sopenharmony_ci		.start		= -1, /* filled at runtime */
548c2ecf20Sopenharmony_ci		.end		= -1, /* filled at runtime */
558c2ecf20Sopenharmony_ci		.flags		= IORESOURCE_MEM,
568c2ecf20Sopenharmony_ci	},
578c2ecf20Sopenharmony_ci	{
588c2ecf20Sopenharmony_ci		.start		= -1, /* filled at runtime */
598c2ecf20Sopenharmony_ci		.end		= -1, /* filled at runtime */
608c2ecf20Sopenharmony_ci		.flags		= IORESOURCE_MEM,
618c2ecf20Sopenharmony_ci	},
628c2ecf20Sopenharmony_ci};
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_cistatic struct platform_device bcm63xx_enet_shared_device = {
658c2ecf20Sopenharmony_ci	.name		= "bcm63xx_enet_shared",
668c2ecf20Sopenharmony_ci	.id		= 0,
678c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(shared_res),
688c2ecf20Sopenharmony_ci	.resource	= shared_res,
698c2ecf20Sopenharmony_ci};
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_cistatic int shared_device_registered;
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_cistatic u64 enet_dmamask = DMA_BIT_MASK(32);
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_cistatic struct resource enet0_res[] = {
768c2ecf20Sopenharmony_ci	{
778c2ecf20Sopenharmony_ci		.start		= -1, /* filled at runtime */
788c2ecf20Sopenharmony_ci		.end		= -1, /* filled at runtime */
798c2ecf20Sopenharmony_ci		.flags		= IORESOURCE_MEM,
808c2ecf20Sopenharmony_ci	},
818c2ecf20Sopenharmony_ci	{
828c2ecf20Sopenharmony_ci		.start		= -1, /* filled at runtime */
838c2ecf20Sopenharmony_ci		.flags		= IORESOURCE_IRQ,
848c2ecf20Sopenharmony_ci	},
858c2ecf20Sopenharmony_ci	{
868c2ecf20Sopenharmony_ci		.start		= -1, /* filled at runtime */
878c2ecf20Sopenharmony_ci		.flags		= IORESOURCE_IRQ,
888c2ecf20Sopenharmony_ci	},
898c2ecf20Sopenharmony_ci	{
908c2ecf20Sopenharmony_ci		.start		= -1, /* filled at runtime */
918c2ecf20Sopenharmony_ci		.flags		= IORESOURCE_IRQ,
928c2ecf20Sopenharmony_ci	},
938c2ecf20Sopenharmony_ci};
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_cistatic struct bcm63xx_enet_platform_data enet0_pd;
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_cistatic struct platform_device bcm63xx_enet0_device = {
988c2ecf20Sopenharmony_ci	.name		= "bcm63xx_enet",
998c2ecf20Sopenharmony_ci	.id		= 0,
1008c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(enet0_res),
1018c2ecf20Sopenharmony_ci	.resource	= enet0_res,
1028c2ecf20Sopenharmony_ci	.dev		= {
1038c2ecf20Sopenharmony_ci		.platform_data = &enet0_pd,
1048c2ecf20Sopenharmony_ci		.dma_mask = &enet_dmamask,
1058c2ecf20Sopenharmony_ci		.coherent_dma_mask = DMA_BIT_MASK(32),
1068c2ecf20Sopenharmony_ci	},
1078c2ecf20Sopenharmony_ci};
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_cistatic struct resource enet1_res[] = {
1108c2ecf20Sopenharmony_ci	{
1118c2ecf20Sopenharmony_ci		.start		= -1, /* filled at runtime */
1128c2ecf20Sopenharmony_ci		.end		= -1, /* filled at runtime */
1138c2ecf20Sopenharmony_ci		.flags		= IORESOURCE_MEM,
1148c2ecf20Sopenharmony_ci	},
1158c2ecf20Sopenharmony_ci	{
1168c2ecf20Sopenharmony_ci		.start		= -1, /* filled at runtime */
1178c2ecf20Sopenharmony_ci		.flags		= IORESOURCE_IRQ,
1188c2ecf20Sopenharmony_ci	},
1198c2ecf20Sopenharmony_ci	{
1208c2ecf20Sopenharmony_ci		.start		= -1, /* filled at runtime */
1218c2ecf20Sopenharmony_ci		.flags		= IORESOURCE_IRQ,
1228c2ecf20Sopenharmony_ci	},
1238c2ecf20Sopenharmony_ci	{
1248c2ecf20Sopenharmony_ci		.start		= -1, /* filled at runtime */
1258c2ecf20Sopenharmony_ci		.flags		= IORESOURCE_IRQ,
1268c2ecf20Sopenharmony_ci	},
1278c2ecf20Sopenharmony_ci};
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_cistatic struct bcm63xx_enet_platform_data enet1_pd;
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_cistatic struct platform_device bcm63xx_enet1_device = {
1328c2ecf20Sopenharmony_ci	.name		= "bcm63xx_enet",
1338c2ecf20Sopenharmony_ci	.id		= 1,
1348c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(enet1_res),
1358c2ecf20Sopenharmony_ci	.resource	= enet1_res,
1368c2ecf20Sopenharmony_ci	.dev		= {
1378c2ecf20Sopenharmony_ci		.platform_data = &enet1_pd,
1388c2ecf20Sopenharmony_ci		.dma_mask = &enet_dmamask,
1398c2ecf20Sopenharmony_ci		.coherent_dma_mask = DMA_BIT_MASK(32),
1408c2ecf20Sopenharmony_ci	},
1418c2ecf20Sopenharmony_ci};
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_cistatic struct resource enetsw_res[] = {
1448c2ecf20Sopenharmony_ci	{
1458c2ecf20Sopenharmony_ci		/* start & end filled at runtime */
1468c2ecf20Sopenharmony_ci		.flags		= IORESOURCE_MEM,
1478c2ecf20Sopenharmony_ci	},
1488c2ecf20Sopenharmony_ci	{
1498c2ecf20Sopenharmony_ci		/* start filled at runtime */
1508c2ecf20Sopenharmony_ci		.flags		= IORESOURCE_IRQ,
1518c2ecf20Sopenharmony_ci	},
1528c2ecf20Sopenharmony_ci	{
1538c2ecf20Sopenharmony_ci		/* start filled at runtime */
1548c2ecf20Sopenharmony_ci		.flags		= IORESOURCE_IRQ,
1558c2ecf20Sopenharmony_ci	},
1568c2ecf20Sopenharmony_ci};
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_cistatic struct bcm63xx_enetsw_platform_data enetsw_pd;
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_cistatic struct platform_device bcm63xx_enetsw_device = {
1618c2ecf20Sopenharmony_ci	.name		= "bcm63xx_enetsw",
1628c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(enetsw_res),
1638c2ecf20Sopenharmony_ci	.resource	= enetsw_res,
1648c2ecf20Sopenharmony_ci	.dev		= {
1658c2ecf20Sopenharmony_ci		.platform_data = &enetsw_pd,
1668c2ecf20Sopenharmony_ci		.dma_mask = &enet_dmamask,
1678c2ecf20Sopenharmony_ci		.coherent_dma_mask = DMA_BIT_MASK(32),
1688c2ecf20Sopenharmony_ci	},
1698c2ecf20Sopenharmony_ci};
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_cistatic int __init register_shared(void)
1728c2ecf20Sopenharmony_ci{
1738c2ecf20Sopenharmony_ci	int ret, chan_count;
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci	if (shared_device_registered)
1768c2ecf20Sopenharmony_ci		return 0;
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci	bcm63xx_enetdmac_regs_init();
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci	shared_res[0].start = bcm63xx_regset_address(RSET_ENETDMA);
1818c2ecf20Sopenharmony_ci	shared_res[0].end = shared_res[0].start;
1828c2ecf20Sopenharmony_ci	if (BCMCPU_IS_6345())
1838c2ecf20Sopenharmony_ci		shared_res[0].end += (RSET_6345_ENETDMA_SIZE) - 1;
1848c2ecf20Sopenharmony_ci	else
1858c2ecf20Sopenharmony_ci		shared_res[0].end += (RSET_ENETDMA_SIZE)  - 1;
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci	if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368())
1888c2ecf20Sopenharmony_ci		chan_count = 32;
1898c2ecf20Sopenharmony_ci	else if (BCMCPU_IS_6345())
1908c2ecf20Sopenharmony_ci		chan_count = 8;
1918c2ecf20Sopenharmony_ci	else
1928c2ecf20Sopenharmony_ci		chan_count = 16;
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci	shared_res[1].start = bcm63xx_regset_address(RSET_ENETDMAC);
1958c2ecf20Sopenharmony_ci	shared_res[1].end = shared_res[1].start;
1968c2ecf20Sopenharmony_ci	shared_res[1].end += RSET_ENETDMAC_SIZE(chan_count)  - 1;
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci	shared_res[2].start = bcm63xx_regset_address(RSET_ENETDMAS);
1998c2ecf20Sopenharmony_ci	shared_res[2].end = shared_res[2].start;
2008c2ecf20Sopenharmony_ci	shared_res[2].end += RSET_ENETDMAS_SIZE(chan_count)  - 1;
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci	ret = platform_device_register(&bcm63xx_enet_shared_device);
2038c2ecf20Sopenharmony_ci	if (ret)
2048c2ecf20Sopenharmony_ci		return ret;
2058c2ecf20Sopenharmony_ci	shared_device_registered = 1;
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci	return 0;
2088c2ecf20Sopenharmony_ci}
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ciint __init bcm63xx_enet_register(int unit,
2118c2ecf20Sopenharmony_ci				 const struct bcm63xx_enet_platform_data *pd)
2128c2ecf20Sopenharmony_ci{
2138c2ecf20Sopenharmony_ci	struct platform_device *pdev;
2148c2ecf20Sopenharmony_ci	struct bcm63xx_enet_platform_data *dpd;
2158c2ecf20Sopenharmony_ci	int ret;
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ci	if (unit > 1)
2188c2ecf20Sopenharmony_ci		return -ENODEV;
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci	if (unit == 1 && (BCMCPU_IS_6338() || BCMCPU_IS_6345()))
2218c2ecf20Sopenharmony_ci		return -ENODEV;
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci	ret = register_shared();
2248c2ecf20Sopenharmony_ci	if (ret)
2258c2ecf20Sopenharmony_ci		return ret;
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci	if (unit == 0) {
2288c2ecf20Sopenharmony_ci		enet0_res[0].start = bcm63xx_regset_address(RSET_ENET0);
2298c2ecf20Sopenharmony_ci		enet0_res[0].end = enet0_res[0].start;
2308c2ecf20Sopenharmony_ci		enet0_res[0].end += RSET_ENET_SIZE - 1;
2318c2ecf20Sopenharmony_ci		enet0_res[1].start = bcm63xx_get_irq_number(IRQ_ENET0);
2328c2ecf20Sopenharmony_ci		enet0_res[2].start = bcm63xx_get_irq_number(IRQ_ENET0_RXDMA);
2338c2ecf20Sopenharmony_ci		enet0_res[3].start = bcm63xx_get_irq_number(IRQ_ENET0_TXDMA);
2348c2ecf20Sopenharmony_ci		pdev = &bcm63xx_enet0_device;
2358c2ecf20Sopenharmony_ci	} else {
2368c2ecf20Sopenharmony_ci		enet1_res[0].start = bcm63xx_regset_address(RSET_ENET1);
2378c2ecf20Sopenharmony_ci		enet1_res[0].end = enet1_res[0].start;
2388c2ecf20Sopenharmony_ci		enet1_res[0].end += RSET_ENET_SIZE - 1;
2398c2ecf20Sopenharmony_ci		enet1_res[1].start = bcm63xx_get_irq_number(IRQ_ENET1);
2408c2ecf20Sopenharmony_ci		enet1_res[2].start = bcm63xx_get_irq_number(IRQ_ENET1_RXDMA);
2418c2ecf20Sopenharmony_ci		enet1_res[3].start = bcm63xx_get_irq_number(IRQ_ENET1_TXDMA);
2428c2ecf20Sopenharmony_ci		pdev = &bcm63xx_enet1_device;
2438c2ecf20Sopenharmony_ci	}
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci	/* copy given platform data */
2468c2ecf20Sopenharmony_ci	dpd = pdev->dev.platform_data;
2478c2ecf20Sopenharmony_ci	memcpy(dpd, pd, sizeof(*pd));
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci	/* adjust them in case internal phy is used */
2508c2ecf20Sopenharmony_ci	if (dpd->use_internal_phy) {
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci		/* internal phy only exists for enet0 */
2538c2ecf20Sopenharmony_ci		if (unit == 1)
2548c2ecf20Sopenharmony_ci			return -ENODEV;
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_ci		dpd->phy_id = 1;
2578c2ecf20Sopenharmony_ci		dpd->has_phy_interrupt = 1;
2588c2ecf20Sopenharmony_ci		dpd->phy_interrupt = bcm63xx_get_irq_number(IRQ_ENET_PHY);
2598c2ecf20Sopenharmony_ci	}
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_ci	dpd->dma_chan_en_mask = ENETDMAC_CHANCFG_EN_MASK;
2628c2ecf20Sopenharmony_ci	dpd->dma_chan_int_mask = ENETDMAC_IR_PKTDONE_MASK;
2638c2ecf20Sopenharmony_ci	if (BCMCPU_IS_6345()) {
2648c2ecf20Sopenharmony_ci		dpd->dma_chan_en_mask |= ENETDMAC_CHANCFG_CHAINING_MASK;
2658c2ecf20Sopenharmony_ci		dpd->dma_chan_en_mask |= ENETDMAC_CHANCFG_WRAP_EN_MASK;
2668c2ecf20Sopenharmony_ci		dpd->dma_chan_en_mask |= ENETDMAC_CHANCFG_FLOWC_EN_MASK;
2678c2ecf20Sopenharmony_ci		dpd->dma_chan_int_mask |= ENETDMA_IR_BUFDONE_MASK;
2688c2ecf20Sopenharmony_ci		dpd->dma_chan_int_mask |= ENETDMA_IR_NOTOWNER_MASK;
2698c2ecf20Sopenharmony_ci		dpd->dma_chan_width = ENETDMA_6345_CHAN_WIDTH;
2708c2ecf20Sopenharmony_ci		dpd->dma_desc_shift = ENETDMA_6345_DESC_SHIFT;
2718c2ecf20Sopenharmony_ci	} else {
2728c2ecf20Sopenharmony_ci		dpd->dma_has_sram = true;
2738c2ecf20Sopenharmony_ci		dpd->dma_chan_width = ENETDMA_CHAN_WIDTH;
2748c2ecf20Sopenharmony_ci	}
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ci	if (unit == 0) {
2778c2ecf20Sopenharmony_ci		dpd->rx_chan = 0;
2788c2ecf20Sopenharmony_ci		dpd->tx_chan = 1;
2798c2ecf20Sopenharmony_ci	} else {
2808c2ecf20Sopenharmony_ci		dpd->rx_chan = 2;
2818c2ecf20Sopenharmony_ci		dpd->tx_chan = 3;
2828c2ecf20Sopenharmony_ci	}
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci	ret = platform_device_register(pdev);
2858c2ecf20Sopenharmony_ci	if (ret)
2868c2ecf20Sopenharmony_ci		return ret;
2878c2ecf20Sopenharmony_ci	return 0;
2888c2ecf20Sopenharmony_ci}
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ciint __init
2918c2ecf20Sopenharmony_cibcm63xx_enetsw_register(const struct bcm63xx_enetsw_platform_data *pd)
2928c2ecf20Sopenharmony_ci{
2938c2ecf20Sopenharmony_ci	int ret;
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ci	if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368())
2968c2ecf20Sopenharmony_ci		return -ENODEV;
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci	ret = register_shared();
2998c2ecf20Sopenharmony_ci	if (ret)
3008c2ecf20Sopenharmony_ci		return ret;
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci	enetsw_res[0].start = bcm63xx_regset_address(RSET_ENETSW);
3038c2ecf20Sopenharmony_ci	enetsw_res[0].end = enetsw_res[0].start;
3048c2ecf20Sopenharmony_ci	enetsw_res[0].end += RSET_ENETSW_SIZE - 1;
3058c2ecf20Sopenharmony_ci	enetsw_res[1].start = bcm63xx_get_irq_number(IRQ_ENETSW_RXDMA0);
3068c2ecf20Sopenharmony_ci	enetsw_res[2].start = bcm63xx_get_irq_number(IRQ_ENETSW_TXDMA0);
3078c2ecf20Sopenharmony_ci	if (!enetsw_res[2].start)
3088c2ecf20Sopenharmony_ci		enetsw_res[2].start = -1;
3098c2ecf20Sopenharmony_ci
3108c2ecf20Sopenharmony_ci	memcpy(bcm63xx_enetsw_device.dev.platform_data, pd, sizeof(*pd));
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci	if (BCMCPU_IS_6328())
3138c2ecf20Sopenharmony_ci		enetsw_pd.num_ports = ENETSW_PORTS_6328;
3148c2ecf20Sopenharmony_ci	else if (BCMCPU_IS_6362() || BCMCPU_IS_6368())
3158c2ecf20Sopenharmony_ci		enetsw_pd.num_ports = ENETSW_PORTS_6368;
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci	enetsw_pd.dma_has_sram = true;
3188c2ecf20Sopenharmony_ci	enetsw_pd.dma_chan_width = ENETDMA_CHAN_WIDTH;
3198c2ecf20Sopenharmony_ci	enetsw_pd.dma_chan_en_mask = ENETDMAC_CHANCFG_EN_MASK;
3208c2ecf20Sopenharmony_ci	enetsw_pd.dma_chan_int_mask = ENETDMAC_IR_PKTDONE_MASK;
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_ci	ret = platform_device_register(&bcm63xx_enetsw_device);
3238c2ecf20Sopenharmony_ci	if (ret)
3248c2ecf20Sopenharmony_ci		return ret;
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_ci	return 0;
3278c2ecf20Sopenharmony_ci}
328