Skip to content

Commit 0a9a1ee

Browse files
Roger QuadrosNipaLocal
authored andcommitted
net: ti: prueth: Adds support for PRUETH on AM33x and AM43x SOCs
Adds support for AM335x and AM437x datasets. Dual-EMAC and Switch mode firmware elf file to switch between protocols at run time. Added API hooks for IEP module (legacy 32-bit model) to support timestamping requests from application. Signed-off-by: Roger Quadros <[email protected]> Signed-off-by: Andrew F. Davis <[email protected]> Signed-off-by: Basharath Hussain Khaja <[email protected]> Signed-off-by: Parvathi Pudi <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent f87f8be commit 0a9a1ee

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

drivers/net/ethernet/ti/icssg/icss_iep.c

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,59 @@ static const struct icss_iep_plat_data am57xx_icss_iep_plat_data = {
10061006
.config = &am654_icss_iep_regmap_config,
10071007
};
10081008

1009+
static bool am335x_icss_iep_valid_reg(struct device *dev, unsigned int reg)
1010+
{
1011+
switch (reg) {
1012+
case ICSS_IEP_GLOBAL_CFG_REG ... ICSS_IEP_CAPTURE_STAT_REG:
1013+
case ICSS_IEP_CAP6_RISE_REG0:
1014+
case ICSS_IEP_CMP_CFG_REG ... ICSS_IEP_CMP0_REG0:
1015+
case ICSS_IEP_CMP8_REG0 ... ICSS_IEP_SYNC_START_REG:
1016+
return true;
1017+
default:
1018+
return false;
1019+
}
1020+
1021+
return false;
1022+
}
1023+
1024+
static const struct regmap_config am335x_icss_iep_regmap_config = {
1025+
.name = "icss iep",
1026+
.reg_stride = 1,
1027+
.reg_write = icss_iep_regmap_write,
1028+
.reg_read = icss_iep_regmap_read,
1029+
.writeable_reg = am335x_icss_iep_valid_reg,
1030+
.readable_reg = am335x_icss_iep_valid_reg,
1031+
};
1032+
1033+
static const struct icss_iep_plat_data am335x_icss_iep_plat_data = {
1034+
.flags = 0,
1035+
.reg_offs = {
1036+
[ICSS_IEP_GLOBAL_CFG_REG] = 0x00,
1037+
[ICSS_IEP_COMPEN_REG] = 0x08,
1038+
[ICSS_IEP_COUNT_REG0] = 0x0C,
1039+
[ICSS_IEP_CAPTURE_CFG_REG] = 0x10,
1040+
[ICSS_IEP_CAPTURE_STAT_REG] = 0x14,
1041+
1042+
[ICSS_IEP_CAP6_RISE_REG0] = 0x30,
1043+
1044+
[ICSS_IEP_CAP7_RISE_REG0] = 0x38,
1045+
1046+
[ICSS_IEP_CMP_CFG_REG] = 0x40,
1047+
[ICSS_IEP_CMP_STAT_REG] = 0x44,
1048+
[ICSS_IEP_CMP0_REG0] = 0x48,
1049+
1050+
[ICSS_IEP_CMP8_REG0] = 0x88,
1051+
[ICSS_IEP_SYNC_CTRL_REG] = 0x100,
1052+
[ICSS_IEP_SYNC0_STAT_REG] = 0x108,
1053+
[ICSS_IEP_SYNC1_STAT_REG] = 0x10C,
1054+
[ICSS_IEP_SYNC_PWIDTH_REG] = 0x110,
1055+
[ICSS_IEP_SYNC0_PERIOD_REG] = 0x114,
1056+
[ICSS_IEP_SYNC1_DELAY_REG] = 0x118,
1057+
[ICSS_IEP_SYNC_START_REG] = 0x11C,
1058+
},
1059+
.config = &am335x_icss_iep_regmap_config,
1060+
};
1061+
10091062
static const struct of_device_id icss_iep_of_match[] = {
10101063
{
10111064
.compatible = "ti,am654-icss-iep",
@@ -1015,6 +1068,14 @@ static const struct of_device_id icss_iep_of_match[] = {
10151068
.compatible = "ti,am5728-icss-iep",
10161069
.data = &am57xx_icss_iep_plat_data,
10171070
},
1071+
{
1072+
.compatible = "ti,am3356-icss-iep",
1073+
.data = &am335x_icss_iep_plat_data,
1074+
},
1075+
{
1076+
.compatible = "ti,am4376-icss-iep",
1077+
.data = &am335x_icss_iep_plat_data,
1078+
},
10181079
{},
10191080
};
10201081
MODULE_DEVICE_TABLE(of, icss_iep_of_match);

drivers/net/ethernet/ti/icssm/icssm_prueth.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,6 +2138,10 @@ static int icssm_prueth_probe(struct platform_device *pdev)
21382138
}
21392139

