3030
3131#include "core.h"
3232#include "packet-header-definitions.h"
33+ #include "phy-packet-definitions.h"
3334#include <trace/events/firewire.h>
3435
3536#define HEADER_DESTINATION_IS_BROADCAST (header ) \
3637 ((async_header_get_destination(header) & 0x3f) == 0x3f)
3738
38- #define PHY_PACKET_CONFIG 0x0
39- #define PHY_PACKET_LINK_ON 0x1
40- #define PHY_PACKET_SELF_ID 0x2
41-
42- #define PHY_CONFIG_GAP_COUNT (gap_count ) (((gap_count) << 16) | (1 << 22))
43- #define PHY_CONFIG_ROOT_ID (node_id ) ((((node_id) & 0x3f) << 24) | (1 << 23))
44- #define PHY_IDENTIFIER (id ) ((id) << 30)
45-
4639/* returns 0 if the split timeout handler is already running */
4740static int try_cancel_split_timeout (struct fw_transaction * t )
4841{
@@ -481,10 +474,14 @@ void fw_send_phy_config(struct fw_card *card,
481474 int node_id , int generation , int gap_count )
482475{
483476 long timeout = DIV_ROUND_UP (HZ , 10 );
484- u32 data = PHY_IDENTIFIER ( PHY_PACKET_CONFIG ) ;
477+ u32 data = 0 ;
485478
486- if (node_id != FW_PHY_CONFIG_NO_NODE_ID )
487- data |= PHY_CONFIG_ROOT_ID (node_id );
479+ phy_packet_set_packet_identifier (& data , PHY_PACKET_PACKET_IDENTIFIER_PHY_CONFIG );
480+
481+ if (node_id != FW_PHY_CONFIG_NO_NODE_ID ) {
482+ phy_packet_phy_config_set_root_id (& data , node_id );
483+ phy_packet_phy_config_set_force_root_node (& data , true);
484+ }
488485
489486 if (gap_count == FW_PHY_CONFIG_CURRENT_GAP_COUNT ) {
490487 gap_count = card -> driver -> read_phy_reg (card , 1 );
@@ -495,7 +492,8 @@ void fw_send_phy_config(struct fw_card *card,
495492 if (gap_count == 63 )
496493 return ;
497494 }
498- data |= PHY_CONFIG_GAP_COUNT (gap_count );
495+ phy_packet_phy_config_set_gap_count (& data , gap_count );
496+ phy_packet_phy_config_set_gap_count_optimization (& data , true);
499497
500498 mutex_lock (& phy_config_mutex );
501499
0 commit comments