Commit graph

249 commits

Author SHA1 Message Date
Paul Mundt 3b0be1a4f2 sh: Fix an off-by-1 in SH7780 PCIC memory resource mapping.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-05 16:11:25 +09:00
Paul Mundt 9ad62ec4f7 sh: Fix up early PCI PERR/SERR IRQ handling.
This adds support for handling early PERR/SERR triggering in between
controller registration and the initial bus scan. Buggy cards end up
asserting these as soon as the M66EN scan is undertaken, resulting in
an early crash.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-03 16:46:20 +09:00
Paul Mundt b6c58b1d98 sh: Improved multi-resource handling for SH7780 PCI.
The SH7780 PCI controller supports 3 different ranges of PCI memory in
addition to its PCI I/O window. In the case of 29-bit mode, only 2 memory
windows are supported, while in 32-bit mode all 3 are visible. This
attempts to make the resource handling completely dynamic and to permit
platforms to map in as many apertures as they can handle.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-01 20:01:50 +09:00
Paul Mundt ef407beefb sh: Hook up ERR/PERR/SERR detection for SH7780 PCI host controllers.
These were never handled before, so implement some common infrastructure
to support them, then make use of that in the SH7780-specific code. In
practice there is little here that can not be generalized for SH4 parts,
which will be an incremental change as the 7780/7751 code is gradually
unified.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-01 16:39:46 +09:00
Paul Mundt bcf39352eb sh: Handle PCI controller resource conflicts.
register_pci_controller() can fail, but presently is a void function.
Change this over to an int so that we can bail early before continuing on
with post-registration initialization (such as throwing the controller in
to 66MHz mode in the case of the SH7780 host controller).

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-01 13:11:25 +09:00
Paul Mundt 85b59f5bb2 sh: Enable PCI66 support for SH7780 host controller.
This adds some helper glue for scanning the bus and determining if all
of the devices are 66MHz capable or not before flipping on 66MHz mode.
This isn't quite to spec, but it's fairly consistent with what other
embedded controllers end up having to do.

Scanning code cribbed from the MIPS txx9 PCI code.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-01 13:01:42 +09:00
Paul Mundt aee4467b5c sh: Fix up large system memory handling for SH7780 PCI.
For systems that have more than 512MB we need to set up an additional
mapping, this fixes up the rounding to the next power of two and splits
out the mapping accordingly between the two local bus mapping windows.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-01 11:33:22 +09:00
Paul Mundt 396c56a9c6 sh: Kill off broken type 1 PCI config access checks.
The host controllers only support type 1, so there's not much else to
test for. Some of the older controllers also supported type 2 accesses,
but we've never supported those, and likely never will. Beyond that, the
P1SEG test is meaningless for 32-bit mode, so rather than refactoring it,
just kill the type 1 test off completely.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-30 01:41:21 +09:00
Paul Mundt 320e68da59 sh: support PCI domains.
Newer SH parts are now commonly shipping with multiple controllers, so
we wire up PCI domain support to deal with them. Shamelessly cloned from
the MIPS implementation.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-29 22:38:13 +09:00
Paul Mundt ac8ab54a8e sh: Bail out early on PCI resource conflicts.
Presently we just call in to request_resource() for the ioport and iomem
resources without checking for errors. This has already hidden a couple
of bugs, so add some error handling in for good measure.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-29 22:22:27 +09:00
Paul Mundt a45635dfb0 sh: Reworked SH7780 PCI initialization.
This consolidates the PCI initialization code for all of the pci-sh7780
users, and sets up the memory window dynamically as opposed to using
hardcoded window positions.