21402140
prueth->ocmc_ram_size = OCMC_RAM_SIZE;
2141+
/* Decreased by 8KB to address the reserved region for AM33x */
2142+
if (prueth->fw_data->driver_data == PRUSS_AM33XX)
2143+
prueth->ocmc_ram_size = (SZ_64K - SZ_8K);
2144+
21412145
prueth->mem[PRUETH_MEM_OCMC].va =
21422146
(void __iomem *)gen_pool_alloc(prueth->sram_pool,
21432147
prueth->ocmc_ram_size);
@@ -2381,6 +2385,32 @@ static const struct dev_pm_ops prueth_dev_pm_ops = {
23812385
SET_SYSTEM_SLEEP_PM_OPS(icssm_prueth_suspend, icssm_prueth_resume)
23822386
};
23832387

2388+
/* AM335x SoC-specific firmware data */
2389+
static struct prueth_private_data am335x_prueth_pdata = {
2390+
.driver_data = PRUSS_AM33XX,
2391+
.fw_pru[PRUSS_PRU0] = {
2392+
.fw_name[PRUSS_ETHTYPE_EMAC] =
2393+
"ti-pruss/am335x-pru0-prueth-fw.elf",
2394+
},
2395+
.fw_pru[PRUSS_PRU1] = {
2396+
.fw_name[PRUSS_ETHTYPE_EMAC] =
2397+
"ti-pruss/am335x-pru1-prueth-fw.elf",
2398+
},
2399+
};
2400+
2401+
/* AM437x SoC-specific firmware data */
2402+
static struct prueth_private_data am437x_prueth_pdata = {
2403+
.driver_data = PRUSS_AM43XX,
2404+
.fw_pru[PRUSS_PRU0] = {
2405+
.fw_name[PRUSS_ETHTYPE_EMAC] =
2406+
"ti-pruss/am437x-pru0-prueth-fw.elf",
2407+
},
2408+
.fw_pru[PRUSS_PRU1] = {
2409+
.fw_name[PRUSS_ETHTYPE_EMAC] =
2410+
"ti-pruss/am437x-pru1-prueth-fw.elf",
2411+
},
2412+
};
2413+
23842414
/* AM57xx SoC-specific firmware data */
23852415
static struct prueth_private_data am57xx_prueth_pdata = {
23862416
.driver_data = PRUSS_AM57XX,
@@ -2396,6 +2426,8 @@ static struct prueth_private_data am57xx_prueth_pdata = {
23962426

23972427
static const struct of_device_id prueth_dt_match[] = {
23982428
{ .compatible = "ti,am57-prueth", .data = &am57xx_prueth_pdata, },
2429+
{ .compatible = "ti,am4376-prueth", .data = &am437x_prueth_pdata, },
2430+
{ .compatible = "ti,am3359-prueth", .data = &am335x_prueth_pdata, },
23992431
{ /* sentinel */ }
24002432
};
24012433
MODULE_DEVICE_TABLE(of, prueth_dt_match);

0 commit comments

Comments
 (0)