* [BUG] cannot access IO ports in CMI8738 sound chip.
@ 2008-01-21 6:25 Katsuya MATSUBARA
2008-01-21 6:41 ` Paul Mundt
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Katsuya MATSUBARA @ 2008-01-21 6:25 UTC (permalink / raw)
To: linux-sh
Hi all,
I am writing a code to use a CMI8738 sound chip, which is
widely used on Intel x86. I am using such a chip through
a PCI slot on R2D-PLUS.
The CMI8738 has IO ports. The pci_resource_start() gives
an IO port number (0x4000), however, this number cannot be
used for IO accessing by in*()/out*().
I found a patch for fixing PCI IO port accessing in some SH7780
platforms and then submitted a similar patch for RTS7751R2D;
http://www.spinics.net/lists/linux-sh/msg00254.html
In my understanding, these patch substitute memory addresses
for IO port numbers. Is it correct?
Unfortunately CMI8738 cannot treat (large) memory addresses
as IO port numers because some upper bits of 'Base Address
Register 0' in the PCI configuration space cannot be updated.
(pcibios_setup_bars() in arch/sh/drivers/pci/pci-auto.c
updates the register with the memory address.)
How should I fix the problem?
---
Katsuya Matsubara
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [BUG] cannot access IO ports in CMI8738 sound chip.
2008-01-21 6:25 [BUG] cannot access IO ports in CMI8738 sound chip Katsuya MATSUBARA
@ 2008-01-21 6:41 ` Paul Mundt
2008-01-21 7:39 ` Katsuya MATSUBARA
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Paul Mundt @ 2008-01-21 6:41 UTC (permalink / raw)
To: linux-sh
On Mon, Jan 21, 2008 at 03:25:50PM +0900, Katsuya MATSUBARA wrote:
> Unfortunately CMI8738 cannot treat (large) memory addresses
> as IO port numers because some upper bits of 'Base Address
> Register 0' in the PCI configuration space cannot be updated.
> (pcibios_setup_bars() in arch/sh/drivers/pci/pci-auto.c
> updates the register with the memory address.)
>
> How should I fix the problem?
Disable PCI_AUTO_UPDATE_RESOURCES like the dreamcast does?
It's a reasonable workaround for PCI-like host controllers that don't
"quite" comply with the PCI specification.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [BUG] cannot access IO ports in CMI8738 sound chip.
2008-01-21 6:25 [BUG] cannot access IO ports in CMI8738 sound chip Katsuya MATSUBARA
2008-01-21 6:41 ` Paul Mundt
@ 2008-01-21 7:39 ` Katsuya MATSUBARA
2008-01-21 7:52 ` Paul Mundt
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Katsuya MATSUBARA @ 2008-01-21 7:39 UTC (permalink / raw)
To: linux-sh
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1254", Size: 8940 bytes --]
Hi Paul,
From: Paul Mundt <lethal@linux-sh.org>
Date: Mon, 21 Jan 2008 15:41:57 +0900
> On Mon, Jan 21, 2008 at 03:25:50PM +0900, Katsuya MATSUBARA wrote:
> > Unfortunately CMI8738 cannot treat (large) memory addresses
> > as IO port numers because some upper bits of 'Base Address
> > Register 0' in the PCI configuration space cannot be updated.
> > (pcibios_setup_bars() in arch/sh/drivers/pci/pci-auto.c
> > updates the register with the memory address.)
> >
> > How should I fix the problem?
>
> Disable PCI_AUTO_UPDATE_RESOURCES like the dreamcast does?
I did it.
Any PCI devices, include an ethernet, cannot be accessed
if PCI_AUTO_UPDATE_RESOURCES is disabled.
[ 0.000000] Linux version 2.6.23.14 (matsu@sh4master) (gcc version 4.2-SH4-LINUX_v0701) #2 PREEMPT Mon Jan 21 16:28:00 JST 2008
[ 0.000000] console [sercon0] enabled
[ 0.000000] Booting machvec: RTS7751R2D
[ 0.000000] Renesas Technology Sales RTS7751R2D support.
[ 0.000000] FPGA version:1 (revision:0)
[ 0.000000] Node 0: start_pfn = 0xc000, low = 0x10000
[ 0.000000] Zone PFN ranges:
[ 0.000000] Normal 49152 -> 65536
[ 0.000000] Movable zone start PFN for each node
[ 0.000000] early_node_map[1] active PFN ranges
[ 0.000000] 0: 49152 -> 65536
[ 0.000000] Built 1 zonelists in Zone order. Total pages: 16256
[ 0.000000] Kernel command line: console=tty0 console=ttySC0,115200 root=/dev/nfs ip=bootp earlyprintk=serial
[ 0.000000] VoyagerGX configured at 0xb3e00000 on irq 4(mapped into 50 to 81)
[ 0.000000] PID hash table entries: 256 (order: 8, 1024 bytes)
[ 0.000000] Using tmu for system timer
[ 0.004086] Using 15.000 MHz high precision timer.
[ 0.009487] Console: colour dummy device 80x25
[ 0.014324] console [tty0] enabled
[ 0.000000] Linux version 2.6.23.14 (matsu@sh4master) (gcc version 4.2-SH4-LINUX_v0701) #2 PREEMPT Mon Jan 21 16:28:00 JST 2008
[ 0.000000] console [sercon0] enabled
[ 0.000000] Booting machvec: RTS7751R2D
[ 0.000000] Renesas Technology Sales RTS7751R2D support.
[ 0.000000] FPGA version:1 (revision:0)
[ 0.000000] Node 0: start_pfn = 0xc000, low = 0x10000
[ 0.000000] Zone PFN ranges:
[ 0.000000] Normal 49152 -> 65536
[ 0.000000] Movable zone start PFN for each node
[ 0.000000] early_node_map[1] active PFN ranges
[ 0.000000] 0: 49152 -> 65536
[ 0.000000] Built 1 zonelists in Zone order. Total pages: 16256
[ 0.000000] Kernel command line: console=tty0 console=ttySC0,115200 root=/dev/nfs ip=bootp earlyprintk=serial
[ 0.000000] VoyagerGX configured at 0xb3e00000 on irq 4(mapped into 50 to 81)
[ 0.000000] PID hash table entries: 256 (order: 8, 1024 bytes)
[ 0.000000] Using tmu for system timer
[ 0.004086] Using 15.000 MHz high precision timer.
[ 0.009487] Console: colour dummy device 80x25
[ 0.014324] console [tty0] enabled
[ 0.124666] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.132573] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.146738] Memory: 62464k/65536k available (1641k kernel code, 574k data, 88k init)
[ 0.155237] PVR\x04050005 CVR 480000 PRR\0000113
[ 0.160474] I-cache : n_ways=2 n_sets%6 way_incr92
[ 0.166184] I-cache : entry_mask=0x00001fe0 alias_mask=0x00001000 n_aliases=2
[ 0.173968] D-cache : n_ways=2 n_setsQ2 way_incr\x16384
[ 0.179772] D-cache : entry_mask=0x00003fe0 alias_mask=0x00003000 n_aliases=4
[ 0.271376] Mount-cache hash table entries: 512
[ 0.277227] CPU: SH7751R
[ 0.282806] NET: Registered protocol family 16
[ 0.299833] SCSI subsystem initialized
[ 0.305614] Autoconfig PCI channel 0x8c22001c
[ 0.310461] Scanning bus 00, I/O 0xfe240000:0xfe280000, Mem 0xfd000000:0xfe000000
[ 0.318774] 00:00.0 Class 0401: 13f6:0111 (rev 10)
[ 0.324051] I/O at 0xfe240000 [size=0x100]
[ 0.329356] 00:01.0 Class 0200: 10ec:8139 (rev 10)
[ 0.334619] I/O at 0xfe240100 [size=0x100]
[ 0.339911] Mem at 0xfd000000 [size=0x100]
[ 0.345214] 00:02.0 Class 0607: 104c:ac55 (rev 01)
[ 0.350470] CARDBUS Bridge: primary\0, secondary\x01
[ 0.356192] PCI Autoconfig: Found CardBus bridge, device 2 function 0
[ 0.363240] Mem at 0xfd001000 [size=0x1000]
[ 0.368611] Scanning sub bus 01, I/O 0xfe240200, Mem 0xfd002000
[ 0.375162] Back to bus 00, sub_bus is 1
[ 0.379501] 00:02.1 Class 0607: 104c:ac55 (rev 01)
[ 0.384758] CARDBUS Bridge: primary\0, secondary\x02
[ 0.390480] PCI Autoconfig: Found CardBus bridge, device 2 function 1
[ 0.397526] Mem at 0xfd003000 [size=0x1000]
[ 0.402923] Scanning sub bus 02, I/O 0xfe240204, Mem 0xfd004000
[ 0.409474] Back to bus 00, sub_bus is 2
[ 0.413821] 00:03.0 Class 0200: 10ec:8139 (rev 10)
[ 0.419112] I/O at 0xfe240300 [size=0x100]
[ 0.424373] Mem at 0xfd005000 [size=0x100]
[ 0.434450] PCI: Using configuration type 1
[ 0.458393] Time: SuperH clocksource has been installed.
[ 0.464660] NET: Registered protocol family 2
[ 0.502443] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.510441] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.518379] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.525454] TCP: Hash tables configured (established 2048 bind 2048)
[ 0.532399] TCP reno registered
[ 0.553074] io scheduler noop registered
[ 0.557457] io scheduler anticipatory registered (default)
[ 0.563533] io scheduler deadline registered
[ 0.568309] io scheduler cfq registered
[ 0.573083] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[ 0.902813] Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
[ 0.935891] serial8250.0: ttyS0 at MMIO 0xb3e30000 (irq = 62) is a ST16654
[ 0.944849] SuperH SCI(F) driver initialized
[ 0.950185] sh-sci: ttySC0 at MMIO 0xffe80000 (irq = 43) is a scif
[ 0.957782] console handover: boot [sercon0] -> real [ttySC0]
[ 0.972391] RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
[ 0.979685] sm501 sm501: SM501 At b3e00000: Version 050100a0, 8 Mb, IRQ 32
[ 0.986054] sm501-fb[0] flags 00000200: 13e80000..13e8ffff
[ 0.991600] sm501-fb[1] flags 00000200: 13f00000..13f4ffff
[ 0.996929] sm501-fb[2] flags 00000200: 10000000..107fffff
[ 1.002383] sm501-fb[3] flags 00000400: 00000020..00000020
[ 1.008469] sm501-fb sm501-fb: using default configuration data
[ 1.013811] sm501-fb sm501-fb: fb sm501fb-crt disabled at start
[ 1.019721] sm501 sm501: gate 00021987, clock 2a090a09, mode 00000001
[ 1.044299] sm501-fb sm501-fb: fb sm501fb-panel disabled at start
[ 1.049684] sm501 sm501: gate 00021987, clock 09090a09, mode 00000000
[ 1.103343] sm501 sm501: gate 00021987, clock 09090a09, mode 00000001
[ 1.131911] Console: switching to colour frame buffer device 80x25
[ 1.167224] sm501-fb sm501-fb: fb0: sm501fb-crt frame buffer device
[ 1.179274] sm501-fb sm501-fb: fb1: sm501fb-panel frame buffer device
[ 1.193215] 8139too Fast Ethernet driver 0.9.28
[ 1.203222] PCI: Device 0000:00:01.0 not available because of resource collisions
[ 1.222452] Trying to free nonexistent resource <0000000000002000-00000000000020ff>
[ 1.242071] Trying to free nonexistent resource <0000000000000000-00000000000000ff>
[ 1.261898] 8139too: probe of 0000:00:01.0 failed with error -22
[ 1.274109] PCI: Device 0000:00:03.0 not available because of resource collisions
[ 1.295385] Trying to free nonexistent resource <0000000000000000-00000000000000ff>
[ 1.317670] Trying to free nonexistent resource <0000000000000000-00000000000000ff>
[ 1.340581] 8139too: probe of 0000:00:03.0 failed with error -22
[ 1.355876] scsi0 : pata_platform
[ 1.367483] ata1: PATA max PIO0 cmd 0xb4001000 ctl 0xb400080c bmdma 0x00000000 irq 1
[ 1.558327] sh-rtc sh-rtc: rtc core: registered sh as rtc0
[ 1.572290] heartbeat: version 0.1.0 loaded
[ 1.584803] oprofile: using timer interrupt.
[ 1.596925] TCP cubic registered
[ 1.607571] NET: Registered protocol family 1
[ 1.619138] NET: Registered protocol family 17
[ 1.631201] sh-rtc sh-rtc: invalid date
[ 1.641633] sh-rtc sh-rtc: hctosys: invalid date/time
[ 2.153025] IP-Config: No network devices available.
[ 2.164942] Root-NFS: No NFS server available, giving up.
[ 2.176653] VFS: Unable to mount root fs via NFS, trying floppy.
[ 2.189462] VFS: Cannot open root device "nfs" or unknown-block(2,0)
[ 2.201886] Please append a correct "root=" boot option; here are the available partitions:
[ 2.222794] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
---
Katsuya Matsubara
-
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [BUG] cannot access IO ports in CMI8738 sound chip.
2008-01-21 6:25 [BUG] cannot access IO ports in CMI8738 sound chip Katsuya MATSUBARA
2008-01-21 6:41 ` Paul Mundt
2008-01-21 7:39 ` Katsuya MATSUBARA
@ 2008-01-21 7:52 ` Paul Mundt
2008-01-21 8:04 ` Katsuya MATSUBARA
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Paul Mundt @ 2008-01-21 7:52 UTC (permalink / raw)
To: linux-sh
On Mon, Jan 21, 2008 at 04:39:04PM +0900, Katsuya MATSUBARA wrote:
> > On Mon, Jan 21, 2008 at 03:25:50PM +0900, Katsuya MATSUBARA wrote:
> > > Unfortunately CMI8738 cannot treat (large) memory addresses
> > > as IO port numers because some upper bits of 'Base Address
> > > Register 0' in the PCI configuration space cannot be updated.
> > > (pcibios_setup_bars() in arch/sh/drivers/pci/pci-auto.c
> > > updates the register with the memory address.)
> > >
> > > How should I fix the problem?
> >
> > Disable PCI_AUTO_UPDATE_RESOURCES like the dreamcast does?
>
> I did it.
> Any PCI devices, include an ethernet, cannot be accessed
> if PCI_AUTO_UPDATE_RESOURCES is disabled.
>
And with pci-auto disabled?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [BUG] cannot access IO ports in CMI8738 sound chip.
2008-01-21 6:25 [BUG] cannot access IO ports in CMI8738 sound chip Katsuya MATSUBARA
` (2 preceding siblings ...)
2008-01-21 7:52 ` Paul Mundt
@ 2008-01-21 8:04 ` Katsuya MATSUBARA
2008-01-21 8:35 ` Paul Mundt
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Katsuya MATSUBARA @ 2008-01-21 8:04 UTC (permalink / raw)
To: linux-sh
From: Paul Mundt <lethal@linux-sh.org>
Date: Mon, 21 Jan 2008 16:52:41 +0900
> On Mon, Jan 21, 2008 at 04:39:04PM +0900, Katsuya MATSUBARA wrote:
> > > On Mon, Jan 21, 2008 at 03:25:50PM +0900, Katsuya MATSUBARA wrote:
> > > > Unfortunately CMI8738 cannot treat (large) memory addresses
> > > > as IO port numers because some upper bits of 'Base Address
> > > > Register 0' in the PCI configuration space cannot be updated.
> > > > (pcibios_setup_bars() in arch/sh/drivers/pci/pci-auto.c
> > > > updates the register with the memory address.)
> > > >
> > > > How should I fix the problem?
> > >
> > > Disable PCI_AUTO_UPDATE_RESOURCES like the dreamcast does?
> >
> > I did it.
> > Any PCI devices, include an ethernet, cannot be accessed
> > if PCI_AUTO_UPDATE_RESOURCES is disabled.
> >
> And with pci-auto disabled?
Yes, I did. I got the same failure even if PCI_AUTO was disabled.
---
Katsuya Matsubara
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [BUG] cannot access IO ports in CMI8738 sound chip.
2008-01-21 6:25 [BUG] cannot access IO ports in CMI8738 sound chip Katsuya MATSUBARA
` (3 preceding siblings ...)
2008-01-21 8:04 ` Katsuya MATSUBARA
@ 2008-01-21 8:35 ` Paul Mundt
2008-01-21 9:18 ` Katsuya MATSUBARA
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Paul Mundt @ 2008-01-21 8:35 UTC (permalink / raw)
To: linux-sh
On Mon, Jan 21, 2008 at 05:04:20PM +0900, Katsuya MATSUBARA wrote:
> > On Mon, Jan 21, 2008 at 04:39:04PM +0900, Katsuya MATSUBARA wrote:
> > > > On Mon, Jan 21, 2008 at 03:25:50PM +0900, Katsuya MATSUBARA wrote:
> > > > > Unfortunately CMI8738 cannot treat (large) memory addresses
> > > > > as IO port numers because some upper bits of 'Base Address
> > > > > Register 0' in the PCI configuration space cannot be updated.
> > > > > (pcibios_setup_bars() in arch/sh/drivers/pci/pci-auto.c
> > > > > updates the register with the memory address.)
> > > > >
> > > > > How should I fix the problem?
> > > >
> > > > Disable PCI_AUTO_UPDATE_RESOURCES like the dreamcast does?
> > >
> > > I did it.
> > > Any PCI devices, include an ethernet, cannot be accessed
> > > if PCI_AUTO_UPDATE_RESOURCES is disabled.
> > >
> > And with pci-auto disabled?
>
> Yes, I did. I got the same failure even if PCI_AUTO was disabled.
The driver itself looks a bit questionable. There's a
pci_resource_start() for that BAR that assigns it to ->iobase and then
uses that for direct I/O without a remap. Whether this BAR is an I/O or
MEM bar, the remap is still necessary. So this does need to go through
something like pci_iomap() regardless.
If you need to do special handling for your pci_iomap() implementation,
that's perfectly acceptable, and a number of platforms do something like
that already. We definitely don't want to overload the I/O routines to
work around driver incompetence, though. Please fix the driver.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [BUG] cannot access IO ports in CMI8738 sound chip.
2008-01-21 6:25 [BUG] cannot access IO ports in CMI8738 sound chip Katsuya MATSUBARA
` (4 preceding siblings ...)
2008-01-21 8:35 ` Paul Mundt
@ 2008-01-21 9:18 ` Katsuya MATSUBARA
2008-01-21 9:37 ` Paul Mundt
2008-01-30 5:27 ` Katsuya MATSUBARA
7 siblings, 0 replies; 9+ messages in thread
From: Katsuya MATSUBARA @ 2008-01-21 9:18 UTC (permalink / raw)
To: linux-sh
From: Paul Mundt <lethal@linux-sh.org>
Date: Mon, 21 Jan 2008 17:35:08 +0900
> On Mon, Jan 21, 2008 at 05:04:20PM +0900, Katsuya MATSUBARA wrote:
> > > On Mon, Jan 21, 2008 at 04:39:04PM +0900, Katsuya MATSUBARA wrote:
> > > > > On Mon, Jan 21, 2008 at 03:25:50PM +0900, Katsuya MATSUBARA wrote:
> > > > > > Unfortunately CMI8738 cannot treat (large) memory addresses
> > > > > > as IO port numers because some upper bits of 'Base Address
> > > > > > Register 0' in the PCI configuration space cannot be updated.
> > > > > > (pcibios_setup_bars() in arch/sh/drivers/pci/pci-auto.c
> > > > > > updates the register with the memory address.)
> > > > > >
> > > > > > How should I fix the problem?
> > > > >
> > > > > Disable PCI_AUTO_UPDATE_RESOURCES like the dreamcast does?
> > > >
> > > > I did it.
> > > > Any PCI devices, include an ethernet, cannot be accessed
> > > > if PCI_AUTO_UPDATE_RESOURCES is disabled.
> > > >
> > > And with pci-auto disabled?
> >
> > Yes, I did. I got the same failure even if PCI_AUTO was disabled.
>
> The driver itself looks a bit questionable. There's a
> pci_resource_start() for that BAR that assigns it to ->iobase and then
> uses that for direct I/O without a remap. Whether this BAR is an I/O or
> MEM bar, the remap is still necessary. So this does need to go through
> something like pci_iomap() regardless.
You mean I should use pci_iomap() in my code?
I use it already in my CMI8738 driver code:
...
pci_enable_device(dev);
pci_request_regions(dev, "CMI8738");
iobase = pci_iomap(dev, 0, 0);
...
In the current kernel, pci_enable_device() get an errror
with the following message;
"PCI: Device .. not available because of resource collisions."
pcibios_enable_device() in arch/sh/drivers/pci/pci.c shows
the message if dev->resource[]->start is 0.
In the case of my CMI8738 driver code, the failure of
updating the BAR causes the condition.
---
Katsuya Matsubara
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [BUG] cannot access IO ports in CMI8738 sound chip.
2008-01-21 6:25 [BUG] cannot access IO ports in CMI8738 sound chip Katsuya MATSUBARA
` (5 preceding siblings ...)
2008-01-21 9:18 ` Katsuya MATSUBARA
@ 2008-01-21 9:37 ` Paul Mundt
2008-01-30 5:27 ` Katsuya MATSUBARA
7 siblings, 0 replies; 9+ messages in thread
From: Paul Mundt @ 2008-01-21 9:37 UTC (permalink / raw)
To: linux-sh
On Mon, Jan 21, 2008 at 04:39:04PM +0900, Katsuya MATSUBARA wrote:
> [ 0.305614] Autoconfig PCI channel 0x8c22001c
> [ 0.310461] Scanning bus 00, I/O 0xfe240000:0xfe280000, Mem 0xfd000000:0xfe000000
> [ 0.318774] 00:00.0 Class 0401: 13f6:0111 (rev 10)
> [ 0.324051] I/O at 0xfe240000 [size=0x100]
> [ 0.329356] 00:01.0 Class 0200: 10ec:8139 (rev 10)
> [ 0.334619] I/O at 0xfe240100 [size=0x100]
> [ 0.339911] Mem at 0xfd000000 [size=0x100]
> [ 0.345214] 00:02.0 Class 0607: 104c:ac55 (rev 01)
> [ 0.350470] CARDBUS Bridge: primary\0, secondary\x01
> [ 0.356192] PCI Autoconfig: Found CardBus bridge, device 2 function 0
> [ 0.363240] Mem at 0xfd001000 [size=0x1000]
> [ 0.368611] Scanning sub bus 01, I/O 0xfe240200, Mem 0xfd002000
> [ 0.375162] Back to bus 00, sub_bus is 1
> [ 0.379501] 00:02.1 Class 0607: 104c:ac55 (rev 01)
> [ 0.384758] CARDBUS Bridge: primary\0, secondary\x02
> [ 0.390480] PCI Autoconfig: Found CardBus bridge, device 2 function 1
> [ 0.397526] Mem at 0xfd003000 [size=0x1000]
> [ 0.402923] Scanning sub bus 02, I/O 0xfe240204, Mem 0xfd004000
> [ 0.409474] Back to bus 00, sub_bus is 2
> [ 0.413821] 00:03.0 Class 0200: 10ec:8139 (rev 10)
> [ 0.419112] I/O at 0xfe240300 [size=0x100]
> [ 0.424373] Mem at 0xfd005000 [size=0x100]
[snip]
> [ 1.203222] PCI: Device 0000:00:01.0 not available because of resource collisions
> [ 1.222452] Trying to free nonexistent resource <0000000000002000-00000000000020ff>
> [ 1.242071] Trying to free nonexistent resource <0000000000000000-00000000000000ff>
> [ 1.261898] 8139too: probe of 0000:00:01.0 failed with error -22
> [ 1.274109] PCI: Device 0000:00:03.0 not available because of resource collisions
> [ 1.295385] Trying to free nonexistent resource <0000000000000000-00000000000000ff>
> [ 1.317670] Trying to free nonexistent resource <0000000000000000-00000000000000ff>
> [ 1.340581] 8139too: probe of 0000:00:03.0 failed with error -22
On Mon, Jan 21, 2008 at 06:18:16PM +0900, Katsuya MATSUBARA wrote:
> In the current kernel, pci_enable_device() get an errror
> with the following message;
>
> "PCI: Device .. not available because of resource collisions."
>
> pcibios_enable_device() in arch/sh/drivers/pci/pci.c shows
> the message if dev->resource[]->start is 0.
> In the case of my CMI8738 driver code, the failure of
> updating the BAR causes the condition.
Apparently we're having a bit of a miscommunication. Either the BAR
values are sane or they aren't. If the initial BAR values that are
reported in that scan are sane, then you can disable the BAR update like
the Dreamcast does, and pass the existing values down.
If you can handle the BARs being updated, then you should not enable
this, and you should let pci-auto find sane mappings for you. If you have
to have fixed BARs, then you need to make sure your board specific fixup
code does the right thing when doing device fixups. Presently this is not
implemented for R2D, as it was assumed that we could update the BAR
values in a reasonable fashion.
Regardless, your driver always has to use pci_iomap() for getting at the
BAR itself. sound/pci/cmipci.c presently does not. Your board-specific
I/O base change seems to be specifically to compensate for the fact that
a driver hasn't performed a remap on the resource start.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [BUG] cannot access IO ports in CMI8738 sound chip.
2008-01-21 6:25 [BUG] cannot access IO ports in CMI8738 sound chip Katsuya MATSUBARA
` (6 preceding siblings ...)
2008-01-21 9:37 ` Paul Mundt
@ 2008-01-30 5:27 ` Katsuya MATSUBARA
7 siblings, 0 replies; 9+ messages in thread
From: Katsuya MATSUBARA @ 2008-01-30 5:27 UTC (permalink / raw)
To: linux-sh
Hi Paul,
From: Paul Mundt <lethal@linux-sh.org>
Date: Mon, 21 Jan 2008 18:37:03 +0900
> On Mon, Jan 21, 2008 at 04:39:04PM +0900, Katsuya MATSUBARA wrote:
> > [ 0.305614] Autoconfig PCI channel 0x8c22001c
> > [ 0.310461] Scanning bus 00, I/O 0xfe240000:0xfe280000, Mem 0xfd000000:0xfe000000
> > [ 0.318774] 00:00.0 Class 0401: 13f6:0111 (rev 10)
> > [ 0.324051] I/O at 0xfe240000 [size=0x100]
> > [ 0.329356] 00:01.0 Class 0200: 10ec:8139 (rev 10)
> > [ 0.334619] I/O at 0xfe240100 [size=0x100]
> > [ 0.339911] Mem at 0xfd000000 [size=0x100]
> > [ 0.345214] 00:02.0 Class 0607: 104c:ac55 (rev 01)
> > [ 0.350470] CARDBUS Bridge: primary\0, secondary\x01
> > [ 0.356192] PCI Autoconfig: Found CardBus bridge, device 2 function 0
> > [ 0.363240] Mem at 0xfd001000 [size=0x1000]
> > [ 0.368611] Scanning sub bus 01, I/O 0xfe240200, Mem 0xfd002000
> > [ 0.375162] Back to bus 00, sub_bus is 1
> > [ 0.379501] 00:02.1 Class 0607: 104c:ac55 (rev 01)
> > [ 0.384758] CARDBUS Bridge: primary\0, secondary\x02
> > [ 0.390480] PCI Autoconfig: Found CardBus bridge, device 2 function 1
> > [ 0.397526] Mem at 0xfd003000 [size=0x1000]
> > [ 0.402923] Scanning sub bus 02, I/O 0xfe240204, Mem 0xfd004000
> > [ 0.409474] Back to bus 00, sub_bus is 2
> > [ 0.413821] 00:03.0 Class 0200: 10ec:8139 (rev 10)
> > [ 0.419112] I/O at 0xfe240300 [size=0x100]
> > [ 0.424373] Mem at 0xfd005000 [size=0x100]
> [snip]
> > [ 1.203222] PCI: Device 0000:00:01.0 not available because of resource collisions
> > [ 1.222452] Trying to free nonexistent resource <0000000000002000-00000000000020ff>
> > [ 1.242071] Trying to free nonexistent resource <0000000000000000-00000000000000ff>
> > [ 1.261898] 8139too: probe of 0000:00:01.0 failed with error -22
> > [ 1.274109] PCI: Device 0000:00:03.0 not available because of resource collisions
> > [ 1.295385] Trying to free nonexistent resource <0000000000000000-00000000000000ff>
> > [ 1.317670] Trying to free nonexistent resource <0000000000000000-00000000000000ff>
> > [ 1.340581] 8139too: probe of 0000:00:03.0 failed with error -22
>
> On Mon, Jan 21, 2008 at 06:18:16PM +0900, Katsuya MATSUBARA wrote:
> > In the current kernel, pci_enable_device() get an errror
> > with the following message;
> >
> > "PCI: Device .. not available because of resource collisions."
> >
> > pcibios_enable_device() in arch/sh/drivers/pci/pci.c shows
> > the message if dev->resource[]->start is 0.
> > In the case of my CMI8738 driver code, the failure of
> > updating the BAR causes the condition.
>
> Apparently we're having a bit of a miscommunication.
I am sorry for the confusion.
> Either the BAR values are sane or they aren't. If the initial BAR
> values that are reported in that scan are sane, then you can disable
> the BAR update like the Dreamcast does, and pass the existing values
> down. If you can handle the BARs being updated, then you should not
> enable this, and you should let pci-auto find sane mappings for
> you. If you have to have fixed BARs, then you need to make sure your
> board specific fixup code does the right thing when doing device
> fixups. Presently this is not implemented for R2D, as it was assumed
> that we could update the BAR values in a reasonable fashion.
Thank you for the description.
I understood I could not disable PCI_AUTO_UPDATE_RESOURCES
for my case.
> Regardless, your driver always has to use pci_iomap() for getting at
> the BAR itself. sound/pci/cmipci.c presently does not. Your
> board-specific I/O base change seems to be specifically to
> compensate for the fact that a driver hasn't performed a remap on
> the resource start.
I see. My R2D I/O base change must be in a misguided way.
In my understanding, pci_iomap() output an address where
a device resouce is mmaped. But it seems to be that
the current pci_iomap() outout the BAR value without
any offsets even if the resource is io port.
Is it correct behavior?
---
Katsuya Matsubara
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-01-30 5:27 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-21 6:25 [BUG] cannot access IO ports in CMI8738 sound chip Katsuya MATSUBARA
2008-01-21 6:41 ` Paul Mundt
2008-01-21 7:39 ` Katsuya MATSUBARA
2008-01-21 7:52 ` Paul Mundt
2008-01-21 8:04 ` Katsuya MATSUBARA
2008-01-21 8:35 ` Paul Mundt
2008-01-21 9:18 ` Katsuya MATSUBARA
2008-01-21 9:37 ` Paul Mundt
2008-01-30 5:27 ` Katsuya MATSUBARA
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox