2016-12-24 10:58:38 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Piotr Mienkowski
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @file
|
|
|
|
* @brief Atmel SAM MCU family Ethernet PHY (GMAC) driver.
|
|
|
|
*/
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_DRIVERS_ETHERNET_PHY_SAM_GMAC_H_
|
|
|
|
#define ZEPHYR_DRIVERS_ETHERNET_PHY_SAM_GMAC_H_
|
2016-12-24 10:58:38 +08:00
|
|
|
|
Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t. This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.
We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.
We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.
Jira: ZEP-2051
Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-19 23:32:08 +08:00
|
|
|
#include <zephyr/types.h>
|
2016-12-24 10:58:38 +08:00
|
|
|
#include <soc.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define PHY_DUPLEX_FULL GMAC_NCFGR_FD
|
|
|
|
#define PHY_DUPLEX_HALF 0
|
|
|
|
#define PHY_SPEED_100M GMAC_NCFGR_SPD
|
|
|
|
#define PHY_SPEED_10M 0
|
|
|
|
|
|
|
|
struct phy_sam_gmac_dev {
|
|
|
|
Gmac *regs;
|
2020-05-28 00:26:57 +08:00
|
|
|
uint8_t address;
|
2016-12-24 10:58:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Initialize Ethernet PHY device.
|
|
|
|
*
|
|
|
|
* @param phy PHY instance
|
|
|
|
* @return 0 on success or a negative error value on failure
|
|
|
|
*/
|
|
|
|
int phy_sam_gmac_init(const struct phy_sam_gmac_dev *phy);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Auto-negotiate and configure link parameters.
|
|
|
|
*
|
|
|
|
* @param phy PHY instance
|
|
|
|
* @param status link parameters common to remote and local PHY
|
|
|
|
* @return 0 on success or a negative error value on failure
|
|
|
|
*/
|
|
|
|
int phy_sam_gmac_auto_negotiate(const struct phy_sam_gmac_dev *phy,
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t *status);
|
2016-12-24 10:58:38 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get PHY ID value.
|
|
|
|
*
|
|
|
|
* @param phy PHY instance
|
|
|
|
* @return PHY ID value or 0xFFFFFFFF on failure
|
|
|
|
*/
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t phy_sam_gmac_id_get(const struct phy_sam_gmac_dev *phy);
|
2016-12-24 10:58:38 +08:00
|
|
|
|
2020-03-11 22:09:25 +08:00
|
|
|
/**
|
|
|
|
* @brief Get PHY link status.
|
|
|
|
*
|
|
|
|
* @param phy PHY instance
|
|
|
|
* @return link status
|
|
|
|
*/
|
|
|
|
bool phy_sam_gmac_link_status_get(const struct phy_sam_gmac_dev *phy);
|
|
|
|
|
2016-12-24 10:58:38 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_DRIVERS_ETHERNET_PHY_SAM_GMAC_H_ */
|