@@ -512,15 +512,6 @@ sub processProcessor
512
512
$targetObj -> setMasterProc($target );
513
513
}
514
514
515
- # I2C arrays
516
- my @engine = ();
517
- my @port = ();
518
- my @slavePort = ();
519
- my @addr = ();
520
- my @speed = ();
521
- my @type = ();
522
- my @purpose = ();
523
-
524
515
$targetObj -> log ($target , " Processing PROC" );
525
516
foreach my $child (@{ $targetObj -> getTargetChildren($target ) })
526
517
{
@@ -576,58 +567,8 @@ sub processProcessor
576
567
{
577
568
processOcc($targetObj , $child , $target );
578
569
}
579
- # Ideally this should be $child_type eq "I2C", but we need a change
580
- # in serverwiz and the witherspoon.xml first
581
- elsif (index ($child ," i2c-master" ) != -1)
582
- {
583
- my ($i2cEngine , $i2cPort , $i2cSlavePort , $i2cAddr ,
584
- $i2cSpeed , $i2cType , $i2cPurpose ) =
585
- processI2C($targetObj , $child , $target );
586
-
587
- # Add this I2C device's information to the proc array
588
- push (@engine ,@$i2cEngine );
589
- push (@port ,@$i2cPort );
590
- push (@slavePort ,@$i2cSlavePort );
591
- push (@addr ,@$i2cAddr );
592
- push (@speed ,@$i2cSpeed );
593
- push (@type ,@$i2cType );
594
- push (@purpose ,@$i2cPurpose );
595
-
596
- }
597
570
}
598
571
599
- # Add final I2C arrays to processor
600
- my $size = scalar @engine ;
601
- my $engine_attr = $engine [0];
602
- my $port_attr = $port [0];
603
- my $slave_attr = $slavePort [0];
604
- my $addr_attr = $addr [0];
605
- my $speed_attr = $speed [0];
606
- my $type_attr = " 0x" .$type [0];
607
- my $purpose_attr = " 0x" .$purpose [0];
608
-
609
- # Parse out array to print as a string
610
- foreach my $n (1..($size -1))
611
- {
612
- $engine_attr .= " ," .$engine [$n ];
613
- $port_attr .= " ," .$port [$n ];
614
- $slave_attr .= " ," .$slavePort [$n ];
615
- $addr_attr .= " ," .$addr [$n ];
616
- $speed_attr .= " ," .$speed [$n ];
617
- $type_attr .= " ,0x" .$type [$n ];
618
- $purpose_attr .= " ,0x" .$purpose [$n ];
619
- }
620
-
621
- # Set the arrays to the corresponding attribute on the proc
622
- $targetObj -> setAttribute($target ," HDAT_I2C_ENGINE" ,$engine_attr );
623
- $targetObj -> setAttribute($target ," HDAT_I2C_MASTER_PORT" ,$port_attr );
624
- $targetObj -> setAttribute($target ," HDAT_I2C_SLAVE_PORT" ,$slave_attr );
625
- $targetObj -> setAttribute($target ," HDAT_I2C_ADDR" ,$addr_attr );
626
- $targetObj -> setAttribute($target ," HDAT_I2C_BUS_FREQ" ,$speed_attr );
627
- $targetObj -> setAttribute($target ," HDAT_I2C_DEVICE_TYPE" ,$type_attr );
628
- $targetObj -> setAttribute($target ," HDAT_I2C_DEVICE_PURPOSE" ,$purpose_attr );
629
- $targetObj -> setAttribute($target ," HDAT_I2C_ELEMENTS" ,$size );
630
-
631
572
# # update path for mvpd's and sbe's
632
573
my $path = $targetObj -> getAttribute($target , " PHYS_PATH" );
633
574
my $model = $targetObj -> getAttribute($target , " MODEL" );
@@ -1562,137 +1503,6 @@ sub getI2cMapField
1562
1503
return $hexfield ;
1563
1504
}
1564
1505
1565
- # ------------------------------------------------------------------------------
1566
- # I2C
1567
- #
1568
- sub processI2C
1569
- {
1570
- my $targetObj = shift ; # Top Hierarchy of targeting structure
1571
- my $target = shift ; # I2C targetInstance
1572
- my $parentTarget = shift ; # Processor target
1573
-
1574
- # Initialize output arrays
1575
- my @i2cEngine = ();
1576
- my @i2cPort = ();
1577
- my @i2cSlave = ();
1578
- my @i2cAddr = ();
1579
- my @i2cSpeed = ();
1580
- my @i2cType = ();
1581
- my @i2cPurpose = ();
1582
-
1583
- # Step 1: get I2C_ENGINE and PORT from <targetInstance>
1584
-
1585
- my $engine = $targetObj -> getAttribute($target , " I2C_ENGINE" );
1586
- if ($engine eq " " ) {$engine = " 0xFF" ;}
1587
-
1588
- my $port = $targetObj -> getAttribute($target , " I2C_PORT" );
1589
- if ($port eq " " ) {$port = " 0xFF" ;}
1590
-
1591
- # Step 2: get I2C_ADDRESS and I2C_SPEED from <bus>
1592
- # This is different for each connection.
1593
-
1594
- my $i2cs = $targetObj -> findConnections($parentTarget , " I2C" ," " );
1595
- if ($i2cs ne " " )
1596
- {
1597
- # This gives all i2c connections
1598
- foreach my $i2c (@{$i2cs -> {CONN }})
1599
- {
1600
- # Here we are checking that the i2c source matches our target
1601
- my $source = $i2c -> {SOURCE };
1602
- if ($source ne $target )
1603
- {
1604
- next ;
1605
- }
1606
-
1607
- # Most I2C devices will default the slave port, it is only valid
1608
- # for gpio expanders.
1609
- my $slavePort = " 0xFF" ;
1610
-
1611
- my @source_array = split (/ -/ ,$source );
1612
- my $source_idx = scalar @source_array ;
1613
-
1614
- # If the last part of the source only includes numbers
1615
- if ($source_array [$source_idx -1] =~ / ^[0-9,.E]+$ / )
1616
- {
1617
- $slavePort = $source_array [$source_idx -1];
1618
- }
1619
-
1620
- my $addr ;
1621
- my $speed ;
1622
- my $type ;
1623
- my $purpose ;
1624
-
1625
- # For all these attributes, we need to check if they're defined,
1626
- # and if not we set them to a default value.
1627
- if ($targetObj -> isBusAttributeDefined(
1628
- $i2c -> {SOURCE },$i2c -> {BUS_NUM }," I2C_ADDRESS" ))
1629
- {
1630
- $addr = $targetObj -> getBusAttribute(
1631
- $i2c -> {SOURCE },$i2c -> {BUS_NUM }," I2C_ADDRESS" );
1632
- }
1633
-
1634
- if ($addr eq " " ) {$addr = " 0xFF" ;}
1635
-
1636
- if ($targetObj -> isBusAttributeDefined(
1637
- $i2c -> {SOURCE },$i2c -> {BUS_NUM }," I2C_SPEED" ))
1638
- {
1639
- $speed = $targetObj -> getBusAttribute(
1640
- $i2c -> {SOURCE },$i2c -> {BUS_NUM }," I2C_SPEED" );
1641
- }
1642
-
1643
- if ($speed eq " " ) {$speed = " 0" ;}
1644
-
1645
- if ($targetObj -> isBusAttributeDefined(
1646
- $i2c -> {SOURCE },$i2c -> {BUS_NUM }," I2C_TYPE" ))
1647
- {
1648
- $type = $targetObj -> getBusAttribute(
1649
- $i2c -> {SOURCE },$i2c -> {BUS_NUM }," I2C_TYPE" );
1650
- }
1651
-
1652
- if ($type eq " " )
1653
- {
1654
- $type = " FF" ;
1655
- }
1656
- else
1657
- {
1658
- $type = $targetObj -> getEnumValue(" HDAT_I2C_DEVICE_TYPE" ,$type );
1659
- }
1660
-
1661
- if ($targetObj -> isBusAttributeDefined(
1662
- $i2c -> {SOURCE },$i2c -> {BUS_NUM }," I2C_PURPOSE" ))
1663
- {
1664
- $purpose = $targetObj -> getBusAttribute(
1665
- $i2c -> {SOURCE },$i2c -> {BUS_NUM }," I2C_PURPOSE" );
1666
- }
1667
-
1668
- if ($purpose eq " " )
1669
- {
1670
- $purpose = " FF" ;
1671
- }
1672
- else
1673
- {
1674
- $purpose = $targetObj -> getEnumValue(" HDAT_I2C_DEVICE_PURPOSE" ,
1675
- $purpose );
1676
- }
1677
-
1678
- # Step 3: For each connection, create an instance in the array
1679
- # for the DeviceInfo_t struct.
1680
- push @i2cEngine , $engine ;
1681
- push @i2cPort , $port ;
1682
- push @i2cSlave , $slavePort ;
1683
- push @i2cAddr , $addr ;
1684
- push @i2cSpeed , $speed ;
1685
- push @i2cType , $type ;
1686
- push @i2cPurpose , $purpose ;
1687
-
1688
- }
1689
- }
1690
-
1691
- # Return this i2c device's information back to the processor
1692
- return (\@i2cEngine , \@i2cPort , \@i2cSlave , \@i2cAddr ,
1693
- \@i2cSpeed , \@i2cType , \@i2cPurpose );
1694
- }
1695
-
1696
1506
1697
1507
sub setEepromAttributes
1698
1508
{
0 commit comments