diff options
Diffstat (limited to 'target/linux/layerscape/patches-5.4/701-net-0173-staging-fsl-dpaa2-mac-Add-support-for-new-link-state.patch')
-rw-r--r-- | target/linux/layerscape/patches-5.4/701-net-0173-staging-fsl-dpaa2-mac-Add-support-for-new-link-state.patch | 235 |
1 files changed, 0 insertions, 235 deletions
diff --git a/target/linux/layerscape/patches-5.4/701-net-0173-staging-fsl-dpaa2-mac-Add-support-for-new-link-state.patch b/target/linux/layerscape/patches-5.4/701-net-0173-staging-fsl-dpaa2-mac-Add-support-for-new-link-state.patch deleted file mode 100644 index 601a4bf6aa..0000000000 --- a/target/linux/layerscape/patches-5.4/701-net-0173-staging-fsl-dpaa2-mac-Add-support-for-new-link-state.patch +++ /dev/null @@ -1,235 +0,0 @@ -From d84bd24a4d6e5b05f7eb1a544dfd0bd98c7f5bb1 Mon Sep 17 00:00:00 2001 -From: Ioana Radulescu <ruxandra.radulescu@nxp.com> -Date: Wed, 17 Oct 2018 20:14:24 +0300 -Subject: [PATCH] staging: fsl-dpaa2/mac: Add support for new link state APIs - -Add v2 of dpmac_set_link_state() and dpmac_get_link_cfg() commands. -The new version allows setting & getting advertised and supported -link options. - -Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com> -Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> ---- - drivers/staging/fsl-dpaa2/mac/dpmac-cmd.h | 24 +++++++++++ - drivers/staging/fsl-dpaa2/mac/dpmac.c | 70 +++++++++++++++++++++++++++++++ - drivers/staging/fsl-dpaa2/mac/dpmac.h | 32 ++++++++++++++ - 3 files changed, 126 insertions(+) - ---- a/drivers/staging/fsl-dpaa2/mac/dpmac-cmd.h -+++ b/drivers/staging/fsl-dpaa2/mac/dpmac-cmd.h -@@ -36,9 +36,11 @@ - #define DPMAC_VER_MAJOR 4 - #define DPMAC_VER_MINOR 2 - #define DPMAC_CMD_BASE_VERSION 1 -+#define DPMAC_CMD_2ND_VERSION 2 - #define DPMAC_CMD_ID_OFFSET 4 - - #define DPMAC_CMD(id) (((id) << DPMAC_CMD_ID_OFFSET) | DPMAC_CMD_BASE_VERSION) -+#define DPMAC_CMD_V2(id) (((id) << DPMAC_CMD_ID_OFFSET) | DPMAC_CMD_2ND_VERSION) - - /* Command IDs */ - #define DPMAC_CMDID_CLOSE DPMAC_CMD(0x800) -@@ -58,7 +60,9 @@ - #define DPMAC_CMDID_CLEAR_IRQ_STATUS DPMAC_CMD(0x017) - - #define DPMAC_CMDID_GET_LINK_CFG DPMAC_CMD(0x0c2) -+#define DPMAC_CMDID_GET_LINK_CFG_V2 DPMAC_CMD_V2(0x0c2) - #define DPMAC_CMDID_SET_LINK_STATE DPMAC_CMD(0x0c3) -+#define DPMAC_CMDID_SET_LINK_STATE_V2 DPMAC_CMD_V2(0x0c3) - #define DPMAC_CMDID_GET_COUNTER DPMAC_CMD(0x0c4) - - #define DPMAC_CMDID_SET_PORT_MAC_ADDR DPMAC_CMD(0x0c5) -@@ -139,8 +143,17 @@ struct dpmac_rsp_get_link_cfg { - u32 rate; - }; - -+struct dpmac_rsp_get_link_cfg_v2 { -+ u64 options; -+ u32 rate; -+ u32 pad; -+ u64 advertising; -+}; -+ - #define DPMAC_STATE_SIZE 1 - #define DPMAC_STATE_SHIFT 0 -+#define DPMAC_STATE_VALID_SIZE 1 -+#define DPMAC_STATE_VALID_SHIFT 1 - - struct dpmac_cmd_set_link_state { - u64 options; -@@ -150,6 +163,17 @@ struct dpmac_cmd_set_link_state { - u8 up; - }; - -+struct dpmac_cmd_set_link_state_v2 { -+ u64 options; -+ u32 rate; -+ u32 pad0; -+ /* from lsb: up:1, state_valid:1 */ -+ u8 state; -+ u8 pad1[7]; -+ u64 supported; -+ u64 advertising; -+}; -+ - struct dpmac_cmd_get_counter { - u8 type; - }; ---- a/drivers/staging/fsl-dpaa2/mac/dpmac.c -+++ b/drivers/staging/fsl-dpaa2/mac/dpmac.c -@@ -492,6 +492,42 @@ int dpmac_get_link_cfg(struct fsl_mc_io - } - - /** -+ * dpmac_get_link_cfg_v2() - Get Ethernet link configuration -+ * @mc_io: Pointer to opaque I/O object -+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' -+ * @token: Token of DPMAC object -+ * @cfg: Returned structure with the link configuration -+ * -+ * Return: '0' on Success; Error code otherwise. -+ */ -+int dpmac_get_link_cfg_v2(struct fsl_mc_io *mc_io, -+ u32 cmd_flags, -+ u16 token, -+ struct dpmac_link_cfg *cfg) -+{ -+ struct dpmac_rsp_get_link_cfg_v2 *rsp_params; -+ struct fsl_mc_command cmd = { 0 }; -+ int err = 0; -+ -+ /* prepare command */ -+ cmd.header = mc_encode_cmd_header(DPMAC_CMDID_GET_LINK_CFG_V2, -+ cmd_flags, -+ token); -+ -+ /* send command to mc*/ -+ err = mc_send_command(mc_io, &cmd); -+ if (err) -+ return err; -+ -+ rsp_params = (struct dpmac_rsp_get_link_cfg_v2 *)cmd.params; -+ cfg->options = le64_to_cpu(rsp_params->options); -+ cfg->rate = le32_to_cpu(rsp_params->rate); -+ cfg->advertising = le64_to_cpu(rsp_params->advertising); -+ -+ return 0; -+} -+ -+/** - * dpmac_set_link_state() - Set the Ethernet link status - * @mc_io: Pointer to opaque I/O object - * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' -@@ -519,6 +555,40 @@ int dpmac_set_link_state(struct fsl_mc_i - - /* send command to mc*/ - return mc_send_command(mc_io, &cmd); -+} -+ -+/** -+ * dpmac_set_link_state_v2() - Set the Ethernet link status -+ * @mc_io: Pointer to opaque I/O object -+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' -+ * @token: Token of DPMAC object -+ * @link_state: Link state configuration -+ * -+ * Return: '0' on Success; Error code otherwise. -+ */ -+int dpmac_set_link_state_v2(struct fsl_mc_io *mc_io, -+ u32 cmd_flags, -+ u16 token, -+ struct dpmac_link_state *link_state) -+{ -+ struct dpmac_cmd_set_link_state_v2 *cmd_params; -+ struct fsl_mc_command cmd = { 0 }; -+ -+ /* prepare command */ -+ cmd.header = mc_encode_cmd_header(DPMAC_CMDID_SET_LINK_STATE_V2, -+ cmd_flags, -+ token); -+ cmd_params = (struct dpmac_cmd_set_link_state_v2 *)cmd.params; -+ cmd_params->options = cpu_to_le64(link_state->options); -+ cmd_params->rate = cpu_to_le32(link_state->rate); -+ dpmac_set_field(cmd_params->state, STATE, link_state->up); -+ dpmac_set_field(cmd_params->state, STATE_VALID, -+ link_state->state_valid); -+ cmd_params->supported = cpu_to_le64(link_state->supported); -+ cmd_params->advertising = cpu_to_le64(link_state->advertising); -+ -+ /* send command to mc*/ -+ return mc_send_command(mc_io, &cmd); - } - - /** ---- a/drivers/staging/fsl-dpaa2/mac/dpmac.h -+++ b/drivers/staging/fsl-dpaa2/mac/dpmac.h -@@ -202,13 +202,29 @@ int dpmac_get_attributes(struct fsl_mc_i - #define DPMAC_LINK_OPT_ASYM_PAUSE 0x0000000000000008ULL - - /** -+ * Advertised link speeds -+ */ -+#define DPMAC_ADVERTISED_10BASET_FULL 0x0000000000000001ULL -+#define DPMAC_ADVERTISED_100BASET_FULL 0x0000000000000002ULL -+#define DPMAC_ADVERTISED_1000BASET_FULL 0x0000000000000004ULL -+#define DPMAC_ADVERTISED_10000BASET_FULL 0x0000000000000010ULL -+#define DPMAC_ADVERTISED_2500BASEX_FULL 0x0000000000000020ULL -+ -+/** -+ * Advertise auto-negotiation enable -+ */ -+#define DPMAC_ADVERTISED_AUTONEG 0x0000000000000008ULL -+ -+/** - * struct dpmac_link_cfg - Structure representing DPMAC link configuration - * @rate: Link's rate - in Mbps - * @options: Enable/Disable DPMAC link cfg features (bitmap) -+ * @advertising: Speeds that are advertised for autoneg (bitmap) - */ - struct dpmac_link_cfg { - u32 rate; - u64 options; -+ u64 advertising; - }; - - int dpmac_get_link_cfg(struct fsl_mc_io *mc_io, -@@ -216,16 +232,27 @@ int dpmac_get_link_cfg(struct fsl_mc_io - u16 token, - struct dpmac_link_cfg *cfg); - -+int dpmac_get_link_cfg_v2(struct fsl_mc_io *mc_io, -+ u32 cmd_flags, -+ u16 token, -+ struct dpmac_link_cfg *cfg); -+ - /** - * struct dpmac_link_state - DPMAC link configuration request - * @rate: Rate in Mbps - * @options: Enable/Disable DPMAC link cfg features (bitmap) - * @up: Link state -+ * @state_valid: Ignore/Update the state of the link -+ * @supported: Speeds capability of the phy (bitmap) -+ * @advertising: Speeds that are advertised for autoneg (bitmap) - */ - struct dpmac_link_state { - u32 rate; - u64 options; - int up; -+ int state_valid; -+ u64 supported; -+ u64 advertising; - }; - - int dpmac_set_link_state(struct fsl_mc_io *mc_io, -@@ -233,6 +260,11 @@ int dpmac_set_link_state(struct fsl_mc_i - u16 token, - struct dpmac_link_state *link_state); - -+int dpmac_set_link_state_v2(struct fsl_mc_io *mc_io, -+ u32 cmd_flags, -+ u16 token, -+ struct dpmac_link_state *link_state); -+ - /** - * enum dpmac_counter - DPMAC counter types - * @DPMAC_CNT_ING_FRAME_64: counts 64-bytes frames, good or bad. |