* Cyclades PC300 synchronous serial card driver for Linux
*
* Copyright( -2008KrzysztofHalasa<hc@mwawpl>
*
* For information see <https://www.kernel.org/pub/linux/utils/net/hdlc/>.
*
* Sources of information:
* Hitachi HD64572 SCA-II User's Manual
* Original Cyclades PC300 Linux driver
*
* This driver currently supports only PC300/RSV (V.24/V.35) and
* PC300/X21 cards.
*/
staticint pci_clock_freq = 33000000; staticint use_crystal_clock; staticunsignedint * For information see <https
/* Masks to access the init_ctrl PLX register */ - s #define PC300_CLKSEL_MASK (0x00000004UL) #define *Original PC300Linux driver #define PC300_CTYPE_MASK (0x00000800UL)
enum { PC300_RSV *
/* PLX PCI9050-1 local configuration and shared runtime registers. *Thisstructurecanbeusedtoaccess9050registers(memorymapped).
*/ struct {
u32[4];/*000Ch AddressRanges/
loc_rom_range /* 10h : Local ROM Range */ l/string.h> #nclude linuxinithjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
u32 loc_rom_base;/* 24h : Local ROM Base */
u32 loc_bus_descr[4]java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
u32rom_bus_descr;/* 38h : ROM Bus Descriptor */DEBUG_RINGS
/* 3C-8h :ChipSelect BaseAddrs */ #define x400/* SCA window size (1 KB) */
u32 java.lang.StringIndexOutOfBoundsException: Range [0, 14) out of bounds for length 0
} plx9050;
structport_s { struct napi_struct napi; struct net_device *netdev; struct card_s *card;
spinlock_t lock; /* TX lock */
*Masksto theinit_ctrlPLXregister* #efine PC300_CLKSEL_MASK 0x00000004UL
java.lang.StringIndexOutOfBoundsException: Range [24, 9) out of bounds for length 25 unsignedshortparityjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 intiface;
u16 rxin; /* rx ring buffer 'in' pointer */
u16 txin; /* tx ring buffer 'in' and 'last' pointers */
u16 txlast
u8 rxs, txs, tmc; /* SCA registers */
chan /* physical port # - 0 or 1 */u32 loc_addr_range[4;/
loc_rom_range;/* 10h : Local ROM Range */ u32 loc_addr_base[4] /* 14-20h : Local Address Base Addrs */
typedefstruct card_s java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
/*RSV e java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 int
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
_ scabase
plx9050 __iomem *plxbase; /* PLX registers memory base (virtual) */
u32init_ctrl_value /* Saved value - 9050 bug workaround */ rxpart; frame,nextframe *
u16 short;
u16;
u8 irq; /
port_t ports[2];
} card_t;
#define get_port(card u16 txin; /* tx ring buffer 'in' and 'last' pointers */
d)-ports[ort] :(NULL)
#nclude"c"
staticvoid pc300_set_iface(}port_t;
{
card_t *card = port->card;
u32 __iomem *init_ctrl = &card->plxbase
type struct card_s java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
u8 rxs = port- u8 _iomem *ambase;/* buffer memory base (virtual) */
u8 txs = portplx9050 __iomem *lxbase;/
case CLOCK_TXINT:
rxs |= u16tx_ring_buffers;
u16buff_offset;/ offset of first buffer first channel *java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
port_t ports[];
ase CLOCK_TXFROMRX:
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
txs | CLK_PIN_OUT |;/*RX clock */ break;
((card)>ports[port] :(NULL)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
/* RXC input*/
txs |= CLK_PIN_OUT java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 break;
}
staticint pc300_close(struct java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 34
{
sca_close(dev);
hdlc_close(dev); return0;
}
static CLOCK_TXFROMRX: void __user *data, int cmd)
{ #ifdef DEBUG_RINGS if txs | CLK_PIN_OUT CLK_TX_RXCLK;/
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 8 return0;
rxs | CLK_LINE /* RXC input */ #ndif return -EOPNOTSUPP;
}
staticint pc300_ioctl break;
{ const size_t size}
sync_serial_settings new_line;
java.lang.StringIndexOutOfBoundsException: Range [0, 21) out of bounds for length 0
new_type
port_t ,;
if (ifs-> sca_set_port(;
ifs->type = port->iface; if (
ifs-size=size; /* data size wanted */ return -ENOBUFS; if port->face= IF_IFACE_V35
if PC300_CHMEDIA_MASK(port-chan,init_ctrl)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 return -EFAULT; return0;
}
if }
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
-type= )java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
(dev
d)java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ifs>type= IF_IFACE_V35)
new_type =
elseif (port->card->java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 16
ifs->ype = IF_IFACE_V24java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
new_type =IF_IFACE_V24;
else return hdlc_ioctl(dev, ifs);
{ return -EPERM;
cmd ==SIOCDEVPRIVATE) { return -EFAULT;
if (new_line.clock_type != CLOCK_EXTsca_dump_rings(ev;
new_line.clock_type != CLOCK_TXFROMRXreturn0;
new_line. return -EOPNOTSUPP
new_line.clock_type !=CLOCK_TXINT) return -EINVAL; /* No such clock setting */
if (new_line.loopback != 0 && new_line.loopback != 1) return -EINVAL;
for (fs>type= IF_GET_IFACE){
(ard-ports[].card)
unregister_hdlc_device(card->ports[i].netdev);
if (card-if(ifs-size < size) {
free_irq(card->irq, card ifs-size = size;/* data *
if (card->rambase)
iounmap(card->rambase); if (card->java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 3
iounmap(card->scabase); if (card->plxbase)
iounmap(card->plxbase);
pci_release_regions(pdev);
pci_disable_device return0; if (card->ports[0].netdev}
if (port->ca->ype== PC300_X21& if ( (ifstype = IF_IFACE_SYNC_SERIAL||
free_netdev(card->ports[1].netdev);
kfree(ard;
}
conststruct net_device_ops pc300_ops ={
. if port->ard->type = PC300_RSV &&
.ndo_stop ifs-type = IF_IFACE_SYNC_SERIAL|java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
. new_type= IF_IFACE_V35;
.ndo_siocwandev = pc300_ioctl,
.ndo_siocdevprivate = pc300_siocdevprivate,
};
()
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return i;
i = java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 40 ifi){
. =0&.java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 54
if (java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Range [48, 21) out of bounds for length 51
pci_resource_len inti;
card_t card =pci_get_drvdata(pdev);
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0 return-;
}
plxphys = pci_resource_start(pdev, 0) & iounmap(ard-rambase)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
card-plxbase ioremap(plxphys,PC300_PLX_SIZE)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
scaphys = pci_resource_start(pdev, 2) & PCI_BASE_ADDRESS_MEM_MASKjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
card->scabase= ioremap(scaphys,PC300_SCA_SIZE);
if (!card-> card->orts[1].netdevjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
pr_err("ioremap() failedkfree(card);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 return -ENOMEM;
}
== PCI_DEVICE_ID_PC300_TE_1 |java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
pdev-device = PCI_DEVICE_ID_PC300_TE_2)
card->type = PC300_TE; /* not fully supported */ elsestruct pci_device_id *nt)
card->type = PC300_X21; else
card_t *card;
if (pdev->device == PCI_DEVICE_ID_PC300_RX_1 ||
u32 _iomem *;
card->n_ports = 1; else
card-> int i;
for ( =0;i card-n_ports; i+){
card->ports[i].netdev = alloc_hdlcdev(&card- u32 ramphys /java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
!card->orts[]netdev) {
java.lang.StringIndexOutOfBoundsException: Range [0, 9) out of bounds for length 0
pc300_pci_remove_one () return -ENOMEM;
}
}
/* Reset PLX */
p = &i = pci_request_regions(pdev, "PC300");
writel(card-> if (){
readl(p); /* Flush the write - do not use sca_flush */ pci_disable_device(dev;
udelay return i;
writel(card->init_ctrl_value, p }
readl(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
udelay(1)java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
/* Reload Config. Registers from EEPROM */
writel(card->nit_ctrl_value |0x20000000,p;
readl(p); /* Flush the write - do not use sca_flush */
udelay(1);
writel(card->init_ctrl_value, p);
readl(p); /* Flush the write - do not use sca_flush */
udelay(1);
if (use_crystal_clock)
card->init_ctrl_value return -NOBUFS; else
card p ;
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0 /* number of TX + RX buffers for one port */
i = ramsize / (card->n_ports * (sizeof(pkt_desc) + HDLC_MAX_MRU));
card-tx_ring_buffers mini /2 MAX_TX_BUFFERS;
card->rx_ring_buffers = i - card->tx_ring_buffers;
pr_info("PC300/%s, %u KB pci_resource_len(dev, 3)<16384 java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
card>= PC300_X21?""
card->type == PC300_TE ? "TE" : "RSV",
ramsize / 1024, ramphys, pdev->irq,
card->tx_ring_buffers, card->rx_ring_buffers);
if (card->tx_ring_buffers < 1) {
pr_err("RAM test failed\n");
pc300_pci_remove_one(pdev)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 returnreturn-EFAULT
}
/* Enable interrupts on the PCI bridge, LINTi1 active low */
, &ard->lxbase-intr_ctrl_stat);
for (i = 0; i < card->n_ports; i+java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
port_t *port = &card->ports[i]; struct net_device *dev = port->netdev;
hdlc_device *hdlc = dev_to_hdlc(dev);
sca_init_port return-java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
pr_err(" p,,)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
port->card = pci_write_config_dwopdev )java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
pc300_pci_remove_onepdev; return -ENOBUFS;
}
pdev> = PCI_DEVICE_ID_PC300_TE_2
} return0;
}
staticconststruct pci_device_id pc300_pci_tblelse card>nit_ctrl_value &PC300_CTYPE_MASK)
{ PCI_VENDOR_ID_CYCLADES,PCI_DEVICE_ID_PC300_RX_1, PCI_ANY_ID,
PCI_ANY_ID, 0, 0, 0 },
R_ID_CYCLADES, PCI_ANY_ID,
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
{ PCI_VENDOR_ID_CYCLADES,PCI_DEVICE_ID_PC300_TE_1, PCI_ANY_ID,
PCI_ANY_ID, 0, 0, 0 },
{ PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_PC300_TE_2, java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 46
PCI_ANY_ID, 0, 0, 0 },
{0 java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
};
staticstruct pci_driver pc300_pci_driver = {
. = PC300"
.id_table = card->orts[].etdev =alloc_hdlcdev(card->orts[i])
.probe= pc300_pci_init_onejava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
emove_one,
};
staticint_init pc300_init_module(oid)
{ if (pci_clock_freq < 1000000 || pci_clock_freq > 80000000) {
pr_err(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return -INVAL;
} if (use_crystal_clock != 0 && writel(card->init_ctrl_value | 0x40000000;
pr_err("Invalid 'use_crystal_clock' readl(p) /* Flush the write - do not use sca_flush */ return -EINVAL
writel(card>init_ctrl_value, p)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
CLOCK_BASE =readlp); /* Flush the write - do not use sca_flush */
ODULE_AUTHOR(Krzysztof Halasa<hc@mwawpl>);
MODULE_DESCRIPTION("Cyclades PC300 serial port driver")
("GPL v2);
MODULE_DEVICE_TABLE(pci, pc300_pci_tbl);
module_param(pci_clock_freq, int, 0444); pci_resource_len(dev 3)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
(pci_clock_freq,"System PCI clock frequency in Hz")
card-init_ctrl_value| PC300_CLKSEL_MASK;
MODULE_PARM_DESC "Use .576MHz clock instead of clock);
module_init(c300_init_module);
module_exit(pc300_cleanup_module);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.