A number of bugs were fixed at the same time, including the PIO handling
and master abort timeout settings being incorrect.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-29 22:19:04 +09:00
Paul Mundt 849593591c sh: Fix up read-only variable assignment in pcibios_align_resource().
arch/sh/drivers/pci/pci.c:167: error: assignment of read-only location '*res'

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-28 18:15:05 +09:00
Paul Mundt 9d56dd3b08 sh: Mass ctrl_in/outX to __raw_read/writeX conversion.
The old ctrl in/out routines are non-portable and unsuitable for
cross-platform use. While drivers/sh has already been sanitized, there
is still quite a lot of code that is not. This converts the arch/sh/ bits
over, which permits us to flag the routines as deprecated whilst still
building with -Werror for the architecture code, and to ensure that
future users are not added.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-26 12:58:40 +09:00
Paul Mundt 7dcaa8e8e6 sh: Generalize SH7786 PCIe support.
Previously this was only built in for Urquell boards, but the same
approach can be used on SDK7786 now that the mode pin reading is
supported, so make it generic to SH7786.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-15 19:13:56 +09:00
Paul Mundt 10ab92d8c3 sh: heartbeat: Support access size specification via resource flags.
This permits the resource access size to be handed off through the
resource flags, which saves platforms from having to establish
platform data only to specify the register width.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-15 12:08:31 +09:00
Sam Ravnborg 3252b11fc4 sh: move machtypes.h to include/generated
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2009-12-12 13:08:14 +01:00
Paul Mundt 1dca899e95 sh: dma: Kill off bogus dma_sysclass symbol export.
This is a static symbol, so the export is wholly superfluous. Recent
kbuild updates flagged this as an error, resulting in build failure,
so this tidies that up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-13 12:29:19 +09:00
Paul Mundt 7693465d81 sh: Kill off superfluous arch/sh/drivers/pci/Kconfig.
Now that this contains a grand total of 1 Kconfig option, it's hardly
worth keeping split out. Roll CONFIG_PCI back in to the top-level
architecture Kconfig, along with the other bus types.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-27 10:36:55 +09:00
Paul Mundt 01be5d63fd sh: Revamp PCI DMA coherence Kconfig bits.
Leaving this configurable caused more trouble than it was ever worth, so
just make it explicit. Boards that are verified one way or the other can
fix up their selects accordingly. We presently default to non-coherent
for most platforms.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-27 10:35:02 +09:00
NeilBrown 4b3df5668c Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx into for-linus 2009-09-23 18:31:11 +10:00
Nobuhiro Iwamatsu d8902adcc1 dmaengine: sh: Add Support SuperH DMA Engine driver
This supported all DMA channels, and it was tested in SH7722,
SH7780, SH7785 and SH7763.
This can not use with SH DMA API.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Reviewed-by: Matt Fleming <matt@console-pimps.org>
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-09-08 17:56:02 -07:00
David McKay 15444a8973 sh: Allow use of GENERIC_IOMAP
The synopsys PCI cell used in the later STMicro chips requires code to
be run in order to do IO cycles, rather than just memory mapping the IO
space. Rather than extending the existing SH infrastructure to allow
this, use the GENERIC_IOMAP implmentation to save re-inventing the
wheel.

This set of changes allows the SH to be built with GENERIC_IOMAP
enabled, it just ifdef's out the functions provided by the GENERIC_IOMAP
implementation, and provides a few required missing functions.

Signed-off-by: David McKay <david.mckay@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 16:10:40 +09:00
Kuninori Morimoto 24d76195d1 sh: Add SH7724 support to NR_ONCHIP_DMA_CHANNELS
This patch also update help comment

Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-19 19:28:40 +09:00
Kuninori Morimoto e174d13010 sh: Prevent heartbeat from scribbling over non-LED bits.
While most platforms implement LED banks in sets of 8/16/32, some use
different configurations. This adds a LED mask to the heartbeat platform
data to allow platforms to constrain the bitmap, which is otherwise
derived from the register size.

Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-18 21:16:29 +09:00
Paul Mundt 5713e60210 sh: pci: Initial PCI-Express support for SH7786 Urquell board.
This adds initial support for the PCI-Express module in the SH7786,
particularly as it relates to the urquell platform. Presently it is
only supported in root complex mode, with endpoint mode still requiring
more debugging. 29/32-bit mode and lane configurations are selectable via
board mode pins, and are otherwise fixed.

