Skip to content

Commit 06fc36e

Browse files
TonyHan11kartben
authored andcommitted
drivers: ethernet: sam_eth: get the register address from parent node
Get the register address from the common parent node as the device tree updated in the last commit. Signed-off-by: Tony Han <[email protected]>
1 parent 17981d2 commit 06fc36e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

drivers/ethernet/eth_sam_gmac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2155,10 +2155,10 @@ static void eth0_irq_config(void)
21552155
PINCTRL_DT_INST_DEFINE(0);
21562156

21572157
static const struct eth_sam_dev_cfg eth0_config = {
2158-
.regs = (Gmac *)DT_INST_REG_ADDR(0),
2158+
.regs = (Gmac *)DT_REG_ADDR(DT_INST_PARENT(0)),
21592159
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0),
21602160
#ifdef CONFIG_SOC_FAMILY_ATMEL_SAM
2161-
.clock_cfg = SAM_DT_INST_CLOCK_PMC_CFG(0),
2161+
.clock_cfg = SAM_DT_CLOCK_PMC_CFG(0, DT_INST_PARENT(0)),
21622162
#endif
21632163
.config_func = eth0_irq_config,
21642164
.phy_dev = DEVICE_DT_GET(DT_INST_PHANDLE(0, phy_handle))

drivers/mdio/mdio_sam.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,14 @@ static DEVICE_API(mdio, mdio_sam_driver_api) = {
169169

170170
#define MDIO_SAM_CLOCK(n) \
171171
COND_CODE_1(CONFIG_SOC_FAMILY_ATMEL_SAM, \
172-
(.clock_cfg = SAM_DT_INST_CLOCK_PMC_CFG(n),), () \
172+
(.clock_cfg = \
173+
SAM_DT_CLOCK_PMC_CFG(0, DT_INST_PARENT(n)),), \
174+
() \
173175
)
174176

175177
#define MDIO_SAM_CONFIG(n) \
176178
static const struct mdio_sam_dev_config mdio_sam_dev_config_##n = { \
177-
.regs = (Gmac *)DT_INST_REG_ADDR(n), \
179+
.regs = (Gmac *)DT_REG_ADDR(DT_INST_PARENT(n)), \
178180
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
179181
MDIO_SAM_CLOCK(n) \
180182
};

0 commit comments

Comments
 (0)