dpni.c (3eb66e91a25497065c5322b1268cbc3953642227) | dpni.c (8eb3cef8d2642da6b72179da73344a442461cb58) |
---|---|
1// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) 2/* Copyright 2013-2016 Freescale Semiconductor Inc. 3 * Copyright 2016 NXP 4 */ 5#include <linux/kernel.h> 6#include <linux/errno.h> 7#include <linux/fsl/mc.h> 8#include "dpni.h" --- 824 unchanged lines hidden (view full) --- 833 * Return: '0' on Success; Error code otherwise. 834 */ 835int dpni_set_link_cfg(struct fsl_mc_io *mc_io, 836 u32 cmd_flags, 837 u16 token, 838 const struct dpni_link_cfg *cfg) 839{ 840 struct fsl_mc_command cmd = { 0 }; | 1// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) 2/* Copyright 2013-2016 Freescale Semiconductor Inc. 3 * Copyright 2016 NXP 4 */ 5#include <linux/kernel.h> 6#include <linux/errno.h> 7#include <linux/fsl/mc.h> 8#include "dpni.h" --- 824 unchanged lines hidden (view full) --- 833 * Return: '0' on Success; Error code otherwise. 834 */ 835int dpni_set_link_cfg(struct fsl_mc_io *mc_io, 836 u32 cmd_flags, 837 u16 token, 838 const struct dpni_link_cfg *cfg) 839{ 840 struct fsl_mc_command cmd = { 0 }; |
841 struct dpni_cmd_set_link_cfg *cmd_params; | 841 struct dpni_cmd_link_cfg *cmd_params; |
842 843 /* prepare command */ 844 cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_LINK_CFG, 845 cmd_flags, 846 token); | 842 843 /* prepare command */ 844 cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_LINK_CFG, 845 cmd_flags, 846 token); |
847 cmd_params = (struct dpni_cmd_set_link_cfg *)cmd.params; | 847 cmd_params = (struct dpni_cmd_link_cfg *)cmd.params; |
848 cmd_params->rate = cpu_to_le32(cfg->rate); 849 cmd_params->options = cpu_to_le64(cfg->options); 850 851 /* send command to mc*/ 852 return mc_send_command(mc_io, &cmd); 853} 854 855/** | 848 cmd_params->rate = cpu_to_le32(cfg->rate); 849 cmd_params->options = cpu_to_le64(cfg->options); 850 851 /* send command to mc*/ 852 return mc_send_command(mc_io, &cmd); 853} 854 855/** |
856 * dpni_get_link_cfg() - return the link configuration 857 * @mc_io: Pointer to MC portal's I/O object 858 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 859 * @token: Token of DPNI object 860 * @cfg: Link configuration from dpni object 861 * 862 * Return: '0' on Success; Error code otherwise. 863 */ 864int dpni_get_link_cfg(struct fsl_mc_io *mc_io, 865 u32 cmd_flags, 866 u16 token, 867 struct dpni_link_cfg *cfg) 868{ 869 struct fsl_mc_command cmd = { 0 }; 870 struct dpni_cmd_link_cfg *rsp_params; 871 int err; 872 873 /* prepare command */ 874 cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_LINK_CFG, 875 cmd_flags, 876 token); 877 878 /* send command to mc*/ 879 err = mc_send_command(mc_io, &cmd); 880 if (err) 881 return err; 882 883 /* retrieve response parameters */ 884 rsp_params = (struct dpni_cmd_link_cfg *)cmd.params; 885 cfg->rate = le32_to_cpu(rsp_params->rate); 886 cfg->options = le64_to_cpu(rsp_params->options); 887 888 return err; 889} 890 891/** |
|
856 * dpni_get_link_state() - Return the link state (either up or down) 857 * @mc_io: Pointer to MC portal's I/O object 858 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 859 * @token: Token of DPNI object 860 * @state: Returned link state; 861 * 862 * Return: '0' on Success; Error code otherwise. 863 */ --- 889 unchanged lines hidden --- | 892 * dpni_get_link_state() - Return the link state (either up or down) 893 * @mc_io: Pointer to MC portal's I/O object 894 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 895 * @token: Token of DPNI object 896 * @state: Returned link state; 897 * 898 * Return: '0' on Success; Error code otherwise. 899 */ --- 889 unchanged lines hidden --- |