Only 4x and 1x PCI channels are presently handled, the PCI bridge still
requires additional debugging and stabilization in hardware.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-17 18:20:48 +09:00
Paul Mundt 66765fe1b6 sh: pci: SH7786 PCI ops.
This adds in preliminary support for the SH7786 PCIe module PCI ops,
and the corresponding module definitions.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-16 06:26:08 +09:00
Paul Mundt 8c6b44d00a sh: pci: Allow register_pci_controller() to handle overlapping regions.
Some host controllers (such as SH7786) have overlapping regions that are
fixed in hardware. The resource allocator does the right thing in
managing this space already, so the conflict case is non-fatal.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-16 06:01:58 +09:00
Huang Weiyi 78c99ba1b1 sh: pci: remove duplicated #include's
Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-14 17:48:43 +09:00
Paul Mundt 5582b0648d sh: pci-sh7780: Fix up for PCI_DISABLE_MWI changes.
This fixes a build error where references to pci_cache_line_size are
undefined, as this ceases to be exported when PCI_DISABLE_MWI is enabled,
as is now the default.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-27 00:12:58 +09:00
Paul Mundt d076d2bd0d sh: pci-sh7751: Initialize io_map_base in controller definition.
As there is only a single controller and remapping has no impact for the
address range in question, just initialize it directly in the controller
definition. This fixes up boot time warnings about not having the field
initialized.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-26 23:10:15 +09:00
Magnus Damm 3d6ad46021 sh: multiple vectors per irq - sh7760
Update intc tables and platform data to use one linux irq
per maskable interrupt source instead of keeping the one-to-one
mapping between vectors and linux irqs.

This fixes potential irq masking issues for sh7760 hardware
blocks such as DMAC/TMU2/REF.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-11 21:59:58 +09:00
Paul Mundt 0fb849b9d7 sh: Integrate the SH-5 onchip_remap() more coherently.
Presently this is special-cased for early initialization. While there are
situations where these static early initializations are still necessary,
with minor changes it is possible to use this for the regular ioremap
implementation as well. This allows us to kill off the special-casing for
the remap completely and to start tidying up all of the SH-5
special-casing in drivers.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-07 18:10:27 +09:00
Paul Mundt cf242007a1 sh: pci: Rename pci-new.c to pci.c.
pci-new.c is now in a state to replace the old pci.c, rename it
accordingly.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 21:53:33 +09:00
Paul Mundt 35bcfffd86 sh: pci: Roll pci-lib in to pci-new.
Now that the pci-auto cruft is gone, pci-lib can go away.
Roll it back in to pci-new.c where it originally split off from.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 21:51:19 +09:00
Paul Mundt 805fcc8899 sh: pci: Kill off the last remnants of the now unused pci-auto code.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 21:46:42 +09:00
Paul Mundt 2d5efc190e sh: pci: Move the se7751 fixups in to arch/sh/drivers/pci/.
The se7751 was still doing the PCI fixups in its own board directory,
so we move it over to arch/sh/drivers/pci/ with the rest of the board
fixups. It has bitrotted significantly over the years, so will still
likely need a bit of work to bring back up to date.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 21:42:59 +09:00
Paul Mundt 951a681bda sh: pci: Convert dreamcast to new-style interface.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 21:34:36 +09:00
Paul Mundt 37c8ac361e sh: pci: Consolidate lboxre2 and r2d IRQ fixups.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 21:27:15 +09:00
Paul Mundt 84972ec0c2 sh: pci: Rename SH7751 platform ops files to fixups.
None of these contain pci_ops, only IRQ routing bits, rename them
accordingly.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 21:17:10 +09:00
Paul Mundt 757e3c16f8 sh: pci: Rewrite SH7751 PCI support to follow SH7780.
This follows the similar sort of scheme that the refactored SH7780 code
uses, using a 64MB CS3 mapping to handle the window0 case, and simply
discarding window1. This vastly simplifies the code, and allows most of
the board-specific setup to go die.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 21:11:07 +09:00
Paul Mundt a5b0804712 sh: pci: Rename ops-cayman -> fixups-cayman.
Now that ops-cayman.c only contains IRQ routing fixups, rename it.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 20:41:45 +09:00
Paul Mundt 48e4237d96 sh: pci: Convert the SH-5 code over to the new interface.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 20:40:48 +09:00
Paul Mundt 3444f5ec49 sh: pci: Tidy up the dreamcast PCI support.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 20:22:05 +09:00
Paul Mundt 0db38cea69 sh: pci: Kill off legacy ide quirks.
These fixups seem to have bitrotted a bit since their introduction in the
2.4 days. As we never had much use for them in the first place, and
nothing is using them any more, kill them off the rest of the way.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 19:54:47 +09:00
Paul Mundt 0e75148108 sh: pci: Consolidate pcibios_setup() in pci-lib.
This wasn't really being used for anything useful, so just stub it in
pci-lib.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 19:48:48 +09:00
Paul Mundt d556fcc101 sh: pci: Flag the dreamcast BBA as IORESOURCE_PCI_FIXED.
This isn't a real BAR, so prevent any attempts to move it, as we don't
wish to encourage a bus luck by overzealous PCI initialization code.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 19:31:20 +09:00
Paul Mundt bb3396477b sh: pci: Kill off superfluous lboxre2 pci fixups.
This is a verbatim copy of the r2d one, use that instead.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 19:26:45 +09:00
Paul Mundt 5ba7205fc4 sh: pci: Kill off the now unused hose->io_base.
Nothing is using this any more, so kill it off.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 19:00:32 +09:00
Paul Mundt 3f8daeacd7 sh: pci: Consolidate the remaining common bits.
This moves the remaining common bits in to pci-lib. Thereby reducing
pci.c/pci-new.c to simple bus fixups and controller registration.

