amiga: pcmcia: inb()/inw() on GAYLE_IO space
Subsystems (2)
cover amiga: pcmcia: inb()/inw() on GAYLE_IO space
Hi there,
attached is a driver for the pcmcia side of C='s gayle - it's a WIP, as such there are many dev_dbg()/pr_err()/pr_dbg() scattered around, you've been warned.
It recognize all pcmcia cards i tried (IOW gayle's attribute space is read and parsed correctly), socket's interrupt work (IOW you can plug & unplug cards), but *it seems* any I/O read operation return bogus data (e.g. 0xff or 0xfff).
Here's a dmesg dealing with with a 3Com 3c589 ethernet card:
http://dpaste.com//84TPTPLNV - notice the "hw_addr ff:ff:ff:ff:ff:ff" or "exiting interrupt, status ffff".
AFAIK inb()/inw() already add the GAYLE_IO offset (AG_ISA_IO_B and AG_ISA_IO_W in arch/m68k/include/asm/io_mm.h), and i didn't know if i could read directly (without an ioremap() first), so i tried both cases:
1) ioreamp() sock->phys_io, and subtract the GAYLE_IO offset (see sock->socket.io_offset).
or
2) set Amiga base IO port to 0x0 and patch drivers/pcmcia/rsrc_mgr.c::static_find_io() (see https://dpaste.com//B75LTFF3V)
In both case the 3c589_cs driver request an I/O aperture at 0x0300, large 0x0010, receives it, but all read operations return 0xff or 0xffff.
Any idea? Any guess is welcome since i'm running out of ideas ATM.
Paolo Pisati (1):
pcmcia: gayle: initial support
arch/m68k/amiga/pcmcia.c | 5 + arch/m68k/amiga/platform.c | 29 +++ arch/m68k/include/asm/amipcmcia.h | 11 ++ drivers/pcmcia/Kconfig | 8 + drivers/pcmcia/Makefile | 1 + drivers/pcmcia/gayle.c | 307 ++++++++++++++++++++++++++++++ 6 files changed, 361 insertions(+) create mode 100644 drivers/pcmcia/gayle.c
Signature · 1 line
2.34.1
PATCH 1/1 pcmcia: gayle: initial support
--- arch/m68k/amiga/pcmcia.c | 5 + arch/m68k/amiga/platform.c | 29 +++ arch/m68k/include/asm/amipcmcia.h | 11 ++ drivers/pcmcia/Kconfig | 8 + drivers/pcmcia/Makefile | 1 + drivers/pcmcia/gayle.c | 307 ++++++++++++++++++++++++++++++ 6 files changed, 361 insertions(+) create mode 100644 drivers/pcmcia/gayle.c
arch/m68k/amiga/pcmcia.c +5 -0
@@ -66,6 +66,11 @@ int pcmcia_copy_tuple(unsigned char tuple_id, void *tuple, int max_len) }EXPORT_SYMBOL (pcmcia_copy_tuple); +unsigned char pcmcia_get_voltage (void ) { +return gayle.config &0x03 ; +} +EXPORT_SYMBOL (pcmcia_get_voltage); +void pcmcia_program_voltage (int voltage) {unsigned char v;
arch/m68k/amiga/platform.c +29 -0
@@ -110,6 +110,26 @@ static const struct gayle_ide_platform_data a1200_ide_pdata __initconst = { .explicit_ack = 1, }; +static const struct resource a1200_pcmcia_resource[]__initconst = { + [0 ] = { + .name ="Gayle memory" , + .start =GAYLE_RAM , + .end =GAYLE_RAM +GAYLE_RAMSIZE -1 , + .flags =IORESOURCE_MEM , + }, + [1 ] = { + .name ="Gayle attribute" , + .start =GAYLE_ATTRIBUTE , + .end =GAYLE_ATTRIBUTE +GAYLE_ATTRIBUTESIZE -1 , + .flags =IORESOURCE_MEM , + }, + [2 ] = { + .name ="Gayle I/O" , + .start =GAYLE_IO , + .end =GAYLE_IO +(2 *GAYLE_IOSIZE )-1 , + .flags =IORESOURCE_MEM , + } +};static const struct resource a4000_ide_resource__initconst = { .start =0xdd2000 ,
@@ -190,6 +210,15 @@ static int __init amiga_init_devices(void) sizeof(a1200_ide_pdata));if (error)return error; + + } + +if (AMIGAHW_PRESENT (PCMCIA )) { + pdev =platform_device_register_simple ("amiga-gayle-pcmcia" ,-1 , + a1200_pcmcia_resource, +ARRAY_SIZE (a1200_pcmcia_resource)); +if (IS_ERR (pdev)) +return PTR_ERR (pdev); }if (AMIGAHW_PRESENT (A4000_IDE )) {
arch/m68k/include/asm/amipcmcia.h +11 -0
@@ -19,6 +19,7 @@void pcmcia_reset (void );int pcmcia_copy_tuple (unsigned char tuple_id,void *tuple,int max_len); +unsigned char pcmcia_get_voltage (void );void pcmcia_program_voltage (int voltage);void pcmcia_access_speed (int speed);void pcmcia_write_enable (void );
@@ -51,6 +52,16 @@ static inline void pcmcia_disable_irq(void)#define PCMCIA_INSERTED (gayle.cardstatus & GAYLE_CS_CCDET) +static inline void pcmcia_disable_ccdet_irq (void ) +{ + gayle.inten &= ~GAYLE_IRQ_CCDET ; +} + +static inline u_char pcmcia_wena (void ) +{ +return (gayle.cardstatus &GAYLE_CS_WR ); +} +/* valid voltages for pcmcia_ProgramVoltage */ #define PCMCIA_0V 0
drivers/pcmcia/Kconfig +8 -0
@@ -253,4 +253,12 @@ config PCCARD_NONSTATIC config PCCARD_IODYN bool +config PCMCIA_GAYLE + tristate "Amiga Gayle bridge support" + depends on PCMCIA && AMIGA && AMIGA_PCMCIA && !APNE + help + Say Y here to include support for PCMCIA host bridges that + are register compatible with Commodore's Gayle. This is found on + Amiga systems. If unsure, say N. + endif # PCCARD
drivers/pcmcia/Makefile +1 -0
@@ -35,6 +35,7 @@ obj-$(CONFIG_OMAP_CF) += omap_cf.o obj-$(CONFIG_ELECTRA_CF) += electra_cf.o obj-$(CONFIG_PCMCIA_ALCHEMY_DEVBOARD) += db1xxx_ss.o obj-$(CONFIG_PCMCIA_MAX1600) += max1600.o +obj-$(CONFIG_PCMCIA_GAYLE) += gayle.o sa1111_cs-y += sa1111_generic.o sa1111_cs-$(CONFIG_ASSABET_NEPONSET) += sa1111_neponset.o
drivers/pcmcia/gayle.c new file +307 -0
307 lines not on this page · raw message
Signature · 1 line
2.34.1
Paolo,
Am 27.10.2024 um 04:42 schrieb Paolo Pisati:
Quoted 9 lines
Hi there,
attached is a driver for the pcmcia side of C='s gayle - it's a WIP, as such there are many dev_dbg()/pr_err()/pr_dbg() scattered around, you've been warned.
It recognize all pcmcia cards i tried (IOW gayle's attribute space is read and parsed correctly), socket's interrupt work (IOW you can plug & unplug cards), but *it seems* any I/O read operation return bogus data (e.g.
0xffor0xfff).
Quoted 5 lines
Here's a dmesg dealing with with a 3Com 3c589 ethernet card:
http://dpaste.com//84TPTPLNV - notice the "hw_addrff:ff:ff:ff:ff:ff" or "exiting interrupt, status ffff".AFAIK inb()/inw() already add the
GAYLE_IOoffset (
Correct.
Quoted 2 lines
AG_ISA_IO_BandAG_ISA_IO_Winarch/m68k/include/asm/io_mm.h), and i didn't know if i could read directly (without anioremap()first), so i tried both cases:
AFAIK the Gayle MMIO region is already mapped in head.S, and does not need ioremap() at all.
Quoted 10 lines
1)
ioreamp()sock->phys_io, and subtract theGAYLE_IOoffset (seesock->socket.io_offset).or
2) set Amiga base IO port to
0x0and patch drivers/pcmcia/rsrc_mgr.c::static_find_io() (see https://dpaste.com//B75LTFF3V)In both case the 3c589_cs driver request an I/O aperture at
0x0300, large0x0010, receives it, but all read operations return0xffor0xffff.
Can you post your .config? I wonder whether the CONFIG_ATARI_ROM_ISA option is set, because that would mess up inb()/outb() for ports < 0x400.
Cheers,
Michael
Quoted 14 lines
Any idea? Any guess is welcome since i'm running out of ideas ATM.
Paolo Pisati (1):
pcmcia: gayle: initial supportarch/m68k/amiga/pcmcia.c | 5 + arch/m68k/amiga/platform.c | 29 +++ arch/m68k/include/asm/amipcmcia.h | 11 ++ drivers/pcmcia/Kconfig | 8 + drivers/pcmcia/Makefile | 1 + drivers/pcmcia/gayle.c | 307 ++++++++++++++++++++++++++++++ 6 files changed, 361 insertions(+) create mode 100644 drivers/pcmcia/gayle.c
Quoted 2 lines · Michael Schmitz
AFAIK the Gayle MMIO region is already mapped in
head.S, and does not needioremap()at all.
Uhm, ok.
Quoted 8 lines
Quoted 8 lines
1)
ioreamp()sock->phys_io, and subtract theGAYLE_IOoffset (seesock->socket.io_offset).or
2) set Amiga base IO port to
0x0and patch drivers/pcmcia/rsrc_mgr.c::static_find_io() (see https://dpaste.com//B75LTFF3V)
Quoted 6 lines
Quoted 2 lines
In both case the 3c589_cs driver request an I/O aperture at
0x0300, large0x0010, receives it, but all read operations return0xffor0xffff.Can you post your .config? I wonder whether the
CONFIG_ATARI_ROM_ISAoption is set, because that would mess up inb()/outb() for ports <0x400.
I cleaned up and made some progress, and now the first network card works: a Corega ethernet PCMCIA supported by pcnet_cs - the same card is already supported in the apne driver, though with the PCMCIA bridge, you get hot plugging too.
Unfortunately, other PCMCIA cards I tested still don't work (an Etherlink ethernet card, a CF adapter, a Ratoc serial card, and an 802.11 wifi card - all of them with varying degrees of "not working").
I should probably repost the cleaned up driver.
Signature · 2 lines
bye, p.