m68k: ColdFire PCI bus support
Subsystems (2)
cover m68k: ColdFire PCI bus support
The following patch series adds support for the PCI bus on the ColdFire M54[78]x family of parts.
This is very much a work in progress, but it does work for some types of PCI add-in cards using the M5474EVB board.
--- b/arch/m68k/Kconfig.bus | 7 b/arch/m68k/include/asm/dma.h | 4 b/arch/m68k/include/asm/io_mm.h | 50 ++++- b/arch/m68k/include/asm/m54xxpci.h | 138 ++++++++++++++ b/arch/m68k/include/asm/m54xxsim.h | 3 b/arch/m68k/include/asm/pci.h | 6 b/arch/m68k/kernel/Makefile | 1 b/arch/m68k/kernel/pcibios.c | 109 +++++++++++ b/arch/m68k/platform/coldfire/Makefile | 2 b/arch/m68k/platform/coldfire/pci.c | 314 +++++++++++++++++++++++++++++++++ b/drivers/pci/Makefile | 1 12 files changed, 634 insertions(+), 1 deletion(-)
PATCH 2/4 m68k: add PCI bus support for the ColdFire M54xx SoC family
From: Greg Ungerer <[email protected]>
The ColdFire M54xx SoC family have a traditional PCI bus interface. Add the core support code to access and use this bus on these parts.
--- arch/m68k/include/asm/m54xxpci.h | 138 +++++++++++++++ arch/m68k/include/asm/m54xxsim.h | 3 + arch/m68k/platform/coldfire/Makefile | 2 + arch/m68k/platform/coldfire/pci.c | 314 ++++++++++++++++++++++++++++++++++ 4 files changed, 457 insertions(+), 0 deletions(-) create mode 100644 arch/m68k/include/asm/m54xxpci.h create mode 100644 arch/m68k/platform/coldfire/pci.c
arch/m68k/include/asm/m54xxpci.h new file +138 -0
@@ -0,0 +1,138 @@ +/****************************************************************************/ + +/* +* m54xxpci.h -- ColdFire 547x and 548x PCI bus support +* +* (C) Copyright 2011, Greg Ungerer <[email protected]> +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file COPYING in the main directory of this archive +* for more details. +*/ + +/****************************************************************************/ +#ifndef M54XXPCI_H +#define M54XXPCI_H +/****************************************************************************/ + +/* +* The core set of PCI support registers are mapped into the MBAR region. +*/ +#define PCIIDR (CONFIG_MBAR + 0xb00)/* PCI device/vendor ID */ +#define PCISCR (CONFIG_MBAR + 0xb04)/* PCI status/command */ +#define PCICCRIR (CONFIG_MBAR + 0xb08)/* PCI class/revision */ +#define PCICR1 (CONFIG_MBAR + 0xb0c)/* PCI configuration 1 */ +#define PCIBAR0 (CONFIG_MBAR + 0xb10)/* PCI base address 0 */ +#define PCIBAR1 (CONFIG_MBAR + 0xb14)/* PCI base address 1 */ +#define PCICCPR (CONFIG_MBAR + 0xb28)/* PCI cardbus CIS pointer */ +#define PCISID (CONFIG_MBAR + 0xb2c)/* PCI subsystem IDs */ +#define PCIERBAR (CONFIG_MBAR + 0xb30)/* PCI expansion ROM */ +#define PCICPR (CONFIG_MBAR + 0xb34)/* PCI capabilities pointer */ +#define PCICR2 (CONFIG_MBAR + 0xb3c)/* PCI configuration 2 */ + +#define PCIGSCR (CONFIG_MBAR + 0xb60)/* Global status/control */ +#define PCITBATR0 (CONFIG_MBAR + 0xb64)/* Target base translation 0 */ +#define PCITBATR1 (CONFIG_MBAR + 0xb68)/* Target base translation 1 */ +#define PCITCR (CONFIG_MBAR + 0xb6c)/* Target control */ +#define PCIIW0BTAR (CONFIG_MBAR + 0xb70)/* Initiator window 0 */ +#define PCIIW1BTAR (CONFIG_MBAR + 0xb74)/* Initiator window 1 */ +#define PCIIW2BTAR (CONFIG_MBAR + 0xb78)/* Initiator window 2 */ +#define PCIIWCR (CONFIG_MBAR + 0xb80)/* Initiator window config */ +#define PCIICR (CONFIG_MBAR + 0xb84)/* Initiator control */ +#define PCIISR (CONFIG_MBAR + 0xb88)/* Initiator status */ +#define PCICAR (CONFIG_MBAR + 0xbf8)/* Configuration address */ + +#define PCITPSR (CONFIG_MBAR + 0x8400)/* TX packet size */ +#define PCITSAR (CONFIG_MBAR + 0x8404)/* TX start address */ +#define PCITTCR (CONFIG_MBAR + 0x8408)/* TX transaction control */ +#define PCITER (CONFIG_MBAR + 0x840c)/* TX enables */ +#define PCITNAR (CONFIG_MBAR + 0x8410)/* TX next address */ +#define PCITLWR (CONFIG_MBAR + 0x8414)/* TX last word */ +#define PCITDCR (CONFIG_MBAR + 0x8418)/* TX done counts */ +#define PCITSR (CONFIG_MBAR + 0x841c)/* TX status */ +#define PCITFDR (CONFIG_MBAR + 0x8440)/* TX FIFO data */ +#define PCITFSR (CONFIG_MBAR + 0x8444)/* TX FIFO status */ +#define PCITFCR (CONFIG_MBAR + 0x8448)/* TX FIFO control */ +#define PCITFAR (CONFIG_MBAR + 0x844c)/* TX FIFO alarm */ +#define PCITFRPR (CONFIG_MBAR + 0x8450)/* TX FIFO read pointer */ +#define PCITFWPR (CONFIG_MBAR + 0x8454)/* TX FIFO write pointer */ + +#define PCIRPSR (CONFIG_MBAR + 0x8480)/* RX packet size */ +#define PCIRSAR (CONFIG_MBAR + 0x8484)/* RX start address */ +#define PCIRTCR (CONFIG_MBAR + 0x8488)/* RX transaction control */ +#define PCIRER (CONFIG_MBAR + 0x848c)/* RX enables */ +#define PCIRNAR (CONFIG_MBAR + 0x8490)/* RX next address */ +#define PCIRDCR (CONFIG_MBAR + 0x8498)/* RX done counts */ +#define PCIRSR (CONFIG_MBAR + 0x849c)/* RX status */ +#define PCIRFDR (CONFIG_MBAR + 0x84c0)/* RX FIFO data */ +#define PCIRFSR (CONFIG_MBAR + 0x84c4)/* RX FIFO status */ +#define PCIRFCR (CONFIG_MBAR + 0x84c8)/* RX FIFO control */ +#define PCIRFAR (CONFIG_MBAR + 0x84cc)/* RX FIFO alarm */ +#define PCIRFRPR (CONFIG_MBAR + 0x84d0)/* RX FIFO read pointer */ +#define PCIRFWPR (CONFIG_MBAR + 0x84d4)/* RX FIFO write pointer */ + +#define PACR (CONFIG_MBAR + 0xc00)/* PCI arbiter control */ +#define PASR (COFNIG_MBAR + 0xc04)/* PCI arbiter status */ + +/* +* Definitions for the Global status and control register. +*/ +#define PCIGSCR_PE 0x20000000/* Parity error detected */ +#define PCIGSCR_SE 0x10000000/* System error detected */ +#define PCIGSCR_XCLKBIN 0x07000000/* XLB2CLKIN mask */ +#define PCIGSCR_PEE 0x00002000/* Parity error intr enable */ +#define PCIGSCR_SEE 0x00001000/* System error intr enable */ +#define PCIGSCR_RESET 0x00000001/* Reset bit */ + +/* +* Bit definitions for the PCICAR configuration address register. +*/ +#define PCICAR_E 0x80000000/* Enable config space */ +#define PCICAR_BUSN 16/* Move bus bits */ +#define PCICAR_DEVFNN 8/* Move devfn bits */ +#define PCICAR_DWORDN 0/* Move dword bits */ + +/* +* The initiator windows hold the memory and IO mapping information. +* This macro creates the register values from the desired addresses. +*/ +#define WXBTAR (hostaddr, pciaddr, size) \ + (((hostaddr) & 0xff000000) | \ + ((((size) - 1) & 0xff000000) >> 8) | \ + (((pciaddr) & 0xff000000) >> 16)) + +#define PCIIWCR_W0_MEM 0x00000000/* Window 0 is memory */ +#define PCIIWCR_W0_IO 0x08000000/* Window 0 is IO */ +#define PCIIWCR_W0_MRD 0x00000000/* Window 0 memory read */ +#define PCIIWCR_W0_MRDL 0x02000000/* Window 0 memory read line */ +#define PCIIWCR_W0_MRDM 0x04000000/* Window 0 memory read mult */ +#define PCIIWCR_W0_E 0x01000000/* Window 0 enable */ + +#define PCIIWCR_W1_MEM 0x00000000/* Window 0 is memory */ +#define PCIIWCR_W1_IO 0x00080000/* Window 0 is IO */ +#define PCIIWCR_W1_MRD 0x00000000/* Window 0 memory read */ +#define PCIIWCR_W1_MRDL 0x00020000/* Window 0 memory read line */ +#define PCIIWCR_W1_MRDM 0x00040000/* Window 0 memory read mult */ +#define PCIIWCR_W1_E 0x00010000/* Window 0 enable */ + +/* +* Bit definitions for the PCIBATR registers. +*/ +#define PCITBATR0_E 0x00000001/* Enable window 0 */ +#define PCITBATR1_E 0x00000001/* Enable window 1 */ + +/* +* PCI arbiter support definitions and macros. +*/ +#define PACR_INTMPRI 0x00000001 +#define PACR_EXTMPRI (x) (((x) & 0x1f) << 1) +#define PACR_INTMINTE 0x00010000 +#define PACR_EXTMINTE (x) (((x) & 0x1f) << 17) +#define PACR_PKMD 0x40000000 +#define PACR_DS 0x80000000 + +#define PCICR1_CL (x) ((x) & 0xf)/* Cacheline size field */ +#define PCICR1_LT (x) (((x) & 0xff) << 8)/* Latency timer field */ + +/****************************************************************************/ +#endif /* M54XXPCI_H */
arch/m68k/include/asm/m54xxsim.h +3 -0
@@ -81,4 +81,7 @@#define MCF_PAR_PSC_RTS_RTS (0x30)#define MCF_PAR_PSC_CANRX (0x40) +#define MCF_PAR_PCIBG (CONFIG_MBAR + 0xa48)/* PCI bus grant */ +#define MCF_PAR_PCIBR (CONFIG_MBAR + 0xa4a)/* PCI */ +#endif /* m54xxsim_h */
arch/m68k/platform/coldfire/Makefile +2 -0
@@ -32,5 +32,7 @@ obj-$(CONFIG_NETtel) += nettel.o obj-$(CONFIG_CLEOPATRA) += nettel.o obj-$(CONFIG_FIREBEE) += firebee.o +obj-$(CONFIG_PCI) += pci.o + obj-y += pinmux.o gpio.o extra-y := head.o
arch/m68k/platform/coldfire/pci.c new file +314 -0
314 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 3/4 m68k: add IO access definitions to support PCI on ColdFire platforms
In reply to [email protected]From: Greg Ungerer <[email protected]>
Define the usual memory access functions (readb/writeb/...) and I/O space functions (inb/outb/...) for PCI bus support on ColdFire CPU based platforms.
--- arch/m68k/include/asm/io_mm.h | 48 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 47 insertions(+), 1 deletions(-)
arch/m68k/include/asm/io_mm.h +47 -1
@@ -65,7 +65,53 @@ -#ifdef CONFIG_ISA +#if defined(CONFIG_PCI ) && defined(CONFIG_COLDFIRE ) + +#define HAVE_ARCH_PIO_SIZE +#define PIO_OFFSET 0 +#define PIO_MASK 0xffff +#define PIO_RESERVED 0x10000 + +u8 mcf_pci_inb (u32 addr); +u16 mcf_pci_inw (u32 addr); +u32 mcf_pci_inl (u32 addr); +void mcf_pci_insb (u32 addr,u8 *buf,u32 len); +void mcf_pci_insw (u32 addr,u16 *buf,u32 len); +void mcf_pci_insl (u32 addr,u32 *buf,u32 len); + +void mcf_pci_outb (u8 v,u32 addr); +void mcf_pci_outw (u16 v,u32 addr); +void mcf_pci_outl (u32 v,u32 addr); +void mcf_pci_outsb (u32 addr,const u8 *buf,u32 len); +void mcf_pci_outsw (u32 addr,const u16 *buf,u32 len); +void mcf_pci_outsl (u32 addr,const u32 *buf,u32 len); + +#define inb mcf_pci_inb +#define inb_p mcf_pci_inb +#define inw mcf_pci_inw +#define inw_p mcf_pci_inw +#define inl mcf_pci_inl +#define inl_p mcf_pci_inl +#define insb mcf_pci_insb +#define insw mcf_pci_insw +#define insl mcf_pci_insl + +#define outb mcf_pci_outb +#define outb_p mcf_pci_outb +#define outw mcf_pci_outw +#define outw_p mcf_pci_outw +#define outl mcf_pci_outl +#define outl_p mcf_pci_outl +#define outsb mcf_pci_outsb +#define outsw mcf_pci_outsw +#define outsl mcf_pci_outsl + +#define readb (addr) in_8(addr) +#define writeb (v, addr) out_8((addr), (v)) +#define readw (addr) in_le16(addr) +#define writew (v, addr) out_le16((addr), (v)) + +#elif defined(CONFIG_ISA )#if MULTI_ISA ==0 #undef MULTI_ISA
Signature · 1 line
1.7.0.4
PATCH 4/4 m68k: allow PCI bus to be enabled for ColdFire m54xx CPUs
In reply to [email protected]From: Greg Ungerer <[email protected]>
All support code for the PCI bus hardware on the ColdFire 547x and 548x CPUs is now in. Allow enabling of CONFIG_PCI for them.
--- arch/m68k/Kconfig.bus | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
arch/m68k/Kconfig.bus +7 -0
@@ -48,6 +48,13 @@ config ISA config GENERIC_ISA_DMA def_bool ISA +config PCI + bool "PCI support" + depends on M54xx + help + Enable the PCI bus. Support for the PCI bus hardware built into the + ColdFire 547x and 548x processors. + source "drivers/pci/Kconfig" source "drivers/zorro/Kconfig"
Signature · 1 line
1.7.0.4
PATCH 1/4 m68k: common PCI support definitions and code
In reply to [email protected]From: Greg Ungerer <[email protected]>
Basic set of definitions and support code required to turn on CONFIG_PCI for the m68k architecture. Nothing specific to any PCI implementation in any m68k class CPU harwdare yet.
--- arch/m68k/include/asm/dma.h | 4 ++ arch/m68k/include/asm/io_mm.h | 2 + arch/m68k/include/asm/pci.h | 6 ++ arch/m68k/kernel/Makefile | 1 + arch/m68k/kernel/pcibios.c | 109 +++++++++++++++++++++++++++++++++++++++++ drivers/pci/Makefile | 1 + 6 files changed, 123 insertions(+), 0 deletions(-) create mode 100644 arch/m68k/kernel/pcibios.c
arch/m68k/include/asm/dma.h +4 -0
@@ -486,6 +486,10 @@ static __inline__ int get_dma_residue(unsigned int dmanr)extern int request_dma (unsigned int dmanr,const char * device_id);/* reserve a DMA channel */ extern void free_dma (unsigned int dmanr);/* release it again */ +#ifdef CONFIG_PCI +extern int isa_dma_bridge_buggy; +#else #define isa_dma_bridge_buggy (0) +#endif #endif /* _M68K_DMA_H */
arch/m68k/include/asm/io_mm.h +2 -0
@@ -340,4 +340,6 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int*/ #define xlate_dev_kmem_ptr (p) p +#define ioport_map (port, nr) ((void __iomem *)(port)) +#endif /* _IO_H */
arch/m68k/include/asm/pci.h +6 -0
@@ -2,6 +2,7 @@#define _ASM_M68K_PCI_H#include <asm-generic/pci-dma-compat.h> +#include <asm-generic/pci.h> /* The PCI address space does equal the physical memory * address space. The networking and block device layers use
@@ -9,4 +10,9 @@*/ #define PCI_DMA_BUS_IS_PHYS (1) +#define pcibios_assign_all_busses () 1 + +#define PCIBIOS_MIN_IO 0x00000100 +#define PCIBIOS_MIN_MEM 0x02000000 +#endif /* _ASM_M68K_PCI_H */
arch/m68k/kernel/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-y += setup.o signal.o sys_m68k.o syscalltable.o time.o traps.o obj-$(CONFIG_MMU_MOTOROLA) += ints.o vectors.o obj-$(CONFIG_MMU_SUN3) += ints.o vectors.o +obj-$(CONFIG_PCI) += pcibios.o ifndef CONFIG_MMU_SUN3 obj-y += dma.o
arch/m68k/kernel/pcibios.c new file +109 -0
109 lines not on this page · raw message
drivers/pci/Makefile +1 -0
@@ -49,6 +49,7 @@ obj-$(CONFIG_MN10300) += setup-bus.o obj-$(CONFIG_MICROBLAZE) += setup-bus.o obj-$(CONFIG_TILE) += setup-bus.o setup-irq.o obj-$(CONFIG_SPARC_LEON) += setup-bus.o setup-irq.o +obj-$(CONFIG_M68K) += setup-bus.o setup-irq.o # # ACPI Related PCI FW Functions
Signature · 1 line
1.7.0.4
Geert Uytterhoeven
maintainerRe: [PATCH 1/4] m68k: common PCI support definitions and code
Quoted 1 line · On Fri, Jun 29, 2012 at 7:17 AM, <[email protected]> wrote:
any m68k class CPU harwdare yet.
hardware
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH 1/4] m68k: common PCI support definitions and code
In reply to [email protected]Quoted 5 lines · On Fri, Jun 29, 2012 at 7:17 AM, <[email protected]> wrote:
Basic set of definitions and support code required to turn on
CONFIG_PCIfor the m68k architecture. Nothing specific to any PCI implementation in any m68k class CPU harwdare yet.Signed-off-by Greg Ungerer <[email protected]>
Nothing harmful to the classic m68k support in there, so
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev
Re: [PATCH 3/4] m68k: add IO access definitions to support PCI on ColdFire platforms
In reply to [email protected]Quoted 4 lines · On Fri, Jun 29, 2012 at 7:17 AM, <[email protected]> wrote:
Define the usual memory access functions (readb/writeb/...) and I/O space functions (inb/outb/...) for PCI bus support on ColdFire CPU based platforms.
Signed-off-by Greg Ungerer <[email protected]>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH 1/4] m68k: common PCI support definitions and code
In reply to Geert UytterhoevenHi Geert,
Quoted 4 lines · Geert Uytterhoeven
Quoted 1 line · On Fri, Jun 29, 2012 at 7:17 AM, <[email protected]> wrote:
any m68k class CPU harwdare yet.
hardware
Wow, you are quick :-) I'll fix that up.
Thanks for the feedback, and the acks!
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected] SnapGear Group, McAfee PHONE: +61 7 3435 2888 8 Gardner Close FAX: +61 7 3217 5323 Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com