1239eab19SMark Haverkamp /* 2239eab19SMark Haverkamp * Adaptec AAC series RAID controller driver 3239eab19SMark Haverkamp * 4239eab19SMark Haverkamp * based on the old aacraid driver that is.. 5239eab19SMark Haverkamp * Adaptec aacraid device driver for Linux. 6239eab19SMark Haverkamp * 7e8b12f0fSMahesh Rajashekhara * Copyright (c) 2000-2010 Adaptec, Inc. 8*f4babba0SRaghava Aditya Renukunta * 2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com) 9*f4babba0SRaghava Aditya Renukunta * 2016-2017 Microsemi Corp. (aacraid@microsemi.com) 10239eab19SMark Haverkamp * 11239eab19SMark Haverkamp * This program is free software; you can redistribute it and/or modify 12239eab19SMark Haverkamp * it under the terms of the GNU General Public License as published by 13239eab19SMark Haverkamp * the Free Software Foundation; either version 2, or (at your option) 14239eab19SMark Haverkamp * any later version. 15239eab19SMark Haverkamp * 16239eab19SMark Haverkamp * This program is distributed in the hope that it will be useful, 17239eab19SMark Haverkamp * but WITHOUT ANY WARRANTY; without even the implied warranty of 18239eab19SMark Haverkamp * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19239eab19SMark Haverkamp * GNU General Public License for more details. 20239eab19SMark Haverkamp * 21239eab19SMark Haverkamp * You should have received a copy of the GNU General Public License 22239eab19SMark Haverkamp * along with this program; see the file COPYING. If not, write to 23239eab19SMark Haverkamp * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 24239eab19SMark Haverkamp * 25239eab19SMark Haverkamp * Module Name: 26239eab19SMark Haverkamp * nark.c 27239eab19SMark Haverkamp * 28239eab19SMark Haverkamp * Abstract: Hardware Device Interface for NEMER/ARK 29239eab19SMark Haverkamp * 30239eab19SMark Haverkamp */ 31239eab19SMark Haverkamp 32239eab19SMark Haverkamp #include <linux/pci.h> 33239eab19SMark Haverkamp #include <linux/blkdev.h> 34239eab19SMark Haverkamp 35239eab19SMark Haverkamp #include <scsi/scsi_host.h> 36239eab19SMark Haverkamp 37239eab19SMark Haverkamp #include "aacraid.h" 38239eab19SMark Haverkamp 39239eab19SMark Haverkamp /** 40239eab19SMark Haverkamp * aac_nark_ioremap 41239eab19SMark Haverkamp * @size: mapping resize request 42239eab19SMark Haverkamp * 43239eab19SMark Haverkamp */ 44239eab19SMark Haverkamp static int aac_nark_ioremap(struct aac_dev * dev, u32 size) 45239eab19SMark Haverkamp { 46239eab19SMark Haverkamp if (!size) { 47239eab19SMark Haverkamp iounmap(dev->regs.rx); 48239eab19SMark Haverkamp dev->regs.rx = NULL; 49239eab19SMark Haverkamp iounmap(dev->base); 50239eab19SMark Haverkamp dev->base = NULL; 51239eab19SMark Haverkamp return 0; 52239eab19SMark Haverkamp } 53ff08784bSBen Collins dev->base_start = pci_resource_start(dev->pdev, 2); 54239eab19SMark Haverkamp dev->regs.rx = ioremap((u64)pci_resource_start(dev->pdev, 0) | 55239eab19SMark Haverkamp ((u64)pci_resource_start(dev->pdev, 1) << 32), 56239eab19SMark Haverkamp sizeof(struct rx_registers) - sizeof(struct rx_inbound)); 57239eab19SMark Haverkamp dev->base = NULL; 58239eab19SMark Haverkamp if (dev->regs.rx == NULL) 59239eab19SMark Haverkamp return -1; 60ff08784bSBen Collins dev->base = ioremap(dev->base_start, size); 61239eab19SMark Haverkamp if (dev->base == NULL) { 62239eab19SMark Haverkamp iounmap(dev->regs.rx); 63239eab19SMark Haverkamp dev->regs.rx = NULL; 64239eab19SMark Haverkamp return -1; 65239eab19SMark Haverkamp } 66239eab19SMark Haverkamp dev->IndexRegs = &((struct rx_registers __iomem *)dev->base)->IndexRegs; 67239eab19SMark Haverkamp return 0; 68239eab19SMark Haverkamp } 69239eab19SMark Haverkamp 70239eab19SMark Haverkamp /** 71239eab19SMark Haverkamp * aac_nark_init - initialize an NEMER/ARK Split Bar card 72239eab19SMark Haverkamp * @dev: device to configure 73239eab19SMark Haverkamp * 74239eab19SMark Haverkamp */ 75239eab19SMark Haverkamp 76239eab19SMark Haverkamp int aac_nark_init(struct aac_dev * dev) 77239eab19SMark Haverkamp { 78239eab19SMark Haverkamp /* 79239eab19SMark Haverkamp * Fill in the function dispatch table. 80239eab19SMark Haverkamp */ 81239eab19SMark Haverkamp dev->a_ops.adapter_ioremap = aac_nark_ioremap; 82239eab19SMark Haverkamp dev->a_ops.adapter_comm = aac_rx_select_comm; 83239eab19SMark Haverkamp 84239eab19SMark Haverkamp return _aac_rx_init(dev); 85239eab19SMark Haverkamp } 86