diff options
Diffstat (limited to 'kernel/xpp/init_card_3_30')
-rwxr-xr-x | kernel/xpp/init_card_3_30 | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/kernel/xpp/init_card_3_30 b/kernel/xpp/init_card_3_30 index cbcd550..9e72089 100755 --- a/kernel/xpp/init_card_3_30 +++ b/kernel/xpp/init_card_3_30 @@ -1,6 +1,9 @@ #! /usr/bin/perl -w use strict; +# Make warnings fatal +local $SIG{__WARN__} = sub { die @_ }; + # # $Id$ # @@ -57,9 +60,10 @@ use Getopt::Std; my $program = basename("$0"); my $init_dir = dirname("$0"); +BEGIN { $init_dir = dirname($0); unshift(@INC, "$init_dir"); } +use XppConfig $init_dir; my $unit_id; my %opts; -$ENV{XPP_BASE} = '/proc/xpp'; getopts('o:', \%opts); @@ -75,6 +79,21 @@ if (-t STDERR) { $unit_id = "$ENV{XBUS_NAME}/UNIT-$ENV{UNIT_NUMBER}"; open (STDERR, "| logger -t $program -p kern.info") || die; logit "Non Interactive startup"; + foreach my $k (qw( + XBUS_NAME + XBUS_NUMBER + UNIT_NUMBER + UNIT_TYPE + UNIT_SUBUNITS + UNIT_SUBUNITS_DIR + XBUS_REVISION + XBUS_CONNECTOR + XBUS_LABEL)) { + unless(defined $ENV{$k}) { + logit "Missing ENV{$k}\n"; + die; + } + } } sub select_subunit($) { @@ -85,8 +104,14 @@ sub select_subunit($) { if($opts{o}) { $output = $opts{o}; } else { - my $xpd_name = sprintf("XPD-%1d%1d", $ENV{UNIT_NUMBER}, $subunit); - $output = "$ENV{XPP_BASE}/$ENV{XBUS_NAME}/$xpd_name/chipregs"; + $output = sprintf "/sys/bus/xpds/devices/%02d:%1d:%1d/chipregs", + $ENV{XBUS_NUMBER}, $ENV{UNIT_NUMBER}, $subunit; + if(! -f $output) { + my $xpd_name = sprintf("XPD-%1d%1d", $ENV{UNIT_NUMBER}, $subunit); + $output = "/proc/xpp/$ENV{XBUS_NAME}/$xpd_name/chipregs"; + logit "OLD DRIVER: does not use /sys chipregs. Falling back to /proc" + if -f $output; + } } open(REG, ">$output") || die "Failed to open '$output': $!\n"; my $oldfh = select REG; @@ -368,13 +393,15 @@ sub init_xhfc($) { # (C4IO, F0IO are inputs) BRI::gen "$portnum WD 14 98"; # R_PCM_MD0: Index value to select - # the register at address 15 + # the register at address 15 BRI::gen "$portnum WD 15 20"; # R_PCM_MD1: V_PLL_ADJ (DPLL adjust speed), # in the last slot of PCM frame # V_PCM_DR, C4IO is 16.384MHz(128 time slots) - BRI::gen "$portnum WD 4C 03"; # GPIOGPIO function (not PWM) on GPIO0 and GPIO1 pins - BRI::gen "$portnum WD 4A 03"; # Output enable for GPIO0 and GPIO1 pins + BRI::gen "$portnum WD 4C 07"; # GPIOGPIO function (not PWM) on GPIO0, GPIO1 and GPIO2 pins + BRI::gen "$portnum WD 4A 07"; # Output enable for GPIO0, GPIO1 and GPIO2 pins + BRI::gen "$portnum WD 48 01"; # GPIO output data bits + } my @port_type = ( |