[Gta04-owner] QtMoko v44

Dr. H. Nikolaus Schaller hns at goldelico.com
Sun Apr 15 09:41:08 CEST 2012


Am 15.04.2012 um 10:10 schrieb Radek Polak:

> On Saturday 14 April 2012 14:18:38 Dr. H. Nikolaus Schaller wrote:
> 
>> testing "GTM601-USB" "check internal USB port"
>> for repeat in 1 2 3 4 5
>> 	do
>> 	if lsusb | fgrep '0af0:8800 Option' >/dev/null
>> 		then # found
>> 		ok
>> 		break
>> 	fi
>> 	if [ -w /sys/devices/virtual/gpio/gpio186/value ]
>> 	then # wake up modem in GTA04A4
>> 		echo 1 >/sys/devices/virtual/gpio/gpio186/value
>> 		sleep 1
>> 		echo 0 >/sys/devices/virtual/gpio/gpio186/value
>> 		sleep 5
> 
> Hi,
> i can add the script to QtMoko, no problem here. But to me it looks like it 
> will boot 6s slower. Can't this be done better way? E.g. power the modem on in 
> kernel while it boots?

Well, the idea not to enable it in the kernel is to give the user-space full control.
And some safety measure if user space init fails.

But you could run this as a background process.

Regarding the delay, you can't avoid some delay between starting the modem
and the usb interface to appear... You could try to check the lsusb every second
in some inner loop. Something like

for repeat in 1 2 3 4 5
do
	for sleep in 1 2 3 4 5
		do
			if [ -r /dev/ttyHSO_Application ]
			then #found
			break ## somehow also break outer loop
			sleep 1
		done
	... impulse ...
done

Note that I would check for the existence of the /dev node since it is
faster than a lsusb|fgrep check and makes sure that the udev
initializations have been finalized.

The key problem of these loops is that there must be a timeout
if the modem does not start up (for whatever reasons). And a hw-reset
needs some time.

So to optimize boot speed:
1. assume that the modem is off after boot (it is - unless it is a
    reboot without switching the modem off before)
2. give a short impulse on the gpio186
3. start QtMoko (or SHR or Replicant or XYZ)
4. that should take enough time for the modem to initialize
5. if then (or any time during operation) /dev/ttyHSO_Application
    is not available, give another impulse and delay 5 seconds and
    repeat step 5.
    Or instead of delaying constant 5 seconds, wait up to 5 seconds
    for /dev/ttyHSO_Application to appear

I think this scheme should enable the modem as fast as possible
but will try another impulse if it has failed or the initial power state
assumption was wrong. And it should also work on the GTA04A3
boards.

BR,
Nikolaus



More information about the Gta04-owner mailing list