2 * IR port driver for the Cirrus Logic EP7211 processor.
4 * Copyright 2001, Blue Mug Inc. All rights reserved.
5 * Copyright 2007, Samuel Ortiz <samuel@sortiz.org>
7 #include <linux/module.h>
8 #include <linux/delay.h>
10 #include <linux/init.h>
11 #include <linux/spinlock.h>
13 #include <net/irda/irda.h>
14 #include <net/irda/irda_device.h>
17 #include <mach/hardware.h>
21 #define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */
22 #define MAX_DELAY 10000 /* 1 ms */
24 static int ep7211_open(struct sir_dev
*dev
);
25 static int ep7211_close(struct sir_dev
*dev
);
26 static int ep7211_change_speed(struct sir_dev
*dev
, unsigned speed
);
27 static int ep7211_reset(struct sir_dev
*dev
);
29 static struct dongle_driver ep7211
= {
31 .driver_name
= "EP7211 IR driver",
32 .type
= IRDA_EP7211_DONGLE
,
34 .close
= ep7211_close
,
35 .reset
= ep7211_reset
,
36 .set_speed
= ep7211_change_speed
,
39 static int __init
ep7211_sir_init(void)
41 return irda_register_dongle(&ep7211
);
44 static void __exit
ep7211_sir_cleanup(void)
46 irda_unregister_dongle(&ep7211
);
49 static int ep7211_open(struct sir_dev
*dev
)
53 /* Turn on the SIR encoder. */
54 syscon
= clps_readl(SYSCON1
);
55 syscon
|= SYSCON1_SIREN
;
56 clps_writel(syscon
, SYSCON1
);
61 static int ep7211_close(struct sir_dev
*dev
)
65 /* Turn off the SIR encoder. */
66 syscon
= clps_readl(SYSCON1
);
67 syscon
&= ~SYSCON1_SIREN
;
68 clps_writel(syscon
, SYSCON1
);
73 static int ep7211_change_speed(struct sir_dev
*dev
, unsigned speed
)
78 static int ep7211_reset(struct sir_dev
*dev
)
83 MODULE_AUTHOR("Samuel Ortiz <samuel@sortiz.org>");
84 MODULE_DESCRIPTION("EP7211 IR dongle driver");
85 MODULE_LICENSE("GPL");
86 MODULE_ALIAS("irda-dongle-13"); /* IRDA_EP7211_DONGLE */
88 module_init(ep7211_sir_init
);
89 module_exit(ep7211_sir_cleanup
);