Release 4.8 drivers/parport/parport_amiga.c
/* Low-level parallel port routines for the Amiga built-in port
*
* Author: Joerg Dorchain <joerg@dorchain.net>
*
* This is a complete rewrite of the code, but based heaviy upon the old
* lp_intern. code.
*
* The built-in Amiga parallel port provides one port at a fixed address
* with 8 bidirectional data lines (D0 - D7) and 3 bidirectional status
* lines (BUSY, POUT, SEL), 1 output control line /STROBE (raised automatically
* in hardware when the data register is accessed), and 1 input control line
* /ACK, able to cause an interrupt, but both not directly settable by
* software.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/parport.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <asm/setup.h>
#include <asm/amigahw.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/amigaints.h>
#undef DEBUG
#ifdef DEBUG
#define DPRINTK printk
#else
#define DPRINTK(x...) do { } while (0)
#endif
static void amiga_write_data(struct parport *p, unsigned char data)
{
DPRINTK(KERN_DEBUG "write_data %c\n",data);
/* Triggers also /STROBE. This behavior cannot be changed */
ciaa.prb = data;
mb();
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 32 | 96.97% | 2 | 66.67% |
linus torvalds | linus torvalds | 1 | 3.03% | 1 | 33.33% |
| Total | 33 | 100.00% | 3 | 100.00% |
static unsigned char amiga_read_data(struct parport *p)
{
/* Triggers also /STROBE. This behavior cannot be changed */
return ciaa.prb;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 18 | 100.00% | 1 | 100.00% |
| Total | 18 | 100.00% | 1 | 100.00% |
static unsigned char control_amiga_to_pc(unsigned char control)
{
return PARPORT_CONTROL_SELECT |
PARPORT_CONTROL_AUTOFD | PARPORT_CONTROL_STROBE;
/* fake value: interrupt enable, select in, no reset,
no autolf, no strobe - seems to be closest the wiring diagram */
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 19 | 100.00% | 2 | 100.00% |
| Total | 19 | 100.00% | 2 | 100.00% |
static void amiga_write_control(struct parport *p, unsigned char control)
{
DPRINTK(KERN_DEBUG "write_control %02x\n",control);
/* No implementation possible */
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 23 | 95.83% | 1 | 50.00% |
linus torvalds | linus torvalds | 1 | 4.17% | 1 | 50.00% |
| Total | 24 | 100.00% | 2 | 100.00% |
static unsigned char amiga_read_control( struct parport *p)
{
DPRINTK(KERN_DEBUG "read_control \n");
return control_amiga_to_pc(0);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 23 | 95.83% | 1 | 50.00% |
linus torvalds | linus torvalds | 1 | 4.17% | 1 | 50.00% |
| Total | 24 | 100.00% | 2 | 100.00% |
static unsigned char amiga_frob_control( struct parport *p, unsigned char mask, unsigned char val)
{
unsigned char old;
DPRINTK(KERN_DEBUG "frob_control mask %02x, value %02x\n",mask,val);
old = amiga_read_control(p);
amiga_write_control(p, (old & ~mask) ^ val);
return old;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 57 | 98.28% | 1 | 50.00% |
linus torvalds | linus torvalds | 1 | 1.72% | 1 | 50.00% |
| Total | 58 | 100.00% | 2 | 100.00% |
static unsigned char status_amiga_to_pc(unsigned char status)
{
unsigned char ret = PARPORT_STATUS_BUSY | PARPORT_STATUS_ACK | PARPORT_STATUS_ERROR;
if (status & 1) /* Busy */
ret &= ~PARPORT_STATUS_BUSY;
if (status & 2) /* PaperOut */
ret |= PARPORT_STATUS_PAPEROUT;
if (status & 4) /* Selected */
ret |= PARPORT_STATUS_SELECT;
/* the rest is not connected or handled autonomously in hardware */
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 59 | 100.00% | 1 | 100.00% |
| Total | 59 | 100.00% | 1 | 100.00% |
static unsigned char amiga_read_status(struct parport *p)
{
unsigned char status;
status = status_amiga_to_pc(ciab.pra & 7);
DPRINTK(KERN_DEBUG "read_status %02x\n", status);
return status;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 37 | 97.37% | 1 | 50.00% |
linus torvalds | linus torvalds | 1 | 2.63% | 1 | 50.00% |
| Total | 38 | 100.00% | 2 | 100.00% |
static void amiga_enable_irq(struct parport *p)
{
enable_irq(IRQ_AMIGA_CIAA_FLG);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 16 | 100.00% | 1 | 100.00% |
| Total | 16 | 100.00% | 1 | 100.00% |
static void amiga_disable_irq(struct parport *p)
{
disable_irq(IRQ_AMIGA_CIAA_FLG);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 16 | 100.00% | 1 | 100.00% |
| Total | 16 | 100.00% | 1 | 100.00% |
static void amiga_data_forward(struct parport *p)
{
DPRINTK(KERN_DEBUG "forward\n");
ciaa.ddrb = 0xff; /* all pins output */
mb();
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 26 | 96.30% | 2 | 66.67% |
linus torvalds | linus torvalds | 1 | 3.70% | 1 | 33.33% |
| Total | 27 | 100.00% | 3 | 100.00% |
static void amiga_data_reverse(struct parport *p)
{
DPRINTK(KERN_DEBUG "reverse\n");
ciaa.ddrb = 0; /* all pins input */
mb();
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 26 | 96.30% | 2 | 66.67% |
linus torvalds | linus torvalds | 1 | 3.70% | 1 | 33.33% |
| Total | 27 | 100.00% | 3 | 100.00% |
static void amiga_init_state(struct pardevice *dev, struct parport_state *s)
{
s->u.amiga.data = 0;
s->u.amiga.datadir = 255;
s->u.amiga.status = 0;
s->u.amiga.statusdir = 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 56 | 100.00% | 2 | 100.00% |
| Total | 56 | 100.00% | 2 | 100.00% |
static void amiga_save_state(struct parport *p, struct parport_state *s)
{
mb();
s->u.amiga.data = ciaa.prb;
s->u.amiga.datadir = ciaa.ddrb;
s->u.amiga.status = ciab.pra & 7;
s->u.amiga.statusdir = ciab.ddra & 7;
mb();
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 74 | 100.00% | 2 | 100.00% |
| Total | 74 | 100.00% | 2 | 100.00% |
static void amiga_restore_state(struct parport *p, struct parport_state *s)
{
mb();
ciaa.prb = s->u.amiga.data;
ciaa.ddrb = s->u.amiga.datadir;
ciab.pra |= (ciab.pra & 0xf8) | s->u.amiga.status;
ciab.ddra |= (ciab.ddra & 0xf8) | s->u.amiga.statusdir;
mb();
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 86 | 100.00% | 2 | 100.00% |
| Total | 86 | 100.00% | 2 | 100.00% |
static struct parport_operations pp_amiga_ops = {
.write_data = amiga_write_data,
.read_data = amiga_read_data,
.write_control = amiga_write_control,
.read_control = amiga_read_control,
.frob_control = amiga_frob_control,
.read_status = amiga_read_status,
.enable_irq = amiga_enable_irq,
.disable_irq = amiga_disable_irq,
.data_forward = amiga_data_forward,
.data_reverse = amiga_data_reverse,
.init_state = amiga_init_state,
.save_state = amiga_save_state,
.restore_state = amiga_restore_state,
.epp_write_data = parport_ieee1284_epp_write_data,
.epp_read_data = parport_ieee1284_epp_read_data,
.epp_write_addr = parport_ieee1284_epp_write_addr,
.epp_read_addr = parport_ieee1284_epp_read_addr,
.ecp_write_data = parport_ieee1284_ecp_write_data,
.ecp_read_data = parport_ieee1284_ecp_read_data,
.ecp_write_addr = parport_ieee1284_ecp_write_addr,
.compat_write_data = parport_ieee1284_write_compat,
.nibble_read_data = parport_ieee1284_read_nibble,
.byte_read_data = parport_ieee1284_read_byte,
.owner = THIS_MODULE,
};
/* ----------- Initialisation code --------------------------------- */
static int __init amiga_parallel_probe(struct platform_device *pdev)
{
struct parport *p;
int err;
ciaa.ddrb = 0xff;
ciab.ddra &= 0xf8;
mb();
p = parport_register_port((unsigned long)&ciaa.prb, IRQ_AMIGA_CIAA_FLG,
PARPORT_DMA_NONE, &pp_amiga_ops);
if (!p)
return -EBUSY;
err = request_irq(IRQ_AMIGA_CIAA_FLG, parport_irq_handler, 0, p->name,
p);
if (err)
goto out_irq;
printk(KERN_INFO "%s: Amiga built-in port using irq\n", p->name);
/* XXX: set operating mode */
parport_announce_port(p);
platform_set_drvdata(pdev, p);
return 0;
out_irq:
parport_put_port(p);
return err;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 106 | 84.80% | 6 | 60.00% |
geert uytterhoeven | geert uytterhoeven | 16 | 12.80% | 1 | 10.00% |
al viro | al viro | 2 | 1.60% | 2 | 20.00% |
jeff garzik | jeff garzik | 1 | 0.80% | 1 | 10.00% |
| Total | 125 | 100.00% | 10 | 100.00% |
static int __exit amiga_parallel_remove(struct platform_device *pdev)
{
struct parport *port = platform_get_drvdata(pdev);
parport_remove_port(port);
if (port->irq != PARPORT_IRQ_NONE)
free_irq(IRQ_AMIGA_CIAA_FLG, port);
parport_put_port(port);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
geert uytterhoeven | geert uytterhoeven | 24 | 48.00% | 1 | 14.29% |
pre-git | pre-git | 20 | 40.00% | 4 | 57.14% |
al viro | al viro | 6 | 12.00% | 2 | 28.57% |
| Total | 50 | 100.00% | 7 | 100.00% |
static struct platform_driver amiga_parallel_driver = {
.remove = __exit_p(amiga_parallel_remove),
.driver = {
.name = "amiga-parallel",
},
};
module_platform_driver_probe(amiga_parallel_driver, amiga_parallel_probe);
MODULE_AUTHOR("Joerg Dorchain <joerg@dorchain.net>");
MODULE_DESCRIPTION("Parport Driver for Amiga builtin Port");
MODULE_SUPPORTED_DEVICE("Amiga builtin Parallel Port");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:amiga-parallel");
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 816 | 82.34% | 9 | 50.00% |
geert uytterhoeven | geert uytterhoeven | 79 | 7.97% | 2 | 11.11% |
alan cox | alan cox | 74 | 7.47% | 1 | 5.56% |
linus torvalds | linus torvalds | 12 | 1.21% | 2 | 11.11% |
al viro | al viro | 8 | 0.81% | 2 | 11.11% |
jeff garzik | jeff garzik | 1 | 0.10% | 1 | 5.56% |
fabio porcedda | fabio porcedda | 1 | 0.10% | 1 | 5.56% |
| Total | 991 | 100.00% | 18 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.