blob: aac9be055e2cb1db40ba2c5a73f997adae358af3 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Yusuke Goda1a2334a2008-03-05 14:30:02 +09002/*
3 * SH4 PCI Controller (PCIC) for U-Boot.
4 * (C) Dustin McIntire (dustin@sensoria.com)
Nobuhiro Iwamatsuab8f4d42008-03-24 02:11:26 +09005 * (C) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Yusuke Goda1a2334a2008-03-05 14:30:02 +09006 * (C) 2008 Yusuke Goda <goda.yusuke@renesas.com>
7 *
Peter Tyser8f0fec72010-04-12 22:28:10 -05008 * u-boot/arch/sh/cpu/sh4/pci-sh4.c
Yusuke Goda1a2334a2008-03-05 14:30:02 +09009 */
10
11#include <common.h>
Simon Glassc05ed002020-05-10 11:40:11 -060012#include <linux/delay.h>
Yusuke Goda1a2334a2008-03-05 14:30:02 +090013
Yusuke Goda1a2334a2008-03-05 14:30:02 +090014#include <asm/processor.h>
15#include <asm/io.h>
16#include <asm/pci.h>
17#include <pci.h>
18
19int 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 Shimoda06e27352009-02-25 14:26:52 +090041#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 Goda1a2334a2008-03-05 14:30:02 +090051 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 Iwamatsud85f46a2008-07-11 17:22:43 +090071
72int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev)
73{
74 return 0;
75}
76
77#ifdef CONFIG_PCI_SCAN_SHOW
78int pci_print_dev(struct pci_controller *hose, pci_dev_t dev)
79{
80 return 1;
81}
82#endif /* CONFIG_PCI_SCAN_SHOW */