Skip to content

Commit bae7711

Browse files
arm: mach-sc5xx: Adding init for sc5xx boards
Adding machine specific initialization Signed-off-by: UtsavAgarwalADI <utsav.agarwal@analog.com>
1 parent 854035a commit bae7711

File tree

7 files changed

+248
-0
lines changed

7 files changed

+248
-0
lines changed

arch/arm/mach-sc5xx/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
3+
obj-y := core.o spu.o
4+
obj-$(CONFIG_ARCH_SC57X) += sc57x-ezkit.o
5+
obj-$(CONFIG_ARCH_SC58X) += sc58x-ezkit.o
6+
obj-$(CONFIG_ARCH_SC59X) += sc59x-ezkit.o

arch/arm/mach-sc5xx/core.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* Common functionality needed on all ezkits. Things like phy fixup functions, etc.
4+
*
5+
* (C) Copyright 2022 - Analog Devices, Inc.
6+
*
7+
* Written and/or maintained by Timesys Corporation
8+
*
9+
* Contact: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
10+
* Contact: Greg Malysa <greg.malysa@timesys.com>
11+
*
12+
*/
13+
14+
#include <linux/init.h>
15+
#include <linux/phy.h>
16+
17+
#include "core.h"
18+
19+
#define DP83865_PHY_ID 0x20005c7a
20+
#define REG_DP83865_AUX_CTRL 0x12
21+
#define BITP_AUX_CTRL_RGMII_EN 12
22+
#define RGMII_3COM_MODE 3
23+
static int dp83865_fixup(struct phy_device *phydev)
24+
{
25+
int phy_data = 0;
26+
27+
phy_data = phy_read(phydev, REG_DP83865_AUX_CTRL);
28+
29+
/* enable 3com mode for RGMII */
30+
phy_write(phydev, REG_DP83865_AUX_CTRL,
31+
(RGMII_3COM_MODE << BITP_AUX_CTRL_RGMII_EN) | phy_data);
32+
33+
return 0;
34+
}
35+
36+
#define DP83848_PHY_ID 0x20005c90
37+
#define REG_DP83848_PHY_MICR 0x11
38+
#define BITM_PHY_MICR_INTEN 0x2
39+
#define BITM_PHY_MICR_INT_OE 0x1
40+
static int dp83848_fixup(struct phy_device *phydev)
41+
{
42+
phy_write(phydev, REG_DP83848_PHY_MICR,
43+
BITM_PHY_MICR_INTEN | BITM_PHY_MICR_INT_OE);
44+
45+
return 0;
46+
}
47+
48+
void __init sc5xx_init_ethernet(void)
49+
{
50+
if (IS_BUILTIN(CONFIG_PHYLIB)) {
51+
phy_register_fixup_for_uid(DP83865_PHY_ID, 0xffffffff, dp83865_fixup);
52+
phy_register_fixup_for_uid(DP83848_PHY_ID, 0xffffffff, dp83848_fixup);
53+
}
54+
}

arch/arm/mach-sc5xx/core.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* SPDX-License-Identifier: GPL-2.0-or-later */
2+
/*
3+
* (C) Copyright 2022 - Analog Devices, Inc.
4+
*
5+
* Written and/or maintained by Timesys Corporation
6+
*
7+
* Contact: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
8+
* Contact: Greg Malysa <greg.malysa@timesys.com>
9+
*
10+
*/
11+
12+
#ifndef ARCH_SC5XX_CORE_H
13+
#define ARCH_SC5XX_CORE_H
14+
15+
#include <linux/init.h>
16+
17+
void __init sc5xx_init_ethernet(void);
18+
19+
#endif

