mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 03:25:20 +07:00
74ba9207e1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 675 mass ave cambridge ma 02139 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 441 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc) Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190520071858.739733335@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
110 lines
2.9 KiB
C
110 lines
2.9 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
Mantis PCI bridge driver
|
|
|
|
Copyright (C) Manu Abraham (abraham.manu@gmail.com)
|
|
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/signal.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/interrupt.h>
|
|
#include <asm/io.h>
|
|
|
|
#include <media/dmxdev.h>
|
|
#include <media/dvbdev.h>
|
|
#include <media/dvb_demux.h>
|
|
#include <media/dvb_frontend.h>
|
|
#include <media/dvb_net.h>
|
|
|
|
#include "mantis_common.h"
|
|
#include "mantis_link.h" /* temporary due to physical layer stuff */
|
|
#include "mantis_reg.h"
|
|
|
|
/*
|
|
* If Slot state is already PLUG_IN event and we are called
|
|
* again, definitely it is jitter alone
|
|
*/
|
|
void mantis_event_cam_plugin(struct mantis_ca *ca)
|
|
{
|
|
struct mantis_pci *mantis = ca->ca_priv;
|
|
|
|
u32 gpif_irqcfg;
|
|
|
|
if (ca->slot_state == MODULE_XTRACTED) {
|
|
dprintk(MANTIS_DEBUG, 1, "Event: CAM Plugged IN: Adapter(%d) Slot(0)", mantis->num);
|
|
udelay(50);
|
|
mmwrite(0xda000000, MANTIS_CARD_RESET);
|
|
gpif_irqcfg = mmread(MANTIS_GPIF_IRQCFG);
|
|
gpif_irqcfg |= MANTIS_MASK_PLUGOUT;
|
|
gpif_irqcfg &= ~MANTIS_MASK_PLUGIN;
|
|
mmwrite(gpif_irqcfg, MANTIS_GPIF_IRQCFG);
|
|
udelay(500);
|
|
ca->slot_state = MODULE_INSERTED;
|
|
}
|
|
udelay(100);
|
|
}
|
|
|
|
/*
|
|
* If Slot state is already UN_PLUG event and we are called
|
|
* again, definitely it is jitter alone
|
|
*/
|
|
void mantis_event_cam_unplug(struct mantis_ca *ca)
|
|
{
|
|
struct mantis_pci *mantis = ca->ca_priv;
|
|
|
|
u32 gpif_irqcfg;
|
|
|
|
if (ca->slot_state == MODULE_INSERTED) {
|
|
dprintk(MANTIS_DEBUG, 1, "Event: CAM Unplugged: Adapter(%d) Slot(0)", mantis->num);
|
|
udelay(50);
|
|
mmwrite(0x00da0000, MANTIS_CARD_RESET);
|
|
gpif_irqcfg = mmread(MANTIS_GPIF_IRQCFG);
|
|
gpif_irqcfg |= MANTIS_MASK_PLUGIN;
|
|
gpif_irqcfg &= ~MANTIS_MASK_PLUGOUT;
|
|
mmwrite(gpif_irqcfg, MANTIS_GPIF_IRQCFG);
|
|
udelay(500);
|
|
ca->slot_state = MODULE_XTRACTED;
|
|
}
|
|
udelay(100);
|
|
}
|
|
|
|
int mantis_pcmcia_init(struct mantis_ca *ca)
|
|
{
|
|
struct mantis_pci *mantis = ca->ca_priv;
|
|
|
|
u32 gpif_stat, card_stat;
|
|
|
|
mantis_unmask_ints(mantis, MANTIS_INT_IRQ0);
|
|
gpif_stat = mmread(MANTIS_GPIF_STATUS);
|
|
card_stat = mmread(MANTIS_GPIF_IRQCFG);
|
|
|
|
if (gpif_stat & MANTIS_GPIF_DETSTAT) {
|
|
dprintk(MANTIS_DEBUG, 1, "CAM found on Adapter(%d) Slot(0)", mantis->num);
|
|
mmwrite(card_stat | MANTIS_MASK_PLUGOUT, MANTIS_GPIF_IRQCFG);
|
|
ca->slot_state = MODULE_INSERTED;
|
|
dvb_ca_en50221_camchange_irq(&ca->en50221,
|
|
0,
|
|
DVB_CA_EN50221_CAMCHANGE_INSERTED);
|
|
} else {
|
|
dprintk(MANTIS_DEBUG, 1, "Empty Slot on Adapter(%d) Slot(0)", mantis->num);
|
|
mmwrite(card_stat | MANTIS_MASK_PLUGIN, MANTIS_GPIF_IRQCFG);
|
|
ca->slot_state = MODULE_XTRACTED;
|
|
dvb_ca_en50221_camchange_irq(&ca->en50221,
|
|
0,
|
|
DVB_CA_EN50221_CAMCHANGE_REMOVED);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
void mantis_pcmcia_exit(struct mantis_ca *ca)
|
|
{
|
|
struct mantis_pci *mantis = ca->ca_priv;
|
|
|
|
mmwrite(mmread(MANTIS_GPIF_STATUS) & (~MANTIS_CARD_PLUGOUT | ~MANTIS_CARD_PLUGIN), MANTIS_GPIF_STATUS);
|
|
mantis_mask_ints(mantis, MANTIS_INT_IRQ0);
|
|
}
|