1 // SPDX-License-Identifier: GPL-2.0
3 * Support functions for the SH5 PCI hardware.
5 * Copyright (C) 2001 David J. Mckay (david.mckay@st.com)
6 * Copyright (C) 2003, 2004 Paul Mundt
7 * Copyright (C) 2004 Richard Curnow
9 #include <linux/kernel.h>
10 #include <linux/rwsem.h>
11 #include <linux/smp.h>
12 #include <linux/interrupt.h>
13 #include <linux/init.h>
14 #include <linux/errno.h>
15 #include <linux/pci.h>
16 #include <linux/delay.h>
17 #include <linux/types.h>
18 #include <linux/irq.h>
22 static int sh5pci_read(struct pci_bus
*bus
, unsigned int devfn
, int where
,
25 SH5PCI_WRITE(PAR
, CONFIG_CMD(bus
, devfn
, where
));
29 *val
= (u8
)SH5PCI_READ_BYTE(PDR
+ (where
& 3));
32 *val
= (u16
)SH5PCI_READ_SHORT(PDR
+ (where
& 2));
35 *val
= SH5PCI_READ(PDR
);
39 return PCIBIOS_SUCCESSFUL
;
42 static int sh5pci_write(struct pci_bus
*bus
, unsigned int devfn
, int where
,
45 SH5PCI_WRITE(PAR
, CONFIG_CMD(bus
, devfn
, where
));
49 SH5PCI_WRITE_BYTE(PDR
+ (where
& 3), (u8
)val
);
52 SH5PCI_WRITE_SHORT(PDR
+ (where
& 2), (u16
)val
);
55 SH5PCI_WRITE(PDR
, val
);
59 return PCIBIOS_SUCCESSFUL
;
62 struct pci_ops sh5_pci_ops
= {
64 .write
= sh5pci_write
,