Overlays in uboot

-------- Forwarded Message --------
Subject: Re: Testing BBBW
Date: Tue, 21 Feb 2017 17:15:35 +1300
From: Kevin & Pauline Gordon <gordonkevin117@ gmail.com>
To: Robert Nelson <robertcnelson@ gmail.com>
CC: Beagle Board <beagleboard@ googlegroups.com>

Hi Robert,

The error I struck using grow_partition.sh was:

Re-reading the partition table …
sfdisk: BLKRRPART: Device or resource busy
sfdisk: The command to re-read the partition table failed.
Run partprobe(8), kpartx(8) or reboot your system now,
before using mkfs
sfdisk: If you created or changed a DOS partition, /dev/foo7, say, then
use dd(1)
to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)

I rebooted and ran:

root@ beaglebone:/opt/scripts/tools# ./version.sh
git:/opt/scripts/:[e066cb50c5eda24ce09227b1a155da823d56225a]
eeprom:[A335BNLTBWA51646BBWG0358]
dogtag:[BeagleBoard.org Debian Image 2017-02-12]
bootloader:[/dev/mmcblk0]:[U-Boot 2017.03-rc1-00003-ga09f2d]
bootloader:[/dev/mmcblk1]:[U-Boot 2016.11-rc3-00002-g73df7f]
kernel:[4.4.48-ti-r88]
nodejs:[v4.7.3]
root@ beaglebone:/opt/scripts/tools# df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 10240 0 10240 0% /dev
tmpfs 99956 3036 96920 4% /run
/dev/mmcblk0p1 7376168 2934944 4090164 42% /
tmpfs 249884 4 249880 1% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 249884 0 249884 0% /sys/fs/cgroup
tmpfs 49980 0 49980 0% /run/user/1000

root@ beaglebone:/opt/scripts/tools# fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 7.2 GiB, 7744782336 bytes, 15126528 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc9171f1a

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 8192 15126527 15118336 7.2G 83 Linux

I HAVE NOT RUN mkfs.

So there is only one partition BUT it starts at 8192 sectors. Is there
absolutely nothing pior to 8192 sectors? Is there a MRB in the first 512
bytes? If I used dd in linux must I allow for that? Why so many sectors
(8192)?

The version is: bootloader:[/dev/mmcblk0]:[U-Boot 2017.03-rc1-00003-ga09f2d] Is U-Boot 2017.03-rc1-00003 sufficiently up
to date?

This is how my slots are at present:

0: P—L- 0 4D 7.0 LCD CAPE- 4DCAPE-70T ,00A3,4D SYSTEMS ,BB-BONE-LCD7-01

1: PF---- -1

2: PF---- -1

3: PF---- -1

In /boot/uEnv.txt I uncommented: enable_uboot_overlays=1 and
disable_uboot_overlay_video=1

Moved /uEnv.txt to /uEnv.txt.old

I shutdown the BBBW and it actually shutdown not rebooted??? After so
long faulty?

After restart checked slots which was the same as above.

In /boot/uEnv.txt I uncommented:disable_uboot_overlay_audio=1

In /boot/uEnv.txtadded
cape_enable=bone_capemgr.enable_partno=BB-UART1,BB-I2C1,BB-UART4

I shutdown the BBBW but it rebooted.

New slots:

0: P—L- 0 4D 7.0 LCD CAPE- 4DCAPE-70T ,00A3,4D SYSTEMS ,BB-BONE-LCD7-01

1: PF---- -1

2: PF---- -1

3: PF---- -1

4: P-O-L- 1 Override Board Name,00A0,Override Manuf,BB-UART1

5: P-O-L- 2 Override Board Name,00A0,Override Manuf,BB-I2C1

6: P-O-L- 3 Override Board Name,00A0,Override Manuf,BB-UART4

I tried adding BB-ADC with no effect. BB-BONE-LCD7-01 uses some of AIN
pins. AIN0 to AIN3? Not sure.

