Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Yusuke Goda | 1a2334a | 2008-03-05 14:30:02 +0900 | [diff] [blame] | 2 | /* |
| 3 | * SH4 PCI Controller (PCIC) for U-Boot. |
| 4 | * (C) Dustin McIntire (dustin@sensoria.com) |
Nobuhiro Iwamatsu | ab8f4d4 | 2008-03-24 02:11:26 +0900 | [diff] [blame] | 5 | * (C) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> |
Yusuke Goda | 1a2334a | 2008-03-05 14:30:02 +0900 | [diff] [blame] | 6 | * (C) 2008 Yusuke Goda <goda.yusuke@renesas.com> |
| 7 | * |
Peter Tyser | 8f0fec7 | 2010-04-12 22:28:10 -0500 | [diff] [blame] | 8 | * u-boot/arch/sh/cpu/sh4/pci-sh4.c |
Yusuke Goda | 1a2334a | 2008-03-05 14:30:02 +0900 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #include <common.h> |
Simon Glass | c05ed00 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 12 | #include <linux/delay.h> |
Yusuke Goda | 1a2334a | 2008-03-05 14:30:02 +0900 | [diff] [blame] | 13 | |
Yusuke Goda | 1a2334a | 2008-03-05 14:30:02 +0900 | [diff] [blame] | 14 | #include <asm/processor.h> |
| 15 | #include <asm/io.h> |
| 16 | #include <asm/pci.h> |
| 17 | #include <pci.h> |
| 18 | |
| 19 | int pci_sh4_init(struct pci_controller *hose) |
| 20 | { |
| 21 | hose->first_busno = 0; |
| 22 | hose->region_count = 0; |
| 23 | hose->last_busno = 0xff; |
| 24 | |
| 25 | /* PCI memory space */ |
| 26 | pci_set_region(hose->regions + 0, |
| 27 | CONFIG_PCI_MEM_BUS, |
| 28 | CONFIG_PCI_MEM_PHYS, |
| 29 | CONFIG_PCI_MEM_SIZE, |
| 30 | PCI_REGION_MEM); |
| 31 | hose->region_count++; |
| 32 | |
| 33 | /* PCI IO space */ |
| 34 | pci_set_region(hose->regions + 1, |
| 35 | CONFIG_PCI_IO_BUS, |
| 36 | CONFIG_PCI_IO_PHYS, |
| 37 | CONFIG_PCI_IO_SIZE, |
| 38 | PCI_REGION_IO); |
| 39 | hose->region_count++; |
| 40 | |
Yoshihiro Shimoda | 06e2735 | 2009-02-25 14:26:52 +0900 | [diff] [blame] | 41 | #if defined(CONFIG_PCI_SYS_BUS) |
| 42 | /* PCI System Memory space */ |
| 43 | pci_set_region(hose->regions + 2, |
| 44 | CONFIG_PCI_SYS_BUS, |
| 45 | CONFIG_PCI_SYS_PHYS, |
| 46 | CONFIG_PCI_SYS_SIZE, |
| 47 | PCI_REGION_MEM | PCI_REGION_SYS_MEMORY); |
| 48 | hose->region_count++; |
| 49 | #endif |
| 50 | |
Yusuke Goda | 1a2334a | 2008-03-05 14:30:02 +0900 | [diff] [blame] | 51 | udelay(1000); |
| 52 | |
| 53 | pci_set_ops(hose, |
| 54 | pci_hose_read_config_byte_via_dword, |
| 55 | pci_hose_read_config_word_via_dword, |
| 56 | pci_sh4_read_config_dword, |
| 57 | pci_hose_write_config_byte_via_dword, |
| 58 | pci_hose_write_config_word_via_dword, |
| 59 | pci_sh4_write_config_dword); |
| 60 | |
| 61 | pci_register_hose(hose); |
| 62 | |
| 63 | udelay(1000); |
| 64 | |
| 65 | #ifdef CONFIG_PCI_SCAN_SHOW |
| 66 | printf("PCI: Bus Dev VenId DevId Class Int\n"); |
| 67 | #endif |
| 68 | hose->last_busno = pci_hose_scan(hose); |
| 69 | return 0; |
| 70 | } |
Nobuhiro Iwamatsu | d85f46a | 2008-07-11 17:22:43 +0900 | [diff] [blame] | 71 | |
| 72 | int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev) |
| 73 | { |
| 74 | return 0; |
| 75 | } |
| 76 | |
| 77 | #ifdef CONFIG_PCI_SCAN_SHOW |
| 78 | int pci_print_dev(struct pci_controller *hose, pci_dev_t dev) |
| 79 | { |
| 80 | return 1; |
| 81 | } |
| 82 | #endif /* CONFIG_PCI_SCAN_SHOW */ |