drivers: eth: sam: Replace constants by devicetree values

The zephyr sam gmac driver don't get register address and, in some
cases, peripheral id from devicetree.  This replace headers constants
in favor of devicetree values.

This fix wrong Atmel SAME7x/SAMV7x gmac register address and add
missing peripheral id property for SAM family.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This commit is contained in:
Gerson Fernando Budke 2021-07-05 21:29:56 -03:00 committed by Christopher Friedt
parent 49eb184ea4
commit 3771b968f0
5 changed files with 19 additions and 5 deletions

View file

@ -2222,14 +2222,14 @@ static const struct soc_gpio_pin pins_eth0[] = ATMEL_SAM_DT_INST_PINS(0);
#endif
static const struct eth_sam_dev_cfg eth0_config = {
.regs = GMAC,
.periph_id = ID_GMAC,
.regs = (Gmac *)DT_INST_REG_ADDR(0),
#ifdef CONFIG_SOC_FAMILY_SAM
.periph_id = DT_INST_PROP_OR(0, peripheral_id, 0),
.pin_list = pins_eth0,
.pin_list_size = ARRAY_SIZE(pins_eth0),
#endif
.config_func = eth0_irq_config,
.phy = {GMAC, CONFIG_ETH_SAM_GMAC_PHY_ADDR},
.phy = {(Gmac *)DT_INST_REG_ADDR(0), CONFIG_ETH_SAM_GMAC_PHY_ADDR},
};
static struct eth_sam_dev_data eth0_data = {

View file

@ -261,9 +261,11 @@ struct gmac_queue {
/* Device constant configuration parameters */
struct eth_sam_dev_cfg {
Gmac *regs;
#ifdef CONFIG_SOC_FAMILY_SAM
uint32_t periph_id;
const struct soc_gpio_pin *pin_list;
uint32_t pin_list_size;
#endif
void (*config_func)(void);
struct phy_sam_gmac_dev phy;
};

View file

@ -149,6 +149,7 @@
gmac: ethernet@40034000 {
compatible = "atmel,sam-gmac";
reg = <0x40034000 0x4000>;
peripheral-id = <44>;
interrupts = <44 0>;
interrupt-names = "gmac";
num-queues = <1>;

View file

@ -338,9 +338,10 @@
label = "USBHS";
};
gmac: ethernet@40050088 {
gmac: ethernet@40050000 {
compatible = "atmel,sam-gmac";
reg = <0x40050088 0x4000>;
reg = <0x40050000 0x4000>;
peripheral-id = <39>;
interrupts = <39 0>, <66 0>, <67 0>;
interrupt-names = "gmac", "q1", "q2";
num-queues = <3>;

View file

@ -6,3 +6,13 @@ description: Atmel SAM-family GMAC Ethernet
compatible: "atmel,sam-gmac"
include: atmel,gmac-common.yaml
properties:
peripheral-id:
type: int
required: true
description: |
The peripheral identifier is required for Atmel SAMs MCUs to indicate
which is the clock line associated with a specific peripheral. This
clock line is defined at Power Management Controller (PMC) and it
enables the peripheral.