arch/arm/mach-sc5xx/sc57x-ezkit.c

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* Machine entries for the sc573 ezkit
4+
*
5+
* (C) Copyright 2022 - Analog Devices, Inc.
6+
*
7+
* Written and/or maintained by Timesys Corporation
8+
*
9+
* Contact: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
10+
* Contact: Greg Malysa <greg.malysa@timesys.com>
11+
*
12+
*/
13+
14+
#include <linux/init.h>
15+
#include <linux/of_platform.h>
16+
17+
#include <asm/mach/arch.h>
18+
#include <asm/siginfo.h>
19+
#include <asm/signal.h>
20+
21+
#include "core.h"
22+
23+
static const char * const sc57x_dt_board_compat[] __initconst = {
24+
"adi,sc57x",
25+
NULL
26+
};
27+
28+
static bool first_fault = true;
29+
30+
static int sc57x_abort_handler(unsigned long addr, unsigned int fsr,
31+
struct pt_regs *regs)
32+
{
33+
if (fsr == 0x1c06 && first_fault) {
34+
first_fault = false;
35+
36+
/*
37+
* These faults with code 0x1c06 happens for no good reason,
38+
* possibly left over from the CFE boot loader.
39+
*/
40+
pr_warn("External imprecise Data abort at addr=%#lx, fsr=%#x ignored.\n",
41+
addr, fsr);
42+
return 0;
43+
}
44+
45+
/* Others should cause a fault */
46+
return 1;
47+
}
48+
49+
static void __init sc57x_init_early(void)
50+
{
51+
hook_fault_code(16 + 6, sc57x_abort_handler, SIGBUS, BUS_OBJERR,
52+
"imprecise external abort");
53+
}
54+
55+
static void __init sc57x_init(void)
56+
{
57+
pr_info("%s: registering device resources\n", __func__);
58+
of_platform_default_populate(NULL, NULL, NULL);
59+
sc5xx_init_ethernet();
60+
}
61+
62+
DT_MACHINE_START(SC57X_DT, "SC57x-EZKIT (Device Tree Support)")
63+
.l2c_aux_val = 0,
64+
.l2c_aux_mask = ~0,
65+
.init_early = sc57x_init_early,
66+
.init_machine = sc57x_init,
67+
.dt_compat = sc57x_dt_board_compat,
68+
MACHINE_END

arch/arm/mach-sc5xx/sc58x-ezkit.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* Machine entries for the sc58x boards (ezkit, mini, etc.)
4+
*
5+
* (C) Copyright 2022 - Analog Devices, Inc.
6+
*
7+
* Written and/or maintained by Timesys Corporation
8+
*
9+
* Contact: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
10+
* Contact: Greg Malysa <greg.malysa@timesys.com>
11+
*
12+
*/
13+
14+
#include <linux/init.h>
15+
#include <linux/of_platform.h>
16+
17+
#include <asm/mach/arch.h>
18+
19+
#include "core.h"
20+
21+
static const char * const sc58x_dt_board_compat[] __initconst = {
22+
"adi,sc58x",
23+
NULL
24+
};
25+
26+
static void __init sc58x_init(void)
27+
{
28+
pr_info("%s: registering device resources\n", __func__);
29+
of_platform_default_populate(NULL, NULL, NULL);
30+
sc5xx_init_ethernet();
31+
}
32+
33+
DT_MACHINE_START(SC58X_DT, "SC58x-EZKIT (Device Tree Support)")
34+
.l2c_aux_val = 0,
35+
.l2c_aux_mask = ~0,
36+
.init_machine = sc58x_init,
37+
.dt_compat = sc58x_dt_board_compat,
38+
MACHINE_END

arch/arm/mach-sc5xx/sc59x-ezkit.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* Machine entries for the sc594 ezkit
4+
*
5+
* (C) Copyright 2022 - Analog Devices, Inc.
6+
*
7+
* Written and/or maintained by Timesys Corporation
8+
*
9+
* Contact: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
10+
* Contact: Greg Malysa <greg.malysa@timesys.com>
11+
*
12+
*/
13+
14+
#include <linux/init.h>
15+
#include <linux/of_platform.h>
16+
17+
#include <asm/mach/arch.h>
18+
#include <asm/siginfo.h>
19+
#include <asm/signal.h>
20+
21+
#include "core.h"
22+
23+
static const char * const sc59x_dt_board_compat[] __initconst = {
24+
"adi,sc59x",
25+
NULL
26+
};
27+
28+
static void __init sc59x_init(void)
29+
{
30+
pr_info("%s: registering device resources\n", __func__);
31+
of_platform_default_populate(NULL, NULL, NULL);
32+
sc5xx_init_ethernet();
33+
}
34+
35+
DT_MACHINE_START(SC59X_DT, "SC59x-EZKIT (Device Tree Support)")
36+
.l2c_aux_val = 0,
37+
.l2c_aux_mask = ~0,
38+
.init_machine = sc59x_init,
39+
.dt_compat = sc59x_dt_board_compat,
40+
MACHINE_END

arch/arm/mach-sc5xx/spu.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* Legacy SPU-compatibility layer. No SPU functionality is used currently,
4+
* this will be removed when it is eliminated from all drivers.
5+
*
6+
* (C) Copyright 2022 - Analog Devices, Inc.
7+
*
8+
* Written and/or maintained by Timesys Corporation
9+
*
10+
* Contact: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
11+
* Contact: Greg Malysa <greg.malysa@timesys.com>
12+
*
13+
*/
14+
15+
#include <linux/export.h>
16+
#include <linux/types.h>
17+
18+
void set_spu_securep_msec(uint16_t n, bool msec)
19+
{
20+
(void)n;
21+
(void)msec;
22+
}
23+
EXPORT_SYMBOL(set_spu_securep_msec);

0 commit comments

Comments
 (0)