• Home
  • Raw
  • Download

Lines Matching refs:mp

115 static inline void bang_the_chip(struct myri_eth *mp)  in bang_the_chip()  argument
117 struct myri_shmem __iomem *shmem = mp->shmem; in bang_the_chip()
118 void __iomem *cregs = mp->cregs; in bang_the_chip()
124 static int myri_do_handshake(struct myri_eth *mp) in myri_do_handshake() argument
126 struct myri_shmem __iomem *shmem = mp->shmem; in myri_do_handshake()
127 void __iomem *cregs = mp->cregs; in myri_do_handshake()
137 myri_disable_irq(mp->lregs, cregs); in myri_do_handshake()
162 myri_enable_irq(mp->lregs, cregs); in myri_do_handshake()
172 static int __devinit myri_load_lanai(struct myri_eth *mp) in myri_load_lanai() argument
174 struct net_device *dev = mp->dev; in myri_load_lanai()
175 struct myri_shmem __iomem *shmem = mp->shmem; in myri_load_lanai()
179 myri_disable_irq(mp->lregs, mp->cregs); in myri_load_lanai()
180 myri_reset_on(mp->cregs); in myri_load_lanai()
182 rptr = mp->lanai; in myri_load_lanai()
183 for (i = 0; i < mp->eeprom.ramsz; i++) in myri_load_lanai()
186 if (mp->eeprom.cpuvers >= CPUVERS_3_0) in myri_load_lanai()
187 sbus_writel(mp->eeprom.cval, mp->lregs + LANAI_CVAL); in myri_load_lanai()
205 sbus_writel(((mp->myri_bursts & 0xf8) >> 3), &shmem->burst); in myri_load_lanai()
209 myri_disable_irq(mp->lregs, mp->cregs); in myri_load_lanai()
210 myri_reset_off(mp->lregs, mp->cregs); in myri_load_lanai()
211 myri_disable_irq(mp->lregs, mp->cregs); in myri_load_lanai()
224 i = myri_do_handshake(mp); in myri_load_lanai()
228 if (mp->eeprom.cpuvers == CPUVERS_4_0) in myri_load_lanai()
229 sbus_writel(0, mp->lregs + LANAI_VERS); in myri_load_lanai()
234 static void myri_clean_rings(struct myri_eth *mp) in myri_clean_rings() argument
236 struct sendq __iomem *sq = mp->sq; in myri_clean_rings()
237 struct recvq __iomem *rq = mp->rq; in myri_clean_rings()
243 if (mp->rx_skbs[i] != NULL) { in myri_clean_rings()
248 dma_unmap_single(&mp->myri_op->dev, dma_addr, in myri_clean_rings()
250 dev_kfree_skb(mp->rx_skbs[i]); in myri_clean_rings()
251 mp->rx_skbs[i] = NULL; in myri_clean_rings()
255 mp->tx_old = 0; in myri_clean_rings()
259 if (mp->tx_skbs[i] != NULL) { in myri_clean_rings()
260 struct sk_buff *skb = mp->tx_skbs[i]; in myri_clean_rings()
265 dma_unmap_single(&mp->myri_op->dev, dma_addr, in myri_clean_rings()
268 dev_kfree_skb(mp->tx_skbs[i]); in myri_clean_rings()
269 mp->tx_skbs[i] = NULL; in myri_clean_rings()
274 static void myri_init_rings(struct myri_eth *mp, int from_irq) in myri_init_rings() argument
276 struct recvq __iomem *rq = mp->rq; in myri_init_rings()
278 struct net_device *dev = mp->dev; in myri_init_rings()
285 myri_clean_rings(mp); in myri_init_rings()
292 mp->rx_skbs[i] = skb; in myri_init_rings()
296 dma_addr = dma_map_single(&mp->myri_op->dev, in myri_init_rings()
308 static int myri_init(struct myri_eth *mp, int from_irq) in myri_init() argument
310 myri_init_rings(mp, from_irq); in myri_init()
314 static void myri_is_not_so_happy(struct myri_eth *mp) in myri_is_not_so_happy() argument
336 static void myri_tx(struct myri_eth *mp, struct net_device *dev) in myri_tx() argument
338 struct sendq __iomem *sq= mp->sq; in myri_tx()
339 int entry = mp->tx_old; in myri_tx()
346 struct sk_buff *skb = mp->tx_skbs[entry]; in myri_tx()
351 dma_unmap_single(&mp->myri_op->dev, dma_addr, in myri_tx()
354 mp->tx_skbs[entry] = NULL; in myri_tx()
358 mp->tx_old = entry; in myri_tx()
405 static void myri_rx(struct myri_eth *mp, struct net_device *dev) in myri_rx() argument
407 struct recvq __iomem *rq = mp->rq; in myri_rx()
408 struct recvq __iomem *rqa = mp->rqack; in myri_rx()
424 struct sk_buff *skb = mp->rx_skbs[index]; in myri_rx()
431 dma_sync_single_for_cpu(&mp->myri_op->dev, in myri_rx()
450 dma_sync_single_for_device(&mp->myri_op->dev, in myri_rx()
472 dma_unmap_single(&mp->myri_op->dev, in myri_rx()
476 mp->rx_skbs[index] = new_skb; in myri_rx()
479 dma_addr = dma_map_single(&mp->myri_op->dev, in myri_rx()
508 dma_sync_single_for_device(&mp->myri_op->dev, in myri_rx()
539 struct myri_eth *mp = netdev_priv(dev); in myri_interrupt() local
540 void __iomem *lregs = mp->lregs; in myri_interrupt()
541 struct myri_channel __iomem *chan = &mp->shmem->channel; in myri_interrupt()
546 spin_lock_irqsave(&mp->irq_lock, flags); in myri_interrupt()
555 myri_disable_irq(lregs, mp->cregs); in myri_interrupt()
560 myri_is_not_so_happy(mp); in myri_interrupt()
563 myri_rx(mp, dev); in myri_interrupt()
567 myri_enable_irq(lregs, mp->cregs); in myri_interrupt()
571 spin_unlock_irqrestore(&mp->irq_lock, flags); in myri_interrupt()
578 struct myri_eth *mp = netdev_priv(dev); in myri_open() local
580 return myri_init(mp, in_interrupt()); in myri_open()
585 struct myri_eth *mp = netdev_priv(dev); in myri_close() local
587 myri_clean_rings(mp); in myri_close()
593 struct myri_eth *mp = netdev_priv(dev); in myri_tx_timeout() local
598 myri_init(mp, 0); in myri_tx_timeout()
604 struct myri_eth *mp = netdev_priv(dev); in myri_start_xmit() local
605 struct sendq __iomem *sq = mp->sq; in myri_start_xmit()
614 myri_tx(mp, dev); in myri_start_xmit()
627 spin_lock_irqsave(&mp->irq_lock, flags); in myri_start_xmit()
644 mp->tx_skbs[entry] = skb; in myri_start_xmit()
659 dma_addr = dma_map_single(&mp->myri_op->dev, skb->data, in myri_start_xmit()
671 bang_the_chip(mp); in myri_start_xmit()
675 spin_unlock_irqrestore(&mp->irq_lock, flags); in myri_start_xmit()
818 static inline void set_boardid_from_idprom(struct myri_eth *mp, int num) in set_boardid_from_idprom() argument
820 mp->eeprom.id[0] = 0; in set_boardid_from_idprom()
821 mp->eeprom.id[1] = idprom->id_machtype; in set_boardid_from_idprom()
822 mp->eeprom.id[2] = (idprom->id_sernum >> 16) & 0xff; in set_boardid_from_idprom()
823 mp->eeprom.id[3] = (idprom->id_sernum >> 8) & 0xff; in set_boardid_from_idprom()
824 mp->eeprom.id[4] = (idprom->id_sernum >> 0) & 0xff; in set_boardid_from_idprom()
825 mp->eeprom.id[5] = num; in set_boardid_from_idprom()
828 static inline void determine_reg_space_size(struct myri_eth *mp) in determine_reg_space_size() argument
830 switch(mp->eeprom.cpuvers) { in determine_reg_space_size()
835 mp->reg_size = (3 * 128 * 1024) + 4096; in determine_reg_space_size()
840 mp->reg_size = ((4096<<1) + mp->eeprom.ramsz); in determine_reg_space_size()
847 mp->eeprom.cpuvers); in determine_reg_space_size()
848 mp->reg_size = (3 * 128 * 1024) + 4096; in determine_reg_space_size()
853 static void dump_eeprom(struct myri_eth *mp) in dump_eeprom() argument
857 mp->eeprom.cval, mp->eeprom.cpuvers, in dump_eeprom()
858 mp->eeprom.id[0], mp->eeprom.id[1], mp->eeprom.id[2], in dump_eeprom()
859 mp->eeprom.id[3], mp->eeprom.id[4], mp->eeprom.id[5]); in dump_eeprom()
860 printk("EEPROM: ramsz[%08x]\n", mp->eeprom.ramsz); in dump_eeprom()
862 mp->eeprom.fvers[0], mp->eeprom.fvers[1], mp->eeprom.fvers[2], in dump_eeprom()
863 mp->eeprom.fvers[3], mp->eeprom.fvers[4], mp->eeprom.fvers[5], in dump_eeprom()
864 mp->eeprom.fvers[6], mp->eeprom.fvers[7]); in dump_eeprom()
866 mp->eeprom.fvers[8], mp->eeprom.fvers[9], mp->eeprom.fvers[10], in dump_eeprom()
867 mp->eeprom.fvers[11], mp->eeprom.fvers[12], mp->eeprom.fvers[13], in dump_eeprom()
868 mp->eeprom.fvers[14], mp->eeprom.fvers[15]); in dump_eeprom()
870 mp->eeprom.fvers[16], mp->eeprom.fvers[17], mp->eeprom.fvers[18], in dump_eeprom()
871 mp->eeprom.fvers[19], mp->eeprom.fvers[20], mp->eeprom.fvers[21], in dump_eeprom()
872 mp->eeprom.fvers[22], mp->eeprom.fvers[23]); in dump_eeprom()
874 mp->eeprom.fvers[24], mp->eeprom.fvers[25], mp->eeprom.fvers[26], in dump_eeprom()
875 mp->eeprom.fvers[27], mp->eeprom.fvers[28], mp->eeprom.fvers[29], in dump_eeprom()
876 mp->eeprom.fvers[30], mp->eeprom.fvers[31]); in dump_eeprom()
878 mp->eeprom.mvers[0], mp->eeprom.mvers[1], mp->eeprom.mvers[2], in dump_eeprom()
879 mp->eeprom.mvers[3], mp->eeprom.mvers[4], mp->eeprom.mvers[5], in dump_eeprom()
880 mp->eeprom.mvers[6], mp->eeprom.mvers[7]); in dump_eeprom()
882 mp->eeprom.mvers[8], mp->eeprom.mvers[9], mp->eeprom.mvers[10], in dump_eeprom()
883 mp->eeprom.mvers[11], mp->eeprom.mvers[12], mp->eeprom.mvers[13], in dump_eeprom()
884 mp->eeprom.mvers[14], mp->eeprom.mvers[15]); in dump_eeprom()
886 mp->eeprom.dlval, mp->eeprom.brd_type, mp->eeprom.bus_type, in dump_eeprom()
887 mp->eeprom.prod_code); in dump_eeprom()
888 printk("EEPROM: serial_num[%08x]\n", mp->eeprom.serial_num); in dump_eeprom()
904 struct myri_eth *mp; in myri_sbus_probe() local
919 mp = netdev_priv(dev); in myri_sbus_probe()
920 spin_lock_init(&mp->irq_lock); in myri_sbus_probe()
921 mp->myri_op = op; in myri_sbus_probe()
925 mp->rx_skbs[i] = NULL; in myri_sbus_probe()
928 mp->tx_skbs[i] = NULL; in myri_sbus_probe()
934 memcpy(&mp->eeprom, prop, sizeof(struct myri_eeprom)); in myri_sbus_probe()
938 mp->eeprom.bus_type = BUS_TYPE_SBUS; in myri_sbus_probe()
939 mp->eeprom.cpuvers = in myri_sbus_probe()
941 mp->eeprom.cval = in myri_sbus_probe()
943 mp->eeprom.ramsz = of_getintprop_default(dp, "sram_size", 0); in myri_sbus_probe()
944 if (!mp->eeprom.cpuvers) in myri_sbus_probe()
945 mp->eeprom.cpuvers = CPUVERS_2_3; in myri_sbus_probe()
946 if (mp->eeprom.cpuvers < CPUVERS_3_0) in myri_sbus_probe()
947 mp->eeprom.cval = 0; in myri_sbus_probe()
948 if (!mp->eeprom.ramsz) in myri_sbus_probe()
949 mp->eeprom.ramsz = (128 * 1024); in myri_sbus_probe()
953 memcpy(&mp->eeprom.id[0], prop, 6); in myri_sbus_probe()
955 set_boardid_from_idprom(mp, num); in myri_sbus_probe()
959 memcpy(&mp->eeprom.fvers[0], prop, 32); in myri_sbus_probe()
961 memset(&mp->eeprom.fvers[0], 0, 32); in myri_sbus_probe()
963 if (mp->eeprom.cpuvers == CPUVERS_4_1) { in myri_sbus_probe()
964 if (mp->eeprom.ramsz == (128 * 1024)) in myri_sbus_probe()
965 mp->eeprom.ramsz = (256 * 1024); in myri_sbus_probe()
966 if ((mp->eeprom.cval == 0x40414041) || in myri_sbus_probe()
967 (mp->eeprom.cval == 0x90449044)) in myri_sbus_probe()
968 mp->eeprom.cval = 0x50e450e4; in myri_sbus_probe()
972 dump_eeprom(mp); in myri_sbus_probe()
976 dev->dev_addr[i] = mp->eeprom.id[i]; in myri_sbus_probe()
978 determine_reg_space_size(mp); in myri_sbus_probe()
981 if (mp->eeprom.cpuvers < CPUVERS_4_0) { in myri_sbus_probe()
987 mp->regs = of_ioremap(&op->resource[0], 0, in myri_sbus_probe()
988 mp->reg_size, "MyriCOM Regs"); in myri_sbus_probe()
989 if (!mp->regs) { in myri_sbus_probe()
993 mp->lanai = mp->regs + (256 * 1024); in myri_sbus_probe()
994 mp->lregs = mp->lanai + (0x10000 * 2); in myri_sbus_probe()
997 mp->cregs = of_ioremap(&op->resource[0], 0, in myri_sbus_probe()
999 mp->lregs = of_ioremap(&op->resource[0], (256 * 1024), in myri_sbus_probe()
1001 mp->lanai = of_ioremap(&op->resource[0], (512 * 1024), in myri_sbus_probe()
1002 mp->eeprom.ramsz, "MyriCOM SRAM"); in myri_sbus_probe()
1005 mp->cregs, mp->lregs, mp->lanai)); in myri_sbus_probe()
1007 if (mp->eeprom.cpuvers >= CPUVERS_4_0) in myri_sbus_probe()
1008 mp->shmem_base = 0xf000; in myri_sbus_probe()
1010 mp->shmem_base = 0x8000; in myri_sbus_probe()
1012 DET(("Shared memory base is %04x, ", mp->shmem_base)); in myri_sbus_probe()
1014 mp->shmem = (struct myri_shmem __iomem *) in myri_sbus_probe()
1015 (mp->lanai + (mp->shmem_base * 2)); in myri_sbus_probe()
1016 DET(("shmem mapped at %p\n", mp->shmem)); in myri_sbus_probe()
1018 mp->rqack = &mp->shmem->channel.recvqa; in myri_sbus_probe()
1019 mp->rq = &mp->shmem->channel.recvq; in myri_sbus_probe()
1020 mp->sq = &mp->shmem->channel.sendq; in myri_sbus_probe()
1024 myri_reset_off(mp->lregs, mp->cregs); in myri_sbus_probe()
1025 myri_reset_on(mp->cregs); in myri_sbus_probe()
1028 myri_disable_irq(mp->lregs, mp->cregs); in myri_sbus_probe()
1031 myri_reset_on(mp->cregs); in myri_sbus_probe()
1034 mp->myri_bursts = of_getintprop_default(dp->parent, in myri_sbus_probe()
1037 mp->myri_bursts &= ~(DMA_BURST64); in myri_sbus_probe()
1039 DET(("MYRI bursts %02x\n", mp->myri_bursts)); in myri_sbus_probe()
1048 sbus_writel((1 << i), mp->cregs + MYRICTRL_IRQLVL); in myri_sbus_probe()
1050 mp->dev = dev; in myri_sbus_probe()
1075 myri_load_lanai(mp); in myri_sbus_probe()
1082 dev_set_drvdata(&op->dev, mp); in myri_sbus_probe()
1101 struct myri_eth *mp = dev_get_drvdata(&op->dev); in myri_sbus_remove() local
1102 struct net_device *net_dev = mp->dev; in myri_sbus_remove()
1108 if (mp->eeprom.cpuvers < CPUVERS_4_0) { in myri_sbus_remove()
1109 of_iounmap(&op->resource[0], mp->regs, mp->reg_size); in myri_sbus_remove()
1111 of_iounmap(&op->resource[0], mp->cregs, PAGE_SIZE); in myri_sbus_remove()
1112 of_iounmap(&op->resource[0], mp->lregs, (256 * 1024)); in myri_sbus_remove()
1113 of_iounmap(&op->resource[0], mp->lanai, (512 * 1024)); in myri_sbus_remove()