As more platforms are moved over, the old code will disappear completely
and the pci-new bits will be rolled in to pci-lib, eventually replacing
pci.c completely.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 18:53:41 +09:00
Paul Mundt 5160d3f782 sh: pci: Consolidate bus<->resource mapping in pci-lib.
Now that the io and mem offsets are tracked accordingly, the pci-new
version of the bus<->resource mappers can be used generically. This
moves them in to pci-lib.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 18:47:21 +09:00
Paul Mundt 09cfeb133e sh: pci: Track io and mem_offset per-channel.
This implements a per-hose offset for I/O and mem resources.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 18:42:00 +09:00
Paul Mundt e79066a659 sh: pci: New-style controller registration.
This moves off of the board_pci_channels[] approach for bus registration
and over to a cleaner register_pci_controller(), all derived from the
MIPS code.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 18:29:22 +09:00
Paul Mundt 0bb34a6bf1 sh: pci: Consolidate pci_iomap() and use the generic I/O base.
This consolidates the pci_iomap() definitions and reworks how the I/O
port base is handled. PCI channels can register their own I/O map base,
or if none is provided, the system-wide generic I/O base is used instead.

Functionally nothing changes, while this allows us to kill off lots of
I/O address special casing and lookups.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 16:38:00 +09:00
Paul Mundt 394b6d2fe6 sh: pci: Kill off unused pcibios_fixup().
This is left over cruft that hasn't been used by anything in a long time,
kill off bits that weren't purged previously.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 16:18:46 +09:00
Paul Mundt a3c0e0d003 sh: pci: Consolidate pcibios_align_resource() definitions.
This introduces a saner pcibios_align_resource() that can be used
regardless of whether pci-auto or pci-new are being used, and
consolidates it in pci-lib.c.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 16:14:29 +09:00
Paul Mundt 9833385131 sh: pci: HAVE_PCI_MMAP support.
Derived from the MIPS version, now uses pgprot_noncached().

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 15:51:45 +09:00
Paul Mundt 4c5107e445 sh: pci: Split out new-style PCI core.
This splits off a 'pci-new.c' which is aimed at gradually replacing the
pci-auto backend and the arch/sh/drivers/pci/pci.c core respectively.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 15:43:36 +09:00
Paul Mundt 9ade1217c9 sh: pci: Drop asm-generic/pci.h, so we can use our own fixups.
The new PCI code wants its own bus<->resource mappings instead of the
generic equivalents, so drop the asm-generic include in preparation.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-20 15:38:25 +09:00
Paul Mundt 62c7ae87cb sh: pci: Start unifying the SH7780 PCIC initialization.
This starts moving out the common initialization bits from the various
fixup paths in to the shared init path.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-17 20:37:16 +09:00
Paul Mundt a6d377b696 sh: pci: Consolidate SH7780 PCIC IRQ routing.
Now that the platform code is a bit leaner, we can start consolidating
the various IRQ routing implementations. There are effectively only 2
variants, and the others can use those directly.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-17 20:11:44 +09:00
Paul Mundt 4c7a47de89 sh: pci: Kill off platform-specific multi-window mappings.
Commit 68b42d1b54 ("sh: sh7785lcr: Map
whole PCI address space.") changed around the semantics of how various
chip-selects are made accessible to PCI. Now that there is a single
large mapping covering from CS0-CS6, there is no longer any need to
do multi-window mapping. Subsequently, all of the differing
implementations can be consolidated in to pci-sh7780.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-17 17:21:36 +09:00
Paul Mundt ab1363a892 sh: pci: Consolidate PCI I/O and mem window definitions for SH7780.
This consolidates all of the PCI I/O and memory window definitions across
the pci-sh7780 users in pci-sh7780 itself. No functional changes, in that
every platform had exactly the same implementation.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-17 17:07:47 +09:00
Paul Mundt f1dcab7566 sh: pci: Set the I/O port base to the SH7780 I/O window default.
Presently the I/O port base isn't being set anywhere, which allows things
like generic_inl() to blow up. Fix this up to point at the PCI IO window.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-17 17:00:27 +09:00
Paul Mundt c66c1d79a9 sh: pci: Set pci_cache_line_size on SH7780 via the PCICLS register.
The SH7780 PCIC contains a read-only cache line size register that we can
derive pci_cache_line_size from. So, make sure that the software idea of
the cache line size actually matches the host controller's idea.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-17 16:38:00 +09:00
Paul Mundt ab78cbcf68 sh: pci: Use the proper write size for class/sub-class code.
Don't use pci_write_reg() for these, as it defaults to 32-bit. Rather
than using the helper, use __raw_writeb() directly.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-17 15:08:01 +09:00
Paul Mundt 4e7b7fdb12 sh: pci: Rework SH7780 host controller detection.
This reworks how the host controller is probed, and makes it a bit more
verbose in the event a new type of controller is detected. Additionally,
we also log the revision information.

This now uses the proper access sizes for the vendor/device registers,
rather than relying on a larger access that encapsulated both of them.
Not all devices support 32-bit read cycles for these registers.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-17 15:05:19 +09:00
Paul Mundt 0bbc9bc318 sh: pci: Set class/sub-class code correctly for SH7780 PCIC.
The SH7780 PCI host controller implements a configuration header that
requires a fair bit of hand-holding to initialize properly. By default
it appears as a pre-2.0 host controller given the zeroed out class code,
so fix this up properly.

Some boards that happened to be using the R7780RP version of the PCIC
fixups had set this correctly, but this belongs in the standard
initialization, and is by no means board specific.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-17 14:09:09 +09:00
Paul Mundt 7e4ba0d77c sh: pci: Prefer P1SEG over P1SEGADDR for CONFIG_CMD.
P1SEGADDR is obsolete and will be killed off completely in the future,
so transition off of it and reference P1SEG explicitly.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-17 14:07:57 +09:00
Paul Mundt b627b4ed3d sh: pci: Move se7780 INTC fixups out of pci-sh7780.c.
These fixups belong in the board INTC setup code, not in the middle of
pci-sh7780.c.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-17 13:00:18 +09:00
Paul Mundt 84971bb401 sh: pci: Kill off useless debugging printk() in pci-sh7780 init.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-17 12:44:25 +09:00
Paul Mundt 0232ba9ce0 sh: pci: Kill off unused SH4_PCIC_NO_RESET code.
Nothing ended up using this anymore, so just kill it off.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-16 18:01:31 +09:00
Paul Mundt f1a9ba8f15 sh: pci: drop duplicate PCIC fixups for SE7780 and SH7785LCR.
SE7780 has the same PCIC fixup as SDK7780, and SH7785LCR the same
as R7780RP. Switch to using those, and drop the duplicate code.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-16 16:00:15 +09:00
Paul Mundt 3aabce8d3d sh: sh7785lcr: Update for recent PCI changes.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-16 16:00:15 +09:00
Paul Mundt 10591578c8 sh: drop duplicate symbol export on dreamcast and sh7785lcr.
With board_pci_channels now being exported in a single place, update the
boards that duplicated the export.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-16 16:00:15 +09:00
Magnus Damm aa5d3ff99c sh: export board_pci_channels in one place
Instead of sometimes exporting board_pci_channels[] in the board specific
code just export it in one place.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-16 16:00:14 +09:00
Magnus Damm 8ce0143b11 sh: pci io port base address code
Adds a __get_pci_io_base() function which is used to match a port range
against struct pci_channel. This allows us to detect if a port range is
assigned to pci or happens to be legacy port io. While at it, remove unused
cpu-specific cruft.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-16 16:00:14 +09:00
Magnus Damm ef339f241b sh: pci memory range checking code
This patch changes the code to use __is_pci_memory() instead of
is_pci_memaddr(). __is_pci_memory() loops through all the pci
channels on the system to match memory windows.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-16 16:00:14 +09:00
Magnus Damm ef53fdeb7e sh: add io_base member to pci_channel
Store the io window base address in struct pci_channel and use that one
instead of SH77xx_PCI_IO_BASE.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-16 16:00:13 +09:00
Magnus Damm e4c6a3604e sh: add reg_base member to pci_channel
Store the base address of the pci host controller registers in struct
pci_channel and use the address in pci_read_reg() and pci_write_reg().

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-16 16:00:13 +09:00
Magnus Damm b6706ef10f sh: hook in struct pci_channel in sysdata
Store a struct pci_channel pointer in bus->sysdata. This makes whatever
struct pci_channel assigned to a bus available for sh4_pci_read() and
sh4_pci_write(). We also modify PCIBIOS_MIN_IO and PCIBIOS_MIN_MEM to
use bus->sysdata - this to gives us support for multiple pci channels.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-16 16:00:13 +09:00
Magnus Damm 710fa3c811 sh: avoid using PCIBIOS_MIN_xxx
Replaces PCIBIOS_MIN_IO and PCIBIOS_MIN_MEM with direct struct
pci_channel access. This allows us to have more than one pci
channel.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-16 16:00:13 +09:00
Magnus Damm d0e3db40e2 sh: add init member to pci_channel data
This patch adds an init callback to struct pci_channel and makes sure
it is initialized properly. Code is added to call this init function
from pcibios_init(). Return values are adjusted and a warning is is
printed if init fails.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-16 16:00:12 +09:00
Magnus Damm b8b47bfbe4 sh: pass along struct pci_channel
These patches rework the pci code for the sh architecture.

Currently each board implements some kind of ioport to address mapping.
Some boards use generic_io_base others try passing addresses as io ports.
This is the first set of patches that try to unify the pci code as much
as possible to avoid duplicated code. This will in the end lead to fewer
lines board specific code and more generic code.

This patch makes sure a struct pci_channel pointer is passed along to
various pci functions such as pci_read_reg(), pci_write_reg(),
pci_fixup_pcic(), sh7751_pcic_init() and sh7780_pcic_init().

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-16 16:00:12 +09:00
Paul Mundt e588a00fe5 sh: Add in PCI bus for DMA API debugging.
This adds in the pci_bus_type for DMA API debug.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-14 15:23:40 +09:00
Yoshihiro Shimoda 9bb019f4c2 sh: sh7785lcr: fix PCI address map for 32-bit mode
Fix the problem that cannot work PCI device on 32-bit mode because
influence of the commit 68b42d1b54
("sh: sh7785lcr: Map whole PCI address space."). So this patch was
implement like a 29-bit mode, map whole physical address space of
DDR-SDRAM.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-06 08:55:51 -07:00
Takashi Yoshii 68b42d1b54 sh: sh7785lcr: Map whole PCI address space.
PCI still doesn't work on sh7785lcr 29bit 256M map mode.

On SH7785, PCI -> SHwy address translation is not base+offset but
somewhat like base|offset (See HW Manual (rej09b0261) Fig. 13.11).
So, you can't export CS2,3,4,5 by 256M at CS2 (results CS0,1,2,3
exported, I guess).  There are two candidates.

