Hi Pavel,
In the linux code,I only find there are i2c1 and i2c3,no i2c2.
Would you tell me how to add the i2c2 to our kernel?
Thank you
BR
Bob
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Bob,
bob lee said:omap_mux_init: Add partition: #1: core, flags: 4
_omap_mux_get_by_name: Could not find signal i2c2_scl.i2c2_scl
_omap_mux_get_by_name: Could not find signal i2c2_sda.i2c2_sda
Have you enabled the I2C2 pins in the i2c.c file? See the below wiki for more info:
Regards,
Pavel
Hi Pavel,
I have modified the i2c.c file as below.
void __init omap2_i2c_mux_pins(int bus_id)
{
if (cpu_is_ti814x() && bus_id == 3) {
sprintf(mux_name, "dcan0_tx.i2c3_sda_mux1");
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
sprintf(mux_name, "dcan0_rx.i2c3_scl_mux1");
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
} else if (cpu_is_ti814x() && bus_id == 2){
sprintf(mux_name, "vout1_g_y_yc2.i2c2_scl_mux2");
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
sprintf(mux_name, "vout1_r_cr3.i2c2_sda_mux2");
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
}else{
sprintf(mux_name, "i2c%i_scl.i2c%i_scl", bus_id, bus_id);
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
sprintf(mux_name, "i2c%i_sda.i2c%i_sda", bus_id, bus_id);
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
}
}
And it shows the below message:
omap_mux_init: Add partition: #1: core, flags: 4
Could not look up i2c2
BR
Bob
Hi Pavel,
Here is the log of boot up message.Because failed to set the log file ,so I paste the message at the this textbox.
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Linux version 2.6.37+ (boblee@javenshen-desktop) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #26 Thu Jan 15 09:58:13 CST 2015
CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: ti8148evm
bootconsole [earlycon0] enabled
reserved size = 52428800 at 0x0
FB: Reserving 52428800 bytes SDRAM for VRAM
Memory policy: ECC disabled, Data cache writeback
OMAP chip is TI8148 3.0
SRAM: Mapped pa 0x402f1000 to va 0xfe400000 size: 0xf000
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 247296
Kernel command line: mem=1024M console=ttyO0,115200n8 earlyprintk root=/dev/ram rw initrd=0x82000000,32MB
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 974MB = 974MB total
Memory: 949804k/949804k available, 98772k reserved, 210944K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
DMA : 0xffc00000 - 0xffe00000 ( 2 MB)
vmalloc : 0xf0800000 - 0xf8000000 ( 120 MB)
lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)
pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
.init : 0xc0008000 - 0xc003c000 ( 208 kB)
.text : 0xc003c000 - 0xc051c000 (4992 kB)
.data : 0xc051c000 - 0xc0564680 ( 290 kB)
SLUB: Genslabs=11, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:375
IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
Total of 128 interrupts on 1 active controller
GPMC revision 6.0
Trying to install interrupt handler for IRQ368
Trying to install interrupt handler for IRQ369
Trying to install interrupt handler for IRQ370
Trying to install interrupt handler for IRQ371
Trying to install interrupt handler for IRQ372
Trying to install interrupt handler for IRQ373
Trying to install interrupt handler for IRQ374
Trying to install type control for IRQ375
Trying to set irq flags for IRQ375
OMAP clockevent source: GPTIMER1 at 20000000 Hz
Console: colour dummy device 80x30
Calibrating delay loop... 599.65 BogoMIPS (lpj=2998272)
pid_max: default: 32768 minimum: 301
Security Framework initialized
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
devtmpfs: initialized
omap_voltage_early_init: voltage driver support not added
regulator: core version 0.5
regulator: dummy:
NET: Registered protocol family 16
omap_voltage_domain_lookup: Voltage driver init not yet happened.Faulting!
omap_voltage_add_dev: VDD specified does not exist!
OMAP GPIO hardware version 0.1
OMAP GPIO hardware version 0.1
OMAP GPIO hardware version 0.1
OMAP GPIO hardware version 0.1
omap_mux_init: Add partition: #1: core, flags: 4
Could not look up i2c2
NOR: Can't request GPMC CS
Debugfs: Only enabling/disabling deep sleep and wakeup timer is supported now
registered ti81xx_vpss device
registered ti81xx_vidout device
registered ti81xx_fb device
registered ti81xx_vin device
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
USBSS revision 4ea2080b
registerd cppi-dma Intr @ IRQ 17
Cppi41 Init Done
omap_i2c omap_i2c.1: bus 1 rev4.0 at 100 kHz
tps65910 1-002d: read from reg 3f failed
tps65910 1-002d: read from reg 1e failed
set_machine_constraints: failed to enable VRTC
tps65910 1-002d: failed to register tps65910-pmic regulator
tps65910-pmic: probe of tps65910-pmic failed with error -121
tps65910 1-002d: No interrupt support, no core IRQ
omap_i2c omap_i2c.3: bus 3 rev4.0 at 100 kHz
Advanced Linux Sound Architecture Driver Version 1.0.23.
Switching to clocksource gp timer
musb-hdrc: version 6.0, host, debug=0
musb-hdrc musb-hdrc.0: dma type: dma-cppi41
MUSB controller-0 revision 4ea20800
musb-hdrc musb-hdrc.0: MUSB HDRC host driver
musb-hdrc musb-hdrc.0: new USB bus registered, assigned bus number 1
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: MUSB HDRC host driver
usb usb1: Manufacturer: Linux 2.6.37+ musb-hcd
usb usb1: SerialNumber: musb-hdrc.0
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
musb-hdrc musb-hdrc.0: USB Host mode controller at f081e000 using DMA, IRQ 18
musb-hdrc musb-hdrc.1: dma type: dma-cppi41
MUSB controller-1 revision 4ea20800
musb-hdrc musb-hdrc.1: MUSB HDRC host driver
musb-hdrc musb-hdrc.1: new USB bus registered, assigned bus number 2
usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: MUSB HDRC host driver
usb usb2: Manufacturer: Linux 2.6.37+ musb-hcd
usb usb2: SerialNumber: musb-hdrc.1
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
musb-hdrc musb-hdrc.1: USB Host mode controller at f0828800 using DMA, IRQ 19
NET: Registered protocol family 2
IP route cache hash table entries: 32768 (order: 5, 131072 bytes)
TCP established hash table entries: 131072 (order: 8, 1048576 bytes)
TCP bind hash table entries: 65536 (order: 6, 262144 bytes)
TCP: Hash tables configured (established 131072 bind 65536)
TCP reno registered
UDP hash table entries: 512 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 512 (order: 1, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Trying to unpack rootfs image as initramfs...
rootfs image is not initramfs (no cpio magic); looks like an initrd
Freeing initrd memory: 32768K
NetWinder Floating Point Emulator V0.97 (double precision)
PMU: registered new PMU device of type 0
omap-iommu omap-iommu.0: ducati registered
omap-iommu omap-iommu.1: sys registered
highmem bounce pool size: 64 pages
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 1507
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
omap_uart.0: ttyO0 at MMIO 0x48020000 (irq = 72) is a OMAP UART0
console [ttyO0] enabled, bootconsole disabled
console [ttyO0] enabled, bootconsole disabled
omap_uart.1: ttyO1 at MMIO 0x48022000 (irq = 73) is a OMAP UART1
omap_uart.2: ttyO2 at MMIO 0x48024000 (irq = 74) is a OMAP UART2
omap_uart.3: ttyO3 at MMIO 0x481a6000 (irq = 44) is a OMAP UART3
omap_uart.4: ttyO4 at MMIO 0x481a8000 (irq = 45) is a OMAP UART4
omap_uart.5: ttyO5 at MMIO 0x481aa000 (irq = 46) is a OMAP UART5
brd: module loaded
loop: module loaded
ahci ahci.0: forcing PORTS_IMPL to 0x1
ahci ahci.0: AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl platform mode
ahci ahci.0: flags: ncq sntf pm led clo only pmp pio slum part ccc apst
scsi0 : ahci_platform
ata1: SATA max UDMA/133 irq_stat 0x00400040, connection status changed irq 16
omap2-nand driver initializing
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung )
Creating 6 MTD partitions on "omap2-nand.0":
0x000000000000-0x000000020000 : "U-Boot-min"
0x000000020000-0x000000260000 : "U-Boot"
0x000000260000-0x000000280000 : "U-Boot Env"
0x000000280000-0x0000006c0000 : "Kernel"
0x0000006c0000-0x00000cee0000 : "File System"
0x00000cee0000-0x000010000000 : "Reserved"
davinci_mdio davinci_mdio.0: davinci mdio revision 1.6
davinci_mdio davinci_mdio.0: detected phy mask fffffff9
davinci_mdio.0: probed
davinci_mdio davinci_mdio.0: phy[1]: device 0:01, driver RTL821x Gigabit Ethernet
davinci_mdio davinci_mdio.0: phy[2]: device 0:02, driver RTL821x Gigabit Ethernet
CAN device driver interface
CAN bus driver for Bosch D_CAN controller 1.0
usbcore: registered new interface driver cdc_ether
usbcore: registered new interface driver dm9601
usbcore: registered new interface driver cdc_acm
cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mice: PS/2 mouse device common for all mice
qt602240_ts 1-004a: __qt602240_read_reg: i2c transfer failed
qt602240_ts: probe of 1-004a failed with error -5
rtc-ds1307 1-0068: rtc core: registered ds3231 as rtc0
omap_rtc omap_rtc: rtc core: registered omap_rtc as rtc1
i2c /dev entries driver
Linux video capture interface: v2.00
usbcore: registered new interface driver uvcvideo
USB Video Class driver (v1.0.0)
lm75 1-004f: hwmon0: sensor 'lm75'
OMAP Watchdog Timer Rev 0x00: initial timeout 60 sec
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
usbcore: registered new interface driver snd-usb-audio
asoc: tlv320aic3x-hifi <-> davinci-mcasp.2 mapping ok
asoc: HDMI-DAI-CODEC <-> hdmi-dai mapping ok
ALSA device list:
#0: TI81XX EVM
IPVS: Registered protocols ()
IPVS: Connection hash table configured (size=4096, memory=32Kbytes)
IPVS: ipvs loaded.
TCP cubic registered
NET: Registered protocol family 17
can: controller area network core (rev 20090105 abi 8)
NET: Registered protocol family 29
can: raw protocol (rev 20090105)
can: broadcast manager protocol (rev 20090105 t)
Registering the dns_resolver key type
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
omap_voltage_late_init: Voltage driver support not added
Power Management for TI81XX.
Detected MACID=84:7e:40:e9:c9:36
rtc-ds1307 1-0068: setting system clock to 2015-01-15 10:49:54 UTC (1421318994)
ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata1.15: Port Multiplier 1.2, 0x197b:0x3202 r0, 2 ports, feat 0x5/0xf
ata1.00: hard resetting link
ata1.00: SATA link up 1.5 Gbps (SStatus 113 SControl 320)
ata1.01: hard resetting link
ata1.01: SATA link down (SStatus 0 SControl 320)
ata1.00: ATA-8: Shinedisk mSATA 8G, 20130816, max UDMA/133
ata1.00: 15650208 sectors, multi 0: LBA
ata1.00: configured for UDMA/133
ata1: EH complete
scsi 0:0:0:0: Direct-Access ATA Shinedisk mSATA 2013 PQ: 0 ANSI: 5
sd 0:0:0:0: Attached scsi generic sg0 type 0
sd 0:0:0:0: [sda] 15650208 512-byte logical blocks: (8.01 GB/7.46 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sda: sda1
sd 0:0:0:0: [sda] Attached SCSI disk
RAMDISK: gzip image found at block 0
VFS: Mounted root (ext2 filesystem) on device 1:0.
devtmpfs: mounted
Freeing init memory: 208K
INIT: version 2.86 booting
Please wait: booting...
Error opening /dev/fb0: No such file or directory
Starting udev
WARNING: -e needs -E or -F
udevd (80): /proc/80/oom_adj is deprecated, please use /proc/80/oom_score_adj instead.
FAT: invalid media value (0xb9)
VFS: Can't find a valid FAT filesystem on dev sda.
EXT2-fs (sda1): warning: mounting unchecked fs, running e2fsck is recommended
Remounting root file system...
Caching udev devnodes
ALSA: Restoring mixer settings...
No state is present for card EVM
Found hardware: "" "" "" "" ""
Hardware is initialized using a generic method
No state is present for card EVM
Configuring e2fsprogs.
update-alternatives: Error: cannot register alternative chattr to /usr/bin/chattr since it is already registered to /bin/chattr
update-alternatives: Linking //sbin/uuidd to uuidd.util-linux-ng
Configuring update-modules.
Configuring dbus.
Adding system startup for /etc/init.d/dbus-1.
Configuring network interfaces...
CPSW phy found : id is : 0x1cc912
CPSW phy found : id is : 0x1cc912
udhcpc (v1.13.2) started
Sending discover...
PHY: 0:02 - Link is Up - 0/Half
PHY: 0:02 - Link is Down
PHY: 0:01 - Link is Up - 100/Full
Sending discover...
Sending select for 192.168.5.109...
Lease of 192.168.5.109 obtained, lease time 7200
adding dns 192.168.5.1
adding dns 192.168.6.9
done.
Setting up IP spoofing protection: rp_filter.
INIT: Entering runlevel: 5
Starting system message bus: dbus.
Starting telnet daemon.
Starting syslogd/klogd: done
Starting thttpd.
_____ _____ _ _
| _ |___ ___ ___ ___ | _ |___ ___ |_|___ ___| |_
| | _| .'| . | . | | __| _| . | | | -_| _| _|
|__|__|_| |__,|_ |___| |__| |_| |___|_| |___|___|_|
|___| |___|
Arago Project http://arago-project.org dm814x-evm ttyO0
Arago 2011.09 dm814x-evm ttyO0
dm814x-evm login:
BR
Bob
Hi Pavel,
After changing the struct ti816x_i2c2_hwmod in omap_hwmod_81xx_data.c file as below,
.omap_chip = OMAP_CHIP_INIT(CHIP_IS_TI816X),------->.omap_chip = OMAP_CHIP_INIT(CHIP_IS_TI814X |CHIP_IS_TI816X),
I can find the message for i2c2.
omap_i2c omap_i2c.2: bus 2 rev4.0 at 100 kHz
And also can get the info about the I2C
root@dm814x-evm:~# i2cdetect -l
i2c-1 i2c OMAP I2C adapter I2C adapter
i2c-2 i2c OMAP I2C adapter I2C adapter
i2c-3 i2c OMAP I2C adapter I2C adapter
But it also shows "omap_i2c omap_i2c.2: controller timed out" during the boot up.
omap_i2c omap_i2c.2: controller timed out
omap_i2c omap_i2c.2: controller timed out
omap_i2c omap_i2c.2: controller timed out
omap_i2c omap_i2c.2: controller timed out
omap_i2c omap_i2c.2: controller timed out
omap_i2c omap_i2c.2: controller timed out
omap_i2c omap_i2c.2: controller timed out
Do you know why ?Is it related to the clock?
BR
Bob
Bob,
bob lee said:void __init omap2_i2c_mux_pins(int bus_id)
{
if (cpu_is_ti814x() && bus_id == 3) {
sprintf(mux_name, "dcan0_tx.i2c3_sda_mux1");
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
sprintf(mux_name, "dcan0_rx.i2c3_scl_mux1");
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
} else if (cpu_is_ti814x() && bus_id == 2){
sprintf(mux_name, "vout1_g_y_yc2.i2c2_scl_mux2");
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
sprintf(mux_name, "vout1_r_cr3.i2c2_sda_mux2");
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
}else{
sprintf(mux_name, "i2c%i_scl.i2c%i_scl", bus_id, bus_id);
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
sprintf(mux_name, "i2c%i_sda.i2c%i_sda", bus_id, bus_id);
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
}
}
This update is not correct. Note that in linux kernel we start counting I2C from 1, thus we have i2c-1 (bus_id=1), i2c-2 (bus_id=2), i2c-3 (bus_id=3), i2c-4 (bus_id=4). While in TRM/datahseet we start I2C from 0, this we have i2c0, i2c1, i2c2 and i2c3.
So i2c-2 in linux kernel correspond to bus_id 2, i2c1 in datasheet (0x4802A000) and pins i2c1_scl/i2c1_sda.
So the i2c.c should be:
void __init omap2_i2c_mux_pins(int bus_id)
{
char mux_name[100];
/* First I2C bus is not muxable */
if (bus_id == 1)
return;
if (cpu_is_ti814x() && bus_id == 3) {
sprintf(mux_name, "uart0_dcdn.i2c2_scl_mux0");
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
sprintf(mux_name, "uart0_dsrn.i2c2_sda_mux0");
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
}
else if (cpu_is_ti814x() && bus_id == 2) {
sprintf(mux_name, "i2c1_scl");
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
sprintf(mux_name, "i2c1_sda");
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
}
else {
sprintf(mux_name, "i2c%i_scl.i2c%i_scl", bus_id, bus_id);
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
sprintf(mux_name, "i2c%i_sda.i2c%i_sda", bus_id, bus_id);
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
}
}
And we should modify also linux-kernel/arch/arm/mach-omap2/devices.c file, where HDMI signals are set on these pins:
/*HDMI I2C scl and I2C sda Function 2*/
/*omap_mux_init_signal("hdmi_ddc_scl_mux0",
TI814X_PULL_UP | TI814X_INPUT_EN);
omap_mux_init_signal("hdmi_ddc_sda_mux0",
TI814X_PULL_UP | TI814X_INPUT_EN);*/
omap_mux_init_signal("hdmi_cec_mux0",
TI814X_PULL_UP | TI814X_INPUT_EN);
omap_mux_init_signal("hdmi_hpd_mux0",
TI814X_INPUT_EN);
/*I2C2 configuration functon 6*/
omap_mux_init_signal("i2c2_scl_mux0",
TI814X_PULL_UP | TI814X_INPUT_EN);
omap_mux_init_signal("i2c2_sda_mux0",
TI814X_PULL_UP | TI814X_INPUT_EN);
omap_mux_init_signal("i2c1_scl",
TI814X_PULL_UP | TI814X_INPUT_EN);
omap_mux_init_signal("i2c1_sda",
TI814X_PULL_UP | TI814X_INPUT_EN);
Best regards,
Pavel
Bob,
bob lee said:Do you know why ?Is it related to the clock?
It might be. Have you enabled I2C1 (i2c-2) clock in the CM_ALWON_I2C_1_CLKCTRL/0x48181568 register?
BR
Pavel
Bob,
bob lee said:During the boot up ,we can see the I2C clock is 100kHz.But we want the clock more higher.
Do you tell me where to change the i2c clock?
I think we move away from the initial question, which was "How to add i2c2 to kernel". Could you open new e2e thread regarding your new questions.
BR
Pavel