Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vesta
meta-vesta
Commits
bd47c003
Commit
bd47c003
authored
Sep 04, 2018
by
David Mondou
Browse files
Update cell scripts
parent
dd69cd77
Changes
7
Hide whitespace changes
Inline
Side-by-side
recipes-core/scripts-vesta/files/ec21_cell_init.sh
0 → 100644
View file @
bd47c003
#!/bin/sh
#IO pin definitions
# --- v2 BOARD!! ---
#reserved pins (should be grounded)
rsvd_GPIO4_IO17
=
113
rsvd_GPIO2_IO9
=
41
rsvd_GPIO2_IO10
=
42
rsvd_GPIO2_IO11
=
43
rsvd_GPIO2_IO12
=
44
rsvd_GPIO2_IO13
=
45
rsvd_GPIO1_IO2
=
2
rsvd_GPIO5_IO5
=
133
rsvd_GPIO3_IO1
=
65
rsvd_GPIO3_IO4
=
68
#used pins
cell_wakeup
=
117
#GPIO4_IO21, ESPI_CLK
vbus_enable
=
118
#GPIO4_IO22, ESPI_CS_N
cell_pwrkey
=
30
#GPIO1_IO30, ESPI_MOSI
cell_status_n
=
31
#GPIO1_IO31, ESPI_MISO
cell_pwr_shdn
=
8
#GPIO1_IO8, SPDIF_OUT
cell_disable
=
23
#GPIO1_IO23, CAN2_RX
cell_reset
=
22
#GPIO1_IO22, CAN2_TX
#Init GPIO
gpio_set
()
{
pin_num
=
$1
pin_dir
=
$2
pin_val
=
$3
num_args
=
$#
test
-e
"/sys/class/gpio/gpio
$pin_num
"
if
[
$?
-ne
"0"
]
;
then
echo
$pin_num
>
/sys/class/gpio/export
fi
echo
$pin_dir
>
/sys/class/gpio/gpio
${
pin_num
}
/direction
if
[
$num_args
-eq
3
]
;
then
echo
$pin_val
>
/sys/class/gpio/gpio
${
pin_num
}
/value
fi
}
#Configure default GPIO settings
gpio_set
$cell_wakeup
out 0
#this must be high for the modem to boot, can start disabled
gpio_set
$vbus_enable
out 0
#start disabled (no usb attach)
gpio_set
$cell_pwrkey
out 0
#do not assert until ready for actual boot
gpio_set
$cell_status_n
in
#status input
gpio_set
$cell_pwr_shdn
out 0
#regulator does not need to be shutdown by default
gpio_set
$cell_disable
out 0
#do not disable (can be used for power saving/stand-by mode once booted)
gpio_set
$cell_reset
out 0
#is not driven while powering on
#Additional signals (reserved)
gpio_set
$rsvd_GPIO4_IO17
out 0
#keep low
gpio_set
$rsvd_GPIO2_IO9
out 0
#keep low
gpio_set
$rsvd_GPIO2_IO10
out 0
#keep low
gpio_set
$rsvd_GPIO2_IO11
out 0
#keep low
gpio_set
$rsvd_GPIO2_IO12
out 0
#keep low
gpio_set
$rsvd_GPIO2_IO13
out 0
#keep low
gpio_set
$rsvd_GPIO1_IO2
out 0
#keep low
gpio_set
$rsvd_GPIO5_IO5
out 0
#keep low
gpio_set
$rsvd_GPIO3_IO1
out 0
#keep low
gpio_set
$rsvd_GPIO3_IO4
out 0
#keep low
recipes-core/scripts-vesta/files/ec21_cell_pwron.sh
0 → 100644
View file @
bd47c003
#!/bin/sh
#Temporary fix for CELL_PWR_SHDN
/unit_tests/memtool
0x20e007c
=
0x15
#Modem interface
interface
=
uart
#Set VDD_EXT limit for ADC (~1.7V)
adc_lower_limit
=
2110
#IO pin definitions
# --- v2-4 BOARD (v2-5 PCBA)!! ---
cell_wakeup
=
117
#GPIO4_IO21, ESPI_CLK
vbus_enable
=
118
#GPIO4_IO22, ESPI_CS_N
cell_pwrkey
=
30
#GPIO1_IO30, ESPI_MOSI
cell_status_n
=
31
#GPIO1_IO31, ESPI_MISO
cell_pwr_shdn
=
8
#GPIO1_IO8
cell_disable
=
23
#GPIO1_IO23, CAN2_RX
cell_reset
=
22
#GPIO1_IO22, CAN2_TX
#print usage info to std out
print_usage
()
{
cat
<<-
EOF
Usage:
$(
basename
$0
)
interface
Specify the cellular modem interface as 'usb' or 'uart'
$(
basename
$0
)
uart
or
$(
basename
$0
)
usb
EOF
}
#set GPIO
gpio_set
()
{
pin_num
=
$1
pin_dir
=
$2
pin_val
=
$3
num_args
=
$#
test
-e
"/sys/class/gpio/gpio
$pin_num
"
if
[
$?
-ne
"0"
]
;
then
echo
$pin_num
>
/sys/class/gpio/export
fi
echo
$pin_dir
>
/sys/class/gpio/gpio
${
pin_num
}
/direction
if
[
$num_args
-eq
3
]
;
then
echo
$pin_val
>
/sys/class/gpio/gpio
${
pin_num
}
/value
fi
}
#read gpio
gpio_read
()
{
pin_num
=
$1
test
-e
"/sys/class/gpio/gpio
$pin_num
"
if
[
$?
-ne
"0"
]
;
then
echo
$pin_num
>
/sys/class/gpio/export
fi
pin_value
=
$(
cat
/sys/class/gpio/gpio
${
pin_num
}
/value
)
}
#check modem on
check_modem_on
()
{
modem_on
=
0
#Get raw value of adc
raw
=
$(
cat
/sys/bus/iio/devices/iio:device0/in_voltage1_raw
)
#Compare raw value against limits
if
[
"
$raw
"
-lt
"
$adc_lower_limit
"
]
;
then
modem_on
=
0
else
modem_on
=
1
fi
}
OPTS
=
`
getopt
-o
h
-n
'parse-options'
--
"
$@
"
`
eval set
--
"
$OPTS
"
# increment through the options one by one
while
true
;
do
case
"
$1
"
in
-h
)
print_usage
exit
0
;;
--
)
interface
=(
"
$2
"
)
;
break
;;
*
)
#print_usage
exit
1
;
esac
done
#Set GPIO
gpio_set
$cell_disable
out 0
#make sure modem is not disabled
gpio_set
$cell_wakeup
out 1
#make sure modem is ready for power on / awake
# Boot Process:
# 1) check modem power is enabled (cell_pwr_shdn == 0)
# F) if no, set low and wait (1 second)
# 2) check if modem is ON (VDD_EXT > 1.8V on ADC1)
# F) if no, power on modem (toggle cell_pwrkey high for 300ms), enable vbus (if USB is used),
# and once status_n goes low, wait (14) seconds
# T) if yes, check that the interface is defined
# USB) enable VBUS
# UART) okay, continue
# ELSE) not defined, exit with error
# 3) kick off USB enumeration (if interface is USB)
printf
"
\n
Enabling modem on
$interface
interface"
#1)check cell modem power
gpio_read
$cell_pwr_shdn
#if [ $pin_value -eq 1 ]; then
printf
"
\n
Enabling power for modem
\n
"
gpio_set
$cell_pwr_shdn
out 0
#enable cell power
# usleep 1000000
#fi
#2)check if modem is ON (VDD_EXT > 1.7V)
check_modem_on
if
[
$modem_on
-eq
0
]
;
then
#modem is OFF, initiate modem boot
printf
"
\n
Turning modem ON
\n
"
gpio_set
$cell_pwrkey
out 1
usleep 600000
#wait 600ms
gpio_set
$cell_pwrkey
out 0
#enable VBUS
if
[
"
$interface
"
==
"usb"
]
;
then
printf
"
\n
Enabling VBUS for modem
\n
"
gpio_set
$vbus_enable
out 1
fi
#wait for status signal to indicate power off is complete
timeout
=
30
readstatus
=
1
printf
"
\n
Checking cell modem Status, time-out in
$timeout
seconds...
\n
"
while
[
$timeout
-gt
0
]
;
do
if
[
$readstatus
-eq
0
]
;
then
printf
"
\n
Cell modem is powering up...
\n
"
usleep 14000000
#boot time is >13 seconds according to hw guide
break
;
else
timeout
=
$((
$timeout
-
1
))
usleep 1000000
gpio_read
$cell_status_n
readstatus
=
$pin_value
fi
done
if
[
$timeout
-eq
0
]
;
then
printf
"
\n
ERROR: Timeout expired. Modem did not indicate status!!
\n
"
fi
else
#cell modem is already ON
printf
"
\n
Modem is ON
\n
"
#allow time for the main board to fully boot
#maybe check how long the system has been up to decide if this is necessary
usleep 1000000
if
[
"
$interface
"
==
"usb"
]
;
then
printf
"
\n
Enabling VBUS
\n
"
gpio_set
$vbus_enable
out 1
usleep 50000
elif
[
-e
/dev/ttymxc6
]
;
then
printf
"
\n
Cell modem uses uart
\n
"
else
printf
"
\n
Cell modem interface is not defined
\n
"
exit
1
fi
fi
#3)If using USB, kick off USB enumeration
if
[
"
$interface
"
==
"usb"
]
;
then
printf
"
\n
Initiating USB enumeration for cell modem
\n
"
cat
/dev/bus/usb/002/001
usleep 6000000
if
[
-e
/dev/ttyUSB2
]
;
then
printf
"
\n
Cell modem attached to USB
\n
"
exit
0
#USB device is attached, modem should work
else
printf
"
\n
USB enumeration failed!
\n
"
exit
1
fi
fi
#done
printf
"
\n
Cell modem power ON is complete
\n
"
recipes-core/scripts-vesta/files/find_expansion_card.sh
View file @
bd47c003
...
...
@@ -37,12 +37,14 @@ do_start() {
if
[
$BOARD
=
"310-00110"
]
;
then
echo
"found verizon cell modem expansion card"
/etc/init.d/vz_cell_init.sh
/etc/init.d/ec21_cell_init.sh
/etc/init.d/ec21_pwron.sh usb
fi
if
[
$BOARD
=
"310-00121"
]
;
then
echo
"found pls62-w cell modem expansion card"
/etc/init.d/pls62-w_cell_init.sh
/etc/init.d/pls62_cell_init.sh
/etc/init.d/pls62_pwron.sh uart
fi
#add tests for additional expansion cards here as they become available
...
...
recipes-core/scripts-vesta/files/pls62_cell_init.sh
0 → 100644
View file @
bd47c003
#!/bin/sh
#IO pin definitions, Expansion - Cell - PLS62
#used pins
vbus_enable
=
118
#GPIO4_IO22, ESPI_CS_N
cell_igt
=
30
#GPIO1_IO30, ESPI_MOSI
cell_status_n
=
31
#GPIO1_IO31, ESPI_MISO
cell_pwr_shdn
=
8
#GPIO1_IO8, SPDIF_OUT
cell_eoff
=
23
#GPIO1_IO23, CAN2_RX
cell_shdn
=
22
#GPIO1_IO22, CAN2_TX
#reserved pins
GPIO3_IO1
=
65
#LCD_EN (GND on expansion board)
GPIO3_IO4
=
68
#LCD_RESET (GND on expansion board)
GPIO5_IO5
=
133
#TAMPER (GND on expansion board)
#Init GPIO
gpio_set
()
{
pin_num
=
$1
pin_dir
=
$2
pin_val
=
$3
num_args
=
$#
test
-e
"/sys/class/gpio/gpio
$pin_num
"
if
[
$?
-ne
"0"
]
;
then
echo
$pin_num
>
/sys/class/gpio/export
fi
echo
$pin_dir
>
/sys/class/gpio/gpio
${
pin_num
}
/direction
if
[
$num_args
-eq
3
]
;
then
echo
$pin_val
>
/sys/class/gpio/gpio
${
pin_num
}
/value
fi
}
#Configure default GPIO settings
gpio_set
$vbus_enable
out 0
#start disabled (no usb attach)
gpio_set
$cell_igt
out 0
#do not assert until ready for actual boot
gpio_set
$cell_status_n
in
#status input
gpio_set
$cell_pwr_shdn
out 0
#regulator should be ON default, keep this low
gpio_set
$cell_shdn
out 0
#should be inactive by default
gpio_set
$cell_eoff
out 0
#should be inactive by default
#Configure unused pins to make sure they aren't driven
gpio_set
$GPIO3_IO1
in
#GND on expansion board
gpio_set
$GPIO3_IO4
in
#GND on expansion board
gpio_set
$GPIO5_IO5
in
#GND on expansion board
recipes-core/scripts-vesta/files/pls62
-w
_cell_
init
.sh
→
recipes-core/scripts-vesta/files/pls62_cell_
pwron
.sh
View file @
bd47c003
#!/bin/sh
#Modem interface
interface
=
uart
#create a timeout variable
timeout
=
30
#Set VDD_EXT limit for ADC
adc_lower_limit
=
2110
#approx 1.7V
#IO pin definitions, Expansion - Cell - PLS62
#used pins
vbus_enable
=
118
#GPIO4_IO22, ESPI_CS_N
cell_igt
=
30
#GPIO1_IO30, ESPI_MOSI
cell_status_n
=
31
#GPIO1_IO31, ESPI_MISO
...
...
@@ -13,12 +17,21 @@ cell_pwr_shdn=8 #GPIO1_IO8, SPDIF_OUT
cell_eoff
=
23
#GPIO1_IO23, CAN2_RX
cell_shdn
=
22
#GPIO1_IO22, CAN2_TX
#reserved pins
GPIO3_IO1
=
65
#LCD_EN (GND on expansion board)
GPIO3_IO4
=
68
#LCD_RESET (GND on expansion board)
GPIO5_IO5
=
133
#TAMPER (GND on expansion board)
#print usage info to std out
print_usage
()
{
cat
<<-
EOF
Usage:
$(
basename
$0
)
interface
Specify the cellular modem interface as 'usb' or 'uart'
$(
basename
$0
)
uart
or
$(
basename
$0
)
usb
EOF
}
#
Ini
t GPIO
#
se
t GPIO
gpio_set
()
{
pin_num
=
$1
...
...
@@ -43,6 +56,11 @@ gpio_read()
{
pin_num
=
$1
test
-e
"/sys/class/gpio/gpio
$pin_num
"
if
[
$?
-ne
"0"
]
;
then
echo
$pin_num
>
/sys/class/gpio/export
fi
pin_value
=
$(
cat
/sys/class/gpio/gpio
${
pin_num
}
/value
)
}
...
...
@@ -62,18 +80,21 @@ check_modem_on()
fi
}
#Configure default GPIO settings
gpio_set
$vbus_enable
out 0
#start disabled (no usb attach)
gpio_set
$cell_igt
out 0
#do not assert until ready for actual boot
gpio_set
$cell_status_n
in
#status input
gpio_set
$cell_pwr_shdn
out 0
#regulator should be ON default, keep this low
gpio_set
$cell_shdn
out 0
#should be inactive by default
gpio_set
$cell_eoff
out 0
#should be inactive by default
#Configure unused pins to make sure they aren't driven
gpio_set
$GPIO3_IO1
in
#GND on expansion board
gpio_set
$GPIO3_IO4
in
#GND on expansion board
gpio_set
$GPIO5_IO5
in
#GND on expansion board
OPTS
=
`
getopt
-o
h
-n
'parse-options'
--
"
$@
"
`
eval set
--
"
$OPTS
"
# increment through the options one by one
while
true
;
do
case
"
$1
"
in
-h
)
print_usage
exit
0
;;
--
)
interface
=(
"
$2
"
)
;
break
;;
*
)
#print_usage
exit
1
;
esac
done
#Set GPIO
gpio_set
$cell_eoff
out 0
#make sure modem is not forced off
...
...
@@ -92,11 +113,12 @@ gpio_set $cell_shdn out 0 #make sure modem is not forced off
# T) if no, enable vbus and wait for (5) seconds
# 3) kick off USB enumeration
printf
"
\n
Enabling modem on
$interface
interface"
#1)check cell modem power
gpio_read
$cell_pwr_shdn
if
[
$pin_value
-eq
1
]
;
then
logger
-s
"
Enabling power for modem"
printf
"
\n
Enabling power for modem
\n
"
gpio_set
$cell_pwr_shdn
out 0
#enable cell power
usleep 1000000
fi
...
...
@@ -106,69 +128,83 @@ check_modem_on
if
[
$modem_on
-eq
0
]
;
then
#modem is OFF, initiate modem boot
logger
-s
"
Turning modem ON"
printf
"
\n
Turning modem ON
\n
"
gpio_set
$cell_igt
out 1
usleep 300000
#wait 300ms
gpio_set
$cell_igt
out 0
#enable VBUS
logger
-s
"Enabling VBUS for modem"
gpio_set
$vbus_enable
out 1
if
[
"
$interface
"
==
"usb"
]
;
then
printf
"
\n
Enabling VBUS for modem
\n
"
gpio_set
$vbus_enable
out 1
fi
#wait for status signal to indicate power o
n
is complete
#wait for status signal to indicate power o
ff
is complete
readstatus
=
1
while
[
$readstatus
-eq
1
]
;
do
usleep 1000000
logger
-s
"Waiting for cell modem status line..."
gpio_read
$cell_status_n
readstatus
=
$pin_value
while
[
$timeout
-gt
0
]
;
do
if
[
$readstatus
-eq
0
]
;
then
printf
"
\n
Cell modem is powering up...
\n
"
usleep 14000000
#boot time is >13 seconds according to hw guide
break
;
else
timeout
=
$((
$timeout
-
1
))
usleep 1000000
printf
"
\n
Checking cell modem Status, time-out in
$timeout
seconds...
\n
"
gpio_read
$cell_status_n
readstatus
=
$pin_value
fi
done
logger
-s
"Cell modem is powering up..."
usleep 14000000
#boot time is >13 seconds according to hw guide
if
[
$timeout
-eq
0
]
;
then
printf
"
\n
ERROR: Modem did not indicate status before timeout, make sure staus line is configured!
\n
"
fi
else
#cell modem is already ON
logger
-s
"
Modem is ON"
printf
"
\n
Modem is ON
\n
"
#allow time for the main board to fully boot
#maybe check how long the system has been up to decide if this is necessary
usleep 1000000
if
[
-e
/dev/ttyACM0
]
;
then
logger
-s
"Cell modem attached to USB"
exit
0
#USB device is attached, modem should work
else
#check if VBUS is enabled
gpio_read
$vbus_enable
if
[
$pin_value
-eq
0
]
;
then
logger
-s
"Enabling VBUS for cell modem"
gpio_set
$vbus_enable
out 1
usleep 50000
if
[
"
$interface
"
==
"usb"
]
;
then
if
[
-e
/dev/ttyACM0
]
;
then
printf
"
\n
Cell modem attached to USB
\n
"
exit
0
#USB device is attached, modem should work
else
#modem is on but not responding - force shutdown the modem
logger
-s
"Modem is ON but not responding"
exit
1
#gpio_set $cell_eoff out 1
#usleep 10000 #wait 10ms
#gpio_set $cell_eoff out 0
#usleep 14000000 # boot time is >13 seconds according to hw guide
#check if VBUS is enabled
gpio_read
$vbus_enable
if
[
$pin_value
-eq
0
]
;
then
printf
"
\n
Enabling VBUS for cell modem
\n
"
gpio_set
$vbus_enable
out 1
usleep 50000
else
printf
"Modem is ON but not enumerated"
exit
1
fi
fi
elif
[
-e
/dev/ttymxc6
]
;
then
printf
"
\n
Cell modem uses uart
\n
"
exit
0
else
printf
"
\n
This unit is not properly configured for a PLS62 modem
\n
"
fi
fi
#3)kick off USB enumeration
logger
-s
"Initiating USB enumeration for cell modem"
cat
/dev/bus/usb/002/001
usleep 6000000
if
[
-e
/dev/ttyACM0
]
;
then
logger
-s
"Cell modem attached to USB"
else
logger
-s
"USB enumeration failed!"
exit
1
#3)If using USB, kick off USB enumeration
if
[
"
$interface
"
==
"usb"
]
;
then
printf
"
\n
Initiating USB enumeration for cell modem
\n
"
cat
/dev/bus/usb/002/001
usleep 6000000
if
[
-e
/dev/ttyACM0
]
;
then
printf
"
\n
Cell modem attached to USB
\n
"
exit
0
#USB device is attached, modem should work
else
printf
"
\n
USB enumeration failed!
\n
"
exit
1
fi
fi
logger
-s
"Cell modem power ON is complete"
printf
"
\n
Cell modem power ON is complete
\n
"
pppd file /etc/ppp/peers/att_lte_ttyACM0
recipes-core/scripts-vesta/files/vz_cell_init.sh
deleted
100755 → 0
View file @
dd69cd77
#!/bin/sh
#Verizon cell modem expansion card IO pin definitions
# --- v3 BOARD!! ---
#reserved pins (should be grounded)
rsvd_GPIO4_IO17
=
113
rsvd_GPIO2_IO9
=
41
rsvd_GPIO2_IO10
=
42
rsvd_GPIO2_IO11
=
43
rsvd_GPIO2_IO12
=
44
rsvd_GPIO2_IO13
=
45
rsvd_GPIO1_IO2
=
2
rsvd_GPIO5_IO5
=
133
rsvd_GPIO3_IO1
=
65
rsvd_GPIO3_IO4
=
68
#used pins
cell_wakeup
=
117
#GPIO4_IO21, ESPI_CLK
vbus_enable
=
118
#GPIO4_IO22, ESPI_CS_N
cell_pwrkey
=
30
#GPIO1_IO30, ESPI_MOSI
cell_status_n
=
31
#GPIO1_IO31, ESPI_MISO
cell_pwr_shdn
=
8
#GPIO1_IO8, SPDIF_OUT
cell_disable
=
23
#GPIO1_IO23, CAN2_RX
cell_reset
=
22
#GPIO1_IO22, CAN2_TX
adc_lower_limit
=
2110
gpio_set
()
{
pin_num
=
$1
pin_dir
=
$2
pin_val
=
$3
num_args
=
$#
test
-e
"/sys/class/gpio/gpio
$pin_num
"
if
[
$?
-ne
"0"
]
;
then
echo
$pin_num
>
/sys/class/gpio/export
fi
echo
$pin_dir
>
/sys/class/gpio/gpio
${
pin_num
}
/direction
if
[
$num_args
-eq
3
]
;
then
echo
$pin_val
>
/sys/class/gpio/gpio
${
pin_num
}
/value
fi
}
gpio_read
()
{