405LP PCMCIA cleanup
The patch below makes some cleanups to the handling of the PCMCIA interface on the 405LP. In particular, it removes the need for a hardcoded io_block_mapping() in the board setup code, replacing it with ioremap()s.
Unfortunately, the ioremap()s can't live in the pccf_4xx driver itself, since this would lead to _IO_BASE and ISA_MEM_BASE being initialized far too late. So instead, I use the hack of an ibm405lp_setup_pccf() function provided in ibm405lp.c, to be used by the board setup code.
This is tested on Arctic-II, but not on Beech. If there aren't serious objections, I'll commit it to linuxppc_2_4_devel.
arch/ppc/kernel/ppc_ksyms.c renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/kernel/ppc_ksyms.c +1 -1
@@ -175,7 +175,7 @@EXPORT_SYMBOL (ppc_ide_md);#endif -#if defined(CONFIG_PCI ) || defined(CONFIG_BEECH ) +#if defined(CONFIG_PCI )EXPORT_SYMBOL_NOVERS (isa_io_base);EXPORT_SYMBOL_NOVERS (isa_mem_base);#endif
arch/ppc/platforms/Makefile renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/Makefile +1 -1
@@ -24,7 +24,7 @@ O_TARGET := platform.o -export-objs := prep_setup.o beech.o ibm405lp.o +export-objs := prep_setup.o beech.o ibm405lp.o arctic2.o obj-$(CONFIG_CEDER) += ceder.o ibmnp405l.o obj-$(CONFIG_CPCI405) += cpci405.o ibm405gp.o
arch/ppc/platforms/arctic2.c renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/arctic2.c +11 -2
@@ -47,6 +47,15 @@#include <platforms/arctic2.h> +/* Virtual address of the PCCF macro, which needs to be ioremap()ed +* and initialized by the board setup code. */ +volatile u16 *pccf_4xx_macro_vaddr; +unsigned long pccf_4xx_io_base; +unsigned long pccf_4xx_mem_base; +EXPORT_SYMBOL (pccf_4xx_macro_vaddr); +EXPORT_SYMBOL (pccf_4xx_io_base); +EXPORT_SYMBOL (pccf_4xx_mem_base); +void __init board_setup_arch (void ) {
@@ -63,8 +72,8 @@ ARCTIC2_FPGA8_SIZE, _PAGE_IO);io_block_mapping (ARCTIC2_FPGA16_VADDR ,ARCTIC2_FPGA16_PADDR ,ARCTIC2_FPGA16_SIZE , _PAGE_IO); -io_block_mapping (SUBZERO_BEECH_PCMCIA_VADDR ,SUBZERO_BEECH_PCMCIA_PADDR , -SUBZERO_BEECH_PCMCIA_SIZE , _PAGE_IO); +ibm405lp_setup_pccf (&pccf_4xx_macro_vaddr, &pccf_4xx_io_base, + &pccf_4xx_mem_base); }void __init
arch/ppc/platforms/arctic2.h renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/arctic2.h +4 -0
@@ -60,6 +60,10 @@#define PPC4xx_MACHINE_NAME "IBM Arctic II" +#include <asm/pccf_4xx.h> +#define _IO_BASE (pccf_4xx_io_base) +#define _ISA_MEM_BASE (pccf_4xx_mem_base) +#endif /* !__ASSEMBLY__ */ #endif /* __ASM_ARCTIC2_H__ */ #endif /* __KERNEL__ */
arch/ppc/platforms/beech.c renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/beech.c +11 -2
@@ -45,8 +45,6 @@static void beech_ebc_setup (void );static void beech_fpga_setup (void ); -unsigned long isa_io_base; -unsigned long isa_mem_base;volatile u8 *beech_fpga_reg_0 =NULL ;volatile u8 *beech_fpga_reg_2 =NULL ;volatile u8 *beech_fpga_reg_4 =NULL ;
@@ -55,6 +53,15 @@EXPORT_SYMBOL (beech_fpga_reg_2);EXPORT_SYMBOL (beech_fpga_reg_4); +/* Virtual address of the PCCF macro, which needs to be ioremap()ed +* and initialized by the board setup code. */ +volatile u16 *pccf_4xx_macro_vaddr; +unsigned long pccf_4xx_io_base; +unsigned long pccf_4xx_mem_base; +EXPORT_SYMBOL (pccf_4xx_macro_vaddr); +EXPORT_SYMBOL (pccf_4xx_io_base); +EXPORT_SYMBOL (pccf_4xx_mem_base); +/* Beech board physical memory map:
@@ -119,6 +126,8 @@void __init board_io_mapping (void ) { +ibm405lp_setup_pccf (&pccf_4xx_macro_vaddr, &pccf_4xx_io_base, + &pccf_4xx_mem_base); }void __init
arch/ppc/platforms/beech.h renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/beech.h +5 -12
@@ -166,13 +166,6 @@#define BEECH_FREE_AREA_OFFSET BEECH_KERNEL_SIZE#define BEECH_FREE_AREA_SIZE (BEECH_BIGFLASH_SIZE - BEECH_KERNEL_SIZE) -/* The PCMCIA controller driver 4xx_pccf.c is responsible for the EBC setup of -PCMCIA. Externally, EBC bank selects 3..7 take on PCMCIA functions when -PCMCIA is enabled. */ - -#define BEECH_PCMCIA_PADDR ((uint)0xf0000000) -#define BEECH_PCMCIA_SIZE ((uint)(32 * 1024 * 1024)) -/* We do not currently support the internal clock mode for the UART. This limits the minimum OPB frequency to just over 2X the UART oscillator frequency. At OPB frequencies less than this the serial port will not
@@ -185,12 +178,12 @@#define PPC4xx_MACHINE_NAME "IBM 405LP Beech" -#define _IO_BASE isa_io_base -#define _ISA_MEM_BASE isa_mem_base -#define PCI_DRAM_OFFSET 0 +#define PCI_DRAM_OFFSET 0 + +#include <asm/pccf_4xx.h> +#define _IO_BASE (pccf_4xx_io_base) +#define _ISA_MEM_BASE (pccf_4xx_mem_base) -extern unsigned long isa_io_base; -extern unsigned long isa_mem_base;/**************************************************************************** * Non-standard board support follows
arch/ppc/platforms/ibm405lp.c renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/ibm405lp.c +104 -0
116 lines not on this page · raw message
arch/ppc/platforms/ibm405lp.h renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/ibm405lp.h +12 -0
@@ -316,6 +316,16 @@#define TDES0_IO_BASE 0xef600b00 +/* The PCMCIA controller driver 4xx_pccf.c is responsible for the EBC setup of +PCMCIA. Externally, EBC bank selects 3..7 take on PCMCIA functions when +PCMCIA is enabled. */ + +#define PCCF_4XX_PADDR (0xf0000000UL) +#define PCCF_4XX_SIZE (32 * 1024 * 1024) +#define PCCF_4XX_MACRO_IRQ UIC_IRQ_EIR5 +#define PCCF_4XX_CARD_IRQ UIC_IRQ_EIR6 + +/***************************************************************************** * CPM bits for the 405LP. Field names are as documented in the 405LP manual. * Backwards-compatible synonyms appear at the end.
@@ -901,6 +911,8 @@****************************************************************************/ int ibm405lp_set_pixclk (unsigned pixclk_min,unsigned pixclk_max); +int ibm405lp_setup_pccf (volatile u16 **vaddr,unsigned long *io_base, +unsigned long *mem_base);void ibm405lp_reset_sdram (u32 new_rtr,u32 new_tr);
arch/ppc/platforms/subzero.h renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/subzero.h +1 -15
@@ -88,21 +88,7 @@#define SUBZERO_BOOTFLASH_PADDR (SUBZERO_BANK0_PADDR)#define SUBZERO_BOOTFLASH_SIZE ((uint)(32 * 1024 * 1024)) -/* The PCMCIA controller driver 4xx_pccf.c is responsible for the EBC setup of -PCMCIA. Externally, EBC bank selects 3..7 take on PCMCIA functions when -PCMCIA is enabled. */ - -#define SUBZERO_BEECH_PCMCIA_PADDR ((uint)0xf0000000) -#define SUBZERO_BEECH_PCMCIA_VADDR SUBZERO_BEECH_PCMCIA_PADDR -#define SUBZERO_BEECH_PCMCIA_SIZE ((uint)(32 * 1024 * 1024)) - -#define SUBZERO_BEECH_PCMCIA_IO_BASE (SUBZERO_BEECH_PCMCIA_VADDR + 0x01800000) - -/* Define _IO_BASE for PCMCIA; other defines are required as well. */ - -#define _IO_BASE SUBZERO_BEECH_PCMCIA_IO_BASE -#define _ISA_MEM_BASE 0 -#define PCI_DRAM_OFFSET 0 +#define PCI_DRAM_OFFSET 0void *beech_sram_alloc (size_t size);int beech_sram_free (void *p);
drivers/pcmcia/Config.in renamed from home/dgibson/kernel/linuxppc_2_4_devel/drivers/pcmcia/Config.in +1 -1
@@ -29,7 +29,7 @@ if [ "$CONFIG_8xx" = "y" ]; then dep_tristate ' M8xx support' CONFIG_PCMCIA_M8XX $CONFIG_PCMCIA fi - if [ "$CONFIG_BEECH" = "y" ]; then + if [ "$CONFIG_405LP" = "y" ]; then dep_tristate ' IBM 4xx PCCF support' CONFIG_PCMCIA_PCCF_4xx $CONFIG_PCMCIA fi fi
drivers/pcmcia/pccf_4xx.c renamed from home/dgibson/kernel/linuxppc_2_4_devel/drivers/pcmcia/pccf_4xx.c +19 -121
229 lines not on this page · raw message
include/asm-ppc/pccf_4xx.h renamed from home/dgibson/kernel/linuxppc_2_4_devel/include/asm-ppc/pccf_4xx.h +27 -0
@@ -0,0 +1,27 @@ +#ifndef __ASM_PCCF_4XX_H +#define __ASM_PCCF_4XX_H + +/* Areas that we ioremap() are mapped only as large as necessary to get the job +done: Only a few locations of the macro space are used, and legacy IO space +is only 64 KB. There is 1 memory window, and 2 virtual IO windows. */ + +#define PCCF_4XX_MACRO_OFFSET 0x00000000 +#define PCCF_4XX_MACRO_PADDR (PCCF_4XX_PADDR + PCCF_4XX_MACRO_OFFSET) +#define PCCF_4XX_MACRO_WINSIZE PAGE_SIZE + +#define PCCF_4XX_MEM_OFFSET 0x01000000 +#define PCCF_4XX_MEM_PADDR (PCCF_4XX_PADDR + PCCF_4XX_MEM_OFFSET) +#define PCCF_4XX_MEM_WINSIZE (8 * 1024 * 1024) + +#define PCCF_4XX_IO_OFFSET 0x01800000 +#define PCCF_4XX_IO_PADDR (PCCF_4XX_PADDR + PCCF_4XX_IO_OFFSET) +#define PCCF_4XX_IO_WINSIZE 0x00010000 + +/* These are declared here, since the pccf_4xx driver needs them, but +* must be defined and initialized by the board setup code. */ +extern volatile u16 *pccf_4xx_macro_vaddr; +extern unsigned long pccf_4xx_io_base; +extern unsigned long pccf_4xx_mem_base; + +#endif /* __ASM_PCCF_4XX_H */ +
--
David Gibson | For every complex problem there is a
[email protected] | solution which is simple, neat and
| wrong.
http://www.ozlabs.org/people/dgibson
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/