From: Stefan E. <se...@us...> - 2004-02-10 03:01:31
|
Update of /cvsroot/blob/blob/include/blob In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20308/include/blob Modified Files: pcmcia.h Log Message: PCMCIA CLEANUP Remove PCMCIA mess and do it like the ethernet driver stuff. Probably breaks SA1111 PCMCIA stuff, but I'm the only one who uses that anyway, and I'll fix. The SA11x0 stuff is still missing. Index: pcmcia.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/pcmcia.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- pcmcia.h 6 Feb 2004 10:32:19 -0000 1.9 +++ pcmcia.h 9 Feb 2004 19:25:12 -0000 1.10 @@ -23,76 +23,97 @@ #include <blob/pcmcia-cis.h> -/********************************************************************** - * Arch dependent defines (should be pretty much the same everywhere, - * tough) - */ -#define PCMCIA_MAX_SLOTS 2 - -#if defined(BADGE4) || defined(IDR) || defined(PT_SYSTEM3) || defined(SHANNON) || \ - defined(PT_DAFIT) -# define PCMCIA_S0_BASE 0x20000000 -# define PCMCIA_S0_IO_BASE 0x20000000 -# define PCMCIA_S0_ATTR_BASE 0x28000000 -# define PCMCIA_S0_MEM_BASE 0x2C000000 -# define PCMCIA_S1_BASE 0x30000000 -# define PCMCIA_S1_IO_BASE 0x30000000 -# define PCMCIA_S1_ATTR_BASE 0x38000000 -# define PCMCIA_S1_MEM_BASE 0x3C000000 -#else -# error "Please add PCMCIA HW defines for your board here" -#endif - -/* some slot stati */ +/* some sock stati */ #define PCMCIA_SS_DETECT (1<<0) #define PCMCIA_SS_ENABLED (1<<1) #define PCMCIA_SS_POWER (1<<2) #define PCMCIA_SS_IDENT (1<<3) -/********************************************************************** - * the following symbols can be overwritten by arch dependent code - * (weak symbols) +/****************************************************************************** + * PCMCIA driver definitions */ -/* do whatever is needed to get pcmcia initialized */ -int pcmcia_init(); -/* set pcmcia slot voltage levels */ -int pcmcia_voltage_set( int slot, int vcc, int vpp ); +/* a PCMCIA socket + */ +struct pcmcia_sock { + int nr; /* socket number */ + int state; /* socket state DETECT,ENABLE,POWER,IDENT */ + int vcc; /* socket power voltage */ + int vpp; -/* detect slot */ -int pcmcia_slot_detect( int slot ); + /* Memory windows */ + u32 io_base; + u32 attr_base; + u32 mem_base; -/* enable slot */ -int pcmcia_slot_enable( int slot ); + /* CIS stuff */ + volatile u8 *ident; + volatile u8 *feature_p[PCMCIA_MAX_FEATURES]; + int n_features; + u16 config_base; -/* disable slot */ -int pcmcia_slot_disable( int slot ); + void *priv; /* per-socket private data used by HW implementations */ +}; -/* reset pcmcia slot */ -int pcmcia_slot_reset(int slot); +typedef int (*pcmcia_init_func_t)( void ); +typedef int (*pcmcia_power_func_t)( struct pcmcia_sock *sock, int vcc, int vpp ); +typedef int (*pcmcia_sock_detect_func_t)( struct pcmcia_sock *sock ); +typedef int (*pcmcia_sock_enable_func_t)( struct pcmcia_sock *sock ); +typedef int (*pcmcia_sock_disable_func_t)( struct pcmcia_sock *sock ); +typedef int (*pcmcia_sock_reset_func_t)( struct pcmcia_sock *sock ); +typedef int (*pcmcia_sock_status_dump_func_t)( struct pcmcia_sock *sock ); -/* dump slot stati */ -int pcmcia_dump_stati( void ); +typedef struct { + int nr; + int first; + struct pcmcia_sock *sock; + pcmcia_init_func_t init; + pcmcia_power_func_t power; + pcmcia_sock_detect_func_t sock_detect; + pcmcia_sock_enable_func_t sock_enable; + pcmcia_sock_reset_func_t sock_reset; + pcmcia_sock_disable_func_t sock_disable; + pcmcia_sock_status_dump_func_t sock_status_dump; + char *name; +} pcmcia_driver_t; -/********************************************************************** - * following symbols cannot be overwritten +#define PCMCIA_SOCK_NR_VALID( n ) ( pcmcia_driver && (n<(pcmcia_driver->nr+pcmcia_driver->first)) \ + && (n>=pcmcia_driver->first) ) + +/* implemented pcmcia drivers */ +extern pcmcia_driver_t sa1111_pcmcia_driver; +extern pcmcia_driver_t pxa_pcmcia_driver; + +/* filled out by board specific code */ +extern pcmcia_driver_t *pcmcia_driver; + +/****************************************************************************** + * exported functions */ + /* set debug verbosity */ void pcmcia_dbg_set( int level ); -/* identify pcmcia card */ -int pcmcia_identify( volatile unsigned char *p ); +int pcmcia_init( void ); +int pcmcia_sock_dump_status( int nr ); -/* parse cis tuples of card in slot <slot> */ -int pcmcia_cis_parse( int slot ); +/* these are kinda low-level, pcmcia_init() should do + * the work for you already + */ +int pcmcia_sock_get( int nr, struct pcmcia_sock **sock ); +int pcmcia_sock_reset( struct pcmcia_sock *sock ); +int pcmcia_sock_enable( struct pcmcia_sock *sock ); +int pcmcia_sock_disable( struct pcmcia_sock *sock ); -/* get base adress and attribute space address of slot <slot> */ -int pcmcia_slot_address_get( int slot, u32 *base, u32 *attr ); +/* read/write attribute space */ +int pcmcia_sock_attr_read( int sock, u16 offset, u8 *value ); +int pcmcia_sock_attr_write( int sock, u16 offset, u8 value ); -/* get config register */ -int pcmcia_slot_cfg_reg_get( int slot, u16 *cfg_base ); +/* read/write io space */ +int pcmcia_sock_io_read( int sock, u16 offset, u8 *value ); +int pcmcia_sock_io_write( int sock, u16 offset, u8 value ); -/* read/write attribute space */ -int pcmcia_slot_attr_read( int slot, u16 offset, u8 *value ); -int pcmcia_slot_attr_write( int slot, u16 offset, u8 value ); +/* read/write mem space */ +int pcmcia_sock_mem_read( int sock, u16 offset, u8 *value ); +int pcmcia_sock_mem_write( int sock, u16 offset, u8 value ); #endif |