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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * BRIEF MODULE DESCRIPTION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *      Board specific pci fixups for the Toshiba rbtx4927
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Copyright 2001 MontaVista Software Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * Author: MontaVista Software, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  *              ppopov@mvista.com or source@mvista.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  * Copyright (C) 2000-2001 Toshiba Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  * Copyright (C) 2004 MontaVista Software Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  * Author: Manish Lachwani (mlachwani@mvista.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  *  This program is free software; you can redistribute  it and/or modify it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  *  under  the terms of  the GNU General  Public License as published by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  *  Free Software Foundation;  either version 2 of the  License, or (at your
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)  *  option) any later version.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)  *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)  *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)  *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)  *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)  *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)  *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)  *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)  *  You should have received a copy of the  GNU General Public License along
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)  *  with this program; if not, write  to the Free Software Foundation, Inc.,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)  *  675 Mass Ave, Cambridge, MA 02139, USA.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #include <asm/txx9/pci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #include <asm/txx9/rbtx4927.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) int rbtx4927_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	unsigned char irq = pin;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	/* IRQ rotation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	irq--;			/* 0-3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	if (slot == TX4927_PCIC_IDSEL_AD_TO_SLOT(23)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 		/* PCI CardSlot (IDSEL=A23) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 		/* PCIA => PCIA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 		irq = (irq + 0 + slot) % 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 		/* PCI Backplane */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 		if (txx9_pci_option & TXX9_PCI_OPT_PICMG)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 			irq = (irq + 33 - slot) % 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 			irq = (irq + 3 + slot) % 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	irq++;	/* 1-4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	switch (irq) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	case 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 		irq = RBTX4927_IRQ_IOC_PCIA;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	case 2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 		irq = RBTX4927_IRQ_IOC_PCIB;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	case 3:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 		irq = RBTX4927_IRQ_IOC_PCIC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 	case 4:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 		irq = RBTX4927_IRQ_IOC_PCID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	return irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) }