a) 128M@CS2 + 128M@CS4
b) 512M@CS0

Attached patch is B. It maps 512M Byte at 0 independently of memory
size. It results CS0 to CS6 and perhaps some more being accessible
from PCI.

Tested on
7785lcr 29bit 128M map
7785lcr 29bit 256M map
(NOT tested on 32bit)

Signed-off-by: Takashi YOSHII <yoshii.takashi@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-04 11:50:52 -04:00
Paul Mundt a27873cd23 sh: Fix up number of on-chip DMA channels on SH7091.
This accidentally regressed when the multi-IRQ changes went in,
switching SH7091 from 4 to 6 channels. Add SH7091 back in to the
4-channel dependency list.

Reported-by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-04-04 11:40:22 -04:00
Paul Mundt 40f49e7ed7 sh: dma: Make G2 DMA configurable.
Follow the PVR2 DMAC change for G2 DMA.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-03-17 12:47:56 +09:00
Paul Mundt da62e71d13 sh: dma: Make PVR2 DMA configurable.
With arch/sh/drivers/dma/ always being built, the Dreamcast DMA engines
are being unconditionally built in, regardless of whether the DMA API is
enabled or not. This is a regression from previous behaviour, but there
is not much advantage in building them all in unconditionally regardless.
Add a new config option to make it optional, and update the only user of
it to reflect that.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-03-17 09:30:36 +09:00
Nobuhiro Iwamatsu 988f831df3 sh: Move IRQ multi definition of DMAC to defconfig
When SuperH CPU has IRQ multi of DMAC, SH_DMA_IRQ_MULTI becomes enable.
The following CPU's are Multi IRQ of DMAC now.
 - SH775X and SH7091
 - SH776X
 - SH7780
 - SH7785

