1f11c7f63SJim Harris /*- 2*718cf2ccSPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0 3*718cf2ccSPedro F. Giffuni * 4f11c7f63SJim Harris * This file is provided under a dual BSD/GPLv2 license. When using or 5f11c7f63SJim Harris * redistributing this file, you may do so under either license. 6f11c7f63SJim Harris * 7f11c7f63SJim Harris * GPL LICENSE SUMMARY 8f11c7f63SJim Harris * 9f11c7f63SJim Harris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 10f11c7f63SJim Harris * 11f11c7f63SJim Harris * This program is free software; you can redistribute it and/or modify 12f11c7f63SJim Harris * it under the terms of version 2 of the GNU General Public License as 13f11c7f63SJim Harris * published by the Free Software Foundation. 14f11c7f63SJim Harris * 15f11c7f63SJim Harris * This program is distributed in the hope that it will be useful, but 16f11c7f63SJim Harris * WITHOUT ANY WARRANTY; without even the implied warranty of 17f11c7f63SJim Harris * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18f11c7f63SJim Harris * General Public License for more details. 19f11c7f63SJim Harris * 20f11c7f63SJim Harris * You should have received a copy of the GNU General Public License 21f11c7f63SJim Harris * along with this program; if not, write to the Free Software 22f11c7f63SJim Harris * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 23f11c7f63SJim Harris * The full GNU General Public License is included in this distribution 24f11c7f63SJim Harris * in the file called LICENSE.GPL. 25f11c7f63SJim Harris * 26f11c7f63SJim Harris * BSD LICENSE 27f11c7f63SJim Harris * 28f11c7f63SJim Harris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 29f11c7f63SJim Harris * All rights reserved. 30f11c7f63SJim Harris * 31f11c7f63SJim Harris * Redistribution and use in source and binary forms, with or without 32f11c7f63SJim Harris * modification, are permitted provided that the following conditions 33f11c7f63SJim Harris * are met: 34f11c7f63SJim Harris * 35f11c7f63SJim Harris * * Redistributions of source code must retain the above copyright 36f11c7f63SJim Harris * notice, this list of conditions and the following disclaimer. 37f11c7f63SJim Harris * * Redistributions in binary form must reproduce the above copyright 38f11c7f63SJim Harris * notice, this list of conditions and the following disclaimer in 39f11c7f63SJim Harris * the documentation and/or other materials provided with the 40f11c7f63SJim Harris * distribution. 41f11c7f63SJim Harris * 42f11c7f63SJim Harris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 43f11c7f63SJim Harris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 44f11c7f63SJim Harris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 45f11c7f63SJim Harris * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 46f11c7f63SJim Harris * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 47f11c7f63SJim Harris * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 48f11c7f63SJim Harris * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49f11c7f63SJim Harris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50f11c7f63SJim Harris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 51f11c7f63SJim Harris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 52f11c7f63SJim Harris * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53f11c7f63SJim Harris */ 54f11c7f63SJim Harris #ifndef _SCIC_SDS_PHY_REGISTERS_H_ 55f11c7f63SJim Harris #define _SCIC_SDS_PHY_REGISTERS_H_ 56f11c7f63SJim Harris 57f11c7f63SJim Harris /** 58f11c7f63SJim Harris * @file 59f11c7f63SJim Harris * 60f11c7f63SJim Harris * @brief This file contains the macros used by the phy object to read/write 61f11c7f63SJim Harris * to the SCU link layer registers. 62f11c7f63SJim Harris */ 63f11c7f63SJim Harris 64f11c7f63SJim Harris #ifdef __cplusplus 65f11c7f63SJim Harris extern "C" { 66f11c7f63SJim Harris #endif // __cplusplus 67f11c7f63SJim Harris 68f11c7f63SJim Harris #include <dev/isci/scil/scic_sds_controller.h> 69f11c7f63SJim Harris 70f11c7f63SJim Harris //***************************************************************************** 71f11c7f63SJim Harris //* SCU LINK LAYER REGISTER OPERATIONS 72f11c7f63SJim Harris //***************************************************************************** 73f11c7f63SJim Harris 74f11c7f63SJim Harris /** 75f11c7f63SJim Harris * Macro to read the transport layer register associated with this phy 76f11c7f63SJim Harris * object. 77f11c7f63SJim Harris */ 78f11c7f63SJim Harris #define scu_transport_layer_read(phy, reg) \ 79f11c7f63SJim Harris scu_register_read( \ 80f11c7f63SJim Harris scic_sds_phy_get_controller(phy), \ 81f11c7f63SJim Harris (phy)->transport_layer_registers->reg \ 82f11c7f63SJim Harris ) 83f11c7f63SJim Harris 84f11c7f63SJim Harris /** 85f11c7f63SJim Harris * Macro to write the transport layer register associated with this phy 86f11c7f63SJim Harris * object. 87f11c7f63SJim Harris */ 88f11c7f63SJim Harris #define scu_transport_layer_write(phy, reg, value) \ 89f11c7f63SJim Harris scu_register_write( \ 90f11c7f63SJim Harris scic_sds_phy_get_controller(phy), \ 91f11c7f63SJim Harris (phy)->transport_layer_registers->reg, \ 92f11c7f63SJim Harris (value) \ 93f11c7f63SJim Harris ) 94f11c7f63SJim Harris 95f11c7f63SJim Harris //**************************************************************************** 96f11c7f63SJim Harris //* Transport Layer registers controlled by the phy object 97f11c7f63SJim Harris //**************************************************************************** 98f11c7f63SJim Harris 99f11c7f63SJim Harris /** 100f11c7f63SJim Harris * This macro reads the Transport layer control register 101f11c7f63SJim Harris */ 102f11c7f63SJim Harris #define SCU_TLCR_READ(phy) \ 103f11c7f63SJim Harris scu_transport_layer_read(phy, control) 104f11c7f63SJim Harris 105f11c7f63SJim Harris /** 106f11c7f63SJim Harris * This macro writes the Transport layer control register 107f11c7f63SJim Harris */ 108f11c7f63SJim Harris #define SCU_TLCR_WRITE(phy, value) \ 109f11c7f63SJim Harris scu_transport_layer_write(phy, control, value) 110f11c7f63SJim Harris 111f11c7f63SJim Harris /** 112f11c7f63SJim Harris * This macro reads the Transport layer address translation register 113f11c7f63SJim Harris */ 114f11c7f63SJim Harris #define SCU_TLADTR_READ(phy) \ 115f11c7f63SJim Harris scu_transport_layer_read(phy, address_translation) 116f11c7f63SJim Harris 117f11c7f63SJim Harris /** 118f11c7f63SJim Harris * This macro writes the Transport layer address translation register 119f11c7f63SJim Harris */ 120f11c7f63SJim Harris #define SCU_TLADTR_WRITE(phy) \ 121f11c7f63SJim Harris scu_transport_layer_write(phy, address_translation, value) 122f11c7f63SJim Harris 123f11c7f63SJim Harris /** 124f11c7f63SJim Harris * This macro writes the STP Transport Layer Direct Attached RNi register. 125f11c7f63SJim Harris */ 126f11c7f63SJim Harris #define SCU_STPTLDARNI_WRITE(phy, index) \ 127f11c7f63SJim Harris scu_transport_layer_write(phy, stp_rni, index) 128f11c7f63SJim Harris 129f11c7f63SJim Harris /** 130f11c7f63SJim Harris * This macro reads the STP Transport Layer Direct Attached RNi register. 131f11c7f63SJim Harris */ 132f11c7f63SJim Harris #define SCU_STPTLDARNI_READ(phy) \ 133f11c7f63SJim Harris scu_transport_layer_read(phy, stp_rni) 134f11c7f63SJim Harris 135f11c7f63SJim Harris //***************************************************************************** 136f11c7f63SJim Harris //* SCU LINK LAYER REGISTER OPERATIONS 137f11c7f63SJim Harris //***************************************************************************** 138f11c7f63SJim Harris 139f11c7f63SJim Harris /** 140f11c7f63SJim Harris * THis macro requests the SCU register write for the specified link layer 141f11c7f63SJim Harris * register. 142f11c7f63SJim Harris */ 143f11c7f63SJim Harris #define scu_link_layer_register_read(phy, reg) \ 144f11c7f63SJim Harris scu_register_read( \ 145f11c7f63SJim Harris scic_sds_phy_get_controller(phy), \ 146f11c7f63SJim Harris (phy)->link_layer_registers->reg \ 147f11c7f63SJim Harris ) 148f11c7f63SJim Harris 149f11c7f63SJim Harris /** 150f11c7f63SJim Harris * This macro requests the SCU register read for the specified link layer 151f11c7f63SJim Harris * register. 152f11c7f63SJim Harris */ 153f11c7f63SJim Harris #define scu_link_layer_register_write(phy, reg, value) \ 154f11c7f63SJim Harris scu_register_write( \ 155f11c7f63SJim Harris scic_sds_phy_get_controller(phy), \ 156f11c7f63SJim Harris (phy)->link_layer_registers->reg, \ 157f11c7f63SJim Harris (value) \ 158f11c7f63SJim Harris ) 159f11c7f63SJim Harris 160f11c7f63SJim Harris //***************************************************************************** 161f11c7f63SJim Harris //* SCU LINK LAYER REGISTERS 162f11c7f63SJim Harris //***************************************************************************** 163f11c7f63SJim Harris 164f11c7f63SJim Harris /// This macro reads from the SAS Identify Frame PHY Identifier register 165f11c7f63SJim Harris #define SCU_SAS_TIPID_READ(phy) \ 166f11c7f63SJim Harris scu_link_layer_register_read(phy, identify_frame_phy_id) 167f11c7f63SJim Harris 168f11c7f63SJim Harris /// This macro writes to the SAS Identify Frame PHY Identifier register 169f11c7f63SJim Harris #define SCU_SAS_TIPID_WRITE(phy, value) \ 170f11c7f63SJim Harris scu_link_layer_register_write(phy, identify_frame_phy_id, value) 171f11c7f63SJim Harris 172f11c7f63SJim Harris /// This macro reads from the SAS Identification register 173f11c7f63SJim Harris #define SCU_SAS_TIID_READ(phy) \ 174f11c7f63SJim Harris scu_link_layer_register_read(phy, transmit_identification) 175f11c7f63SJim Harris 176f11c7f63SJim Harris /// This macro writes to the SAS Identification register 177f11c7f63SJim Harris #define SCU_SAS_TIID_WRITE(phy, value) \ 178f11c7f63SJim Harris scu_link_layer_register_write(phy, transmit_identification, value) 179f11c7f63SJim Harris 180f11c7f63SJim Harris /// This macro reads the SAS Device Name High register 181f11c7f63SJim Harris #define SCU_SAS_TIDNH_READ(phy) \ 182f11c7f63SJim Harris scu_link_layer_register_read(phy, sas_device_name_high) 183f11c7f63SJim Harris 184f11c7f63SJim Harris /// This macro writes the SAS Device Name High register 185f11c7f63SJim Harris #define SCU_SAS_TIDNH_WRITE(phy, value) \ 186f11c7f63SJim Harris scu_link_layer_register_write(phy, sas_device_name_high, value) 187f11c7f63SJim Harris 188f11c7f63SJim Harris /// This macro reads the SAS Device Name Low register 189f11c7f63SJim Harris #define SCU_SAS_TIDNL_READ(phy) \ 190f11c7f63SJim Harris scu_link_layer_register_read(phy, sas_device_name_low) 191f11c7f63SJim Harris 192f11c7f63SJim Harris /// This macro writes the SAS Device Name Low register 193f11c7f63SJim Harris #define SCU_SAS_TIDNL_WRITE(phy, value) \ 194f11c7f63SJim Harris scu_link_layer_register_write(phy, sas_device_name_low, value) 195f11c7f63SJim Harris 196f11c7f63SJim Harris /// This macro reads the Source SAS Address High register 197f11c7f63SJim Harris #define SCU_SAS_TISSAH_READ(phy) \ 198f11c7f63SJim Harris scu_link_layer_register_read(phy, source_sas_address_high) 199f11c7f63SJim Harris 200f11c7f63SJim Harris /// This macro writes the Source SAS Address High register 201f11c7f63SJim Harris #define SCU_SAS_TISSAH_WRITE(phy, value) \ 202f11c7f63SJim Harris scu_link_layer_register_write(phy, source_sas_address_high, value) 203f11c7f63SJim Harris 204f11c7f63SJim Harris /// This macro reads the Source SAS Address Low register 205f11c7f63SJim Harris #define SCU_SAS_TISSAL_READ(phy) \ 206f11c7f63SJim Harris scu_link_layer_register_read(phy, source_sas_address_low) 207f11c7f63SJim Harris 208f11c7f63SJim Harris /// This macro writes the Source SAS Address Low register 209f11c7f63SJim Harris #define SCU_SAS_TISSAL_WRITE(phy, value) \ 210f11c7f63SJim Harris scu_link_layer_register_write(phy, source_sas_address_low, value) 211f11c7f63SJim Harris 212f11c7f63SJim Harris /// This macro reads the PHY Configuration register 213f11c7f63SJim Harris #define SCU_SAS_PCFG_READ(phy) \ 214f11c7f63SJim Harris scu_link_layer_register_read(phy, phy_configuration); 215f11c7f63SJim Harris 216f11c7f63SJim Harris /// This macro writes the PHY Configuration register 217f11c7f63SJim Harris #define SCU_SAS_PCFG_WRITE(phy, value) \ 218f11c7f63SJim Harris scu_link_layer_register_write(phy, phy_configuration, value) 219f11c7f63SJim Harris 220f11c7f63SJim Harris /// This macro reads the PHY Enable Spinup register 221f11c7f63SJim Harris #define SCU_SAS_ENSPINUP_READ(phy) \ 222f11c7f63SJim Harris scu_link_layer_register_read(phy, notify_enable_spinup_control) 223f11c7f63SJim Harris 224f11c7f63SJim Harris /// This macro writes the PHY Enable Spinup register 225f11c7f63SJim Harris #define SCU_SAS_ENSPINUP_WRITE(phy, value) \ 226f11c7f63SJim Harris scu_link_layer_register_write(phy, notify_enable_spinup_control, value) 227f11c7f63SJim Harris 228f11c7f63SJim Harris /// This macro reads the CLKSM register 229f11c7f63SJim Harris #define SCU_SAS_CLKSM_READ(phy) \ 230f11c7f63SJim Harris scu_link_layer_register_read(phy, clock_skew_management) 231f11c7f63SJim Harris 232f11c7f63SJim Harris /// This macro writes the CLKSM register 233f11c7f63SJim Harris #define SCU_SAS_CLKSM_WRITE(phy, value) \ 234f11c7f63SJim Harris scu_link_layer_register_write(phy, clock_skew_management, value) 235f11c7f63SJim Harris 236f11c7f63SJim Harris /// This macro reads the PHY Capacity register 237f11c7f63SJim Harris #define SCU_SAS_PHYCAP_READ(phy) \ 238f11c7f63SJim Harris scu_link_layer_register_read(phy, phy_capabilities) 239f11c7f63SJim Harris 240f11c7f63SJim Harris /// This macro writes the PHY Capacity register 241f11c7f63SJim Harris #define SCU_SAS_PHYCAP_WRITE(phy, value) \ 242f11c7f63SJim Harris scu_link_layer_register_write(phy, phy_capabilities, value) 243f11c7f63SJim Harris 244453130d9SPedro F. Giffuni /// This macro reads the Received PHY Capacity register 245f11c7f63SJim Harris #define SCU_SAS_RECPHYCAP_READ(phy) \ 246f11c7f63SJim Harris scu_link_layer_register_read(phy, receive_phycap) 247f11c7f63SJim Harris 248f11c7f63SJim Harris /// This macro reads the link layer control register 249f11c7f63SJim Harris #define SCU_SAS_LLCTL_READ(phy) \ 250f11c7f63SJim Harris scu_link_layer_register_read(phy, link_layer_control); 251f11c7f63SJim Harris 252f11c7f63SJim Harris /// This macro writes the link layer control register 253f11c7f63SJim Harris #define SCU_SAS_LLCTL_WRITE(phy, value) \ 254f11c7f63SJim Harris scu_link_layer_register_write(phy, link_layer_control, value); 255f11c7f63SJim Harris 256f11c7f63SJim Harris /// This macro reads the link layer status register 257f11c7f63SJim Harris #define SCU_SAS_LLSTA_READ(phy) \ 258f11c7f63SJim Harris scu_link_layer_register_read(phy, link_layer_status); 259f11c7f63SJim Harris 260f11c7f63SJim Harris #define SCU_SAS_ECENCR_READ(phy) \ 261f11c7f63SJim Harris scu_link_layer_register_read(phy, error_counter_event_notification_control) 262f11c7f63SJim Harris 263f11c7f63SJim Harris #define SCU_SAS_ECENCR_WRITE(phy, value) \ 264f11c7f63SJim Harris scu_link_layer_register_write(phy, error_counter_event_notification_control, value) 265f11c7f63SJim Harris 266f11c7f63SJim Harris #ifdef __cplusplus 267f11c7f63SJim Harris } 268f11c7f63SJim Harris #endif // __cplusplus 269f11c7f63SJim Harris 270f11c7f63SJim Harris #endif // _SCIC_SDS_PHY_REGISTERS_H_ 271