123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- /*
- * linux/arch/arm/mach-sa1100/neponset.c
- */
- #include <linux/err.h>
- #include <linux/init.h>
- #include <linux/ioport.h>
- #include <linux/irq.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/platform_data/sa11x0-serial.h>
- #include <linux/platform_device.h>
- #include <linux/pm.h>
- #include <linux/serial_core.h>
- #include <linux/slab.h>
- #include <asm/mach-types.h>
- #include <asm/mach/map.h>
- #include <asm/hardware/sa1111.h>
- #include <asm/sizes.h>
- #include <mach/hardware.h>
- #include <mach/assabet.h>
- #include <mach/neponset.h>
- #include <mach/irqs.h>
- #define NEP_IRQ_SMC91X 0
- #define NEP_IRQ_USAR 1
- #define NEP_IRQ_SA1111 2
- #define NEP_IRQ_NR 3
- #define WHOAMI 0x00
- #define LEDS 0x10
- #define SWPK 0x20
- #define IRR 0x24
- #define KP_Y_IN 0x80
- #define KP_X_OUT 0x90
- #define NCR_0 0xa0
- #define MDM_CTL_0 0xb0
- #define MDM_CTL_1 0xb4
- #define AUD_CTL 0xc0
- #define IRR_ETHERNET (1 << 0)
- #define IRR_USAR (1 << 1)
- #define IRR_SA1111 (1 << 2)
- #define MDM_CTL0_RTS1 (1 << 0)
- #define MDM_CTL0_DTR1 (1 << 1)
- #define MDM_CTL0_RTS2 (1 << 2)
- #define MDM_CTL0_DTR2 (1 << 3)
- #define MDM_CTL1_CTS1 (1 << 0)
- #define MDM_CTL1_DSR1 (1 << 1)
- #define MDM_CTL1_DCD1 (1 << 2)
- #define MDM_CTL1_CTS2 (1 << 3)
- #define MDM_CTL1_DSR2 (1 << 4)
- #define MDM_CTL1_DCD2 (1 << 5)
- #define AUD_SEL_1341 (1 << 0)
- #define AUD_MUTE_1341 (1 << 1)
- extern void sa1110_mb_disable(void);
- struct neponset_drvdata {
- void __iomem *base;
- struct platform_device *sa1111;
- struct platform_device *smc91x;
- unsigned irq_base;
- #ifdef CONFIG_PM_SLEEP
- u32 ncr0;
- u32 mdm_ctl_0;
- #endif
- };
- static void __iomem *nep_base;
- void neponset_ncr_frob(unsigned int mask, unsigned int val)
- {
- void __iomem *base = nep_base;
- if (base) {
- unsigned long flags;
- unsigned v;
- local_irq_save(flags);
- v = readb_relaxed(base + NCR_0);
- writeb_relaxed((v & ~mask) | val, base + NCR_0);
- local_irq_restore(flags);
- } else {
- WARN(1, "nep_base unset\n");
- }
- }
- EXPORT_SYMBOL(neponset_ncr_frob);
- static void neponset_set_mctrl(struct uart_port *port, u_int mctrl)
- {
- void __iomem *base = nep_base;
- u_int mdm_ctl0;
- if (!base)
- return;
- mdm_ctl0 = readb_relaxed(base + MDM_CTL_0);
- if (port->mapbase == _Ser1UTCR0) {
- if (mctrl & TIOCM_RTS)
- mdm_ctl0 &= ~MDM_CTL0_RTS2;
- else
- mdm_ctl0 |= MDM_CTL0_RTS2;
- if (mctrl & TIOCM_DTR)
- mdm_ctl0 &= ~MDM_CTL0_DTR2;
- else
- mdm_ctl0 |= MDM_CTL0_DTR2;
- } else if (port->mapbase == _Ser3UTCR0) {
- if (mctrl & TIOCM_RTS)
- mdm_ctl0 &= ~MDM_CTL0_RTS1;
- else
- mdm_ctl0 |= MDM_CTL0_RTS1;
- if (mctrl & TIOCM_DTR)
- mdm_ctl0 &= ~MDM_CTL0_DTR1;
|