~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to arch/mips/pci/pci-octeon.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
#include <linux/interrupt.h>
12
12
#include <linux/time.h>
13
13
#include <linux/delay.h>
 
14
#include <linux/swiotlb.h>
14
15
 
15
16
#include <asm/time.h>
16
17
 
19
20
#include <asm/octeon/cvmx-pci-defs.h>
20
21
#include <asm/octeon/pci-octeon.h>
21
22
 
 
23
#include <dma-coherence.h>
 
24
 
22
25
#define USE_OCTEON_INTERNAL_ARBITER
23
26
 
24
27
/*
32
35
/* Octeon't PCI controller uses did=3, subdid=3 for PCI memory. */
33
36
#define OCTEON_PCI_MEMSPACE_OFFSET  (0x00011b0000000000ull)
34
37
 
 
38
u64 octeon_bar1_pci_phys;
 
39
 
35
40
/**
36
41
 * This is the bit decoding used for the Octeon PCI controller addresses
37
42
 */
170
175
                pci_write_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, dconfig);
171
176
        }
172
177
 
 
178
        dev->dev.archdata.dma_ops = octeon_pci_dma_map_ops;
 
179
 
173
180
        return 0;
174
181
}
175
182
 
209
216
        case CVMX_BOARD_TYPE_NAO38:
210
217
                /* This is really the NAC38 */
211
218
                return "AAAAADABAAAAAAAAAAAAAAAAAAAAAAAA";
212
 
        case CVMX_BOARD_TYPE_THUNDER:
213
 
                return "";
214
 
        case CVMX_BOARD_TYPE_EBH3000:
215
 
                return "";
216
219
        case CVMX_BOARD_TYPE_EBH3100:
217
220
        case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
218
221
        case CVMX_BOARD_TYPE_CN3005_EVB_HS5:
219
222
                return "AAABAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
220
223
        case CVMX_BOARD_TYPE_BBGW_REF:
221
224
                return "AABCD";
 
225
        case CVMX_BOARD_TYPE_THUNDER:
 
226
        case CVMX_BOARD_TYPE_EBH3000:
222
227
        default:
223
228
                return "";
224
229
        }
620
625
         * before the readl()'s below. We don't want BAR2 overlapping
621
626
         * with BAR0/BAR1 during these reads.
622
627
         */
623
 
        octeon_npi_write32(CVMX_NPI_PCI_CFG08, 0);
624
 
        octeon_npi_write32(CVMX_NPI_PCI_CFG09, 0x80);
625
 
 
626
 
        /* Disable the BAR1 movable mappings */
627
 
        for (index = 0; index < 32; index++)
628
 
                octeon_npi_write32(CVMX_NPI_PCI_BAR1_INDEXX(index), 0);
 
628
        octeon_npi_write32(CVMX_NPI_PCI_CFG08,
 
629
                           (u32)(OCTEON_BAR2_PCI_ADDRESS & 0xffffffffull));
 
630
        octeon_npi_write32(CVMX_NPI_PCI_CFG09,
 
631
                           (u32)(OCTEON_BAR2_PCI_ADDRESS >> 32));
629
632
 
630
633
        if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_BIG) {
631
634
                /* Remap the Octeon BAR 0 to 0-2GB */
639
642
                octeon_npi_write32(CVMX_NPI_PCI_CFG06, 2ul << 30);
640
643
                octeon_npi_write32(CVMX_NPI_PCI_CFG07, 0);
641
644
 
 
645
                /* BAR1 movable mappings set for identity mapping */
 
646
                octeon_bar1_pci_phys = 0x80000000ull;
 
647
                for (index = 0; index < 32; index++) {
 
648
                        union cvmx_pci_bar1_indexx bar1_index;
 
649
 
 
650
                        bar1_index.u32 = 0;
 
651
                        /* Address bits[35:22] sent to L2C */
 
652
                        bar1_index.s.addr_idx =
 
653
                                (octeon_bar1_pci_phys >> 22) + index;
 
654
                        /* Don't put PCI accesses in L2. */
 
655
                        bar1_index.s.ca = 1;
 
656
                        /* Endian Swap Mode */
 
657
                        bar1_index.s.end_swp = 1;
 
658
                        /* Set '1' when the selected address range is valid. */
 
659
                        bar1_index.s.addr_v = 1;
 
660
                        octeon_npi_write32(CVMX_NPI_PCI_BAR1_INDEXX(index),
 
661
                                           bar1_index.u32);
 
662
                }
 
663
 
642
664
                /* Devices go after BAR1 */
643
665
                octeon_pci_mem_resource.start =
644
666
                        OCTEON_PCI_MEMSPACE_OFFSET + (4ul << 30) -
654
676
                octeon_npi_write32(CVMX_NPI_PCI_CFG06, 0);
655
677
                octeon_npi_write32(CVMX_NPI_PCI_CFG07, 0);
656
678
 
 
679
                /* BAR1 movable regions contiguous to cover the swiotlb */
 
680
                octeon_bar1_pci_phys =
 
681
                        virt_to_phys(octeon_swiotlb) & ~((1ull << 22) - 1);
 
682
 
 
683
                for (index = 0; index < 32; index++) {
 
684
                        union cvmx_pci_bar1_indexx bar1_index;
 
685
 
 
686
                        bar1_index.u32 = 0;
 
687
                        /* Address bits[35:22] sent to L2C */
 
688
                        bar1_index.s.addr_idx =
 
689
                                (octeon_bar1_pci_phys >> 22) + index;
 
690
                        /* Don't put PCI accesses in L2. */
 
691
                        bar1_index.s.ca = 1;
 
692
                        /* Endian Swap Mode */
 
693
                        bar1_index.s.end_swp = 1;
 
694
                        /* Set '1' when the selected address range is valid. */
 
695
                        bar1_index.s.addr_v = 1;
 
696
                        octeon_npi_write32(CVMX_NPI_PCI_BAR1_INDEXX(index),
 
697
                                           bar1_index.u32);
 
698
                }
 
699
 
657
700
                /* Devices go after BAR0 */
658
701
                octeon_pci_mem_resource.start =
659
702
                        OCTEON_PCI_MEMSPACE_OFFSET + (128ul << 20) +
669
712
         * was setup properly.
670
713
         */
671
714
        cvmx_write_csr(CVMX_NPI_PCI_INT_SUM2, -1);
 
715
 
 
716
        octeon_pci_dma_init();
 
717
 
672
718
        return 0;
673
719
}
674
720