root@ beaglebone:/home/debian# cd /sys/bus/iio/devices/iio:device0
root@ beaglebone:/sys/bus/iio/devices/iio:device0# ls -al
total 0
drwxr-xr-x 5 root root 0 Feb 20 23:41 .
drwxr-xr-x 4 root root 0 Feb 20 23:41 …
drwxr-xr-x 2 root root 0 Feb 21 03:49 buffer
-r–r–r-- 1 root root 4096 Feb 21 03:49 dev
-rw-r–r-- 1 root root 4096 Feb 21 03:49 in_voltage4_raw
-rw-r–r-- 1 root root 4096 Feb 21 03:49 in_voltage5_raw
-rw-r–r-- 1 root root 4096 Feb 21 03:49 in_voltage6_raw
-rw-r–r-- 1 root root 4096 Feb 21 03:49 in_voltage7_raw
-r–r–r-- 1 root root 4096 Feb 21 03:49 name
lrwxrwxrwx 1 root root 0 Feb 21 03:49 of_node →
…/…/…/…/…/…/firmware/devicetree/base/ocp/tscadc@ 44e0d000/adc
drwxr-xr-x 2 root root 0 Feb 21 03:49 power
drwxr-xr-x 2 root root 0 Feb 21 03:49 scan_elements
lrwxrwxrwx 1 root root 0 Feb 21 03:49 subsystem →
…/…/…/…/…/…/bus/iio
-rw-r–r-- 1 root root 4096 Feb 20 23:41 uevent
root@ beaglebone:/sys/bus/iio/devices/iio:device0#

I guess from the above I can use AIN3 to AIN6?

The important result is that using uboot overlays does NOT impact on
wireless.

Regards,

Kevin.

@ KG1 -

So finally what are you going to do? :smiley:

If just want to get ADC working, I don’t think we have touch on u-boot !

http://elinux.org/Beagleboard:BeagleBone_Debian_Image_Migration#U-Boot_Overlays
From Robert C Nelson
"So, due to the shear number of *.dtb files, i haven’t implemented a
direct “emmc-overlay” specific for the bbbw.
Instead, i’ve implemented something newer, utilizing U-Boot overlays. "

Re GHI designed BBBW: Robert C Nelson is not intending to write *.dtb files (where necessary) for the BBBW.
Users of BBBW will need to wait until U-Boot Overlays are released.

At present my immediate problem was that disabling HDMI video/audio destroyed the wireless connection.
However the fix is available via Jessie Testing using U-Boot Overlays. This is experimental.
BB-BONE-LCD7-01-00A3.dts is used by my 4DCAPE-70T display part of which is below:

fragment@ 4 { 
	target = <&tscadc>; 
	__overlay__ { 


		status = "okay"; 
		tsc { 
			ti,wires = <4>; 
			ti,x-plate-resistance = <200>; 
			ti,coordinate-readouts = <5>; 
			ti,wire-config = <0x00 0x11 0x22 0x33>; 
		}; 


		adc { 
			ti,adc-channels = <4 5 6 7>; 
		}; 
	}; 
}; 

Hence some of the ADC’s are used by the display.
@ Dale which adc’s are used and can I use the remaining one’s for other purposes?

@ KG1 -

following your dtb I think

ADC 0,1,2,3 are used for LCD

ADC 4,5,6,7 are enable for ADC purpose.

If you don’t need ADC, you can disable 4,5,6,7.

Also, that dtb overlay is used for tscadc which is kernel driver to control LCD touch ADC, not related to HDMI. I think.

Actually, you can visit here:

https://www.ghielectronics.com/docs/348/osd3358-developers-guide

In Display section. That show you how to change or reload a device tree overlay, example is for LCD but same for other things, beside load manually.

I think that is what they mean “utilizing U-boot Overlay”.

I don’t think they meant you have to re-partition your MMC or eMMC to update uboot. That is different thing.

Those are just what I am thinking.

uboot overlays are very new and under development. Please look at [url]Beagleboard:BeagleBone Debian Image Migration - eLinux.org
The BB-BONE-LCD7-01-00A3.dts overlay is in the 4DCAPE-70T and is hard wired in a ROM.
The 4DCAPE-70T uses AIN0 to AIN3.
I thought I needed to use BB-ADC to activate AIN4 to AIN6 but it was rejected “as pins already in use”.
tsc is the driver of touch which uses I2C2.
I will try P9.35 and P9.36 with my analogue joystick.
Many thanks,
Kevin.

@ KG1 -

I don’t think tscadc is something for touch I2C, for my understand, it is for analog touch screen.
Here is the link: https://www.kernel.org/doc/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt

I am not familiar with 4DCAPE-70T, so not sure what driver is trigger for this screen. But yes, technically analog touch needs only 2 analog, but if tscadc is used for this case, I don’t think you can take AIN1 and AIN2 for other purpose, unless you don’t want touch or re-write driver or newer driver. It must be AIN0, AIN1, AIN2, AIN3, even the order must be exactly “00,11,22,33”.

As I said, you can not use BB-ADC to enable 4,5,6, just because they are enable already in tscadc (if this driver is loaded - follow your dtb file above)