If SH_DMA_IRQ_MULTI becomes enable, dma-sh api driver is optimized
for Multi IRQ.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-03-16 20:14:25 +09:00
Nobuhiro Iwamatsu 02ebd32f52 sh: Disable get_dma_error_irq for non-SH4 targets.
dma-sh's get_dma_error_irq() is only used by SH4, as the SH3
doesn't have the DMA Error interrupt.

Disable it out for non-SH4 builds.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-03-16 19:49:01 +09:00
Nobuhiro Iwamatsu 71b973a42c sh: dma-sh updates for multi IRQ and new SH-4A CPUs.
This adds DMA support for newer SH-4A CPUs, particularly SH7763/64/80/85.

This also enables multi IRQ support for platforms that have multiple
vectors bound to the same IRQ source.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-03-10 17:26:49 +09:00
Yoshihiro Shimoda 8ffe313342 sh: pci-sh7780: fix pci memory address for fixed PMB
Fix the problem that cannot work a PCI device when 32-bit physical
address mode.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-03-10 15:51:49 +09:00
Bjorn Helgaas e55823492d PCI: sh: use generic INTx swizzle from PCI core
Use the generic pci_common_swizzle() instead of arch-specific code.

Note that pci_common_swizzle() loops based on dev->bus->self, not
dev->bus->parent as the sh simple_swizzle() did.  I think they
are equivalent for this purpose.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-01-07 11:13:15 -08:00
Bjorn Helgaas 6aa6e49817 PCI: sh: use generic pci_swizzle_interrupt_pin()
Use the generic pci_swizzle_interrupt_pin() instead of arch-specific code.

Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-01-07 11:12:52 -08:00
Paul Mundt 78fb40263f sh: dma: Kill off ISA DMA wrapper.
There are no more users for this code, and it has been deprecated for
some time, so just kill it off.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:47 +09:00
Paul Mundt 43eeb0fb9f sh: mach-sh03: Use __set_io_port_base(), kill off special ioport_map().
This also fixes up a long-standing bug for this platform where the PIO
base was set to a register offset, rather than the actual PIO offset
itself.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:45 +09:00
Yoshihiro Shimoda 331ff103c7 sh: pci-sh7780: fix pci memory address mask
Fix the problem that cannot work a PCI device when system memory size is
256Mbyte in 29bit address mode.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:50 +09:00
Steve Glendinning f617682e9c sh: add SH DMAC burst mode constant
The SH7709 datasheet defines bit 5 as set for burst mode, clear for
cycle-steal mode.

Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:54 +09:00
Steve Glendinning c2c5883b3f sh: fix DMAOR register access on SH7709
sh7709 hardware manual says DMAOR is 16 bits long on this platform.

Tested and working with a modified smsc911x ethernet driver (sh-dma
support patch for this driver is coming soon).

Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:54 +09:00