Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *	Adaptec AAC series RAID controller driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *	(c) Copyright 2001 Red Hat Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * based on the old aacraid driver that is..
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * Adaptec aacraid device driver for Linux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  * Copyright (c) 2000-2010 Adaptec, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  *               2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  *		 2016-2017 Microsemi Corp. (aacraid@microsemi.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  * Module Name:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  *  rkt.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  * Abstract: Hardware miniport for Drawbridge specific hardware functions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/blkdev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <scsi/scsi_host.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include "aacraid.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define AAC_NUM_IO_FIB_RKT      (246 - AAC_NUM_MGT_FIB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)  *	aac_rkt_select_comm	-	Select communications method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)  *	@dev: Adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)  *	@comm: communications method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) static int aac_rkt_select_comm(struct aac_dev *dev, int comm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	int retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	retval = aac_rx_select_comm(dev, comm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	if (comm == AAC_COMM_MESSAGE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 		 * FIB Setup has already been done, but we can minimize the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 		 * damage by at least ensuring the OS never issues more
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 		 * commands than we can handle. The Rocket adapters currently
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 		 * can only handle 246 commands and 8 AIFs at the same time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 		 * and in fact do notify us accordingly if we negotiate the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 		 * FIB size. The problem that causes us to add this check is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 		 * to ensure that we do not overdo it with the adapter when a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 		 * hard coded FIB override is being utilized. This special
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 		 * case warrants this half baked, but convenient, check here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 		if (dev->scsi_host_ptr->can_queue > AAC_NUM_IO_FIB_RKT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 			dev->init->r7.max_io_commands =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 				cpu_to_le32(AAC_NUM_IO_FIB_RKT + AAC_NUM_MGT_FIB);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 			dev->scsi_host_ptr->can_queue = AAC_NUM_IO_FIB_RKT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	return retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)  *	aac_rkt_ioremap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)  *	@dev: device to ioremap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)  *	@size: mapping resize request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) static int aac_rkt_ioremap(struct aac_dev * dev, u32 size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 	if (!size) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 		iounmap(dev->regs.rkt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	dev->base = dev->regs.rkt = ioremap(dev->base_start, size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	if (dev->base == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 		return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	dev->IndexRegs = &dev->regs.rkt->IndexRegs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)  *	aac_rkt_init	-	initialize an i960 based AAC card
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)  *	@dev: device to configure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)  *	Allocate and set up resources for the i960 based AAC variants. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)  *	device_interface in the commregion will be allocated and linked
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)  *	to the comm region.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) int aac_rkt_init(struct aac_dev *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) 	 *	Fill in the function dispatch table.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) 	dev->a_ops.adapter_ioremap = aac_rkt_ioremap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) 	dev->a_ops.adapter_comm = aac_rkt_select_comm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) 	return _aac_rx_init(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) }