Problem with i2c-pcf-epp module
I am having a problem getting the i2c-pcf-epp module working.
As a quick first question:
How can I confirm that my parallel port is in EPP mode?
Where I am up to.
I have patched and complied the kernel (I'm using 2.4.20) but need some help.
A few facts about me so you may know how to respond.
1) I am not a computer programmer
2) I cannot program in C to save my life
3) I have built a parallel port to i2c adaptor circuit using a PCF8584 which I
have plugged into my notebook parallel port.
4) It isn't working and I am trying to find out why.
5) Any help would be greatly appreciated.
6) My biggest problem is I think I am getting a kernel oops every time
modprobe i2c-pcf-epp fails
I have attached part of my log with debuging on a the very bottom of this post. Please ignore all the extra rubbish in there, that's just me trying to figure out what is going on.
This is what I think the problem is (the kernel oops at any rate)
In i2c-pcf-epp.c there is a function:
int __init i2c_pcfepp_init(void)
under which is the block of code:
if (pcf_epp_init(pepp) = 0) {
int ret;
if ( (ret = i2c_pcf_add_bus(&pcf_epp_ops)) < 0) {
printk(KERN_WARNING "i2c_pcf_add_bus caused an error: %d\n",ret);
release_region(pepp->pe_base , 5);
return ret;
}
} else {
return -ENODEV; }
printk(KERN_DEBUG "i2c-pcf-epp.o: found device at %#x.\n", pepp->pe_base); return 0;
}
I think the problem relates to
release_region(pepp->pe_base , 5);
Under normal circumstances this is not a problem but if the i2c_pcf_add_bus fails you will get an oops if you have an irq assigned.
I have tried the following modification and it works (meaning I don't get the oops). Looking at it a bit more though I think that between the if ( (ret = i2c_pcf_add_bus(&pcf_epp_ops)) < 0) and the return ret should simply be a call to
cleanup_module()
Could someone look over this and acknowledge and patch if necessary please.
Example code that doesn't give the oops
if (pcf_epp_init(pepp) = 0) {
int ret;
if ( (ret = i2c_pcf_add_bus(&pcf_epp_ops)) < 0) {
printk(KERN_WARNING "i2c_pcf_add_bus caused an error: %d\n",ret);
if ( gpe.pe_irq > 0 ) {
disable_irq(gpe.pe_irq);
free_irq(gpe.pe_irq, &gpe);
}
release_region(pepp->pe_base , 5);
return ret;
}
} else {
return -ENODEV; }
printk(KERN_DEBUG "i2c-pcf-epp.o: found device at %#x.\n", pepp->pe_base); return 0;
}
Signature · 62 lines
Best Regards, David Price --------------------- Feb 12 14:42:10 c17008 kernel: i2c-algo-pcf.o: hw routines for PCF8584 EPP adapter registered. Feb 12 14:42:10 c17008 kernel: Registering th new adaptor pcf_algo.id 000 Feb 12 14:42:10 c17008 kernel: Just about to if ((i = pcf_init_8584(pcf_adap))) Feb 12 14:42:10 c17008 kernel: i2c-algo-pcf.o: pcf_init_8584 Feb 12 14:42:10 c17008 kernel: i2c-pcf-epp.o: Read control 0xff Feb 12 14:42:10 c17008 kernel: i2c-algo-pcf.o: PCF state 0xff Feb 12 14:42:10 c17008 kernel: i2c-pcf-epp.o: Write control 0x88 Feb 12 14:42:10 c17008 kernel: set_pcf(adap, 1, I2C_PCF_PIN� Feb 12 14:42:10 c17008 kernel: i2c-pcf-epp.o: Read control 0xff Feb 12 14:42:10 c17008 kernel: if (((temp = get_pcf(adap, 1)); temp� Feb 12 14:42:10 c17008 kernel: i2c-algo-pcf.o: PCF detection failed -- can't select S0 (0xff). Feb 12 14:42:10 c17008 kernel: pcf_init_8584(pcf_adap)�fffffa Feb 12 14:42:10 c17008 kernel: i2c-algo-pcf.o: pcf_init_8584 Feb 12 14:42:10 c17008 kernel: i2c-pcf-epp.o: Read control 0xff Feb 12 14:42:10 c17008 kernel: i2c-algo-pcf.o: PCF state 0xff Feb 12 14:42:10 c17008 kernel: i2c-pcf-epp.o: Write control 0x88 Feb 12 14:42:10 c17008 kernel: set_pcf(adap, 1, I2C_PCF_PIN� Feb 12 14:42:10 c17008 kernel: i2c-pcf-epp.o: Read control 0xff Feb 12 14:42:10 c17008 kernel: if (((temp = get_pcf(adap, 1)); temp� Feb 12 14:42:10 c17008 kernel: i2c-algo-pcf.o: PCF detection failed -- can't select S0 (0xff). Feb 12 14:42:10 c17008 kernel: about to return to i2c-pcf-epp i2c_pcfepp_init i�fffffa Feb 12 14:42:10 c17008 kernel: i2c_pcf_add_bus caused an error: -6 Feb 12 14:42:10 c17008 kernel: Just about to die &pepp->pr_base�960544 Feb 12 14:42:10 c17008 kernel: rest of value pepp->pr_base78 Feb 12 14:42:11 c17008 kernel: Unable to handle kernel paging request at virtual address e495fe3c Feb 12 14:42:11 c17008 kernel: printing eip: Feb 12 14:42:11 c17008 kernel: c023b482 Feb 12 14:42:11 c17008 kernel: *pde = 23fae067 Feb 12 14:42:11 c17008 kernel: *pte = 00000000 Feb 12 14:42:11 c17008 kernel: Oops: 0000 Feb 12 14:42:11 c17008 kernel: CPU: 0 Feb 12 14:42:11 c17008 kernel: EIP: 0010:[<c023b482>] Tainted: P Feb 12 14:42:11 c17008 kernel: EFLAGS: 00010297 Feb 12 14:42:11 c17008 kernel: eax: e495fe3c ebx: 0000000a ecx: e495fe3c edx: fffffffe Feb 12 14:42:11 c17008 kernel: esi: d5eb20de edi: 00000000 ebp: ffffffff esp: dcf3beac Feb 12 14:42:11 c17008 kernel: ds: 0018 es: 0018 ss: 0018 Feb 12 14:42:11 c17008 kernel: Process kdeinit (pid: 1321, stackpage�f3b000) Feb 12 14:42:11 c17008 kernel: Stack: dcf3bef0 ffffffff 0000000a 00000000 0000000a 0000000a 00000001 00000000 Feb 12 14:42:11 c17008 kernel: ffffffff ffffffff e1e7c580 d5eb20dc 00000007 c02e09e4 c023b657 d5eb20dc Feb 12 14:42:11 c17008 kernel: 2a14df24 c0267419 dcf3bf18 c023b67f d5eb20dc c0267416 dcf3bf14 c010a560 Feb 12 14:42:11 c17008 kernel: Call Trace: [<c023b657>] [<c023b67f>] [<c010a560>] [<c0161f33>] [<c015f4f1>] Feb 12 14:42:11 c17008 kernel: [<c013c3e3>] [<c01090ef>] Feb 12 14:42:11 c17008 kernel: Feb 12 14:42:11 c17008 kernel: Code: 80 38 00 74 07 40 4a 83 fa ff 75 f4 29 c8 83 e7 10 89 c3 75