diff options
165 files changed, 8102 insertions, 2217 deletions
diff --git a/Documentation/devicetree/bindings/ata/cavium-compact-flash.txt b/Documentation/devicetree/bindings/ata/cavium-compact-flash.txt new file mode 100644 index 000000000000..93986a5a8018 --- /dev/null +++ b/Documentation/devicetree/bindings/ata/cavium-compact-flash.txt | |||
@@ -0,0 +1,30 @@ | |||
1 | * Compact Flash | ||
2 | |||
3 | The Cavium Compact Flash device is connected to the Octeon Boot Bus, | ||
4 | and is thus a child of the Boot Bus device. It can read and write | ||
5 | industry standard compact flash devices. | ||
6 | |||
7 | Properties: | ||
8 | - compatible: "cavium,ebt3000-compact-flash"; | ||
9 | |||
10 | Compatibility with many Cavium evaluation boards. | ||
11 | |||
12 | - reg: The base address of the the CF chip select banks. Depending on | ||
13 | the device configuration, there may be one or two banks. | ||
14 | |||
15 | - cavium,bus-width: The width of the connection to the CF devices. Valid | ||
16 | values are 8 and 16. | ||
17 | |||
18 | - cavium,true-ide: Optional, if present the CF connection is in True IDE mode. | ||
19 | |||
20 | - cavium,dma-engine-handle: Optional, a phandle for the DMA Engine connected | ||
21 | to this device. | ||
22 | |||
23 | Example: | ||
24 | compact-flash@5,0 { | ||
25 | compatible = "cavium,ebt3000-compact-flash"; | ||
26 | reg = <5 0 0x10000>, <6 0 0x10000>; | ||
27 | cavium,bus-width = <16>; | ||
28 | cavium,true-ide; | ||
29 | cavium,dma-engine-handle = <&dma0>; | ||
30 | }; | ||
diff --git a/Documentation/devicetree/bindings/gpio/cavium-octeon-gpio.txt b/Documentation/devicetree/bindings/gpio/cavium-octeon-gpio.txt new file mode 100644 index 000000000000..9d6dcd3fe7f9 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/cavium-octeon-gpio.txt | |||
@@ -0,0 +1,49 @@ | |||
1 | * General Purpose Input Output (GPIO) bus. | ||
2 | |||
3 | Properties: | ||
4 | - compatible: "cavium,octeon-3860-gpio" | ||
5 | |||
6 | Compatibility with all cn3XXX, cn5XXX and cn6XXX SOCs. | ||
7 | |||
8 | - reg: The base address of the GPIO unit's register bank. | ||
9 | |||
10 | - gpio-controller: This is a GPIO controller. | ||
11 | |||
12 | - #gpio-cells: Must be <2>. The first cell is the GPIO pin. | ||
13 | |||
14 | - interrupt-controller: The GPIO controller is also an interrupt | ||
15 | controller, many of its pins may be configured as an interrupt | ||
16 | source. | ||
17 | |||
18 | - #interrupt-cells: Must be <2>. The first cell is the GPIO pin | ||
19 | connected to the interrupt source. The second cell is the interrupt | ||
20 | triggering protocol and may have one of four values: | ||
21 | 1 - edge triggered on the rising edge. | ||
22 | 2 - edge triggered on the falling edge | ||
23 | 4 - level triggered active high. | ||
24 | 8 - level triggered active low. | ||
25 | |||
26 | - interrupts: Interrupt routing for each pin. | ||
27 | |||
28 | Example: | ||
29 | |||
30 | gpio-controller@1070000000800 { | ||
31 | #gpio-cells = <2>; | ||
32 | compatible = "cavium,octeon-3860-gpio"; | ||
33 | reg = <0x10700 0x00000800 0x0 0x100>; | ||
34 | gpio-controller; | ||
35 | /* Interrupts are specified by two parts: | ||
36 | * 1) GPIO pin number (0..15) | ||
37 | * 2) Triggering (1 - edge rising | ||
38 | * 2 - edge falling | ||
39 | * 4 - level active high | ||
40 | * 8 - level active low) | ||
41 | */ | ||
42 | interrupt-controller; | ||
43 | #interrupt-cells = <2>; | ||
44 | /* The GPIO pin connect to 16 consecutive CUI bits */ | ||
45 | interrupts = <0 16>, <0 17>, <0 18>, <0 19>, | ||
46 | <0 20>, <0 21>, <0 22>, <0 23>, | ||
47 | <0 24>, <0 25>, <0 26>, <0 27>, | ||
48 | <0 28>, <0 29>, <0 30>, <0 31>; | ||
49 | }; | ||
diff --git a/Documentation/devicetree/bindings/i2c/cavium-i2c.txt b/Documentation/devicetree/bindings/i2c/cavium-i2c.txt new file mode 100644 index 000000000000..dced82ebe31d --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/cavium-i2c.txt | |||
@@ -0,0 +1,34 @@ | |||
1 | * Two Wire Serial Interface (TWSI) / I2C | ||
2 | |||
3 | - compatible: "cavium,octeon-3860-twsi" | ||
4 | |||
5 | Compatibility with all cn3XXX, cn5XXX and cn6XXX SOCs. | ||
6 | |||
7 | - reg: The base address of the TWSI/I2C bus controller register bank. | ||
8 | |||
9 | - #address-cells: Must be <1>. | ||
10 | |||
11 | - #size-cells: Must be <0>. I2C addresses have no size component. | ||
12 | |||
13 | - interrupts: A single interrupt specifier. | ||
14 | |||
15 | - clock-frequency: The I2C bus clock rate in Hz. | ||
16 | |||
17 | Example: | ||
18 | twsi0: i2c@1180000001000 { | ||
19 | #address-cells = <1>; | ||
20 | #size-cells = <0>; | ||
21 | compatible = "cavium,octeon-3860-twsi"; | ||
22 | reg = <0x11800 0x00001000 0x0 0x200>; | ||
23 | interrupts = <0 45>; | ||
24 | clock-frequency = <100000>; | ||
25 | |||
26 | rtc@68 { | ||
27 | compatible = "dallas,ds1337"; | ||
28 | reg = <0x68>; | ||
29 | }; | ||
30 | tmp@4c { | ||
31 | compatible = "ti,tmp421"; | ||
32 | reg = <0x4c>; | ||
33 | }; | ||
34 | }; | ||
diff --git a/Documentation/devicetree/bindings/mips/cavium/bootbus.txt b/Documentation/devicetree/bindings/mips/cavium/bootbus.txt new file mode 100644 index 000000000000..6581478225a2 --- /dev/null +++ b/Documentation/devicetree/bindings/mips/cavium/bootbus.txt | |||
@@ -0,0 +1,126 @@ | |||
1 | * Boot Bus | ||
2 | |||
3 | The Octeon Boot Bus is a configurable parallel bus with 8 chip | ||
4 | selects. Each chip select is independently configurable. | ||
5 | |||
6 | Properties: | ||
7 | - compatible: "cavium,octeon-3860-bootbus" | ||
8 | |||
9 | Compatibility with all cn3XXX, cn5XXX and cn6XXX SOCs. | ||
10 | |||
11 | - reg: The base address of the Boot Bus' register bank. | ||
12 | |||
13 | - #address-cells: Must be <2>. The first cell is the chip select | ||
14 | within the bootbus. The second cell is the offset from the chip select. | ||
15 | |||
16 | - #size-cells: Must be <1>. | ||
17 | |||
18 | - ranges: There must be one one triplet of (child-bus-address, | ||
19 | parent-bus-address, length) for each active chip select. If the | ||
20 | length element for any triplet is zero, the chip select is disabled, | ||
21 | making it inactive. | ||
22 | |||
23 | The configuration parameters for each chip select are stored in child | ||
24 | nodes. | ||
25 | |||
26 | Configuration Properties: | ||
27 | - compatible: "cavium,octeon-3860-bootbus-config" | ||
28 | |||
29 | - cavium,cs-index: A single cell indicating the chip select that | ||
30 | corresponds to this configuration. | ||
31 | |||
32 | - cavium,t-adr: A cell specifying the ADR timing (in nS). | ||
33 | |||
34 | - cavium,t-ce: A cell specifying the CE timing (in nS). | ||
35 | |||
36 | - cavium,t-oe: A cell specifying the OE timing (in nS). | ||
37 | |||
38 | - cavium,t-we: A cell specifying the WE timing (in nS). | ||
39 | |||
40 | - cavium,t-rd-hld: A cell specifying the RD_HLD timing (in nS). | ||
41 | |||
42 | - cavium,t-wr-hld: A cell specifying the WR_HLD timing (in nS). | ||
43 | |||
44 | - cavium,t-pause: A cell specifying the PAUSE timing (in nS). | ||
45 | |||
46 | - cavium,t-wait: A cell specifying the WAIT timing (in nS). | ||
47 | |||
48 | - cavium,t-page: A cell specifying the PAGE timing (in nS). | ||
49 | |||
50 | - cavium,t-rd-dly: A cell specifying the RD_DLY timing (in nS). | ||
51 | |||
52 | - cavium,pages: A cell specifying the PAGES parameter (0 = 8 bytes, 1 | ||
53 | = 2 bytes, 2 = 4 bytes, 3 = 8 bytes). | ||
54 | |||
55 | - cavium,wait-mode: Optional. If present, wait mode (WAITM) is selected. | ||
56 | |||
57 | - cavium,page-mode: Optional. If present, page mode (PAGEM) is selected. | ||
58 | |||
59 | - cavium,bus-width: A cell specifying the WIDTH parameter (in bits) of | ||
60 | the bus for this chip select. | ||
61 | |||
62 | - cavium,ale-mode: Optional. If present, ALE mode is selected. | ||
63 | |||
64 | - cavium,sam-mode: Optional. If present, SAM mode is selected. | ||
65 | |||
66 | - cavium,or-mode: Optional. If present, OR mode is selected. | ||
67 | |||
68 | Example: | ||
69 | bootbus: bootbus@1180000000000 { | ||
70 | compatible = "cavium,octeon-3860-bootbus"; | ||
71 | reg = <0x11800 0x00000000 0x0 0x200>; | ||
72 | /* The chip select number and offset */ | ||
73 | #address-cells = <2>; | ||
74 | /* The size of the chip select region */ | ||
75 | #size-cells = <1>; | ||
76 | ranges = <0 0 0x0 0x1f400000 0xc00000>, | ||
77 | <1 0 0x10000 0x30000000 0>, | ||
78 | <2 0 0x10000 0x40000000 0>, | ||
79 | <3 0 0x10000 0x50000000 0>, | ||
80 | <4 0 0x0 0x1d020000 0x10000>, | ||
81 | <5 0 0x0 0x1d040000 0x10000>, | ||
82 | <6 0 0x0 0x1d050000 0x10000>, | ||
83 | <7 0 0x10000 0x90000000 0>; | ||
84 | |||
85 | cavium,cs-config@0 { | ||
86 | compatible = "cavium,octeon-3860-bootbus-config"; | ||
87 | cavium,cs-index = <0>; | ||
88 | cavium,t-adr = <20>; | ||
89 | cavium,t-ce = <60>; | ||
90 | cavium,t-oe = <60>; | ||
91 | cavium,t-we = <45>; | ||
92 | cavium,t-rd-hld = <35>; | ||
93 | cavium,t-wr-hld = <45>; | ||
94 | cavium,t-pause = <0>; | ||
95 | cavium,t-wait = <0>; | ||
96 | cavium,t-page = <35>; | ||
97 | cavium,t-rd-dly = <0>; | ||
98 | |||
99 | cavium,pages = <0>; | ||
100 | cavium,bus-width = <8>; | ||
101 | }; | ||
102 | . | ||
103 | . | ||
104 | . | ||
105 | cavium,cs-config@6 { | ||
106 | compatible = "cavium,octeon-3860-bootbus-config"; | ||
107 | cavium,cs-index = <6>; | ||
108 | cavium,t-adr = <5>; | ||
109 | cavium,t-ce = <300>; | ||
110 | cavium,t-oe = <270>; | ||
111 | cavium,t-we = <150>; | ||
112 | cavium,t-rd-hld = <100>; | ||
113 | cavium,t-wr-hld = <70>; | ||
114 | cavium,t-pause = <0>; | ||
115 | cavium,t-wait = <0>; | ||
116 | cavium,t-page = <320>; | ||
117 | cavium,t-rd-dly = <0>; | ||
118 | |||
119 | cavium,pages = <0>; | ||
120 | cavium,wait-mode; | ||
121 | cavium,bus-width = <16>; | ||
122 | }; | ||
123 | . | ||
124 | . | ||
125 | . | ||
126 | }; | ||
diff --git a/Documentation/devicetree/bindings/mips/cavium/ciu.txt b/Documentation/devicetree/bindings/mips/cavium/ciu.txt new file mode 100644 index 000000000000..2c2d0746b43d --- /dev/null +++ b/Documentation/devicetree/bindings/mips/cavium/ciu.txt | |||
@@ -0,0 +1,26 @@ | |||
1 | * Central Interrupt Unit | ||
2 | |||
3 | Properties: | ||
4 | - compatible: "cavium,octeon-3860-ciu" | ||
5 | |||
6 | Compatibility with all cn3XXX, cn5XXX and cn63XX SOCs. | ||
7 | |||
8 | - interrupt-controller: This is an interrupt controller. | ||
9 | |||
10 | - reg: The base address of the CIU's register bank. | ||
11 | |||
12 | - #interrupt-cells: Must be <2>. The first cell is the bank within | ||
13 | the CIU and may have a value of 0 or 1. The second cell is the bit | ||
14 | within the bank and may have a value between 0 and 63. | ||
15 | |||
16 | Example: | ||
17 | interrupt-controller@1070000000000 { | ||
18 | compatible = "cavium,octeon-3860-ciu"; | ||
19 | interrupt-controller; | ||
20 | /* Interrupts are specified by two parts: | ||
21 | * 1) Controller register (0 or 1) | ||
22 | * 2) Bit within the register (0..63) | ||
23 | */ | ||
24 | #interrupt-cells = <2>; | ||
25 | reg = <0x10700 0x00000000 0x0 0x7000>; | ||
26 | }; | ||
diff --git a/Documentation/devicetree/bindings/mips/cavium/ciu2.txt b/Documentation/devicetree/bindings/mips/cavium/ciu2.txt new file mode 100644 index 000000000000..0ec7ba8bbbcb --- /dev/null +++ b/Documentation/devicetree/bindings/mips/cavium/ciu2.txt | |||
@@ -0,0 +1,27 @@ | |||
1 | * Central Interrupt Unit | ||
2 | |||
3 | Properties: | ||
4 | - compatible: "cavium,octeon-6880-ciu2" | ||
5 | |||
6 | Compatibility with 68XX SOCs. | ||
7 | |||
8 | - interrupt-controller: This is an interrupt controller. | ||
9 | |||
10 | - reg: The base address of the CIU's register bank. | ||
11 | |||
12 | - #interrupt-cells: Must be <2>. The first cell is the bank within | ||
13 | the CIU and may have a value between 0 and 63. The second cell is | ||
14 | the bit within the bank and may also have a value between 0 and 63. | ||
15 | |||
16 | Example: | ||
17 | interrupt-controller@1070100000000 { | ||
18 | compatible = "cavium,octeon-6880-ciu2"; | ||
19 | interrupt-controller; | ||
20 | /* Interrupts are specified by two parts: | ||
21 | * 1) Controller register (0..63) | ||
22 | * 2) Bit within the register (0..63) | ||
23 | */ | ||
24 | #address-cells = <0>; | ||
25 | #interrupt-cells = <2>; | ||
26 | reg = <0x10701 0x00000000 0x0 0x4000000>; | ||
27 | }; | ||
diff --git a/Documentation/devicetree/bindings/mips/cavium/dma-engine.txt b/Documentation/devicetree/bindings/mips/cavium/dma-engine.txt new file mode 100644 index 000000000000..cb4291e3b1d1 --- /dev/null +++ b/Documentation/devicetree/bindings/mips/cavium/dma-engine.txt | |||
@@ -0,0 +1,21 @@ | |||
1 | * DMA Engine. | ||
2 | |||
3 | The Octeon DMA Engine transfers between the Boot Bus and main memory. | ||
4 | The DMA Engine will be refered to by phandle by any device that is | ||
5 | connected to it. | ||
6 | |||
7 | Properties: | ||
8 | - compatible: "cavium,octeon-5750-bootbus-dma" | ||
9 | |||
10 | Compatibility with all cn52XX, cn56XX and cn6XXX SOCs. | ||
11 | |||
12 | - reg: The base address of the DMA Engine's register bank. | ||
13 | |||
14 | - interrupts: A single interrupt specifier. | ||
15 | |||
16 | Example: | ||
17 | dma0: dma-engine@1180000000100 { | ||
18 | compatible = "cavium,octeon-5750-bootbus-dma"; | ||
19 | reg = <0x11800 0x00000100 0x0 0x8>; | ||
20 | interrupts = <0 63>; | ||
21 | }; | ||
diff --git a/Documentation/devicetree/bindings/mips/cavium/uctl.txt b/Documentation/devicetree/bindings/mips/cavium/uctl.txt new file mode 100644 index 000000000000..aa66b9b8d801 --- /dev/null +++ b/Documentation/devicetree/bindings/mips/cavium/uctl.txt | |||
@@ -0,0 +1,46 @@ | |||
1 | * UCTL USB controller glue | ||
2 | |||
3 | Properties: | ||
4 | - compatible: "cavium,octeon-6335-uctl" | ||
5 | |||
6 | Compatibility with all cn6XXX SOCs. | ||
7 | |||
8 | - reg: The base address of the UCTL register bank. | ||
9 | |||
10 | - #address-cells: Must be <2>. | ||
11 | |||
12 | - #size-cells: Must be <2>. | ||
13 | |||
14 | - ranges: Empty to signify direct mapping of the children. | ||
15 | |||
16 | - refclk-frequency: A single cell containing the reference clock | ||
17 | frequency in Hz. | ||
18 | |||
19 | - refclk-type: A string describing the reference clock connection | ||
20 | either "crystal" or "external". | ||
21 | |||
22 | Example: | ||
23 | uctl@118006f000000 { | ||
24 | compatible = "cavium,octeon-6335-uctl"; | ||
25 | reg = <0x11800 0x6f000000 0x0 0x100>; | ||
26 | ranges; /* Direct mapping */ | ||
27 | #address-cells = <2>; | ||
28 | #size-cells = <2>; | ||
29 | /* 12MHz, 24MHz and 48MHz allowed */ | ||
30 | refclk-frequency = <24000000>; | ||
31 | /* Either "crystal" or "external" */ | ||
32 | refclk-type = "crystal"; | ||
33 | |||
34 | ehci@16f0000000000 { | ||
35 | compatible = "cavium,octeon-6335-ehci","usb-ehci"; | ||
36 | reg = <0x16f00 0x00000000 0x0 0x100>; | ||
37 | interrupts = <0 56>; | ||
38 | big-endian-regs; | ||
39 | }; | ||
40 | ohci@16f0000000400 { | ||
41 | compatible = "cavium,octeon-6335-ohci","usb-ohci"; | ||
42 | reg = <0x16f00 0x00000400 0x0 0x100>; | ||
43 | interrupts = <0 56>; | ||
44 | big-endian-regs; | ||
45 | }; | ||
46 | }; | ||
diff --git a/Documentation/devicetree/bindings/net/cavium-mdio.txt b/Documentation/devicetree/bindings/net/cavium-mdio.txt new file mode 100644 index 000000000000..04cb7491d232 --- /dev/null +++ b/Documentation/devicetree/bindings/net/cavium-mdio.txt | |||
@@ -0,0 +1,27 @@ | |||
1 | * System Management Interface (SMI) / MDIO | ||
2 | |||
3 | Properties: | ||
4 | - compatible: "cavium,octeon-3860-mdio" | ||
5 | |||
6 | Compatibility with all cn3XXX, cn5XXX and cn6XXX SOCs. | ||
7 | |||
8 | - reg: The base address of the MDIO bus controller register bank. | ||
9 | |||
10 | - #address-cells: Must be <1>. | ||
11 | |||
12 | - #size-cells: Must be <0>. MDIO addresses have no size component. | ||
13 | |||
14 | Typically an MDIO bus might have several children. | ||
15 | |||
16 | Example: | ||
17 | mdio@1180000001800 { | ||
18 | compatible = "cavium,octeon-3860-mdio"; | ||
19 | #address-cells = <1>; | ||
20 | #size-cells = <0>; | ||
21 | reg = <0x11800 0x00001800 0x0 0x40>; | ||
22 | |||
23 | ethernet-phy@0 { | ||
24 | ... | ||
25 | reg = <0>; | ||
26 | }; | ||
27 | }; | ||
diff --git a/Documentation/devicetree/bindings/net/cavium-mix.txt b/Documentation/devicetree/bindings/net/cavium-mix.txt new file mode 100644 index 000000000000..5da628db68bf --- /dev/null +++ b/Documentation/devicetree/bindings/net/cavium-mix.txt | |||
@@ -0,0 +1,39 @@ | |||
1 | * MIX Ethernet controller. | ||
2 | |||
3 | Properties: | ||
4 | - compatible: "cavium,octeon-5750-mix" | ||
5 | |||
6 | Compatibility with all cn5XXX and cn6XXX SOCs populated with MIX | ||
7 | devices. | ||
8 | |||
9 | - reg: The base addresses of four separate register banks. The first | ||
10 | bank contains the MIX registers. The second bank the corresponding | ||
11 | AGL registers. The third bank are the AGL registers shared by all | ||
12 | MIX devices present. The fourth bank is the AGL_PRT_CTL shared by | ||
13 | all MIX devices present. | ||
14 | |||
15 | - cell-index: A single cell specifying which portion of the shared | ||
16 | register banks corresponds to this MIX device. | ||
17 | |||
18 | - interrupts: Two interrupt specifiers. The first is the MIX | ||
19 | interrupt routing and the second the routing for the AGL interrupts. | ||
20 | |||
21 | - mac-address: Optional, the MAC address to assign to the device. | ||
22 | |||
23 | - local-mac-address: Optional, the MAC address to assign to the device | ||
24 | if mac-address is not specified. | ||
25 | |||
26 | - phy-handle: Optional, a phandle for the PHY device connected to this device. | ||
27 | |||
28 | Example: | ||
29 | ethernet@1070000100800 { | ||
30 | compatible = "cavium,octeon-5750-mix"; | ||
31 | reg = <0x10700 0x00100800 0x0 0x100>, /* MIX */ | ||
32 | <0x11800 0xE0000800 0x0 0x300>, /* AGL */ | ||
33 | <0x11800 0xE0000400 0x0 0x400>, /* AGL_SHARED */ | ||
34 | <0x11800 0xE0002008 0x0 0x8>; /* AGL_PRT_CTL */ | ||
35 | cell-index = <1>; | ||
36 | interrupts = <1 18>, < 1 46>; | ||
37 | local-mac-address = [ 00 0f b7 10 63 54 ]; | ||
38 | phy-handle = <&phy1>; | ||
39 | }; | ||
diff --git a/Documentation/devicetree/bindings/net/cavium-pip.txt b/Documentation/devicetree/bindings/net/cavium-pip.txt new file mode 100644 index 000000000000..d4c53ba04b3b --- /dev/null +++ b/Documentation/devicetree/bindings/net/cavium-pip.txt | |||
@@ -0,0 +1,98 @@ | |||
1 | * PIP Ethernet nexus. | ||
2 | |||
3 | The PIP Ethernet nexus can control several data packet input/output | ||
4 | devices. The devices have a two level grouping scheme. There may be | ||
5 | several interfaces, and each interface may have several ports. These | ||
6 | ports might be an individual Ethernet PHY. | ||
7 | |||
8 | |||
9 | Properties for the PIP nexus: | ||
10 | - compatible: "cavium,octeon-3860-pip" | ||
11 | |||
12 | Compatibility with all cn3XXX, cn5XXX and cn6XXX SOCs. | ||
13 | |||
14 | - reg: The base address of the PIP's register bank. | ||
15 | |||
16 | - #address-cells: Must be <1>. | ||
17 | |||
18 | - #size-cells: Must be <0>. | ||
19 | |||
20 | Properties for PIP interfaces which is a child the PIP nexus: | ||
21 | - compatible: "cavium,octeon-3860-pip-interface" | ||
22 | |||
23 | Compatibility with all cn3XXX, cn5XXX and cn6XXX SOCs. | ||
24 | |||
25 | - reg: The interface number. | ||
26 | |||
27 | - #address-cells: Must be <1>. | ||
28 | |||
29 | - #size-cells: Must be <0>. | ||
30 | |||
31 | Properties for PIP port which is a child the PIP interface: | ||
32 | - compatible: "cavium,octeon-3860-pip-port" | ||
33 | |||
34 | Compatibility with all cn3XXX, cn5XXX and cn6XXX SOCs. | ||
35 | |||
36 | - reg: The port number within the interface group. | ||
37 | |||
38 | - mac-address: Optional, the MAC address to assign to the device. | ||
39 | |||
40 | - local-mac-address: Optional, the MAC address to assign to the device | ||
41 | if mac-address is not specified. | ||
42 | |||
43 | - phy-handle: Optional, a phandle for the PHY device connected to this device. | ||
44 | |||
45 | Example: | ||
46 | |||
47 | pip@11800a0000000 { | ||
48 | compatible = "cavium,octeon-3860-pip"; | ||
49 | #address-cells = <1>; | ||
50 | #size-cells = <0>; | ||
51 | reg = <0x11800 0xa0000000 0x0 0x2000>; | ||
52 | |||
53 | interface@0 { | ||
54 | compatible = "cavium,octeon-3860-pip-interface"; | ||
55 | #address-cells = <1>; | ||
56 | #size-cells = <0>; | ||
57 | reg = <0>; /* interface */ | ||
58 | |||
59 | ethernet@0 { | ||
60 | compatible = "cavium,octeon-3860-pip-port"; | ||
61 | reg = <0x0>; /* Port */ | ||
62 | local-mac-address = [ 00 0f b7 10 63 60 ]; | ||
63 | phy-handle = <&phy2>; | ||
64 | }; | ||
65 | ethernet@1 { | ||
66 | compatible = "cavium,octeon-3860-pip-port"; | ||
67 | reg = <0x1>; /* Port */ | ||
68 | local-mac-address = [ 00 0f b7 10 63 61 ]; | ||
69 | phy-handle = <&phy3>; | ||
70 | }; | ||
71 | ethernet@2 { | ||
72 | compatible = "cavium,octeon-3860-pip-port"; | ||
73 | reg = <0x2>; /* Port */ | ||
74 | local-mac-address = [ 00 0f b7 10 63 62 ]; | ||
75 | phy-handle = <&phy4>; | ||
76 | }; | ||
77 | ethernet@3 { | ||
78 | compatible = "cavium,octeon-3860-pip-port"; | ||
79 | reg = <0x3>; /* Port */ | ||
80 | local-mac-address = [ 00 0f b7 10 63 63 ]; | ||
81 | phy-handle = <&phy5>; | ||
82 | }; | ||
83 | }; | ||
84 | |||
85 | interface@1 { | ||
86 | compatible = "cavium,octeon-3860-pip-interface"; | ||
87 | #address-cells = <1>; | ||
88 | #size-cells = <0>; | ||
89 | reg = <1>; /* interface */ | ||
90 | |||
91 | ethernet@0 { | ||
92 | compatible = "cavium,octeon-3860-pip-port"; | ||
93 | reg = <0x0>; /* Port */ | ||
94 | local-mac-address = [ 00 0f b7 10 63 64 ]; | ||
95 | phy-handle = <&phy6>; | ||
96 | }; | ||
97 | }; | ||
98 | }; | ||
diff --git a/Documentation/devicetree/bindings/serial/cavium-uart.txt b/Documentation/devicetree/bindings/serial/cavium-uart.txt new file mode 100644 index 000000000000..87a6c375cd44 --- /dev/null +++ b/Documentation/devicetree/bindings/serial/cavium-uart.txt | |||
@@ -0,0 +1,19 @@ | |||
1 | * Universal Asynchronous Receiver/Transmitter (UART) | ||
2 | |||
3 | - compatible: "cavium,octeon-3860-uart" | ||
4 | |||
5 | Compatibility with all cn3XXX, cn5XXX and cn6XXX SOCs. | ||
6 | |||
7 | - reg: The base address of the UART register bank. | ||
8 | |||
9 | - interrupts: A single interrupt specifier. | ||
10 | |||
11 | - current-speed: Optional, the current bit rate in bits per second. | ||
12 | |||
13 | Example: | ||
14 | uart1: serial@1180000000c00 { | ||
15 | compatible = "cavium,octeon-3860-uart","ns16550"; | ||
16 | reg = <0x11800 0x00000c00 0x0 0x400>; | ||
17 | current-speed = <115200>; | ||
18 | interrupts = <0 35>; | ||
19 | }; | ||
diff --git a/arch/mips/Kbuild.platforms b/arch/mips/Kbuild.platforms index 5ce8029f558b..d64786d5e2f3 100644 --- a/arch/mips/Kbuild.platforms +++ b/arch/mips/Kbuild.platforms | |||
@@ -14,6 +14,7 @@ platforms += jz4740 | |||
14 | platforms += lantiq | 14 | platforms += lantiq |
15 | platforms += lasat | 15 | platforms += lasat |
16 | platforms += loongson | 16 | platforms += loongson |
17 | platforms += loongson1 | ||
17 | platforms += mipssim | 18 | platforms += mipssim |
18 | platforms += mti-malta | 19 | platforms += mti-malta |
19 | platforms += netlogic | 20 | platforms += netlogic |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index b3e10fdd3898..750429018534 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -209,6 +209,7 @@ config MACH_JZ4740 | |||
209 | select SYS_HAS_CPU_MIPS32_R1 | 209 | select SYS_HAS_CPU_MIPS32_R1 |
210 | select SYS_SUPPORTS_32BIT_KERNEL | 210 | select SYS_SUPPORTS_32BIT_KERNEL |
211 | select SYS_SUPPORTS_LITTLE_ENDIAN | 211 | select SYS_SUPPORTS_LITTLE_ENDIAN |
212 | select SYS_SUPPORTS_ZBOOT_UART16550 | ||
212 | select DMA_NONCOHERENT | 213 | select DMA_NONCOHERENT |
213 | select IRQ_CPU | 214 | select IRQ_CPU |
214 | select GENERIC_GPIO | 215 | select GENERIC_GPIO |
@@ -264,6 +265,16 @@ config MACH_LOONGSON | |||
264 | Chinese Academy of Sciences (CAS) in the People's Republic | 265 | Chinese Academy of Sciences (CAS) in the People's Republic |
265 | of China. The chief architect is Professor Weiwu Hu. | 266 | of China. The chief architect is Professor Weiwu Hu. |
266 | 267 | ||
268 | config MACH_LOONGSON1 | ||
269 | bool "Loongson 1 family of machines" | ||
270 | select SYS_SUPPORTS_ZBOOT | ||
271 | help | ||
272 | This enables support for the Loongson 1 based machines. | ||
273 | |||
274 | Loongson 1 is a family of 32-bit MIPS-compatible SoCs developed by | ||
275 | the ICT (Institute of Computing Technology) and the Chinese Academy | ||
276 | of Sciences. | ||
277 | |||
267 | config MIPS_MALTA | 278 | config MIPS_MALTA |
268 | bool "MIPS Malta board" | 279 | bool "MIPS Malta board" |
269 | select ARCH_MAY_HAVE_PC_FDC | 280 | select ARCH_MAY_HAVE_PC_FDC |
@@ -787,6 +798,8 @@ config NLM_XLR_BOARD | |||
787 | select ZONE_DMA if 64BIT | 798 | select ZONE_DMA if 64BIT |
788 | select SYNC_R4K | 799 | select SYNC_R4K |
789 | select SYS_HAS_EARLY_PRINTK | 800 | select SYS_HAS_EARLY_PRINTK |
801 | select USB_ARCH_HAS_OHCI if USB_SUPPORT | ||
802 | select USB_ARCH_HAS_EHCI if USB_SUPPORT | ||
790 | help | 803 | help |
791 | Support for systems based on Netlogic XLR and XLS processors. | 804 | Support for systems based on Netlogic XLR and XLS processors. |
792 | Say Y here if you have a XLR or XLS based board. | 805 | Say Y here if you have a XLR or XLS based board. |
@@ -799,7 +812,6 @@ config NLM_XLP_BOARD | |||
799 | select SYS_HAS_CPU_XLP | 812 | select SYS_HAS_CPU_XLP |
800 | select SYS_SUPPORTS_SMP | 813 | select SYS_SUPPORTS_SMP |
801 | select HW_HAS_PCI | 814 | select HW_HAS_PCI |
802 | select SWAP_IO_SPACE | ||
803 | select SYS_SUPPORTS_32BIT_KERNEL | 815 | select SYS_SUPPORTS_32BIT_KERNEL |
804 | select SYS_SUPPORTS_64BIT_KERNEL | 816 | select SYS_SUPPORTS_64BIT_KERNEL |
805 | select 64BIT_PHYS_ADDR | 817 | select 64BIT_PHYS_ADDR |
@@ -836,6 +848,7 @@ source "arch/mips/txx9/Kconfig" | |||
836 | source "arch/mips/vr41xx/Kconfig" | 848 | source "arch/mips/vr41xx/Kconfig" |
837 | source "arch/mips/cavium-octeon/Kconfig" | 849 | source "arch/mips/cavium-octeon/Kconfig" |
838 | source "arch/mips/loongson/Kconfig" | 850 | source "arch/mips/loongson/Kconfig" |
851 | source "arch/mips/loongson1/Kconfig" | ||
839 | source "arch/mips/netlogic/Kconfig" | 852 | source "arch/mips/netlogic/Kconfig" |
840 | 853 | ||
841 | endmenu | 854 | endmenu |
@@ -1217,6 +1230,14 @@ config CPU_LOONGSON2F | |||
1217 | have a similar programming interface with FPGA northbridge used in | 1230 | have a similar programming interface with FPGA northbridge used in |
1218 | Loongson2E. | 1231 | Loongson2E. |
1219 | 1232 | ||
1233 | config CPU_LOONGSON1B | ||
1234 | bool "Loongson 1B" | ||
1235 | depends on SYS_HAS_CPU_LOONGSON1B | ||
1236 | select CPU_LOONGSON1 | ||
1237 | help | ||
1238 | The Loongson 1B is a 32-bit SoC, which implements the MIPS32 | ||
1239 | release 2 instruction set. | ||
1240 | |||
1220 | config CPU_MIPS32_R1 | 1241 | config CPU_MIPS32_R1 |
1221 | bool "MIPS32 Release 1" | 1242 | bool "MIPS32 Release 1" |
1222 | depends on SYS_HAS_CPU_MIPS32_R1 | 1243 | depends on SYS_HAS_CPU_MIPS32_R1 |
@@ -1432,6 +1453,8 @@ config CPU_CAVIUM_OCTEON | |||
1432 | select WEAK_ORDERING | 1453 | select WEAK_ORDERING |
1433 | select CPU_SUPPORTS_HIGHMEM | 1454 | select CPU_SUPPORTS_HIGHMEM |
1434 | select CPU_SUPPORTS_HUGEPAGES | 1455 | select CPU_SUPPORTS_HUGEPAGES |
1456 | select LIBFDT | ||
1457 | select USE_OF | ||
1435 | help | 1458 | help |
1436 | The Cavium Octeon processor is a highly integrated chip containing | 1459 | The Cavium Octeon processor is a highly integrated chip containing |
1437 | many ethernet hardware widgets for networking tasks. The processor | 1460 | many ethernet hardware widgets for networking tasks. The processor |
@@ -1544,6 +1567,14 @@ config CPU_LOONGSON2 | |||
1544 | select CPU_SUPPORTS_64BIT_KERNEL | 1567 | select CPU_SUPPORTS_64BIT_KERNEL |
1545 | select CPU_SUPPORTS_HIGHMEM | 1568 | select CPU_SUPPORTS_HIGHMEM |
1546 | 1569 | ||
1570 | config CPU_LOONGSON1 | ||
1571 | bool | ||
1572 | select CPU_MIPS32 | ||
1573 | select CPU_MIPSR2 | ||
1574 | select CPU_HAS_PREFETCH | ||
1575 | select CPU_SUPPORTS_32BIT_KERNEL | ||
1576 | select CPU_SUPPORTS_HIGHMEM | ||
1577 | |||
1547 | config CPU_BMIPS | 1578 | config CPU_BMIPS |
1548 | bool | 1579 | bool |
1549 | select CPU_MIPS32 | 1580 | select CPU_MIPS32 |
@@ -1562,6 +1593,9 @@ config SYS_HAS_CPU_LOONGSON2F | |||
1562 | select CPU_SUPPORTS_ADDRWINCFG if 64BIT | 1593 | select CPU_SUPPORTS_ADDRWINCFG if 64BIT |
1563 | select CPU_SUPPORTS_UNCACHED_ACCELERATED | 1594 | select CPU_SUPPORTS_UNCACHED_ACCELERATED |
1564 | 1595 | ||
1596 | config SYS_HAS_CPU_LOONGSON1B | ||
1597 | bool | ||
1598 | |||
1565 | config SYS_HAS_CPU_MIPS32_R1 | 1599 | config SYS_HAS_CPU_MIPS32_R1 |
1566 | bool | 1600 | bool |
1567 | 1601 | ||
@@ -2366,6 +2400,8 @@ config PCI_DOMAINS | |||
2366 | 2400 | ||
2367 | source "drivers/pci/Kconfig" | 2401 | source "drivers/pci/Kconfig" |
2368 | 2402 | ||
2403 | source "drivers/pci/pcie/Kconfig" | ||
2404 | |||
2369 | # | 2405 | # |
2370 | # ISA support is now enabled via select. Too many systems still have the one | 2406 | # ISA support is now enabled via select. Too many systems still have the one |
2371 | # or other ISA chip on the board that users don't know about so don't expect | 2407 | # or other ISA chip on the board that users don't know about so don't expect |
diff --git a/arch/mips/alchemy/board-mtx1.c b/arch/mips/alchemy/board-mtx1.c index 295f1a95f745..99969484c475 100644 --- a/arch/mips/alchemy/board-mtx1.c +++ b/arch/mips/alchemy/board-mtx1.c | |||
@@ -81,10 +81,10 @@ static void mtx1_power_off(void) | |||
81 | 81 | ||
82 | void __init board_setup(void) | 82 | void __init board_setup(void) |
83 | { | 83 | { |
84 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | 84 | #if IS_ENABLED(CONFIG_USB_OHCI_HCD) |
85 | /* Enable USB power switch */ | 85 | /* Enable USB power switch */ |
86 | alchemy_gpio_direction_output(204, 0); | 86 | alchemy_gpio_direction_output(204, 0); |
87 | #endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ | 87 | #endif /* IS_ENABLED(CONFIG_USB_OHCI_HCD) */ |
88 | 88 | ||
89 | /* Initialize sys_pinfunc */ | 89 | /* Initialize sys_pinfunc */ |
90 | au_writel(SYS_PF_NI2, SYS_PINFUNC); | 90 | au_writel(SYS_PF_NI2, SYS_PINFUNC); |
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c index 95cb9113b12c..c0f3ce6dcb56 100644 --- a/arch/mips/alchemy/common/platform.c +++ b/arch/mips/alchemy/common/platform.c | |||
@@ -334,13 +334,12 @@ static void __init alchemy_setup_macs(int ctype) | |||
334 | if (alchemy_get_macs(ctype) < 1) | 334 | if (alchemy_get_macs(ctype) < 1) |
335 | return; | 335 | return; |
336 | 336 | ||
337 | macres = kmalloc(sizeof(struct resource) * MAC_RES_COUNT, GFP_KERNEL); | 337 | macres = kmemdup(au1xxx_eth0_resources[ctype], |
338 | sizeof(struct resource) * MAC_RES_COUNT, GFP_KERNEL); | ||
338 | if (!macres) { | 339 | if (!macres) { |
339 | printk(KERN_INFO "Alchemy: no memory for MAC0 resources\n"); | 340 | printk(KERN_INFO "Alchemy: no memory for MAC0 resources\n"); |
340 | return; | 341 | return; |
341 | } | 342 | } |
342 | memcpy(macres, au1xxx_eth0_resources[ctype], | ||
343 | sizeof(struct resource) * MAC_RES_COUNT); | ||
344 | au1xxx_eth0_device.resource = macres; | 343 | au1xxx_eth0_device.resource = macres; |
345 | 344 | ||
346 | i = prom_get_ethernet_addr(ethaddr); | 345 | i = prom_get_ethernet_addr(ethaddr); |
@@ -356,13 +355,12 @@ static void __init alchemy_setup_macs(int ctype) | |||
356 | if (alchemy_get_macs(ctype) < 2) | 355 | if (alchemy_get_macs(ctype) < 2) |
357 | return; | 356 | return; |
358 | 357 | ||
359 | macres = kmalloc(sizeof(struct resource) * MAC_RES_COUNT, GFP_KERNEL); | 358 | macres = kmemdup(au1xxx_eth1_resources[ctype], |
359 | sizeof(struct resource) * MAC_RES_COUNT, GFP_KERNEL); | ||
360 | if (!macres) { | 360 | if (!macres) { |
361 | printk(KERN_INFO "Alchemy: no memory for MAC1 resources\n"); | 361 | printk(KERN_INFO "Alchemy: no memory for MAC1 resources\n"); |
362 | return; | 362 | return; |
363 | } | 363 | } |
364 | memcpy(macres, au1xxx_eth1_resources[ctype], | ||
365 | sizeof(struct resource) * MAC_RES_COUNT); | ||
366 | au1xxx_eth1_device.resource = macres; | 364 | au1xxx_eth1_device.resource = macres; |
367 | 365 | ||
368 | ethaddr[5] += 1; /* next addr for 2nd MAC */ | 366 | ethaddr[5] += 1; /* next addr for 2nd MAC */ |
diff --git a/arch/mips/alchemy/devboards/Makefile b/arch/mips/alchemy/devboards/Makefile index 3c37fb303364..c9e747dd9fc2 100644 --- a/arch/mips/alchemy/devboards/Makefile +++ b/arch/mips/alchemy/devboards/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Alchemy Develboards | 2 | # Alchemy Develboards |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y += prom.o bcsr.o platform.o | 5 | obj-y += bcsr.o platform.o |
6 | obj-$(CONFIG_PM) += pm.o | 6 | obj-$(CONFIG_PM) += pm.o |
7 | obj-$(CONFIG_MIPS_PB1100) += pb1100.o | 7 | obj-$(CONFIG_MIPS_PB1100) += pb1100.o |
8 | obj-$(CONFIG_MIPS_PB1500) += pb1500.o | 8 | obj-$(CONFIG_MIPS_PB1500) += pb1500.o |
diff --git a/arch/mips/alchemy/devboards/bcsr.c b/arch/mips/alchemy/devboards/bcsr.c index 1e83ce2e1147..f2039ef2c293 100644 --- a/arch/mips/alchemy/devboards/bcsr.c +++ b/arch/mips/alchemy/devboards/bcsr.c | |||
@@ -90,10 +90,7 @@ static void bcsr_csc_handler(unsigned int irq, struct irq_desc *d) | |||
90 | unsigned short bisr = __raw_readw(bcsr_virt + BCSR_REG_INTSTAT); | 90 | unsigned short bisr = __raw_readw(bcsr_virt + BCSR_REG_INTSTAT); |
91 | 91 | ||
92 | disable_irq_nosync(irq); | 92 | disable_irq_nosync(irq); |
93 | 93 | generic_handle_irq(bcsr_csc_base + __ffs(bisr)); | |
94 | for ( ; bisr; bisr &= bisr - 1) | ||
95 | generic_handle_irq(bcsr_csc_base + __ffs(bisr)); | ||
96 | |||
97 | enable_irq(irq); | 94 | enable_irq(irq); |
98 | } | 95 | } |
99 | 96 | ||
diff --git a/arch/mips/alchemy/devboards/pb1100.c b/arch/mips/alchemy/devboards/pb1100.c index cff50d05ddd4..78c77a44a317 100644 --- a/arch/mips/alchemy/devboards/pb1100.c +++ b/arch/mips/alchemy/devboards/pb1100.c | |||
@@ -46,7 +46,7 @@ void __init board_setup(void) | |||
46 | alchemy_gpio1_input_enable(); | 46 | alchemy_gpio1_input_enable(); |
47 | udelay(100); | 47 | udelay(100); |
48 | 48 | ||
49 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | 49 | #if IS_ENABLED(CONFIG_USB_OHCI_HCD) |
50 | { | 50 | { |
51 | u32 pin_func, sys_freqctrl, sys_clksrc; | 51 | u32 pin_func, sys_freqctrl, sys_clksrc; |
52 | 52 | ||
@@ -93,7 +93,7 @@ void __init board_setup(void) | |||
93 | pin_func |= SYS_PF_USB; | 93 | pin_func |= SYS_PF_USB; |
94 | au_writel(pin_func, SYS_PINFUNC); | 94 | au_writel(pin_func, SYS_PINFUNC); |
95 | } | 95 | } |
96 | #endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ | 96 | #endif /* IS_ENABLED(CONFIG_USB_OHCI_HCD) */ |
97 | 97 | ||
98 | /* Enable sys bus clock divider when IDLE state or no bus activity. */ | 98 | /* Enable sys bus clock divider when IDLE state or no bus activity. */ |
99 | au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL); | 99 | au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL); |
diff --git a/arch/mips/alchemy/devboards/pb1500.c b/arch/mips/alchemy/devboards/pb1500.c index e7b807b3ec51..232fee942000 100644 --- a/arch/mips/alchemy/devboards/pb1500.c +++ b/arch/mips/alchemy/devboards/pb1500.c | |||
@@ -53,7 +53,7 @@ void __init board_setup(void) | |||
53 | alchemy_gpio_direction_input(201); | 53 | alchemy_gpio_direction_input(201); |
54 | alchemy_gpio_direction_input(203); | 54 | alchemy_gpio_direction_input(203); |
55 | 55 | ||
56 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | 56 | #if IS_ENABLED(CONFIG_USB_OHCI_HCD) |
57 | 57 | ||
58 | /* Zero and disable FREQ2 */ | 58 | /* Zero and disable FREQ2 */ |
59 | sys_freqctrl = au_readl(SYS_FREQCTRL0); | 59 | sys_freqctrl = au_readl(SYS_FREQCTRL0); |
@@ -87,7 +87,7 @@ void __init board_setup(void) | |||
87 | /* 2nd USB port is USB host */ | 87 | /* 2nd USB port is USB host */ |
88 | pin_func |= SYS_PF_USB; | 88 | pin_func |= SYS_PF_USB; |
89 | au_writel(pin_func, SYS_PINFUNC); | 89 | au_writel(pin_func, SYS_PINFUNC); |
90 | #endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ | 90 | #endif /* IS_ENABLED(CONFIG_USB_OHCI_HCD) */ |
91 | 91 | ||
92 | #ifdef CONFIG_PCI | 92 | #ifdef CONFIG_PCI |
93 | { | 93 | { |
diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/devboards/platform.c index 621f70afb63a..f39042e99d0d 100644 --- a/arch/mips/alchemy/devboards/platform.c +++ b/arch/mips/alchemy/devboards/platform.c | |||
@@ -10,9 +10,39 @@ | |||
10 | #include <linux/platform_device.h> | 10 | #include <linux/platform_device.h> |
11 | #include <linux/pm.h> | 11 | #include <linux/pm.h> |
12 | 12 | ||
13 | #include <asm/bootinfo.h> | ||
13 | #include <asm/reboot.h> | 14 | #include <asm/reboot.h> |
15 | #include <asm/mach-au1x00/au1000.h> | ||
14 | #include <asm/mach-db1x00/bcsr.h> | 16 | #include <asm/mach-db1x00/bcsr.h> |
15 | 17 | ||
18 | #include <prom.h> | ||
19 | |||
20 | void __init prom_init(void) | ||
21 | { | ||
22 | unsigned char *memsize_str; | ||
23 | unsigned long memsize; | ||
24 | |||
25 | prom_argc = (int)fw_arg0; | ||
26 | prom_argv = (char **)fw_arg1; | ||
27 | prom_envp = (char **)fw_arg2; | ||
28 | |||
29 | prom_init_cmdline(); | ||
30 | memsize_str = prom_getenv("memsize"); | ||
31 | if (!memsize_str || kstrtoul(memsize_str, 0, &memsize)) | ||
32 | memsize = 64 << 20; /* all devboards have at least 64MB RAM */ | ||
33 | |||
34 | add_memory_region(0, memsize, BOOT_MEM_RAM); | ||
35 | } | ||
36 | |||
37 | void prom_putchar(unsigned char c) | ||
38 | { | ||
39 | #ifdef CONFIG_MIPS_DB1300 | ||
40 | alchemy_uart_putchar(AU1300_UART2_PHYS_ADDR, c); | ||
41 | #else | ||
42 | alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); | ||
43 | #endif | ||
44 | } | ||
45 | |||
16 | 46 | ||
17 | static struct platform_device db1x00_rtc_dev = { | 47 | static struct platform_device db1x00_rtc_dev = { |
18 | .name = "rtc-au1xxx", | 48 | .name = "rtc-au1xxx", |
diff --git a/arch/mips/alchemy/devboards/prom.c b/arch/mips/alchemy/devboards/prom.c deleted file mode 100644 index 93a22107cc41..000000000000 --- a/arch/mips/alchemy/devboards/prom.c +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | /* | ||
2 | * Common code used by all Alchemy develboards. | ||
3 | * | ||
4 | * Extracted from files which had this to say: | ||
5 | * | ||
6 | * Copyright 2000, 2008 MontaVista Software Inc. | ||
7 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
17 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
20 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License along | ||
26 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
27 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | */ | ||
29 | |||
30 | #include <linux/init.h> | ||
31 | #include <linux/kernel.h> | ||
32 | #include <asm/bootinfo.h> | ||
33 | #include <asm/mach-au1x00/au1000.h> | ||
34 | #include <prom.h> | ||
35 | |||
36 | #if defined(CONFIG_MIPS_DB1000) || \ | ||
37 | defined(CONFIG_MIPS_PB1100) || \ | ||
38 | defined(CONFIG_MIPS_PB1500) | ||
39 | #define ALCHEMY_BOARD_DEFAULT_MEMSIZE 0x04000000 | ||
40 | |||
41 | #else /* Au1550/Au1200-based develboards */ | ||
42 | #define ALCHEMY_BOARD_DEFAULT_MEMSIZE 0x08000000 | ||
43 | #endif | ||
44 | |||
45 | void __init prom_init(void) | ||
46 | { | ||
47 | unsigned char *memsize_str; | ||
48 | unsigned long memsize; | ||
49 | |||
50 | prom_argc = (int)fw_arg0; | ||
51 | prom_argv = (char **)fw_arg1; | ||
52 | prom_envp = (char **)fw_arg2; | ||
53 | |||
54 | prom_init_cmdline(); | ||
55 | memsize_str = prom_getenv("memsize"); | ||
56 | if (!memsize_str || strict_strtoul(memsize_str, 0, &memsize)) | ||
57 | memsize = ALCHEMY_BOARD_DEFAULT_MEMSIZE; | ||
58 | |||
59 | add_memory_region(0, memsize, BOOT_MEM_RAM); | ||
60 | } | ||
61 | |||
62 | void prom_putchar(unsigned char c) | ||
63 | { | ||
64 | #ifdef CONFIG_MIPS_DB1300 | ||
65 | alchemy_uart_putchar(AU1300_UART2_PHYS_ADDR, c); | ||
66 | #else | ||
67 | alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); | ||
68 | #endif | ||
69 | } | ||
diff --git a/arch/mips/bcm63xx/Kconfig b/arch/mips/bcm63xx/Kconfig index 6b1b9ad8d857..d03e8799d1cf 100644 --- a/arch/mips/bcm63xx/Kconfig +++ b/arch/mips/bcm63xx/Kconfig | |||
@@ -1,6 +1,10 @@ | |||
1 | menu "CPU support" | 1 | menu "CPU support" |
2 | depends on BCM63XX | 2 | depends on BCM63XX |
3 | 3 | ||
4 | config BCM63XX_CPU_6328 | ||
5 | bool "support 6328 CPU" | ||
6 | select HW_HAS_PCI | ||
7 | |||
4 | config BCM63XX_CPU_6338 | 8 | config BCM63XX_CPU_6338 |
5 | bool "support 6338 CPU" | 9 | bool "support 6338 CPU" |
6 | select HW_HAS_PCI | 10 | select HW_HAS_PCI |
diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile index 6dfdc69928ac..833af72c852a 100644 --- a/arch/mips/bcm63xx/Makefile +++ b/arch/mips/bcm63xx/Makefile | |||
@@ -1,5 +1,6 @@ | |||
1 | obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \ | 1 | obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \ |
2 | dev-dsp.o dev-enet.o dev-pcmcia.o dev-uart.o dev-wdt.o | 2 | dev-dsp.o dev-enet.o dev-flash.o dev-pcmcia.o dev-rng.o \ |
3 | dev-spi.o dev-uart.o dev-wdt.o | ||
3 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | 4 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
4 | 5 | ||
5 | obj-y += boards/ | 6 | obj-y += boards/ |
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c index 2f1773f3fb7a..feb05258a4d1 100644 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c | |||
@@ -11,9 +11,6 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/mtd/mtd.h> | ||
15 | #include <linux/mtd/partitions.h> | ||
16 | #include <linux/mtd/physmap.h> | ||
17 | #include <linux/ssb/ssb.h> | 14 | #include <linux/ssb/ssb.h> |
18 | #include <asm/addrspace.h> | 15 | #include <asm/addrspace.h> |
19 | #include <bcm63xx_board.h> | 16 | #include <bcm63xx_board.h> |
@@ -24,7 +21,9 @@ | |||
24 | #include <bcm63xx_dev_pci.h> | 21 | #include <bcm63xx_dev_pci.h> |
25 | #include <bcm63xx_dev_enet.h> | 22 | #include <bcm63xx_dev_enet.h> |
26 | #include <bcm63xx_dev_dsp.h> | 23 | #include <bcm63xx_dev_dsp.h> |
24 | #include <bcm63xx_dev_flash.h> | ||
27 | #include <bcm63xx_dev_pcmcia.h> | 25 | #include <bcm63xx_dev_pcmcia.h> |
26 | #include <bcm63xx_dev_spi.h> | ||
28 | #include <board_bcm963xx.h> | 27 | #include <board_bcm963xx.h> |
29 | 28 | ||
30 | #define PFX "board_bcm963xx: " | 29 | #define PFX "board_bcm963xx: " |
@@ -34,6 +33,48 @@ static unsigned int mac_addr_used; | |||
34 | static struct board_info board; | 33 | static struct board_info board; |
35 | 34 | ||
36 | /* | 35 | /* |
36 | * known 6328 boards | ||
37 | */ | ||
38 | #ifdef CONFIG_BCM63XX_CPU_6328 | ||
39 | static struct board_info __initdata board_96328avng = { | ||
40 | .name = "96328avng", | ||
41 | .expected_cpu_id = 0x6328, | ||
42 | |||
43 | .has_uart0 = 1, | ||
44 | .has_pci = 1, | ||
45 | |||
46 | .leds = { | ||
47 | { | ||
48 | .name = "96328avng::ppp-fail", | ||
49 | .gpio = 2, | ||
50 | .active_low = 1, | ||
51 | }, | ||
52 | { | ||
53 | .name = "96328avng::power", | ||
54 | .gpio = 4, | ||
55 | .active_low = 1, | ||
56 | .default_trigger = "default-on", | ||
57 | }, | ||
58 | { | ||
59 | .name = "96328avng::power-fail", | ||
60 | .gpio = 8, | ||
61 | .active_low = 1, | ||
62 | }, | ||
63 | { | ||
64 | .name = "96328avng::wps", | ||
65 | .gpio = 9, | ||
66 | .active_low = 1, | ||
67 | }, | ||
68 | { | ||
69 | .name = "96328avng::ppp", | ||
70 | .gpio = 11, | ||
71 | .active_low = 1, | ||
72 | }, | ||
73 | }, | ||
74 | }; | ||
75 | #endif | ||
76 | |||
77 | /* | ||
37 | * known 6338 boards | 78 | * known 6338 boards |
38 | */ | 79 | */ |
39 | #ifdef CONFIG_BCM63XX_CPU_6338 | 80 | #ifdef CONFIG_BCM63XX_CPU_6338 |
@@ -592,6 +633,9 @@ static struct board_info __initdata board_DWVS0 = { | |||
592 | * all boards | 633 | * all boards |
593 | */ | 634 | */ |
594 | static const struct board_info __initdata *bcm963xx_boards[] = { | 635 | static const struct board_info __initdata *bcm963xx_boards[] = { |
636 | #ifdef CONFIG_BCM63XX_CPU_6328 | ||
637 | &board_96328avng, | ||
638 | #endif | ||
595 | #ifdef CONFIG_BCM63XX_CPU_6338 | 639 | #ifdef CONFIG_BCM63XX_CPU_6338 |
596 | &board_96338gw, | 640 | &board_96338gw, |
597 | &board_96338w, | 641 | &board_96338w, |
@@ -709,9 +753,15 @@ void __init board_prom_init(void) | |||
709 | char cfe_version[32]; | 753 | char cfe_version[32]; |
710 | u32 val; | 754 | u32 val; |
711 | 755 | ||
712 | /* read base address of boot chip select (0) */ | 756 | /* read base address of boot chip select (0) |
713 | val = bcm_mpi_readl(MPI_CSBASE_REG(0)); | 757 | * 6328 does not have MPI but boots from a fixed address |
714 | val &= MPI_CSBASE_BASE_MASK; | 758 | */ |
759 | if (BCMCPU_IS_6328()) | ||
760 | val = 0x18000000; | ||
761 | else { | ||
762 | val = bcm_mpi_readl(MPI_CSBASE_REG(0)); | ||
763 | val &= MPI_CSBASE_BASE_MASK; | ||
764 | } | ||
715 | boot_addr = (u8 *)KSEG1ADDR(val); | 765 | boot_addr = (u8 *)KSEG1ADDR(val); |
716 | 766 | ||
717 | /* dump cfe version */ | 767 | /* dump cfe version */ |
@@ -808,40 +858,6 @@ void __init board_setup(void) | |||
808 | panic("unexpected CPU for bcm963xx board"); | 858 | panic("unexpected CPU for bcm963xx board"); |
809 | } | 859 | } |
810 | 860 | ||
811 | static struct mtd_partition mtd_partitions[] = { | ||
812 | { | ||
813 | .name = "cfe", | ||
814 | .offset = 0x0, | ||
815 | .size = 0x40000, | ||
816 | } | ||
817 | }; | ||
818 | |||
819 | static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL }; | ||
820 | |||
821 | static struct physmap_flash_data flash_data = { | ||
822 | .width = 2, | ||
823 | .nr_parts = ARRAY_SIZE(mtd_partitions), | ||
824 | .parts = mtd_partitions, | ||
825 | .part_probe_types = bcm63xx_part_types, | ||
826 | }; | ||
827 | |||
828 | static struct resource mtd_resources[] = { | ||
829 | { | ||
830 | .start = 0, /* filled at runtime */ | ||
831 | .end = 0, /* filled at runtime */ | ||
832 | .flags = IORESOURCE_MEM, | ||
833 | } | ||
834 | }; | ||
835 | |||
836 | static struct platform_device mtd_dev = { | ||
837 | .name = "physmap-flash", | ||
838 | .resource = mtd_resources, | ||
839 | .num_resources = ARRAY_SIZE(mtd_resources), | ||
840 | .dev = { | ||
841 | .platform_data = &flash_data, | ||
842 | }, | ||
843 | }; | ||
844 | |||
845 | static struct gpio_led_platform_data bcm63xx_led_data; | 861 | static struct gpio_led_platform_data bcm63xx_led_data; |
846 | 862 | ||
847 | static struct platform_device bcm63xx_gpio_leds = { | 863 | static struct platform_device bcm63xx_gpio_leds = { |
@@ -855,8 +871,6 @@ static struct platform_device bcm63xx_gpio_leds = { | |||
855 | */ | 871 | */ |
856 | int __init board_register_devices(void) | 872 | int __init board_register_devices(void) |
857 | { | 873 | { |
858 | u32 val; | ||
859 | |||
860 | if (board.has_uart0) | 874 | if (board.has_uart0) |
861 | bcm63xx_uart_register(0); | 875 | bcm63xx_uart_register(0); |
862 | 876 | ||
@@ -890,14 +904,9 @@ int __init board_register_devices(void) | |||
890 | } | 904 | } |
891 | #endif | 905 | #endif |
892 | 906 | ||
893 | /* read base address of boot chip select (0) */ | 907 | bcm63xx_spi_register(); |
894 | val = bcm_mpi_readl(MPI_CSBASE_REG(0)); | ||
895 | val &= MPI_CSBASE_BASE_MASK; | ||
896 | |||
897 | mtd_resources[0].start = val; | ||
898 | mtd_resources[0].end = 0x1FFFFFFF; | ||
899 | 908 | ||
900 | platform_device_register(&mtd_dev); | 909 | bcm63xx_flash_register(); |
901 | 910 | ||
902 | bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); | 911 | bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); |
903 | bcm63xx_led_data.leds = board.leds; | 912 | bcm63xx_led_data.leds = board.leds; |
diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c index 9d57c71b7b58..1db48adb543a 100644 --- a/arch/mips/bcm63xx/clk.c +++ b/arch/mips/bcm63xx/clk.c | |||
@@ -120,7 +120,7 @@ static void enetsw_set(struct clk *clk, int enable) | |||
120 | { | 120 | { |
121 | if (!BCMCPU_IS_6368()) | 121 | if (!BCMCPU_IS_6368()) |
122 | return; | 122 | return; |
123 | bcm_hwclock_set(CKCTL_6368_ROBOSW_CLK_EN | | 123 | bcm_hwclock_set(CKCTL_6368_ROBOSW_EN | |
124 | CKCTL_6368_SWPKT_USB_EN | | 124 | CKCTL_6368_SWPKT_USB_EN | |
125 | CKCTL_6368_SWPKT_SAR_EN, enable); | 125 | CKCTL_6368_SWPKT_SAR_EN, enable); |
126 | if (enable) { | 126 | if (enable) { |
@@ -163,7 +163,7 @@ static void usbh_set(struct clk *clk, int enable) | |||
163 | if (BCMCPU_IS_6348()) | 163 | if (BCMCPU_IS_6348()) |
164 | bcm_hwclock_set(CKCTL_6348_USBH_EN, enable); | 164 | bcm_hwclock_set(CKCTL_6348_USBH_EN, enable); |
165 | else if (BCMCPU_IS_6368()) | 165 | else if (BCMCPU_IS_6368()) |
166 | bcm_hwclock_set(CKCTL_6368_USBH_CLK_EN, enable); | 166 | bcm_hwclock_set(CKCTL_6368_USBH_EN, enable); |
167 | } | 167 | } |
168 | 168 | ||
169 | static struct clk clk_usbh = { | 169 | static struct clk clk_usbh = { |
@@ -181,9 +181,11 @@ static void spi_set(struct clk *clk, int enable) | |||
181 | mask = CKCTL_6338_SPI_EN; | 181 | mask = CKCTL_6338_SPI_EN; |
182 | else if (BCMCPU_IS_6348()) | 182 | else if (BCMCPU_IS_6348()) |
183 | mask = CKCTL_6348_SPI_EN; | 183 | mask = CKCTL_6348_SPI_EN; |
184 | else | 184 | else if (BCMCPU_IS_6358()) |
185 | /* BCMCPU_IS_6358 */ | ||
186 | mask = CKCTL_6358_SPI_EN; | 185 | mask = CKCTL_6358_SPI_EN; |
186 | else | ||
187 | /* BCMCPU_IS_6368 */ | ||
188 | mask = CKCTL_6368_SPI_EN; | ||
187 | bcm_hwclock_set(mask, enable); | 189 | bcm_hwclock_set(mask, enable); |
188 | } | 190 | } |
189 | 191 | ||
@@ -199,7 +201,7 @@ static void xtm_set(struct clk *clk, int enable) | |||
199 | if (!BCMCPU_IS_6368()) | 201 | if (!BCMCPU_IS_6368()) |
200 | return; | 202 | return; |
201 | 203 | ||
202 | bcm_hwclock_set(CKCTL_6368_SAR_CLK_EN | | 204 | bcm_hwclock_set(CKCTL_6368_SAR_EN | |
203 | CKCTL_6368_SWPKT_SAR_EN, enable); | 205 | CKCTL_6368_SWPKT_SAR_EN, enable); |
204 | 206 | ||
205 | if (enable) { | 207 | if (enable) { |
@@ -222,6 +224,18 @@ static struct clk clk_xtm = { | |||
222 | }; | 224 | }; |
223 | 225 | ||
224 | /* | 226 | /* |
227 | * IPsec clock | ||
228 | */ | ||
229 | static void ipsec_set(struct clk *clk, int enable) | ||
230 | { | ||
231 | bcm_hwclock_set(CKCTL_6368_IPSEC_EN, enable); | ||
232 | } | ||
233 | |||
234 | static struct clk clk_ipsec = { | ||
235 | .set = ipsec_set, | ||
236 | }; | ||
237 | |||
238 | /* | ||
225 | * Internal peripheral clock | 239 | * Internal peripheral clock |
226 | */ | 240 | */ |
227 | static struct clk clk_periph = { | 241 | static struct clk clk_periph = { |
@@ -278,6 +292,8 @@ struct clk *clk_get(struct device *dev, const char *id) | |||
278 | return &clk_periph; | 292 | return &clk_periph; |
279 | if (BCMCPU_IS_6358() && !strcmp(id, "pcm")) | 293 | if (BCMCPU_IS_6358() && !strcmp(id, "pcm")) |
280 | return &clk_pcm; | 294 | return &clk_pcm; |
295 | if (BCMCPU_IS_6368() && !strcmp(id, "ipsec")) | ||
296 | return &clk_ipsec; | ||
281 | return ERR_PTR(-ENOENT); | 297 | return ERR_PTR(-ENOENT); |
282 | } | 298 | } |
283 | 299 | ||
diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c index 8f0d6c7725ea..a7afb289b15a 100644 --- a/arch/mips/bcm63xx/cpu.c +++ b/arch/mips/bcm63xx/cpu.c | |||
@@ -29,6 +29,14 @@ static u16 bcm63xx_cpu_rev; | |||
29 | static unsigned int bcm63xx_cpu_freq; | 29 | static unsigned int bcm63xx_cpu_freq; |
30 | static unsigned int bcm63xx_memory_size; | 30 | static unsigned int bcm63xx_memory_size; |
31 | 31 | ||
32 | static const unsigned long bcm6328_regs_base[] = { | ||
33 | __GEN_CPU_REGS_TABLE(6328) | ||
34 | }; | ||
35 | |||
36 | static const int bcm6328_irqs[] = { | ||
37 | __GEN_CPU_IRQ_TABLE(6328) | ||
38 | }; | ||
39 | |||
32 | static const unsigned long bcm6338_regs_base[] = { | 40 | static const unsigned long bcm6338_regs_base[] = { |
33 | __GEN_CPU_REGS_TABLE(6338) | 41 | __GEN_CPU_REGS_TABLE(6338) |
34 | }; | 42 | }; |
@@ -99,6 +107,33 @@ unsigned int bcm63xx_get_memory_size(void) | |||
99 | static unsigned int detect_cpu_clock(void) | 107 | static unsigned int detect_cpu_clock(void) |
100 | { | 108 | { |
101 | switch (bcm63xx_get_cpu_id()) { | 109 | switch (bcm63xx_get_cpu_id()) { |
110 | case BCM6328_CPU_ID: | ||
111 | { | ||
112 | unsigned int tmp, mips_pll_fcvo; | ||
113 | |||
114 | tmp = bcm_misc_readl(MISC_STRAPBUS_6328_REG); | ||
115 | mips_pll_fcvo = (tmp & STRAPBUS_6328_FCVO_MASK) | ||
116 | >> STRAPBUS_6328_FCVO_SHIFT; | ||
117 | |||
118 | switch (mips_pll_fcvo) { | ||
119 | case 0x12: | ||
120 | case 0x14: | ||
121 | case 0x19: | ||
122 | return 160000000; | ||
123 | case 0x1c: | ||
124 | return 192000000; | ||
125 | case 0x13: | ||
126 | case 0x15: | ||
127 | return 200000000; | ||
128 | case 0x1a: | ||
129 | return 384000000; | ||
130 | case 0x16: | ||
131 | return 400000000; | ||
132 | default: | ||
133 | return 320000000; | ||
134 | } | ||
135 | |||
136 | } | ||
102 | case BCM6338_CPU_ID: | 137 | case BCM6338_CPU_ID: |
103 | /* BCM6338 has a fixed 240 Mhz frequency */ | 138 | /* BCM6338 has a fixed 240 Mhz frequency */ |
104 | return 240000000; | 139 | return 240000000; |
@@ -170,6 +205,9 @@ static unsigned int detect_memory_size(void) | |||
170 | unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0; | 205 | unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0; |
171 | u32 val; | 206 | u32 val; |
172 | 207 | ||
208 | if (BCMCPU_IS_6328()) | ||
209 | return bcm_ddr_readl(DDR_CSEND_REG) << 24; | ||
210 | |||
173 | if (BCMCPU_IS_6345()) { | 211 | if (BCMCPU_IS_6345()) { |
174 | val = bcm_sdram_readl(SDRAM_MBASE_REG); | 212 | val = bcm_sdram_readl(SDRAM_MBASE_REG); |
175 | return (val * 8 * 1024 * 1024); | 213 | return (val * 8 * 1024 * 1024); |
@@ -228,17 +266,26 @@ void __init bcm63xx_cpu_init(void) | |||
228 | bcm63xx_irqs = bcm6345_irqs; | 266 | bcm63xx_irqs = bcm6345_irqs; |
229 | break; | 267 | break; |
230 | case CPU_BMIPS4350: | 268 | case CPU_BMIPS4350: |
231 | switch (read_c0_prid() & 0xf0) { | 269 | if ((read_c0_prid() & 0xf0) == 0x10) { |
232 | case 0x10: | ||
233 | expected_cpu_id = BCM6358_CPU_ID; | 270 | expected_cpu_id = BCM6358_CPU_ID; |
234 | bcm63xx_regs_base = bcm6358_regs_base; | 271 | bcm63xx_regs_base = bcm6358_regs_base; |
235 | bcm63xx_irqs = bcm6358_irqs; | 272 | bcm63xx_irqs = bcm6358_irqs; |
236 | break; | 273 | } else { |
237 | case 0x30: | 274 | /* all newer chips have the same chip id location */ |
238 | expected_cpu_id = BCM6368_CPU_ID; | 275 | u16 chip_id = bcm_readw(BCM_6368_PERF_BASE); |
239 | bcm63xx_regs_base = bcm6368_regs_base; | 276 | |
240 | bcm63xx_irqs = bcm6368_irqs; | 277 | switch (chip_id) { |
241 | break; | 278 | case BCM6328_CPU_ID: |
279 | expected_cpu_id = BCM6328_CPU_ID; | ||
280 | bcm63xx_regs_base = bcm6328_regs_base; | ||
281 | bcm63xx_irqs = bcm6328_irqs; | ||
282 | break; | ||
283 | case BCM6368_CPU_ID: | ||
284 | expected_cpu_id = BCM6368_CPU_ID; | ||
285 | bcm63xx_regs_base = bcm6368_regs_base; | ||
286 | bcm63xx_irqs = bcm6368_irqs; | ||
287 | break; | ||
288 | } | ||
242 | } | 289 | } |
243 | break; | 290 | break; |
244 | } | 291 | } |
diff --git a/arch/mips/bcm63xx/dev-dsp.c b/arch/mips/bcm63xx/dev-dsp.c index da46d1d3c77c..5bb5b154c9bd 100644 --- a/arch/mips/bcm63xx/dev-dsp.c +++ b/arch/mips/bcm63xx/dev-dsp.c | |||
@@ -31,7 +31,7 @@ static struct resource voip_dsp_resources[] = { | |||
31 | 31 | ||
32 | static struct platform_device bcm63xx_voip_dsp_device = { | 32 | static struct platform_device bcm63xx_voip_dsp_device = { |
33 | .name = "bcm63xx-voip-dsp", | 33 | .name = "bcm63xx-voip-dsp", |
34 | .id = 0, | 34 | .id = -1, |
35 | .num_resources = ARRAY_SIZE(voip_dsp_resources), | 35 | .num_resources = ARRAY_SIZE(voip_dsp_resources), |
36 | .resource = voip_dsp_resources, | 36 | .resource = voip_dsp_resources, |
37 | }; | 37 | }; |
diff --git a/arch/mips/bcm63xx/dev-flash.c b/arch/mips/bcm63xx/dev-flash.c new file mode 100644 index 000000000000..58371c7deac2 --- /dev/null +++ b/arch/mips/bcm63xx/dev-flash.c | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * Broadcom BCM63xx flash registration | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr> | ||
9 | * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org> | ||
10 | * Copyright (C) 2012 Jonas Gorski <jonas.gorski@gmail.com> | ||
11 | */ | ||
12 | |||
13 | #include <linux/init.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/mtd/mtd.h> | ||
17 | #include <linux/mtd/partitions.h> | ||
18 | #include <linux/mtd/physmap.h> | ||
19 | |||
20 | #include <bcm63xx_cpu.h> | ||
21 | #include <bcm63xx_dev_flash.h> | ||
22 | #include <bcm63xx_regs.h> | ||
23 | #include <bcm63xx_io.h> | ||
24 | |||
25 | static struct mtd_partition mtd_partitions[] = { | ||
26 | { | ||
27 | .name = "cfe", | ||
28 | .offset = 0x0, | ||
29 | .size = 0x40000, | ||
30 | } | ||
31 | }; | ||
32 | |||
33 | static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL }; | ||
34 | |||
35 | static struct physmap_flash_data flash_data = { | ||
36 | .width = 2, | ||
37 | .parts = mtd_partitions, | ||
38 | .part_probe_types = bcm63xx_part_types, | ||
39 | }; | ||
40 | |||
41 | static struct resource mtd_resources[] = { | ||
42 | { | ||
43 | .start = 0, /* filled at runtime */ | ||
44 | .end = 0, /* filled at runtime */ | ||
45 | .flags = IORESOURCE_MEM, | ||
46 | } | ||
47 | }; | ||
48 | |||
49 | static struct platform_device mtd_dev = { | ||
50 | .name = "physmap-flash", | ||
51 | .resource = mtd_resources, | ||
52 | .num_resources = ARRAY_SIZE(mtd_resources), | ||
53 | .dev = { | ||
54 | .platform_data = &flash_data, | ||
55 | }, | ||
56 | }; | ||
57 | |||
58 | static int __init bcm63xx_detect_flash_type(void) | ||
59 | { | ||
60 | u32 val; | ||
61 | |||
62 | switch (bcm63xx_get_cpu_id()) { | ||
63 | case BCM6328_CPU_ID: | ||
64 | val = bcm_misc_readl(MISC_STRAPBUS_6328_REG); | ||
65 | if (val & STRAPBUS_6328_BOOT_SEL_SERIAL) | ||
66 | return BCM63XX_FLASH_TYPE_SERIAL; | ||
67 | else | ||
68 | return BCM63XX_FLASH_TYPE_NAND; | ||
69 | case BCM6338_CPU_ID: | ||
70 | case BCM6345_CPU_ID: | ||
71 | case BCM6348_CPU_ID: | ||
72 | /* no way to auto detect so assume parallel */ | ||
73 | return BCM63XX_FLASH_TYPE_PARALLEL; | ||
74 | case BCM6358_CPU_ID: | ||
75 | val = bcm_gpio_readl(GPIO_STRAPBUS_REG); | ||
76 | if (val & STRAPBUS_6358_BOOT_SEL_PARALLEL) | ||
77 | return BCM63XX_FLASH_TYPE_PARALLEL; | ||
78 | else | ||
79 | return BCM63XX_FLASH_TYPE_SERIAL; | ||
80 | case BCM6368_CPU_ID: | ||
81 | val = bcm_gpio_readl(GPIO_STRAPBUS_REG); | ||
82 | switch (val & STRAPBUS_6368_BOOT_SEL_MASK) { | ||
83 | case STRAPBUS_6368_BOOT_SEL_NAND: | ||
84 | return BCM63XX_FLASH_TYPE_NAND; | ||
85 | case STRAPBUS_6368_BOOT_SEL_SERIAL: | ||
86 | return BCM63XX_FLASH_TYPE_SERIAL; | ||
87 | case STRAPBUS_6368_BOOT_SEL_PARALLEL: | ||
88 | return BCM63XX_FLASH_TYPE_PARALLEL; | ||
89 | } | ||
90 | default: | ||
91 | return -EINVAL; | ||
92 | } | ||
93 | } | ||
94 | |||
95 | int __init bcm63xx_flash_register(void) | ||
96 | { | ||
97 | int flash_type; | ||
98 | u32 val; | ||
99 | |||
100 | flash_type = bcm63xx_detect_flash_type(); | ||
101 | |||
102 | switch (flash_type) { | ||
103 | case BCM63XX_FLASH_TYPE_PARALLEL: | ||
104 | /* read base address of boot chip select (0) */ | ||
105 | val = bcm_mpi_readl(MPI_CSBASE_REG(0)); | ||
106 | val &= MPI_CSBASE_BASE_MASK; | ||
107 | |||
108 | mtd_resources[0].start = val; | ||
109 | mtd_resources[0].end = 0x1FFFFFFF; | ||
110 | |||
111 | return platform_device_register(&mtd_dev); | ||
112 | case BCM63XX_FLASH_TYPE_SERIAL: | ||
113 | pr_warn("unsupported serial flash detected\n"); | ||
114 | return -ENODEV; | ||
115 | case BCM63XX_FLASH_TYPE_NAND: | ||
116 | pr_warn("unsupported NAND flash detected\n"); | ||
117 | return -ENODEV; | ||
118 | default: | ||
119 | pr_err("flash detection failed for BCM%x: %d\n", | ||
120 | bcm63xx_get_cpu_id(), flash_type); | ||
121 | return -ENODEV; | ||
122 | } | ||
123 | } | ||
diff --git a/arch/mips/bcm63xx/dev-rng.c b/arch/mips/bcm63xx/dev-rng.c new file mode 100644 index 000000000000..d277b4dc6c68 --- /dev/null +++ b/arch/mips/bcm63xx/dev-rng.c | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2011 Florian Fainelli <florian@openwrt.org> | ||
7 | */ | ||
8 | |||
9 | #include <linux/init.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/platform_device.h> | ||
12 | #include <bcm63xx_cpu.h> | ||
13 | |||
14 | static struct resource rng_resources[] = { | ||
15 | { | ||
16 | .start = -1, /* filled at runtime */ | ||
17 | .end = -1, /* filled at runtime */ | ||
18 | .flags = IORESOURCE_MEM, | ||
19 | }, | ||
20 | }; | ||
21 | |||
22 | static struct platform_device bcm63xx_rng_device = { | ||
23 | .name = "bcm63xx-rng", | ||
24 | .id = -1, | ||
25 | .num_resources = ARRAY_SIZE(rng_resources), | ||
26 | .resource = rng_resources, | ||
27 | }; | ||
28 | |||
29 | int __init bcm63xx_rng_register(void) | ||
30 | { | ||
31 | if (!BCMCPU_IS_6368()) | ||
32 | return -ENODEV; | ||
33 | |||
34 | rng_resources[0].start = bcm63xx_regset_address(RSET_RNG); | ||
35 | rng_resources[0].end = rng_resources[0].start; | ||
36 | rng_resources[0].end += RSET_RNG_SIZE - 1; | ||
37 | |||
38 | return platform_device_register(&bcm63xx_rng_device); | ||
39 | } | ||
40 | arch_initcall(bcm63xx_rng_register); | ||
diff --git a/arch/mips/bcm63xx/dev-spi.c b/arch/mips/bcm63xx/dev-spi.c new file mode 100644 index 000000000000..e39f73048d4f --- /dev/null +++ b/arch/mips/bcm63xx/dev-spi.c | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2009-2011 Florian Fainelli <florian@openwrt.org> | ||
7 | * Copyright (C) 2010 Tanguy Bouzeloc <tanguy.bouzeloc@efixo.com> | ||
8 | */ | ||
9 | |||
10 | #include <linux/init.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/export.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/err.h> | ||
15 | #include <linux/clk.h> | ||
16 | |||
17 | #include <bcm63xx_cpu.h> | ||
18 | #include <bcm63xx_dev_spi.h> | ||
19 | #include <bcm63xx_regs.h> | ||
20 | |||
21 | #ifdef BCMCPU_RUNTIME_DETECT | ||
22 | /* | ||
23 | * register offsets | ||
24 | */ | ||
25 | static const unsigned long bcm6338_regs_spi[] = { | ||
26 | __GEN_SPI_REGS_TABLE(6338) | ||
27 | }; | ||
28 | |||
29 | static const unsigned long bcm6348_regs_spi[] = { | ||
30 | __GEN_SPI_REGS_TABLE(6348) | ||
31 | }; | ||
32 | |||
33 | static const unsigned long bcm6358_regs_spi[] = { | ||
34 | __GEN_SPI_REGS_TABLE(6358) | ||
35 | }; | ||
36 | |||
37 | static const unsigned long bcm6368_regs_spi[] = { | ||
38 | __GEN_SPI_REGS_TABLE(6368) | ||
39 | }; | ||
40 | |||
41 | const unsigned long *bcm63xx_regs_spi; | ||
42 | EXPORT_SYMBOL(bcm63xx_regs_spi); | ||
43 | |||
44 | static __init void bcm63xx_spi_regs_init(void) | ||
45 | { | ||
46 | if (BCMCPU_IS_6338()) | ||
47 | bcm63xx_regs_spi = bcm6338_regs_spi; | ||
48 | if (BCMCPU_IS_6348()) | ||
49 | bcm63xx_regs_spi = bcm6348_regs_spi; | ||
50 | if (BCMCPU_IS_6358()) | ||
51 | bcm63xx_regs_spi = bcm6358_regs_spi; | ||
52 | if (BCMCPU_IS_6368()) | ||
53 | bcm63xx_regs_spi = bcm6368_regs_spi; | ||
54 | } | ||
55 | #else | ||
56 | static __init void bcm63xx_spi_regs_init(void) { } | ||
57 | #endif | ||
58 | |||
59 | static struct resource spi_resources[] = { | ||
60 | { | ||
61 | .start = -1, /* filled at runtime */ | ||
62 | .end = -1, /* filled at runtime */ | ||
63 | .flags = IORESOURCE_MEM, | ||
64 | }, | ||
65 | { | ||
66 | .start = -1, /* filled at runtime */ | ||
67 | .flags = IORESOURCE_IRQ, | ||
68 | }, | ||
69 | }; | ||
70 | |||
71 | static struct bcm63xx_spi_pdata spi_pdata = { | ||
72 | .bus_num = 0, | ||
73 | .num_chipselect = 8, | ||
74 | }; | ||
75 | |||
76 | static struct platform_device bcm63xx_spi_device = { | ||
77 | .name = "bcm63xx-spi", | ||
78 | .id = -1, | ||
79 | .num_resources = ARRAY_SIZE(spi_resources), | ||
80 | .resource = spi_resources, | ||
81 | .dev = { | ||
82 | .platform_data = &spi_pdata, | ||
83 | }, | ||
84 | }; | ||
85 | |||
86 | int __init bcm63xx_spi_register(void) | ||
87 | { | ||
88 | struct clk *periph_clk; | ||
89 | |||
90 | if (BCMCPU_IS_6328() || BCMCPU_IS_6345()) | ||
91 | return -ENODEV; | ||
92 | |||
93 | periph_clk = clk_get(NULL, "periph"); | ||
94 | if (IS_ERR(periph_clk)) { | ||
95 | pr_err("unable to get periph clock\n"); | ||
96 | return -ENODEV; | ||
97 | } | ||
98 | |||
99 | /* Set bus frequency */ | ||
100 | spi_pdata.speed_hz = clk_get_rate(periph_clk); | ||
101 | |||
102 | spi_resources[0].start = bcm63xx_regset_address(RSET_SPI); | ||
103 | spi_resources[0].end = spi_resources[0].start; | ||
104 | spi_resources[1].start = bcm63xx_get_irq_number(IRQ_SPI); | ||
105 | |||
106 | if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) { | ||
107 | spi_resources[0].end += BCM_6338_RSET_SPI_SIZE - 1; | ||
108 | spi_pdata.fifo_size = SPI_6338_MSG_DATA_SIZE; | ||
109 | } | ||
110 | |||
111 | if (BCMCPU_IS_6358() || BCMCPU_IS_6368()) { | ||
112 | spi_resources[0].end += BCM_6358_RSET_SPI_SIZE - 1; | ||
113 | spi_pdata.fifo_size = SPI_6358_MSG_DATA_SIZE; | ||
114 | } | ||
115 | |||
116 | bcm63xx_spi_regs_init(); | ||
117 | |||
118 | return platform_device_register(&bcm63xx_spi_device); | ||
119 | } | ||
diff --git a/arch/mips/bcm63xx/dev-wdt.c b/arch/mips/bcm63xx/dev-wdt.c index 3e6c716a4c11..2a2346a99bcb 100644 --- a/arch/mips/bcm63xx/dev-wdt.c +++ b/arch/mips/bcm63xx/dev-wdt.c | |||
@@ -21,7 +21,7 @@ static struct resource wdt_resources[] = { | |||
21 | 21 | ||
22 | static struct platform_device bcm63xx_wdt_device = { | 22 | static struct platform_device bcm63xx_wdt_device = { |
23 | .name = "bcm63xx-wdt", | 23 | .name = "bcm63xx-wdt", |
24 | .id = 0, | 24 | .id = -1, |
25 | .num_resources = ARRAY_SIZE(wdt_resources), | 25 | .num_resources = ARRAY_SIZE(wdt_resources), |
26 | .resource = wdt_resources, | 26 | .resource = wdt_resources, |
27 | }; | 27 | }; |
diff --git a/arch/mips/bcm63xx/irq.c b/arch/mips/bcm63xx/irq.c index 9a216a451d92..18e051ad18a5 100644 --- a/arch/mips/bcm63xx/irq.c +++ b/arch/mips/bcm63xx/irq.c | |||
@@ -27,6 +27,17 @@ static void __internal_irq_unmask_32(unsigned int irq) __maybe_unused; | |||
27 | static void __internal_irq_unmask_64(unsigned int irq) __maybe_unused; | 27 | static void __internal_irq_unmask_64(unsigned int irq) __maybe_unused; |
28 | 28 | ||
29 | #ifndef BCMCPU_RUNTIME_DETECT | 29 | #ifndef BCMCPU_RUNTIME_DETECT |
30 | #ifdef CONFIG_BCM63XX_CPU_6328 | ||
31 | #define irq_stat_reg PERF_IRQSTAT_6328_REG | ||
32 | #define irq_mask_reg PERF_IRQMASK_6328_REG | ||
33 | #define irq_bits 64 | ||
34 | #define is_ext_irq_cascaded 1 | ||
35 | #define ext_irq_start (BCM_6328_EXT_IRQ0 - IRQ_INTERNAL_BASE) | ||
36 | #define ext_irq_end (BCM_6328_EXT_IRQ3 - IRQ_INTERNAL_BASE) | ||
37 | #define ext_irq_count 4 | ||
38 | #define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6328 | ||
39 | #define ext_irq_cfg_reg2 0 | ||
40 | #endif | ||
30 | #ifdef CONFIG_BCM63XX_CPU_6338 | 41 | #ifdef CONFIG_BCM63XX_CPU_6338 |
31 | #define irq_stat_reg PERF_IRQSTAT_6338_REG | 42 | #define irq_stat_reg PERF_IRQSTAT_6338_REG |
32 | #define irq_mask_reg PERF_IRQMASK_6338_REG | 43 | #define irq_mask_reg PERF_IRQMASK_6338_REG |
@@ -118,6 +129,16 @@ static void bcm63xx_init_irq(void) | |||
118 | irq_mask_addr = bcm63xx_regset_address(RSET_PERF); | 129 | irq_mask_addr = bcm63xx_regset_address(RSET_PERF); |
119 | 130 | ||
120 | switch (bcm63xx_get_cpu_id()) { | 131 | switch (bcm63xx_get_cpu_id()) { |
132 | case BCM6328_CPU_ID: | ||
133 | irq_stat_addr += PERF_IRQSTAT_6328_REG; | ||
134 | irq_mask_addr += PERF_IRQMASK_6328_REG; | ||
135 | irq_bits = 64; | ||
136 | ext_irq_count = 4; | ||
137 | is_ext_irq_cascaded = 1; | ||
138 | ext_irq_start = BCM_6328_EXT_IRQ0 - IRQ_INTERNAL_BASE; | ||
139 | ext_irq_end = BCM_6328_EXT_IRQ3 - IRQ_INTERNAL_BASE; | ||
140 | ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6328; | ||
141 | break; | ||
121 | case BCM6338_CPU_ID: | 142 | case BCM6338_CPU_ID: |
122 | irq_stat_addr += PERF_IRQSTAT_6338_REG; | 143 | irq_stat_addr += PERF_IRQSTAT_6338_REG; |
123 | irq_mask_addr += PERF_IRQMASK_6338_REG; | 144 | irq_mask_addr += PERF_IRQMASK_6338_REG; |
diff --git a/arch/mips/bcm63xx/prom.c b/arch/mips/bcm63xx/prom.c index 99d7f405cbeb..10eaff458071 100644 --- a/arch/mips/bcm63xx/prom.c +++ b/arch/mips/bcm63xx/prom.c | |||
@@ -26,7 +26,9 @@ void __init prom_init(void) | |||
26 | bcm_wdt_writel(WDT_STOP_2, WDT_CTL_REG); | 26 | bcm_wdt_writel(WDT_STOP_2, WDT_CTL_REG); |
27 | 27 | ||
28 | /* disable all hardware blocks clock for now */ | 28 | /* disable all hardware blocks clock for now */ |
29 | if (BCMCPU_IS_6338()) | 29 | if (BCMCPU_IS_6328()) |
30 | mask = CKCTL_6328_ALL_SAFE_EN; | ||
31 | else if (BCMCPU_IS_6338()) | ||
30 | mask = CKCTL_6338_ALL_SAFE_EN; | 32 | mask = CKCTL_6338_ALL_SAFE_EN; |
31 | else if (BCMCPU_IS_6345()) | 33 | else if (BCMCPU_IS_6345()) |
32 | mask = CKCTL_6345_ALL_SAFE_EN; | 34 | mask = CKCTL_6345_ALL_SAFE_EN; |
diff --git a/arch/mips/bcm63xx/setup.c b/arch/mips/bcm63xx/setup.c index 356b05583e14..0e74a13639cd 100644 --- a/arch/mips/bcm63xx/setup.c +++ b/arch/mips/bcm63xx/setup.c | |||
@@ -68,6 +68,9 @@ void bcm63xx_machine_reboot(void) | |||
68 | 68 | ||
69 | /* mask and clear all external irq */ | 69 | /* mask and clear all external irq */ |
70 | switch (bcm63xx_get_cpu_id()) { | 70 | switch (bcm63xx_get_cpu_id()) { |
71 | case BCM6328_CPU_ID: | ||
72 | perf_regs[0] = PERF_EXTIRQ_CFG_REG_6328; | ||
73 | break; | ||
71 | case BCM6338_CPU_ID: | 74 | case BCM6338_CPU_ID: |
72 | perf_regs[0] = PERF_EXTIRQ_CFG_REG_6338; | 75 | perf_regs[0] = PERF_EXTIRQ_CFG_REG_6338; |
73 | break; | 76 | break; |
@@ -95,9 +98,13 @@ void bcm63xx_machine_reboot(void) | |||
95 | bcm6348_a1_reboot(); | 98 | bcm6348_a1_reboot(); |
96 | 99 | ||
97 | printk(KERN_INFO "triggering watchdog soft-reset...\n"); | 100 | printk(KERN_INFO "triggering watchdog soft-reset...\n"); |
98 | reg = bcm_perf_readl(PERF_SYS_PLL_CTL_REG); | 101 | if (BCMCPU_IS_6328()) { |
99 | reg |= SYS_PLL_SOFT_RESET; | 102 | bcm_wdt_writel(1, WDT_SOFTRESET_REG); |
100 | bcm_perf_writel(reg, PERF_SYS_PLL_CTL_REG); | 103 | } else { |
104 | reg = bcm_perf_readl(PERF_SYS_PLL_CTL_REG); | ||
105 | reg |= SYS_PLL_SOFT_RESET; | ||
106 | bcm_perf_writel(reg, PERF_SYS_PLL_CTL_REG); | ||
107 | } | ||
101 | while (1) | 108 | while (1) |
102 | ; | 109 | ; |
103 | } | 110 | } |
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile index 5042d51b0512..c2a3fb0ffc87 100644 --- a/arch/mips/boot/compressed/Makefile +++ b/arch/mips/boot/compressed/Makefile | |||
@@ -58,8 +58,12 @@ $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE | |||
58 | # Calculate the load address of the compressed kernel image | 58 | # Calculate the load address of the compressed kernel image |
59 | hostprogs-y := calc_vmlinuz_load_addr | 59 | hostprogs-y := calc_vmlinuz_load_addr |
60 | 60 | ||
61 | ifeq ($(CONFIG_MACH_JZ4740),y) | ||
62 | VMLINUZ_LOAD_ADDRESS := 0x80600000 | ||
63 | else | ||
61 | VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \ | 64 | VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \ |
62 | $(obj)/vmlinux.bin $(VMLINUX_LOAD_ADDRESS)) | 65 | $(obj)/vmlinux.bin $(VMLINUX_LOAD_ADDRESS)) |
66 | endif | ||
63 | 67 | ||
64 | vmlinuzobjs-y += $(obj)/piggy.o | 68 | vmlinuzobjs-y += $(obj)/piggy.o |
65 | 69 | ||
diff --git a/arch/mips/boot/compressed/uart-16550.c b/arch/mips/boot/compressed/uart-16550.c index c9caaf4fbf60..1c7b739b6a1d 100644 --- a/arch/mips/boot/compressed/uart-16550.c +++ b/arch/mips/boot/compressed/uart-16550.c | |||
@@ -18,6 +18,11 @@ | |||
18 | #define PORT(offset) (CKSEG1ADDR(AR7_REGS_UART0) + (4 * offset)) | 18 | #define PORT(offset) (CKSEG1ADDR(AR7_REGS_UART0) + (4 * offset)) |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | #ifdef CONFIG_MACH_JZ4740 | ||
22 | #define UART0_BASE 0xB0030000 | ||
23 | #define PORT(offset) (UART0_BASE + (4 * offset)) | ||
24 | #endif | ||
25 | |||
21 | #ifndef PORT | 26 | #ifndef PORT |
22 | #error please define the serial port address for your own machine | 27 | #error please define the serial port address for your own machine |
23 | #endif | 28 | #endif |
diff --git a/arch/mips/cavium-octeon/.gitignore b/arch/mips/cavium-octeon/.gitignore new file mode 100644 index 000000000000..39c968605ff6 --- /dev/null +++ b/arch/mips/cavium-octeon/.gitignore | |||
@@ -0,0 +1,2 @@ | |||
1 | *.dtb.S | ||
2 | *.dtb | ||
diff --git a/arch/mips/cavium-octeon/Makefile b/arch/mips/cavium-octeon/Makefile index 19eb0434269f..bc96e2908f14 100644 --- a/arch/mips/cavium-octeon/Makefile +++ b/arch/mips/cavium-octeon/Makefile | |||
@@ -9,9 +9,25 @@ | |||
9 | # Copyright (C) 2005-2009 Cavium Networks | 9 | # Copyright (C) 2005-2009 Cavium Networks |
10 | # | 10 | # |
11 | 11 | ||
12 | CFLAGS_octeon-platform.o = -I$(src)/../../../scripts/dtc/libfdt | ||
13 | CFLAGS_setup.o = -I$(src)/../../../scripts/dtc/libfdt | ||
14 | |||
12 | obj-y := cpu.o setup.o serial.o octeon-platform.o octeon-irq.o csrc-octeon.o | 15 | obj-y := cpu.o setup.o serial.o octeon-platform.o octeon-irq.o csrc-octeon.o |
13 | obj-y += dma-octeon.o flash_setup.o | 16 | obj-y += dma-octeon.o flash_setup.o |
14 | obj-y += octeon-memcpy.o | 17 | obj-y += octeon-memcpy.o |
15 | obj-y += executive/ | 18 | obj-y += executive/ |
16 | 19 | ||
17 | obj-$(CONFIG_SMP) += smp.o | 20 | obj-$(CONFIG_SMP) += smp.o |
21 | |||
22 | DTS_FILES = octeon_3xxx.dts octeon_68xx.dts | ||
23 | DTB_FILES = $(patsubst %.dts, %.dtb, $(DTS_FILES)) | ||
24 | |||
25 | obj-y += $(patsubst %.dts, %.dtb.o, $(DTS_FILES)) | ||
26 | |||
27 | $(obj)/%.dtb: $(src)/%.dts FORCE | ||
28 | $(call if_changed_dep,dtc) | ||
29 | |||
30 | # Let's keep the .dtb files around in case we want to look at them. | ||
31 | .SECONDARY: $(addprefix $(obj)/, $(DTB_FILES)) | ||
32 | |||
33 | clean-files += $(DTB_FILES) $(patsubst %.dtb, %.dtb.S, $(DTB_FILES)) | ||
diff --git a/arch/mips/cavium-octeon/executive/cvmx-fpa.c b/arch/mips/cavium-octeon/executive/cvmx-fpa.c deleted file mode 100644 index ad44b8bd8057..000000000000 --- a/arch/mips/cavium-octeon/executive/cvmx-fpa.c +++ /dev/null | |||
@@ -1,183 +0,0 @@ | |||
1 | /***********************license start*************** | ||
2 | * Author: Cavium Networks | ||
3 | * | ||
4 | * Contact: support@caviumnetworks.com | ||
5 | * This file is part of the OCTEON SDK | ||
6 | * | ||
7 | * Copyright (c) 2003-2008 Cavium Networks | ||
8 | * | ||
9 | * This file is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License, Version 2, as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This file is distributed in the hope that it will be useful, but | ||
14 | * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty | ||
15 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or | ||
16 | * NONINFRINGEMENT. See the GNU General Public License for more | ||
17 | * details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this file; if not, write to the Free Software | ||
21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
22 | * or visit http://www.gnu.org/licenses/. | ||
23 | * | ||
24 | * This file may also be available under a different license from Cavium. | ||
25 | * Contact Cavium Networks for more information | ||
26 | ***********************license end**************************************/ | ||
27 | |||
28 | /** | ||
29 | * @file | ||
30 | * | ||
31 | * Support library for the hardware Free Pool Allocator. | ||
32 | * | ||
33 | * | ||
34 | */ | ||
35 | |||
36 | #include "cvmx-config.h" | ||
37 | #include "cvmx.h" | ||
38 | #include "cvmx-fpa.h" | ||
39 | #include "cvmx-ipd.h" | ||
40 | |||
41 | /** | ||
42 | * Current state of all the pools. Use access functions | ||
43 | * instead of using it directly. | ||
44 | */ | ||
45 | CVMX_SHARED cvmx_fpa_pool_info_t cvmx_fpa_pool_info[CVMX_FPA_NUM_POOLS]; | ||
46 | |||
47 | /** | ||
48 | * Setup a FPA pool to control a new block of memory. The | ||
49 | * buffer pointer must be a physical address. | ||
50 | * | ||
51 | * @pool: Pool to initialize | ||
52 | * 0 <= pool < 8 | ||
53 | * @name: Constant character string to name this pool. | ||
54 | * String is not copied. | ||
55 | * @buffer: Pointer to the block of memory to use. This must be | ||
56 | * accessible by all processors and external hardware. | ||
57 | * @block_size: Size for each block controlled by the FPA | ||
58 | * @num_blocks: Number of blocks | ||
59 | * | ||
60 | * Returns 0 on Success, | ||
61 | * -1 on failure | ||
62 | */ | ||
63 | int cvmx_fpa_setup_pool(uint64_t pool, const char *name, void *buffer, | ||
64 | uint64_t block_size, uint64_t num_blocks) | ||
65 | { | ||
66 | char *ptr; | ||
67 | if (!buffer) { | ||
68 | cvmx_dprintf | ||
69 | ("ERROR: cvmx_fpa_setup_pool: NULL buffer pointer!\n"); | ||
70 | return -1; | ||
71 | } | ||
72 | if (pool >= CVMX_FPA_NUM_POOLS) { | ||
73 | cvmx_dprintf("ERROR: cvmx_fpa_setup_pool: Illegal pool!\n"); | ||
74 | return -1; | ||
75 | } | ||
76 | |||
77 | if (block_size < CVMX_FPA_MIN_BLOCK_SIZE) { | ||
78 | cvmx_dprintf | ||
79 | ("ERROR: cvmx_fpa_setup_pool: Block size too small.\n"); | ||
80 | return -1; | ||
81 | } | ||
82 | |||
83 | if (((unsigned long)buffer & (CVMX_FPA_ALIGNMENT - 1)) != 0) { | ||
84 | cvmx_dprintf | ||
85 | ("ERROR: cvmx_fpa_setup_pool: Buffer not aligned properly.\n"); | ||
86 | return -1; | ||
87 | } | ||
88 | |||
89 | cvmx_fpa_pool_info[pool].name = name; | ||
90 | cvmx_fpa_pool_info[pool].size = block_size; | ||
91 | cvmx_fpa_pool_info[pool].starting_element_count = num_blocks; | ||
92 | cvmx_fpa_pool_info[pool].base = buffer; | ||
93 | |||
94 | ptr = (char *)buffer; | ||
95 | while (num_blocks--) { | ||
96 | cvmx_fpa_free(ptr, pool, 0); | ||
97 | ptr += block_size; | ||
98 | } | ||
99 | return 0; | ||
100 | } | ||
101 | |||
102 | /** | ||
103 | * Shutdown a Memory pool and validate that it had all of | ||
104 | * the buffers originally placed in it. | ||
105 | * | ||
106 | * @pool: Pool to shutdown | ||
107 | * Returns Zero on success | ||
108 | * - Positive is count of missing buffers | ||
109 | * - Negative is too many buffers or corrupted pointers | ||
110 | */ | ||
111 | uint64_t cvmx_fpa_shutdown_pool(uint64_t pool) | ||
112 | { | ||
113 | uint64_t errors = 0; | ||
114 | uint64_t count = 0; | ||
115 | uint64_t base = cvmx_ptr_to_phys(cvmx_fpa_pool_info[pool].base); | ||
116 | uint64_t finish = | ||
117 | base + | ||
118 | cvmx_fpa_pool_info[pool].size * | ||
119 | cvmx_fpa_pool_info[pool].starting_element_count; | ||
120 | void *ptr; | ||
121 | uint64_t address; | ||
122 | |||
123 | count = 0; | ||
124 | do { | ||
125 | ptr = cvmx_fpa_alloc(pool); | ||
126 | if (ptr) | ||
127 | address = cvmx_ptr_to_phys(ptr); | ||
128 | else | ||
129 | address = 0; | ||
130 | if (address) { | ||
131 | if ((address >= base) && (address < finish) && | ||
132 | (((address - | ||
133 | base) % cvmx_fpa_pool_info[pool].size) == 0)) { | ||
134 | count++; | ||
135 | } else { | ||
136 | cvmx_dprintf | ||
137 | ("ERROR: cvmx_fpa_shutdown_pool: Illegal address 0x%llx in pool %s(%d)\n", | ||
138 | (unsigned long long)address, | ||
139 | cvmx_fpa_pool_info[pool].name, (int)pool); | ||
140 | errors++; | ||
141 | } | ||
142 | } | ||
143 | } while (address); | ||
144 | |||
145 | #ifdef CVMX_ENABLE_PKO_FUNCTIONS | ||
146 | if (pool == 0) | ||
147 | cvmx_ipd_free_ptr(); | ||
148 | #endif | ||
149 | |||
150 | if (errors) { | ||
151 | cvmx_dprintf | ||
152 | ("ERROR: cvmx_fpa_shutdown_pool: Pool %s(%d) started at 0x%llx, ended at 0x%llx, with a step of 0x%llx\n", | ||
153 | cvmx_fpa_pool_info[pool].name, (int)pool, | ||
154 | (unsigned long long)base, (unsigned long long)finish, | ||
155 | (unsigned long long)cvmx_fpa_pool_info[pool].size); | ||
156 | return -errors; | ||
157 | } else | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | uint64_t cvmx_fpa_get_block_size(uint64_t pool) | ||
162 | { | ||
163 | switch (pool) { | ||
164 | case 0: | ||
165 | return CVMX_FPA_POOL_0_SIZE; | ||
166 | case 1: | ||
167 | return CVMX_FPA_POOL_1_SIZE; | ||
168 | case 2: | ||
169 | return CVMX_FPA_POOL_2_SIZE; | ||
170 | case 3: | ||
171 | return CVMX_FPA_POOL_3_SIZE; | ||
172 | case 4: | ||
173 | return CVMX_FPA_POOL_4_SIZE; | ||
174 | case 5: | ||
175 | return CVMX_FPA_POOL_5_SIZE; | ||
176 | case 6: | ||
177 | return CVMX_FPA_POOL_6_SIZE; | ||
178 | case 7: | ||
179 | return CVMX_FPA_POOL_7_SIZE; | ||
180 | default: | ||
181 | return 0; | ||
182 | } | ||
183 | } | ||
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-fpa.c b/arch/mips/cavium-octeon/executive/cvmx-helper-fpa.c deleted file mode 100644 index c239e5f4ab9a..000000000000 --- a/arch/mips/cavium-octeon/executive/cvmx-helper-fpa.c +++ /dev/null | |||
@@ -1,243 +0,0 @@ | |||
1 | /***********************license start*************** | ||
2 | * Author: Cavium Networks | ||
3 | * | ||
4 | * Contact: support@caviumnetworks.com | ||
5 | * This file is part of the OCTEON SDK | ||
6 | * | ||
7 | * Copyright (c) 2003-2008 Cavium Networks | ||
8 | * | ||
9 | * This file is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License, Version 2, as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This file is distributed in the hope that it will be useful, but | ||
14 | * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty | ||
15 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or | ||
16 | * NONINFRINGEMENT. See the GNU General Public License for more | ||
17 | * details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this file; if not, write to the Free Software | ||
21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
22 | * or visit http://www.gnu.org/licenses/. | ||
23 | * | ||
24 | * This file may also be available under a different license from Cavium. | ||
25 | * Contact Cavium Networks for more information | ||
26 | ***********************license end**************************************/ | ||
27 | |||
28 | /** | ||
29 | * @file | ||
30 | * | ||
31 | * Helper functions for FPA setup. | ||
32 | * | ||
33 | */ | ||
34 | #include "executive-config.h" | ||
35 | #include "cvmx-config.h" | ||
36 | #include "cvmx.h" | ||
37 | #include "cvmx-bootmem.h" | ||
38 | #include "cvmx-fpa.h" | ||
39 | #include "cvmx-helper-fpa.h" | ||
40 | |||
41 | /** | ||
42 | * Allocate memory for and initialize a single FPA pool. | ||
43 | * | ||
44 | * @pool: Pool to initialize | ||
45 | * @buffer_size: Size of buffers to allocate in bytes | ||
46 | * @buffers: Number of buffers to put in the pool. Zero is allowed | ||
47 | * @name: String name of the pool for debugging purposes | ||
48 | * Returns Zero on success, non-zero on failure | ||
49 | */ | ||
50 | static int __cvmx_helper_initialize_fpa_pool(int pool, uint64_t buffer_size, | ||
51 | uint64_t buffers, const char *name) | ||
52 | { | ||
53 | uint64_t current_num; | ||
54 | void *memory; | ||
55 | uint64_t align = CVMX_CACHE_LINE_SIZE; | ||
56 | |||
57 | /* | ||
58 | * Align the allocation so that power of 2 size buffers are | ||
59 | * naturally aligned. | ||
60 | */ | ||
61 | while (align < buffer_size) | ||
62 | align = align << 1; | ||
63 | |||
64 | if (buffers == 0) | ||
65 | return 0; | ||
66 | |||
67 | current_num = cvmx_read_csr(CVMX_FPA_QUEX_AVAILABLE(pool)); | ||
68 | if (current_num) { | ||
69 | cvmx_dprintf("Fpa pool %d(%s) already has %llu buffers. " | ||
70 | "Skipping setup.\n", | ||
71 | pool, name, (unsigned long long)current_num); | ||
72 | return 0; | ||
73 | } | ||
74 | |||
75 | memory = cvmx_bootmem_alloc(buffer_size * buffers, align); | ||
76 | if (memory == NULL) { | ||
77 | cvmx_dprintf("Out of memory initializing fpa pool %d(%s).\n", | ||
78 | pool, name); | ||
79 | return -1; | ||
80 | } | ||
81 | cvmx_fpa_setup_pool(pool, name, memory, buffer_size, buffers); | ||
82 | return 0; | ||
83 | } | ||
84 | |||
85 | /** | ||
86 | * Allocate memory and initialize the FPA pools using memory | ||
87 | * from cvmx-bootmem. Specifying zero for the number of | ||
88 | * buffers will cause that FPA pool to not be setup. This is | ||
89 | * useful if you aren't using some of the hardware and want | ||
90 | * to save memory. Use cvmx_helper_initialize_fpa instead of | ||
91 | * this function directly. | ||
92 | * | ||
93 | * @pip_pool: Should always be CVMX_FPA_PACKET_POOL | ||
94 | * @pip_size: Should always be CVMX_FPA_PACKET_POOL_SIZE | ||
95 | * @pip_buffers: | ||
96 | * Number of packet buffers. | ||
97 | * @wqe_pool: Should always be CVMX_FPA_WQE_POOL | ||
98 | * @wqe_size: Should always be CVMX_FPA_WQE_POOL_SIZE | ||
99 | * @wqe_entries: | ||
100 | * Number of work queue entries | ||
101 | * @pko_pool: Should always be CVMX_FPA_OUTPUT_BUFFER_POOL | ||
102 | * @pko_size: Should always be CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE | ||
103 | * @pko_buffers: | ||
104 | * PKO Command buffers. You should at minimum have two per | ||
105 | * each PKO queue. | ||
106 | * @tim_pool: Should always be CVMX_FPA_TIMER_POOL | ||
107 | * @tim_size: Should always be CVMX_FPA_TIMER_POOL_SIZE | ||
108 | * @tim_buffers: | ||
109 | * TIM ring buffer command queues. At least two per timer bucket | ||
110 | * is recommened. | ||
111 | * @dfa_pool: Should always be CVMX_FPA_DFA_POOL | ||
112 | * @dfa_size: Should always be CVMX_FPA_DFA_POOL_SIZE | ||
113 | * @dfa_buffers: | ||
114 | * DFA command buffer. A relatively small (32 for example) | ||
115 | * number should work. | ||
116 | * Returns Zero on success, non-zero if out of memory | ||
117 | */ | ||
118 | static int __cvmx_helper_initialize_fpa(int pip_pool, int pip_size, | ||
119 | int pip_buffers, int wqe_pool, | ||
120 | int wqe_size, int wqe_entries, | ||
121 | int pko_pool, int pko_size, | ||
122 | int pko_buffers, int tim_pool, | ||
123 | int tim_size, int tim_buffers, | ||
124 | int dfa_pool, int dfa_size, | ||
125 | int dfa_buffers) | ||
126 | { | ||
127 | int status; | ||
128 | |||
129 | cvmx_fpa_enable(); | ||
130 | |||
131 | if ((pip_buffers > 0) && (pip_buffers <= 64)) | ||
132 | cvmx_dprintf | ||
133 | ("Warning: %d packet buffers may not be enough for hardware" | ||
134 | " prefetch. 65 or more is recommended.\n", pip_buffers); | ||
135 | |||
136 | if (pip_pool >= 0) { | ||
137 | status = | ||
138 | __cvmx_helper_initialize_fpa_pool(pip_pool, pip_size, | ||
139 | pip_buffers, | ||
140 | "Packet Buffers"); | ||
141 | if (status) | ||
142 | return status; | ||
143 | } | ||
144 | |||
145 | if (wqe_pool >= 0) { | ||
146 | status = | ||
147 | __cvmx_helper_initialize_fpa_pool(wqe_pool, wqe_size, | ||
148 | wqe_entries, | ||
149 | "Work Queue Entries"); | ||
150 | if (status) | ||
151 | return status; | ||
152 | } | ||
153 | |||
154 | if (pko_pool >= 0) { | ||
155 | status = | ||
156 | __cvmx_helper_initialize_fpa_pool(pko_pool, pko_size, | ||
157 | pko_buffers, | ||
158 | "PKO Command Buffers"); | ||
159 | if (status) | ||
160 | return status; | ||
161 | } | ||
162 | |||
163 | if (tim_pool >= 0) { | ||
164 | status = | ||
165 | __cvmx_helper_initialize_fpa_pool(tim_pool, tim_size, | ||
166 | tim_buffers, | ||
167 | "TIM Command Buffers"); | ||
168 | if (status) | ||
169 | return status; | ||
170 | } | ||
171 | |||
172 | if (dfa_pool >= 0) { | ||
173 | status = | ||
174 | __cvmx_helper_initialize_fpa_pool(dfa_pool, dfa_size, | ||
175 | dfa_buffers, | ||
176 | "DFA Command Buffers"); | ||
177 | if (status) | ||
178 | return status; | ||
179 | } | ||
180 | |||
181 | return 0; | ||
182 | } | ||
183 | |||
184 | /** | ||
185 | * Allocate memory and initialize the FPA pools using memory | ||
186 | * from cvmx-bootmem. Sizes of each element in the pools is | ||
187 | * controlled by the cvmx-config.h header file. Specifying | ||
188 | * zero for any parameter will cause that FPA pool to not be | ||
189 | * setup. This is useful if you aren't using some of the | ||
190 | * hardware and want to save memory. | ||
191 | * | ||
192 | * @packet_buffers: | ||
193 | * Number of packet buffers to allocate | ||
194 | * @work_queue_entries: | ||
195 | * Number of work queue entries | ||
196 | * @pko_buffers: | ||
197 | * PKO Command buffers. You should at minimum have two per | ||
198 | * each PKO queue. | ||
199 | * @tim_buffers: | ||
200 | * TIM ring buffer command queues. At least two per timer bucket | ||
201 | * is recommened. | ||
202 | * @dfa_buffers: | ||
203 | * DFA command buffer. A relatively small (32 for example) | ||
204 | * number should work. | ||
205 | * Returns Zero on success, non-zero if out of memory | ||
206 | */ | ||
207 | int cvmx_helper_initialize_fpa(int packet_buffers, int work_queue_entries, | ||
208 | int pko_buffers, int tim_buffers, | ||
209 | int dfa_buffers) | ||
210 | { | ||
211 | #ifndef CVMX_FPA_PACKET_POOL | ||
212 | #define CVMX_FPA_PACKET_POOL -1 | ||
213 | #define CVMX_FPA_PACKET_POOL_SIZE 0 | ||
214 | #endif | ||
215 | #ifndef CVMX_FPA_WQE_POOL | ||
216 | #define CVMX_FPA_WQE_POOL -1 | ||
217 | #define CVMX_FPA_WQE_POOL_SIZE 0 | ||
218 | #endif | ||
219 | #ifndef CVMX_FPA_OUTPUT_BUFFER_POOL | ||
220 | #define CVMX_FPA_OUTPUT_BUFFER_POOL -1 | ||
221 | #define CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE 0 | ||
222 | #endif | ||
223 | #ifndef CVMX_FPA_TIMER_POOL | ||
224 | #define CVMX_FPA_TIMER_POOL -1 | ||
225 | #define CVMX_FPA_TIMER_POOL_SIZE 0 | ||
226 | #endif | ||
227 | #ifndef CVMX_FPA_DFA_POOL | ||
228 | #define CVMX_FPA_DFA_POOL -1 | ||
229 | #define CVMX_FPA_DFA_POOL_SIZE 0 | ||
230 | #endif | ||
231 | return __cvmx_helper_initialize_fpa(CVMX_FPA_PACKET_POOL, | ||
232 | CVMX_FPA_PACKET_POOL_SIZE, | ||
233 | packet_buffers, CVMX_FPA_WQE_POOL, | ||
234 | CVMX_FPA_WQE_POOL_SIZE, | ||
235 | work_queue_entries, | ||
236 | CVMX_FPA_OUTPUT_BUFFER_POOL, | ||
237 | CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, | ||
238 | pko_buffers, CVMX_FPA_TIMER_POOL, | ||
239 | CVMX_FPA_TIMER_POOL_SIZE, | ||
240 | tim_buffers, CVMX_FPA_DFA_POOL, | ||
241 | CVMX_FPA_DFA_POOL_SIZE, | ||
242 | dfa_buffers); | ||
243 | } | ||
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c index ffd4ae660f79..7fb1f222b8a5 100644 --- a/arch/mips/cavium-octeon/octeon-irq.c +++ b/arch/mips/cavium-octeon/octeon-irq.c | |||
@@ -3,14 +3,17 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (C) 2004-2008, 2009, 2010, 2011 Cavium Networks | 6 | * Copyright (C) 2004-2012 Cavium, Inc. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/interrupt.h> | 9 | #include <linux/interrupt.h> |
10 | #include <linux/irqdomain.h> | ||
10 | #include <linux/bitops.h> | 11 | #include <linux/bitops.h> |
11 | #include <linux/percpu.h> | 12 | #include <linux/percpu.h> |
13 | #include <linux/slab.h> | ||
12 | #include <linux/irq.h> | 14 | #include <linux/irq.h> |
13 | #include <linux/smp.h> | 15 | #include <linux/smp.h> |
16 | #include <linux/of.h> | ||
14 | 17 | ||
15 | #include <asm/octeon/octeon.h> | 18 | #include <asm/octeon/octeon.h> |
16 | 19 | ||
@@ -42,9 +45,9 @@ struct octeon_core_chip_data { | |||
42 | 45 | ||
43 | static struct octeon_core_chip_data octeon_irq_core_chip_data[MIPS_CORE_IRQ_LINES]; | 46 | static struct octeon_core_chip_data octeon_irq_core_chip_data[MIPS_CORE_IRQ_LINES]; |
44 | 47 | ||
45 | static void __init octeon_irq_set_ciu_mapping(int irq, int line, int bit, | 48 | static void octeon_irq_set_ciu_mapping(int irq, int line, int bit, |
46 | struct irq_chip *chip, | 49 | struct irq_chip *chip, |
47 | irq_flow_handler_t handler) | 50 | irq_flow_handler_t handler) |
48 | { | 51 | { |
49 | union octeon_ciu_chip_data cd; | 52 | union octeon_ciu_chip_data cd; |
50 | 53 | ||
@@ -505,6 +508,85 @@ static void octeon_irq_ciu_enable_all_v2(struct irq_data *data) | |||
505 | } | 508 | } |
506 | } | 509 | } |
507 | 510 | ||
511 | static void octeon_irq_gpio_setup(struct irq_data *data) | ||
512 | { | ||
513 | union cvmx_gpio_bit_cfgx cfg; | ||
514 | union octeon_ciu_chip_data cd; | ||
515 | u32 t = irqd_get_trigger_type(data); | ||
516 | |||
517 | cd.p = irq_data_get_irq_chip_data(data); | ||
518 | |||
519 | cfg.u64 = 0; | ||
520 | cfg.s.int_en = 1; | ||
521 | cfg.s.int_type = (t & IRQ_TYPE_EDGE_BOTH) != 0; | ||
522 | cfg.s.rx_xor = (t & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_EDGE_FALLING)) != 0; | ||
523 | |||
524 | /* 140 nS glitch filter*/ | ||
525 | cfg.s.fil_cnt = 7; | ||
526 | cfg.s.fil_sel = 3; | ||
527 | |||
528 | cvmx_write_csr(CVMX_GPIO_BIT_CFGX(cd.s.bit - 16), cfg.u64); | ||
529 | } | ||
530 | |||
531 | static void octeon_irq_ciu_enable_gpio_v2(struct irq_data *data) | ||
532 | { | ||
533 | octeon_irq_gpio_setup(data); | ||
534 | octeon_irq_ciu_enable_v2(data); | ||
535 | } | ||
536 | |||
537 | static void octeon_irq_ciu_enable_gpio(struct irq_data *data) | ||
538 | { | ||
539 | octeon_irq_gpio_setup(data); | ||
540 | octeon_irq_ciu_enable(data); | ||
541 | } | ||
542 | |||
543 | static int octeon_irq_ciu_gpio_set_type(struct irq_data *data, unsigned int t) | ||
544 | { | ||
545 | irqd_set_trigger_type(data, t); | ||
546 | octeon_irq_gpio_setup(data); | ||
547 | |||
548 | return IRQ_SET_MASK_OK; | ||
549 | } | ||
550 | |||
551 | static void octeon_irq_ciu_disable_gpio_v2(struct irq_data *data) | ||
552 | { | ||
553 | union octeon_ciu_chip_data cd; | ||
554 | |||
555 | cd.p = irq_data_get_irq_chip_data(data); | ||
556 | cvmx_write_csr(CVMX_GPIO_BIT_CFGX(cd.s.bit - 16), 0); | ||
557 | |||
558 | octeon_irq_ciu_disable_all_v2(data); | ||
559 | } | ||
560 | |||
561 | static void octeon_irq_ciu_disable_gpio(struct irq_data *data) | ||
562 | { | ||
563 | union octeon_ciu_chip_data cd; | ||
564 | |||
565 | cd.p = irq_data_get_irq_chip_data(data); | ||
566 | cvmx_write_csr(CVMX_GPIO_BIT_CFGX(cd.s.bit - 16), 0); | ||
567 | |||
568 | octeon_irq_ciu_disable_all(data); | ||
569 | } | ||
570 | |||
571 | static void octeon_irq_ciu_gpio_ack(struct irq_data *data) | ||
572 | { | ||
573 | union octeon_ciu_chip_data cd; | ||
574 | u64 mask; | ||
575 | |||
576 | cd.p = irq_data_get_irq_chip_data(data); | ||
577 | mask = 1ull << (cd.s.bit - 16); | ||
578 | |||
579 | cvmx_write_csr(CVMX_GPIO_INT_CLR, mask); | ||
580 | } | ||
581 | |||
582 | static void octeon_irq_handle_gpio(unsigned int irq, struct irq_desc *desc) | ||
583 | { | ||
584 | if (irqd_get_trigger_type(irq_desc_get_irq_data(desc)) & IRQ_TYPE_EDGE_BOTH) | ||
585 | handle_edge_irq(irq, desc); | ||
586 | else | ||
587 | handle_level_irq(irq, desc); | ||
588 | } | ||
589 | |||
508 | #ifdef CONFIG_SMP | 590 | #ifdef CONFIG_SMP |
509 | 591 | ||
510 | static void octeon_irq_cpu_offline_ciu(struct irq_data *data) | 592 | static void octeon_irq_cpu_offline_ciu(struct irq_data *data) |
@@ -650,18 +732,6 @@ static struct irq_chip octeon_irq_chip_ciu_v2 = { | |||
650 | .name = "CIU", | 732 | .name = "CIU", |
651 | .irq_enable = octeon_irq_ciu_enable_v2, | 733 | .irq_enable = octeon_irq_ciu_enable_v2, |
652 | .irq_disable = octeon_irq_ciu_disable_all_v2, | 734 | .irq_disable = octeon_irq_ciu_disable_all_v2, |
653 | .irq_mask = octeon_irq_ciu_disable_local_v2, | ||
654 | .irq_unmask = octeon_irq_ciu_enable_v2, | ||
655 | #ifdef CONFIG_SMP | ||
656 | .irq_set_affinity = octeon_irq_ciu_set_affinity_v2, | ||
657 | .irq_cpu_offline = octeon_irq_cpu_offline_ciu, | ||
658 | #endif | ||
659 | }; | ||
660 | |||
661 | static struct irq_chip octeon_irq_chip_ciu_edge_v2 = { | ||
662 | .name = "CIU-E", | ||
663 | .irq_enable = octeon_irq_ciu_enable_v2, | ||
664 | .irq_disable = octeon_irq_ciu_disable_all_v2, | ||
665 | .irq_ack = octeon_irq_ciu_ack, | 735 | .irq_ack = octeon_irq_ciu_ack, |
666 | .irq_mask = octeon_irq_ciu_disable_local_v2, | 736 | .irq_mask = octeon_irq_ciu_disable_local_v2, |
667 | .irq_unmask = octeon_irq_ciu_enable_v2, | 737 | .irq_unmask = octeon_irq_ciu_enable_v2, |
@@ -675,19 +745,8 @@ static struct irq_chip octeon_irq_chip_ciu = { | |||
675 | .name = "CIU", | 745 | .name = "CIU", |
676 | .irq_enable = octeon_irq_ciu_enable, | 746 | .irq_enable = octeon_irq_ciu_enable, |
677 | .irq_disable = octeon_irq_ciu_disable_all, | 747 | .irq_disable = octeon_irq_ciu_disable_all, |
678 | .irq_mask = octeon_irq_dummy_mask, | ||
679 | #ifdef CONFIG_SMP | ||
680 | .irq_set_affinity = octeon_irq_ciu_set_affinity, | ||
681 | .irq_cpu_offline = octeon_irq_cpu_offline_ciu, | ||
682 | #endif | ||
683 | }; | ||
684 | |||
685 | static struct irq_chip octeon_irq_chip_ciu_edge = { | ||
686 | .name = "CIU-E", | ||
687 | .irq_enable = octeon_irq_ciu_enable, | ||
688 | .irq_disable = octeon_irq_ciu_disable_all, | ||
689 | .irq_mask = octeon_irq_dummy_mask, | ||
690 | .irq_ack = octeon_irq_ciu_ack, | 748 | .irq_ack = octeon_irq_ciu_ack, |
749 | .irq_mask = octeon_irq_dummy_mask, | ||
691 | #ifdef CONFIG_SMP | 750 | #ifdef CONFIG_SMP |
692 | .irq_set_affinity = octeon_irq_ciu_set_affinity, | 751 | .irq_set_affinity = octeon_irq_ciu_set_affinity, |
693 | .irq_cpu_offline = octeon_irq_cpu_offline_ciu, | 752 | .irq_cpu_offline = octeon_irq_cpu_offline_ciu, |
@@ -717,6 +776,33 @@ static struct irq_chip octeon_irq_chip_ciu_mbox = { | |||
717 | .flags = IRQCHIP_ONOFFLINE_ENABLED, | 776 | .flags = IRQCHIP_ONOFFLINE_ENABLED, |
718 | }; | 777 | }; |
719 | 778 | ||
779 | static struct irq_chip octeon_irq_chip_ciu_gpio_v2 = { | ||
780 | .name = "CIU-GPIO", | ||
781 | .irq_enable = octeon_irq_ciu_enable_gpio_v2, | ||
782 | .irq_disable = octeon_irq_ciu_disable_gpio_v2, | ||
783 | .irq_ack = octeon_irq_ciu_gpio_ack, | ||
784 | .irq_mask = octeon_irq_ciu_disable_local_v2, | ||
785 | .irq_unmask = octeon_irq_ciu_enable_v2, | ||
786 | .irq_set_type = octeon_irq_ciu_gpio_set_type, | ||
787 | #ifdef CONFIG_SMP | ||
788 | .irq_set_affinity = octeon_irq_ciu_set_affinity_v2, | ||
789 | #endif | ||
790 | .flags = IRQCHIP_SET_TYPE_MASKED, | ||
791 | }; | ||
792 | |||
793 | static struct irq_chip octeon_irq_chip_ciu_gpio = { | ||
794 | .name = "CIU-GPIO", | ||
795 | .irq_enable = octeon_irq_ciu_enable_gpio, | ||
796 | .irq_disable = octeon_irq_ciu_disable_gpio, | ||
797 | .irq_mask = octeon_irq_dummy_mask, | ||
798 | .irq_ack = octeon_irq_ciu_gpio_ack, | ||
799 | .irq_set_type = octeon_irq_ciu_gpio_set_type, | ||
800 | #ifdef CONFIG_SMP | ||
801 | .irq_set_affinity = octeon_irq_ciu_set_affinity, | ||
802 | #endif | ||
803 | .flags = IRQCHIP_SET_TYPE_MASKED, | ||
804 | }; | ||
805 | |||
720 | /* | 806 | /* |
721 | * Watchdog interrupts are special. They are associated with a single | 807 | * Watchdog interrupts are special. They are associated with a single |
722 | * core, so we hardwire the affinity to that core. | 808 | * core, so we hardwire the affinity to that core. |
@@ -764,6 +850,178 @@ static struct irq_chip octeon_irq_chip_ciu_wd = { | |||
764 | .irq_mask = octeon_irq_dummy_mask, | 850 | .irq_mask = octeon_irq_dummy_mask, |
765 | }; | 851 | }; |
766 | 852 | ||
853 | static bool octeon_irq_ciu_is_edge(unsigned int line, unsigned int bit) | ||
854 | { | ||
855 | bool edge = false; | ||
856 | |||
857 | if (line == 0) | ||
858 | switch (bit) { | ||
859 | case 48 ... 49: /* GMX DRP */ | ||
860 | case 50: /* IPD_DRP */ | ||
861 | case 52 ... 55: /* Timers */ | ||
862 | case 58: /* MPI */ | ||
863 | edge = true; | ||
864 | break; | ||
865 | default: | ||
866 | break; | ||
867 | } | ||
868 | else /* line == 1 */ | ||
869 | switch (bit) { | ||
870 | case 47: /* PTP */ | ||
871 | edge = true; | ||
872 | break; | ||
873 | default: | ||
874 | break; | ||
875 | } | ||
876 | return edge; | ||
877 | } | ||
878 | |||
879 | struct octeon_irq_gpio_domain_data { | ||
880 | unsigned int base_hwirq; | ||
881 | }; | ||
882 | |||
883 | static int octeon_irq_gpio_xlat(struct irq_domain *d, | ||
884 | struct device_node *node, | ||
885 | const u32 *intspec, | ||
886 | unsigned int intsize, | ||
887 | unsigned long *out_hwirq, | ||
888 | unsigned int *out_type) | ||
889 | { | ||
890 | unsigned int type; | ||
891 | unsigned int pin; | ||
892 | unsigned int trigger; | ||
893 | struct octeon_irq_gpio_domain_data *gpiod; | ||
894 | |||
895 | if (d->of_node != node) | ||
896 | return -EINVAL; | ||
897 | |||
898 | if (intsize < 2) | ||
899 | return -EINVAL; | ||
900 | |||
901 | pin = intspec[0]; | ||
902 | if (pin >= 16) | ||
903 | return -EINVAL; | ||
904 | |||
905 | trigger = intspec[1]; | ||
906 | |||
907 | switch (trigger) { | ||
908 | case 1: | ||
909 | type = IRQ_TYPE_EDGE_RISING; | ||
910 | break; | ||
911 | case 2: | ||
912 | type = IRQ_TYPE_EDGE_FALLING; | ||
913 | break; | ||
914 | case 4: | ||
915 | type = IRQ_TYPE_LEVEL_HIGH; | ||
916 | break; | ||
917 | case 8: | ||
918 | type = IRQ_TYPE_LEVEL_LOW; | ||
919 | break; | ||
920 | default: | ||
921 | pr_err("Error: (%s) Invalid irq trigger specification: %x\n", | ||
922 | node->name, | ||
923 | trigger); | ||
924 | type = IRQ_TYPE_LEVEL_LOW; | ||
925 | break; | ||
926 | } | ||
927 | *out_type = type; | ||
928 | gpiod = d->host_data; | ||
929 | *out_hwirq = gpiod->base_hwirq + pin; | ||
930 | |||
931 | return 0; | ||
932 | } | ||
933 | |||
934 | static int octeon_irq_ciu_xlat(struct irq_domain *d, | ||
935 | struct device_node *node, | ||
936 | const u32 *intspec, | ||
937 | unsigned int intsize, | ||
938 | unsigned long *out_hwirq, | ||
939 | unsigned int *out_type) | ||
940 | { | ||
941 | unsigned int ciu, bit; | ||
942 | |||
943 | ciu = intspec[0]; | ||
944 | bit = intspec[1]; | ||
945 | |||
946 | if (ciu > 1 || bit > 63) | ||
947 | return -EINVAL; | ||
948 | |||
949 | /* These are the GPIO lines */ | ||
950 | if (ciu == 0 && bit >= 16 && bit < 32) | ||
951 | return -EINVAL; | ||
952 | |||
953 | *out_hwirq = (ciu << 6) | bit; | ||
954 | *out_type = 0; | ||
955 | |||
956 | return 0; | ||
957 | } | ||
958 | |||
959 | static struct irq_chip *octeon_irq_ciu_chip; | ||
960 | static struct irq_chip *octeon_irq_gpio_chip; | ||
961 | |||
962 | static bool octeon_irq_virq_in_range(unsigned int virq) | ||
963 | { | ||
964 | /* We cannot let it overflow the mapping array. */ | ||
965 | if (virq < (1ul << 8 * sizeof(octeon_irq_ciu_to_irq[0][0]))) | ||
966 | return true; | ||
967 | |||
968 | WARN_ONCE(true, "virq out of range %u.\n", virq); | ||
969 | return false; | ||
970 | } | ||
971 | |||
972 | static int octeon_irq_ciu_map(struct irq_domain *d, | ||
973 | unsigned int virq, irq_hw_number_t hw) | ||
974 | { | ||
975 | unsigned int line = hw >> 6; | ||
976 | unsigned int bit = hw & 63; | ||
977 | |||
978 | if (!octeon_irq_virq_in_range(virq)) | ||
979 | return -EINVAL; | ||
980 | |||
981 | if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0) | ||
982 | return -EINVAL; | ||
983 | |||
984 | if (octeon_irq_ciu_is_edge(line, bit)) | ||
985 | octeon_irq_set_ciu_mapping(virq, line, bit, | ||
986 | octeon_irq_ciu_chip, | ||
987 | handle_edge_irq); | ||
988 | else | ||
989 | octeon_irq_set_ciu_mapping(virq, line, bit, | ||
990 | octeon_irq_ciu_chip, | ||
991 | handle_level_irq); | ||
992 | |||
993 | return 0; | ||
994 | } | ||
995 | |||
996 | static int octeon_irq_gpio_map(struct irq_domain *d, | ||
997 | unsigned int virq, irq_hw_number_t hw) | ||
998 | { | ||
999 | unsigned int line = hw >> 6; | ||
1000 | unsigned int bit = hw & 63; | ||
1001 | |||
1002 | if (!octeon_irq_virq_in_range(virq)) | ||
1003 | return -EINVAL; | ||
1004 | |||
1005 | if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0) | ||
1006 | return -EINVAL; | ||
1007 | |||
1008 | octeon_irq_set_ciu_mapping(virq, line, bit, | ||
1009 | octeon_irq_gpio_chip, | ||
1010 | octeon_irq_handle_gpio); | ||
1011 | |||
1012 | return 0; | ||
1013 | } | ||
1014 | |||
1015 | static struct irq_domain_ops octeon_irq_domain_ciu_ops = { | ||
1016 | .map = octeon_irq_ciu_map, | ||
1017 | .xlate = octeon_irq_ciu_xlat, | ||
1018 | }; | ||
1019 | |||
1020 | static struct irq_domain_ops octeon_irq_domain_gpio_ops = { | ||
1021 | .map = octeon_irq_gpio_map, | ||
1022 | .xlate = octeon_irq_gpio_xlat, | ||
1023 | }; | ||
1024 | |||
767 | static void octeon_irq_ip2_v1(void) | 1025 | static void octeon_irq_ip2_v1(void) |
768 | { | 1026 | { |
769 | const unsigned long core_id = cvmx_get_core_num(); | 1027 | const unsigned long core_id = cvmx_get_core_num(); |
@@ -887,9 +1145,10 @@ static void __init octeon_irq_init_ciu(void) | |||
887 | { | 1145 | { |
888 | unsigned int i; | 1146 | unsigned int i; |
889 | struct irq_chip *chip; | 1147 | struct irq_chip *chip; |
890 | struct irq_chip *chip_edge; | ||
891 | struct irq_chip *chip_mbox; | 1148 | struct irq_chip *chip_mbox; |
892 | struct irq_chip *chip_wd; | 1149 | struct irq_chip *chip_wd; |
1150 | struct device_node *gpio_node; | ||
1151 | struct device_node *ciu_node; | ||
893 | 1152 | ||
894 | octeon_irq_init_ciu_percpu(); | 1153 | octeon_irq_init_ciu_percpu(); |
895 | octeon_irq_setup_secondary = octeon_irq_setup_secondary_ciu; | 1154 | octeon_irq_setup_secondary = octeon_irq_setup_secondary_ciu; |
@@ -901,17 +1160,18 @@ static void __init octeon_irq_init_ciu(void) | |||
901 | octeon_irq_ip2 = octeon_irq_ip2_v2; | 1160 | octeon_irq_ip2 = octeon_irq_ip2_v2; |
902 | octeon_irq_ip3 = octeon_irq_ip3_v2; | 1161 | octeon_irq_ip3 = octeon_irq_ip3_v2; |
903 | chip = &octeon_irq_chip_ciu_v2; | 1162 | chip = &octeon_irq_chip_ciu_v2; |
904 | chip_edge = &octeon_irq_chip_ciu_edge_v2; | ||
905 | chip_mbox = &octeon_irq_chip_ciu_mbox_v2; | 1163 | chip_mbox = &octeon_irq_chip_ciu_mbox_v2; |
906 | chip_wd = &octeon_irq_chip_ciu_wd_v2; | 1164 | chip_wd = &octeon_irq_chip_ciu_wd_v2; |
1165 | octeon_irq_gpio_chip = &octeon_irq_chip_ciu_gpio_v2; | ||
907 | } else { | 1166 | } else { |
908 | octeon_irq_ip2 = octeon_irq_ip2_v1; | 1167 | octeon_irq_ip2 = octeon_irq_ip2_v1; |
909 | octeon_irq_ip3 = octeon_irq_ip3_v1; | 1168 | octeon_irq_ip3 = octeon_irq_ip3_v1; |
910 | chip = &octeon_irq_chip_ciu; | 1169 | chip = &octeon_irq_chip_ciu; |
911 | chip_edge = &octeon_irq_chip_ciu_edge; | ||
912 | chip_mbox = &octeon_irq_chip_ciu_mbox; | 1170 | chip_mbox = &octeon_irq_chip_ciu_mbox; |
913 | chip_wd = &octeon_irq_chip_ciu_wd; | 1171 | chip_wd = &octeon_irq_chip_ciu_wd; |
1172 | octeon_irq_gpio_chip = &octeon_irq_chip_ciu_gpio; | ||
914 | } | 1173 | } |
1174 | octeon_irq_ciu_chip = chip; | ||
915 | octeon_irq_ip4 = octeon_irq_ip4_mask; | 1175 | octeon_irq_ip4 = octeon_irq_ip4_mask; |
916 | 1176 | ||
917 | /* Mips internal */ | 1177 | /* Mips internal */ |
@@ -920,80 +1180,49 @@ static void __init octeon_irq_init_ciu(void) | |||
920 | /* CIU_0 */ | 1180 | /* CIU_0 */ |
921 | for (i = 0; i < 16; i++) | 1181 | for (i = 0; i < 16; i++) |
922 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_WORKQ0, 0, i + 0, chip, handle_level_irq); | 1182 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_WORKQ0, 0, i + 0, chip, handle_level_irq); |
923 | for (i = 0; i < 16; i++) | ||
924 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_GPIO0, 0, i + 16, chip, handle_level_irq); | ||
925 | 1183 | ||
926 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX0, 0, 32, chip_mbox, handle_percpu_irq); | 1184 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX0, 0, 32, chip_mbox, handle_percpu_irq); |
927 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX1, 0, 33, chip_mbox, handle_percpu_irq); | 1185 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX1, 0, 33, chip_mbox, handle_percpu_irq); |
928 | 1186 | ||
929 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_UART0, 0, 34, chip, handle_level_irq); | ||
930 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_UART1, 0, 35, chip, handle_level_irq); | ||
931 | |||
932 | for (i = 0; i < 4; i++) | 1187 | for (i = 0; i < 4; i++) |
933 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_PCI_INT0, 0, i + 36, chip, handle_level_irq); | 1188 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_PCI_INT0, 0, i + 36, chip, handle_level_irq); |
934 | for (i = 0; i < 4; i++) | 1189 | for (i = 0; i < 4; i++) |
935 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_PCI_MSI0, 0, i + 40, chip, handle_level_irq); | 1190 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_PCI_MSI0, 0, i + 40, chip, handle_level_irq); |
936 | 1191 | ||
937 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_TWSI, 0, 45, chip, handle_level_irq); | ||
938 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_RML, 0, 46, chip, handle_level_irq); | 1192 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_RML, 0, 46, chip, handle_level_irq); |
939 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_TRACE0, 0, 47, chip, handle_level_irq); | ||
940 | |||
941 | for (i = 0; i < 2; i++) | ||
942 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_GMX_DRP0, 0, i + 48, chip_edge, handle_edge_irq); | ||
943 | |||
944 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_IPD_DRP, 0, 50, chip_edge, handle_edge_irq); | ||
945 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_KEY_ZERO, 0, 51, chip_edge, handle_edge_irq); | ||
946 | |||
947 | for (i = 0; i < 4; i++) | 1193 | for (i = 0; i < 4; i++) |
948 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_TIMER0, 0, i + 52, chip_edge, handle_edge_irq); | 1194 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_TIMER0, 0, i + 52, chip, handle_edge_irq); |
949 | 1195 | ||
950 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_USB0, 0, 56, chip, handle_level_irq); | 1196 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_USB0, 0, 56, chip, handle_level_irq); |
951 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_PCM, 0, 57, chip, handle_level_irq); | ||
952 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_MPI, 0, 58, chip, handle_level_irq); | ||
953 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_TWSI2, 0, 59, chip, handle_level_irq); | ||
954 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_POWIQ, 0, 60, chip, handle_level_irq); | ||
955 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_IPDPPTHR, 0, 61, chip, handle_level_irq); | ||
956 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_MII0, 0, 62, chip, handle_level_irq); | ||
957 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_BOOTDMA, 0, 63, chip, handle_level_irq); | 1197 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_BOOTDMA, 0, 63, chip, handle_level_irq); |
958 | 1198 | ||
959 | /* CIU_1 */ | 1199 | /* CIU_1 */ |
960 | for (i = 0; i < 16; i++) | 1200 | for (i = 0; i < 16; i++) |
961 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_WDOG0, 1, i + 0, chip_wd, handle_level_irq); | 1201 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_WDOG0, 1, i + 0, chip_wd, handle_level_irq); |
962 | 1202 | ||
963 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_UART2, 1, 16, chip, handle_level_irq); | ||
964 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_USB1, 1, 17, chip, handle_level_irq); | 1203 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_USB1, 1, 17, chip, handle_level_irq); |
965 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_MII1, 1, 18, chip, handle_level_irq); | 1204 | |
966 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_NAND, 1, 19, chip, handle_level_irq); | 1205 | gpio_node = of_find_compatible_node(NULL, NULL, "cavium,octeon-3860-gpio"); |
967 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_MIO, 1, 20, chip, handle_level_irq); | 1206 | if (gpio_node) { |
968 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_IOB, 1, 21, chip, handle_level_irq); | 1207 | struct octeon_irq_gpio_domain_data *gpiod; |
969 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_FPA, 1, 22, chip, handle_level_irq); | 1208 | |
970 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_POW, 1, 23, chip, handle_level_irq); | 1209 | gpiod = kzalloc(sizeof(*gpiod), GFP_KERNEL); |
971 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_L2C, 1, 24, chip, handle_level_irq); | 1210 | if (gpiod) { |
972 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_IPD, 1, 25, chip, handle_level_irq); | 1211 | /* gpio domain host_data is the base hwirq number. */ |
973 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_PIP, 1, 26, chip, handle_level_irq); | 1212 | gpiod->base_hwirq = 16; |
974 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_PKO, 1, 27, chip, handle_level_irq); | 1213 | irq_domain_add_linear(gpio_node, 16, &octeon_irq_domain_gpio_ops, gpiod); |
975 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_ZIP, 1, 28, chip, handle_level_irq); | 1214 | of_node_put(gpio_node); |
976 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_TIM, 1, 29, chip, handle_level_irq); | 1215 | } else |
977 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_RAD, 1, 30, chip, handle_level_irq); | 1216 | pr_warn("Cannot allocate memory for GPIO irq_domain.\n"); |
978 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_KEY, 1, 31, chip, handle_level_irq); | 1217 | } else |
979 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_DFA, 1, 32, chip, handle_level_irq); | 1218 | pr_warn("Cannot find device node for cavium,octeon-3860-gpio.\n"); |
980 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_USBCTL, 1, 33, chip, handle_level_irq); | 1219 | |
981 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_SLI, 1, 34, chip, handle_level_irq); | 1220 | ciu_node = of_find_compatible_node(NULL, NULL, "cavium,octeon-3860-ciu"); |
982 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_DPI, 1, 35, chip, handle_level_irq); | 1221 | if (ciu_node) { |
983 | 1222 | irq_domain_add_tree(ciu_node, &octeon_irq_domain_ciu_ops, NULL); | |
984 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_AGX0, 1, 36, chip, handle_level_irq); | 1223 | of_node_put(ciu_node); |
985 | 1224 | } else | |
986 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_AGL, 1, 46, chip, handle_level_irq); | 1225 | pr_warn("Cannot find device node for cavium,octeon-3860-ciu.\n"); |
987 | |||
988 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_PTP, 1, 47, chip_edge, handle_edge_irq); | ||
989 | |||
990 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_PEM0, 1, 48, chip, handle_level_irq); | ||
991 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_PEM1, 1, 49, chip, handle_level_irq); | ||
992 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_SRIO0, 1, 50, chip, handle_level_irq); | ||
993 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_SRIO1, 1, 51, chip, handle_level_irq); | ||
994 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_LMC0, 1, 52, chip, handle_level_irq); | ||
995 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_DFM, 1, 56, chip, handle_level_irq); | ||
996 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_RST, 1, 63, chip, handle_level_irq); | ||
997 | 1226 | ||
998 | /* Enable the CIU lines */ | 1227 | /* Enable the CIU lines */ |
999 | set_c0_status(STATUSF_IP3 | STATUSF_IP2); | 1228 | set_c0_status(STATUSF_IP3 | STATUSF_IP2); |
diff --git a/arch/mips/cavium-octeon/octeon-memcpy.S b/arch/mips/cavium-octeon/octeon-memcpy.S index 88e0cddca205..db478dbb9c7b 100644 --- a/arch/mips/cavium-octeon/octeon-memcpy.S +++ b/arch/mips/cavium-octeon/octeon-memcpy.S | |||
@@ -164,6 +164,14 @@ | |||
164 | .set noat | 164 | .set noat |
165 | 165 | ||
166 | /* | 166 | /* |
167 | * t7 is used as a flag to note inatomic mode. | ||
168 | */ | ||
169 | LEAF(__copy_user_inatomic) | ||
170 | b __copy_user_common | ||
171 | li t7, 1 | ||
172 | END(__copy_user_inatomic) | ||
173 | |||
174 | /* | ||
167 | * A combined memcpy/__copy_user | 175 | * A combined memcpy/__copy_user |
168 | * __copy_user sets len to 0 for success; else to an upper bound of | 176 | * __copy_user sets len to 0 for success; else to an upper bound of |
169 | * the number of uncopied bytes. | 177 | * the number of uncopied bytes. |
@@ -174,6 +182,8 @@ LEAF(memcpy) /* a0=dst a1=src a2=len */ | |||
174 | move v0, dst /* return value */ | 182 | move v0, dst /* return value */ |
175 | __memcpy: | 183 | __memcpy: |
176 | FEXPORT(__copy_user) | 184 | FEXPORT(__copy_user) |
185 | li t7, 0 /* not inatomic */ | ||
186 | __copy_user_common: | ||
177 | /* | 187 | /* |
178 | * Note: dst & src may be unaligned, len may be 0 | 188 | * Note: dst & src may be unaligned, len may be 0 |
179 | * Temps | 189 | * Temps |
@@ -412,7 +422,6 @@ l_exc_copy: | |||
412 | * Assumes src < THREAD_BUADDR($28) | 422 | * Assumes src < THREAD_BUADDR($28) |
413 | */ | 423 | */ |
414 | LOAD t0, TI_TASK($28) | 424 | LOAD t0, TI_TASK($28) |
415 | nop | ||
416 | LOAD t0, THREAD_BUADDR(t0) | 425 | LOAD t0, THREAD_BUADDR(t0) |
417 | 1: | 426 | 1: |
418 | EXC( lb t1, 0(src), l_exc) | 427 | EXC( lb t1, 0(src), l_exc) |
@@ -422,10 +431,9 @@ EXC( lb t1, 0(src), l_exc) | |||
422 | ADD dst, dst, 1 | 431 | ADD dst, dst, 1 |
423 | l_exc: | 432 | l_exc: |
424 | LOAD t0, TI_TASK($28) | 433 | LOAD t0, TI_TASK($28) |
425 | nop | ||
426 | LOAD t0, THREAD_BUADDR(t0) # t0 is just past last good address | 434 | LOAD t0, THREAD_BUADDR(t0) # t0 is just past last good address |
427 | nop | ||
428 | SUB len, AT, t0 # len number of uncopied bytes | 435 | SUB len, AT, t0 # len number of uncopied bytes |
436 | bnez t7, 2f /* Skip the zeroing out part if inatomic */ | ||
429 | /* | 437 | /* |
430 | * Here's where we rely on src and dst being incremented in tandem, | 438 | * Here's where we rely on src and dst being incremented in tandem, |
431 | * See (3) above. | 439 | * See (3) above. |
@@ -443,7 +451,7 @@ l_exc: | |||
443 | ADD dst, dst, 1 | 451 | ADD dst, dst, 1 |
444 | bnez src, 1b | 452 | bnez src, 1b |
445 | SUB src, src, 1 | 453 | SUB src, src, 1 |
446 | jr ra | 454 | 2: jr ra |
447 | nop | 455 | nop |
448 | 456 | ||
449 | 457 | ||
diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index cd61d7281d91..0938df10a71c 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (C) 2004-2010 Cavium Networks | 6 | * Copyright (C) 2004-2011 Cavium Networks |
7 | * Copyright (C) 2008 Wind River Systems | 7 | * Copyright (C) 2008 Wind River Systems |
8 | */ | 8 | */ |
9 | 9 | ||
@@ -13,10 +13,16 @@ | |||
13 | #include <linux/usb.h> | 13 | #include <linux/usb.h> |
14 | #include <linux/dma-mapping.h> | 14 | #include <linux/dma-mapping.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/slab.h> | ||
16 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/of_platform.h> | ||
19 | #include <linux/of_fdt.h> | ||
20 | #include <linux/libfdt.h> | ||
17 | 21 | ||
18 | #include <asm/octeon/octeon.h> | 22 | #include <asm/octeon/octeon.h> |
19 | #include <asm/octeon/cvmx-rnm-defs.h> | 23 | #include <asm/octeon/cvmx-rnm-defs.h> |
24 | #include <asm/octeon/cvmx-helper.h> | ||
25 | #include <asm/octeon/cvmx-helper-board.h> | ||
20 | 26 | ||
21 | static struct octeon_cf_data octeon_cf_data; | 27 | static struct octeon_cf_data octeon_cf_data; |
22 | 28 | ||
@@ -162,182 +168,6 @@ out: | |||
162 | } | 168 | } |
163 | device_initcall(octeon_rng_device_init); | 169 | device_initcall(octeon_rng_device_init); |
164 | 170 | ||
165 | static struct i2c_board_info __initdata octeon_i2c_devices[] = { | ||
166 | { | ||
167 | I2C_BOARD_INFO("ds1337", 0x68), | ||
168 | }, | ||
169 | }; | ||
170 | |||
171 | static int __init octeon_i2c_devices_init(void) | ||
172 | { | ||
173 | return i2c_register_board_info(0, octeon_i2c_devices, | ||
174 | ARRAY_SIZE(octeon_i2c_devices)); | ||
175 | } | ||
176 | arch_initcall(octeon_i2c_devices_init); | ||
177 | |||
178 | #define OCTEON_I2C_IO_BASE 0x1180000001000ull | ||
179 | #define OCTEON_I2C_IO_UNIT_OFFSET 0x200 | ||
180 | |||
181 | static struct octeon_i2c_data octeon_i2c_data[2]; | ||
182 | |||
183 | static int __init octeon_i2c_device_init(void) | ||
184 | { | ||
185 | struct platform_device *pd; | ||
186 | int ret = 0; | ||
187 | int port, num_ports; | ||
188 | |||
189 | struct resource i2c_resources[] = { | ||
190 | { | ||
191 | .flags = IORESOURCE_MEM, | ||
192 | }, { | ||
193 | .flags = IORESOURCE_IRQ, | ||
194 | } | ||
195 | }; | ||
196 | |||
197 | if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN52XX)) | ||
198 | num_ports = 2; | ||
199 | else | ||
200 | num_ports = 1; | ||
201 | |||
202 | for (port = 0; port < num_ports; port++) { | ||
203 | octeon_i2c_data[port].sys_freq = octeon_get_io_clock_rate(); | ||
204 | /*FIXME: should be examined. At the moment is set for 100Khz */ | ||
205 | octeon_i2c_data[port].i2c_freq = 100000; | ||
206 | |||
207 | pd = platform_device_alloc("i2c-octeon", port); | ||
208 | if (!pd) { | ||
209 | ret = -ENOMEM; | ||
210 | goto out; | ||
211 | } | ||
212 | |||
213 | pd->dev.platform_data = octeon_i2c_data + port; | ||
214 | |||
215 | i2c_resources[0].start = | ||
216 | OCTEON_I2C_IO_BASE + (port * OCTEON_I2C_IO_UNIT_OFFSET); | ||
217 | i2c_resources[0].end = i2c_resources[0].start + 0x1f; | ||
218 | switch (port) { | ||
219 | case 0: | ||
220 | i2c_resources[1].start = OCTEON_IRQ_TWSI; | ||
221 | i2c_resources[1].end = OCTEON_IRQ_TWSI; | ||
222 | break; | ||
223 | case 1: | ||
224 | i2c_resources[1].start = OCTEON_IRQ_TWSI2; | ||
225 | i2c_resources[1].end = OCTEON_IRQ_TWSI2; | ||
226 | break; | ||
227 | default: | ||
228 | BUG(); | ||
229 | } | ||
230 | |||
231 | ret = platform_device_add_resources(pd, | ||
232 | i2c_resources, | ||
233 | ARRAY_SIZE(i2c_resources)); | ||
234 | if (ret) | ||
235 | goto fail; | ||
236 | |||
237 | ret = platform_device_add(pd); | ||
238 | if (ret) | ||
239 | goto fail; | ||
240 | } | ||
241 | return ret; | ||
242 | fail: | ||
243 | platform_device_put(pd); | ||
244 | out: | ||
245 | return ret; | ||
246 | } | ||
247 | device_initcall(octeon_i2c_device_init); | ||
248 | |||
249 | /* Octeon SMI/MDIO interface. */ | ||
250 | static int __init octeon_mdiobus_device_init(void) | ||
251 | { | ||
252 | struct platform_device *pd; | ||
253 | int ret = 0; | ||
254 | |||
255 | if (octeon_is_simulation()) | ||
256 | return 0; /* No mdio in the simulator. */ | ||
257 | |||
258 | /* The bus number is the platform_device id. */ | ||
259 | pd = platform_device_alloc("mdio-octeon", 0); | ||
260 | if (!pd) { | ||
261 | ret = -ENOMEM; | ||
262 | goto out; | ||
263 | } | ||
264 | |||
265 | ret = platform_device_add(pd); | ||
266 | if (ret) | ||
267 | goto fail; | ||
268 | |||
269 | return ret; | ||
270 | fail: | ||
271 | platform_device_put(pd); | ||
272 | |||
273 | out: | ||
274 | return ret; | ||
275 | |||
276 | } | ||
277 | device_initcall(octeon_mdiobus_device_init); | ||
278 | |||
279 | /* Octeon mgmt port Ethernet interface. */ | ||
280 | static int __init octeon_mgmt_device_init(void) | ||
281 | { | ||
282 | struct platform_device *pd; | ||
283 | int ret = 0; | ||
284 | int port, num_ports; | ||
285 | |||
286 | struct resource mgmt_port_resource = { | ||
287 | .flags = IORESOURCE_IRQ, | ||
288 | .start = -1, | ||
289 | .end = -1 | ||
290 | }; | ||
291 | |||
292 | if (!OCTEON_IS_MODEL(OCTEON_CN56XX) && !OCTEON_IS_MODEL(OCTEON_CN52XX)) | ||
293 | return 0; | ||
294 | |||
295 | if (OCTEON_IS_MODEL(OCTEON_CN56XX)) | ||
296 | num_ports = 1; | ||
297 | else | ||
298 | num_ports = 2; | ||
299 | |||
300 | for (port = 0; port < num_ports; port++) { | ||
301 | pd = platform_device_alloc("octeon_mgmt", port); | ||
302 | if (!pd) { | ||
303 | ret = -ENOMEM; | ||
304 | goto out; | ||
305 | } | ||
306 | /* No DMA restrictions */ | ||
307 | pd->dev.coherent_dma_mask = DMA_BIT_MASK(64); | ||
308 | pd->dev.dma_mask = &pd->dev.coherent_dma_mask; | ||
309 | |||
310 | switch (port) { | ||
311 | case 0: | ||
312 | mgmt_port_resource.start = OCTEON_IRQ_MII0; | ||
313 | break; | ||
314 | case 1: | ||
315 | mgmt_port_resource.start = OCTEON_IRQ_MII1; | ||
316 | break; | ||
317 | default: | ||
318 | BUG(); | ||
319 | } | ||
320 | mgmt_port_resource.end = mgmt_port_resource.start; | ||
321 | |||
322 | ret = platform_device_add_resources(pd, &mgmt_port_resource, 1); | ||
323 | |||
324 | if (ret) | ||
325 | goto fail; | ||
326 | |||
327 | ret = platform_device_add(pd); | ||
328 | if (ret) | ||
329 | goto fail; | ||
330 | } | ||
331 | return ret; | ||
332 | fail: | ||
333 | platform_device_put(pd); | ||
334 | |||
335 | out: | ||
336 | return ret; | ||
337 | |||
338 | } | ||
339 | device_initcall(octeon_mgmt_device_init); | ||
340 | |||
341 | #ifdef CONFIG_USB | 171 | #ifdef CONFIG_USB |
342 | 172 | ||
343 | static int __init octeon_ehci_device_init(void) | 173 | static int __init octeon_ehci_device_init(void) |
@@ -440,6 +270,521 @@ device_initcall(octeon_ohci_device_init); | |||
440 | 270 | ||
441 | #endif /* CONFIG_USB */ | 271 | #endif /* CONFIG_USB */ |
442 | 272 | ||
273 | static struct of_device_id __initdata octeon_ids[] = { | ||
274 | { .compatible = "simple-bus", }, | ||
275 | { .compatible = "cavium,octeon-6335-uctl", }, | ||
276 | { .compatible = "cavium,octeon-3860-bootbus", }, | ||
277 | { .compatible = "cavium,mdio-mux", }, | ||
278 | { .compatible = "gpio-leds", }, | ||
279 | {}, | ||
280 | }; | ||
281 | |||
282 | static bool __init octeon_has_88e1145(void) | ||
283 | { | ||
284 | return !OCTEON_IS_MODEL(OCTEON_CN52XX) && | ||
285 | !OCTEON_IS_MODEL(OCTEON_CN6XXX) && | ||
286 | !OCTEON_IS_MODEL(OCTEON_CN56XX); | ||
287 | } | ||
288 | |||
289 | static void __init octeon_fdt_set_phy(int eth, int phy_addr) | ||
290 | { | ||
291 | const __be32 *phy_handle; | ||
292 | const __be32 *alt_phy_handle; | ||
293 | const __be32 *reg; | ||
294 | u32 phandle; | ||
295 | int phy; | ||
296 | int alt_phy; | ||
297 | const char *p; | ||
298 | int current_len; | ||
299 | char new_name[20]; | ||
300 | |||
301 | phy_handle = fdt_getprop(initial_boot_params, eth, "phy-handle", NULL); | ||
302 | if (!phy_handle) | ||
303 | return; | ||
304 | |||
305 | phandle = be32_to_cpup(phy_handle); | ||
306 | phy = fdt_node_offset_by_phandle(initial_boot_params, phandle); | ||
307 | |||
308 | alt_phy_handle = fdt_getprop(initial_boot_params, eth, "cavium,alt-phy-handle", NULL); | ||
309 | if (alt_phy_handle) { | ||
310 | u32 alt_phandle = be32_to_cpup(alt_phy_handle); | ||
311 | alt_phy = fdt_node_offset_by_phandle(initial_boot_params, alt_phandle); | ||
312 | } else { | ||
313 | alt_phy = -1; | ||
314 | } | ||
315 | |||
316 | if (phy_addr < 0 || phy < 0) { | ||
317 | /* Delete the PHY things */ | ||
318 | fdt_nop_property(initial_boot_params, eth, "phy-handle"); | ||
319 | /* This one may fail */ | ||
320 | fdt_nop_property(initial_boot_params, eth, "cavium,alt-phy-handle"); | ||
321 | if (phy >= 0) | ||
322 | fdt_nop_node(initial_boot_params, phy); | ||
323 | if (alt_phy >= 0) | ||
324 | fdt_nop_node(initial_boot_params, alt_phy); | ||
325 | return; | ||
326 | } | ||
327 | |||
328 | if (phy_addr >= 256 && alt_phy > 0) { | ||
329 | const struct fdt_property *phy_prop; | ||
330 | struct fdt_property *alt_prop; | ||
331 | u32 phy_handle_name; | ||
332 | |||
333 | /* Use the alt phy node instead.*/ | ||
334 | phy_prop = fdt_get_property(initial_boot_params, eth, "phy-handle", NULL); | ||
335 | phy_handle_name = phy_prop->nameoff; | ||
336 | fdt_nop_node(initial_boot_params, phy); | ||
337 | fdt_nop_property(initial_boot_params, eth, "phy-handle"); | ||
338 | alt_prop = fdt_get_property_w(initial_boot_params, eth, "cavium,alt-phy-handle", NULL); | ||
339 | alt_prop->nameoff = phy_handle_name; | ||
340 | phy = alt_phy; | ||
341 | } | ||
342 | |||
343 | phy_addr &= 0xff; | ||
344 | |||
345 | if (octeon_has_88e1145()) { | ||
346 | fdt_nop_property(initial_boot_params, phy, "marvell,reg-init"); | ||
347 | memset(new_name, 0, sizeof(new_name)); | ||
348 | strcpy(new_name, "marvell,88e1145"); | ||
349 | p = fdt_getprop(initial_boot_params, phy, "compatible", | ||
350 | ¤t_len); | ||
351 | if (p && current_len >= strlen(new_name)) | ||
352 | fdt_setprop_inplace(initial_boot_params, phy, | ||
353 | "compatible", new_name, current_len); | ||
354 | } | ||
355 | |||
356 | reg = fdt_getprop(initial_boot_params, phy, "reg", NULL); | ||
357 | if (phy_addr == be32_to_cpup(reg)) | ||
358 | return; | ||
359 | |||
360 | fdt_setprop_inplace_cell(initial_boot_params, phy, "reg", phy_addr); | ||
361 | |||
362 | snprintf(new_name, sizeof(new_name), "ethernet-phy@%x", phy_addr); | ||
363 | |||
364 | p = fdt_get_name(initial_boot_params, phy, ¤t_len); | ||
365 | if (p && current_len == strlen(new_name)) | ||
366 | fdt_set_name(initial_boot_params, phy, new_name); | ||
367 | else | ||
368 | pr_err("Error: could not rename ethernet phy: <%s>", p); | ||
369 | } | ||
370 | |||
371 | static void __init octeon_fdt_set_mac_addr(int n, u64 *pmac) | ||
372 | { | ||
373 | u8 new_mac[6]; | ||
374 | u64 mac = *pmac; | ||
375 | int r; | ||
376 | |||
377 | new_mac[0] = (mac >> 40) & 0xff; | ||
378 | new_mac[1] = (mac >> 32) & 0xff; | ||
379 | new_mac[2] = (mac >> 24) & 0xff; | ||
380 | new_mac[3] = (mac >> 16) & 0xff; | ||
381 | new_mac[4] = (mac >> 8) & 0xff; | ||
382 | new_mac[5] = mac & 0xff; | ||
383 | |||
384 | r = fdt_setprop_inplace(initial_boot_params, n, "local-mac-address", | ||
385 | new_mac, sizeof(new_mac)); | ||
386 | |||
387 | if (r) { | ||
388 | pr_err("Setting \"local-mac-address\" failed %d", r); | ||
389 | return; | ||
390 | } | ||
391 | *pmac = mac + 1; | ||
392 | } | ||
393 | |||
394 | static void __init octeon_fdt_rm_ethernet(int node) | ||
395 | { | ||
396 | const __be32 *phy_handle; | ||
397 | |||
398 | phy_handle = fdt_getprop(initial_boot_params, node, "phy-handle", NULL); | ||
399 | if (phy_handle) { | ||
400 | u32 ph = be32_to_cpup(phy_handle); | ||
401 | int p = fdt_node_offset_by_phandle(initial_boot_params, ph); | ||
402 | if (p >= 0) | ||
403 | fdt_nop_node(initial_boot_params, p); | ||
404 | } | ||
405 | fdt_nop_node(initial_boot_params, node); | ||
406 | } | ||
407 | |||
408 | static void __init octeon_fdt_pip_port(int iface, int i, int p, int max, u64 *pmac) | ||
409 | { | ||
410 | char name_buffer[20]; | ||
411 | int eth; | ||
412 | int phy_addr; | ||
413 | int ipd_port; | ||
414 | |||
415 | snprintf(name_buffer, sizeof(name_buffer), "ethernet@%x", p); | ||
416 | eth = fdt_subnode_offset(initial_boot_params, iface, name_buffer); | ||
417 | if (eth < 0) | ||
418 | return; | ||
419 | if (p > max) { | ||
420 | pr_debug("Deleting port %x:%x\n", i, p); | ||
421 | octeon_fdt_rm_ethernet(eth); | ||
422 | return; | ||
423 | } | ||
424 | if (OCTEON_IS_MODEL(OCTEON_CN68XX)) | ||
425 | ipd_port = (0x100 * i) + (0x10 * p) + 0x800; | ||
426 | else | ||
427 | ipd_port = 16 * i + p; | ||
428 | |||
429 | phy_addr = cvmx_helper_board_get_mii_address(ipd_port); | ||
430 | octeon_fdt_set_phy(eth, phy_addr); | ||
431 | octeon_fdt_set_mac_addr(eth, pmac); | ||
432 | } | ||
433 | |||
434 | static void __init octeon_fdt_pip_iface(int pip, int idx, u64 *pmac) | ||
435 | { | ||
436 | char name_buffer[20]; | ||
437 | int iface; | ||
438 | int p; | ||
439 | int count; | ||
440 | |||
441 | count = cvmx_helper_interface_enumerate(idx); | ||
442 | |||
443 | snprintf(name_buffer, sizeof(name_buffer), "interface@%d", idx); | ||
444 | iface = fdt_subnode_offset(initial_boot_params, pip, name_buffer); | ||
445 | if (iface < 0) | ||
446 | return; | ||
447 | |||
448 | for (p = 0; p < 16; p++) | ||
449 | octeon_fdt_pip_port(iface, idx, p, count - 1, pmac); | ||
450 | } | ||
451 | |||
452 | int __init octeon_prune_device_tree(void) | ||
453 | { | ||
454 | int i, max_port, uart_mask; | ||
455 | const char *pip_path; | ||
456 | const char *alias_prop; | ||
457 | char name_buffer[20]; | ||
458 | int aliases; | ||
459 | u64 mac_addr_base; | ||
460 | |||
461 | if (fdt_check_header(initial_boot_params)) | ||
462 | panic("Corrupt Device Tree."); | ||
463 | |||
464 | aliases = fdt_path_offset(initial_boot_params, "/aliases"); | ||
465 | if (aliases < 0) { | ||
466 | pr_err("Error: No /aliases node in device tree."); | ||
467 | return -EINVAL; | ||
468 | } | ||
469 | |||
470 | |||
471 | mac_addr_base = | ||
472 | ((octeon_bootinfo->mac_addr_base[0] & 0xffull)) << 40 | | ||
473 | ((octeon_bootinfo->mac_addr_base[1] & 0xffull)) << 32 | | ||
474 | ((octeon_bootinfo->mac_addr_base[2] & 0xffull)) << 24 | | ||
475 | ((octeon_bootinfo->mac_addr_base[3] & 0xffull)) << 16 | | ||
476 | ((octeon_bootinfo->mac_addr_base[4] & 0xffull)) << 8 | | ||
477 | (octeon_bootinfo->mac_addr_base[5] & 0xffull); | ||
478 | |||
479 | if (OCTEON_IS_MODEL(OCTEON_CN52XX) || OCTEON_IS_MODEL(OCTEON_CN63XX)) | ||
480 | max_port = 2; | ||
481 | else if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN68XX)) | ||
482 | max_port = 1; | ||
483 | else | ||
484 | max_port = 0; | ||
485 | |||
486 | if (octeon_bootinfo->board_type == CVMX_BOARD_TYPE_NIC10E) | ||
487 | max_port = 0; | ||
488 | |||
489 | for (i = 0; i < 2; i++) { | ||
490 | int mgmt; | ||
491 | snprintf(name_buffer, sizeof(name_buffer), | ||
492 | "mix%d", i); | ||
493 | alias_prop = fdt_getprop(initial_boot_params, aliases, | ||
494 | name_buffer, NULL); | ||
495 | if (alias_prop) { | ||
496 | mgmt = fdt_path_offset(initial_boot_params, alias_prop); | ||
497 | if (mgmt < 0) | ||
498 | continue; | ||
499 | if (i >= max_port) { | ||
500 | pr_debug("Deleting mix%d\n", i); | ||
501 | octeon_fdt_rm_ethernet(mgmt); | ||
502 | fdt_nop_property(initial_boot_params, aliases, | ||
503 | name_buffer); | ||
504 | } else { | ||
505 | int phy_addr = cvmx_helper_board_get_mii_address(CVMX_HELPER_BOARD_MGMT_IPD_PORT + i); | ||
506 | octeon_fdt_set_phy(mgmt, phy_addr); | ||
507 | octeon_fdt_set_mac_addr(mgmt, &mac_addr_base); | ||
508 | } | ||
509 | } | ||
510 | } | ||
511 | |||
512 | pip_path = fdt_getprop(initial_boot_params, aliases, "pip", NULL); | ||
513 | if (pip_path) { | ||
514 | int pip = fdt_path_offset(initial_boot_params, pip_path); | ||
515 | if (pip >= 0) | ||
516 | for (i = 0; i <= 4; i++) | ||
517 | octeon_fdt_pip_iface(pip, i, &mac_addr_base); | ||
518 | } | ||
519 | |||
520 | /* I2C */ | ||
521 | if (OCTEON_IS_MODEL(OCTEON_CN52XX) || | ||
522 | OCTEON_IS_MODEL(OCTEON_CN63XX) || | ||
523 | OCTEON_IS_MODEL(OCTEON_CN68XX) || | ||
524 | OCTEON_IS_MODEL(OCTEON_CN56XX)) | ||
525 | max_port = 2; | ||
526 | else | ||
527 | max_port = 1; | ||
528 | |||
529 | for (i = 0; i < 2; i++) { | ||
530 | int i2c; | ||
531 | snprintf(name_buffer, sizeof(name_buffer), | ||
532 | "twsi%d", i); | ||
533 | alias_prop = fdt_getprop(initial_boot_params, aliases, | ||
534 | name_buffer, NULL); | ||
535 | |||
536 | if (alias_prop) { | ||
537 | i2c = fdt_path_offset(initial_boot_params, alias_prop); | ||
538 | if (i2c < 0) | ||
539 | continue; | ||
540 | if (i >= max_port) { | ||
541 | pr_debug("Deleting twsi%d\n", i); | ||
542 | fdt_nop_node(initial_boot_params, i2c); | ||
543 | fdt_nop_property(initial_boot_params, aliases, | ||
544 | name_buffer); | ||
545 | } | ||
546 | } | ||
547 | } | ||
548 | |||
549 | /* SMI/MDIO */ | ||
550 | if (OCTEON_IS_MODEL(OCTEON_CN68XX)) | ||
551 | max_port = 4; | ||
552 | else if (OCTEON_IS_MODEL(OCTEON_CN52XX) || | ||
553 | OCTEON_IS_MODEL(OCTEON_CN63XX) || | ||
554 | OCTEON_IS_MODEL(OCTEON_CN56XX)) | ||
555 | max_port = 2; | ||
556 | else | ||
557 | max_port = 1; | ||
558 | |||
559 | for (i = 0; i < 2; i++) { | ||
560 | int i2c; | ||
561 | snprintf(name_buffer, sizeof(name_buffer), | ||
562 | "smi%d", i); | ||
563 | alias_prop = fdt_getprop(initial_boot_params, aliases, | ||
564 | name_buffer, NULL); | ||
565 | |||
566 | if (alias_prop) { | ||
567 | i2c = fdt_path_offset(initial_boot_params, alias_prop); | ||
568 | if (i2c < 0) | ||
569 | continue; | ||
570 | if (i >= max_port) { | ||
571 | pr_debug("Deleting smi%d\n", i); | ||
572 | fdt_nop_node(initial_boot_params, i2c); | ||
573 | fdt_nop_property(initial_boot_params, aliases, | ||
574 | name_buffer); | ||
575 | } | ||
576 | } | ||
577 | } | ||
578 | |||
579 | /* Serial */ | ||
580 | uart_mask = 3; | ||
581 | |||
582 | /* Right now CN52XX is the only chip with a third uart */ | ||
583 | if (OCTEON_IS_MODEL(OCTEON_CN52XX)) | ||
584 | uart_mask |= 4; /* uart2 */ | ||
585 | |||
586 | for (i = 0; i < 3; i++) { | ||
587 | int uart; | ||
588 | snprintf(name_buffer, sizeof(name_buffer), | ||
589 | "uart%d", i); | ||
590 | alias_prop = fdt_getprop(initial_boot_params, aliases, | ||
591 | name_buffer, NULL); | ||
592 | |||
593 | if (alias_prop) { | ||
594 | uart = fdt_path_offset(initial_boot_params, alias_prop); | ||
595 | if (uart_mask & (1 << i)) | ||
596 | continue; | ||
597 | pr_debug("Deleting uart%d\n", i); | ||
598 | fdt_nop_node(initial_boot_params, uart); | ||
599 | fdt_nop_property(initial_boot_params, aliases, | ||
600 | name_buffer); | ||
601 | } | ||
602 | } | ||
603 | |||
604 | /* Compact Flash */ | ||
605 | alias_prop = fdt_getprop(initial_boot_params, aliases, | ||
606 | "cf0", NULL); | ||
607 | if (alias_prop) { | ||
608 | union cvmx_mio_boot_reg_cfgx mio_boot_reg_cfg; | ||
609 | unsigned long base_ptr, region_base, region_size; | ||
610 | unsigned long region1_base = 0; | ||
611 | unsigned long region1_size = 0; | ||
612 | int cs, bootbus; | ||
613 | bool is_16bit = false; | ||
614 | bool is_true_ide = false; | ||
615 | __be32 new_reg[6]; | ||
616 | __be32 *ranges; | ||
617 | int len; | ||
618 | |||
619 | int cf = fdt_path_offset(initial_boot_params, alias_prop); | ||
620 | base_ptr = 0; | ||
621 | if (octeon_bootinfo->major_version == 1 | ||
622 | && octeon_bootinfo->minor_version >= 1) { | ||
623 | if (octeon_bootinfo->compact_flash_common_base_addr) | ||
624 | base_ptr = octeon_bootinfo->compact_flash_common_base_addr; | ||
625 | } else { | ||
626 | base_ptr = 0x1d000800; | ||
627 | } | ||
628 | |||
629 | if (!base_ptr) | ||
630 | goto no_cf; | ||
631 | |||
632 | /* Find CS0 region. */ | ||
633 | for (cs = 0; cs < 8; cs++) { | ||
634 | mio_boot_reg_cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(cs)); | ||
635 | region_base = mio_boot_reg_cfg.s.base << 16; | ||
636 | region_size = (mio_boot_reg_cfg.s.size + 1) << 16; | ||
637 | if (mio_boot_reg_cfg.s.en && base_ptr >= region_base | ||
638 | && base_ptr < region_base + region_size) { | ||
639 | is_16bit = mio_boot_reg_cfg.s.width; | ||
640 | break; | ||
641 | } | ||
642 | } | ||
643 | if (cs >= 7) { | ||
644 | /* cs and cs + 1 are CS0 and CS1, both must be less than 8. */ | ||
645 | goto no_cf; | ||
646 | } | ||
647 | |||
648 | if (!(base_ptr & 0xfffful)) { | ||
649 | /* | ||
650 | * Boot loader signals availability of DMA (true_ide | ||
651 | * mode) by setting low order bits of base_ptr to | ||
652 | * zero. | ||
653 | */ | ||
654 | |||
655 | /* Asume that CS1 immediately follows. */ | ||
656 | mio_boot_reg_cfg.u64 = | ||
657 | cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(cs + 1)); | ||
658 | region1_base = mio_boot_reg_cfg.s.base << 16; | ||
659 | region1_size = (mio_boot_reg_cfg.s.size + 1) << 16; | ||
660 | if (!mio_boot_reg_cfg.s.en) | ||
661 | goto no_cf; | ||
662 | is_true_ide = true; | ||
663 | |||
664 | } else { | ||
665 | fdt_nop_property(initial_boot_params, cf, "cavium,true-ide"); | ||
666 | fdt_nop_property(initial_boot_params, cf, "cavium,dma-engine-handle"); | ||
667 | if (!is_16bit) { | ||
668 | __be32 width = cpu_to_be32(8); | ||
669 | fdt_setprop_inplace(initial_boot_params, cf, | ||
670 | "cavium,bus-width", &width, sizeof(width)); | ||
671 | } | ||
672 | } | ||
673 | new_reg[0] = cpu_to_be32(cs); | ||
674 | new_reg[1] = cpu_to_be32(0); | ||
675 | new_reg[2] = cpu_to_be32(0x10000); | ||
676 | new_reg[3] = cpu_to_be32(cs + 1); | ||
677 | new_reg[4] = cpu_to_be32(0); | ||
678 | new_reg[5] = cpu_to_be32(0x10000); | ||
679 | fdt_setprop_inplace(initial_boot_params, cf, | ||
680 | "reg", new_reg, sizeof(new_reg)); | ||
681 | |||
682 | bootbus = fdt_parent_offset(initial_boot_params, cf); | ||
683 | if (bootbus < 0) | ||
684 | goto no_cf; | ||
685 | ranges = fdt_getprop_w(initial_boot_params, bootbus, "ranges", &len); | ||
686 | if (!ranges || len < (5 * 8 * sizeof(__be32))) | ||
687 | goto no_cf; | ||
688 | |||
689 | ranges[(cs * 5) + 2] = cpu_to_be32(region_base >> 32); | ||
690 | ranges[(cs * 5) + 3] = cpu_to_be32(region_base & 0xffffffff); | ||
691 | ranges[(cs * 5) + 4] = cpu_to_be32(region_size); | ||
692 | if (is_true_ide) { | ||
693 | cs++; | ||
694 | ranges[(cs * 5) + 2] = cpu_to_be32(region1_base >> 32); | ||
695 | ranges[(cs * 5) + 3] = cpu_to_be32(region1_base & 0xffffffff); | ||
696 | ranges[(cs * 5) + 4] = cpu_to_be32(region1_size); | ||
697 | } | ||
698 | goto end_cf; | ||
699 | no_cf: | ||
700 | fdt_nop_node(initial_boot_params, cf); | ||
701 | |||
702 | end_cf: | ||
703 | ; | ||
704 | } | ||
705 | |||
706 | /* 8 char LED */ | ||
707 | alias_prop = fdt_getprop(initial_boot_params, aliases, | ||
708 | "led0", NULL); | ||
709 | if (alias_prop) { | ||
710 | union cvmx_mio_boot_reg_cfgx mio_boot_reg_cfg; | ||
711 | unsigned long base_ptr, region_base, region_size; | ||
712 | int cs, bootbus; | ||
713 | __be32 new_reg[6]; | ||
714 | __be32 *ranges; | ||
715 | int len; | ||
716 | int led = fdt_path_offset(initial_boot_params, alias_prop); | ||
717 | |||
718 | base_ptr = octeon_bootinfo->led_display_base_addr; | ||
719 | if (base_ptr == 0) | ||
720 | goto no_led; | ||
721 | /* Find CS0 region. */ | ||
722 | for (cs = 0; cs < 8; cs++) { | ||
723 | mio_boot_reg_cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(cs)); | ||
724 | region_base = mio_boot_reg_cfg.s.base << 16; | ||
725 | region_size = (mio_boot_reg_cfg.s.size + 1) << 16; | ||
726 | if (mio_boot_reg_cfg.s.en && base_ptr >= region_base | ||
727 | && base_ptr < region_base + region_size) | ||
728 | break; | ||
729 | } | ||
730 | |||
731 | if (cs > 7) | ||
732 | goto no_led; | ||
733 | |||
734 | new_reg[0] = cpu_to_be32(cs); | ||
735 | new_reg[1] = cpu_to_be32(0x20); | ||
736 | new_reg[2] = cpu_to_be32(0x20); | ||
737 | new_reg[3] = cpu_to_be32(cs); | ||
738 | new_reg[4] = cpu_to_be32(0); | ||
739 | new_reg[5] = cpu_to_be32(0x20); | ||
740 | fdt_setprop_inplace(initial_boot_params, led, | ||
741 | "reg", new_reg, sizeof(new_reg)); | ||
742 | |||
743 | bootbus = fdt_parent_offset(initial_boot_params, led); | ||
744 | if (bootbus < 0) | ||
745 | goto no_led; | ||
746 | ranges = fdt_getprop_w(initial_boot_params, bootbus, "ranges", &len); | ||
747 | if (!ranges || len < (5 * 8 * sizeof(__be32))) | ||
748 | goto no_led; | ||
749 | |||
750 | ranges[(cs * 5) + 2] = cpu_to_be32(region_base >> 32); | ||
751 | ranges[(cs * 5) + 3] = cpu_to_be32(region_base & 0xffffffff); | ||
752 | ranges[(cs * 5) + 4] = cpu_to_be32(region_size); | ||
753 | goto end_led; | ||
754 | |||
755 | no_led: | ||
756 | fdt_nop_node(initial_boot_params, led); | ||
757 | end_led: | ||
758 | ; | ||
759 | } | ||
760 | |||
761 | /* OHCI/UHCI USB */ | ||
762 | alias_prop = fdt_getprop(initial_boot_params, aliases, | ||
763 | "uctl", NULL); | ||
764 | if (alias_prop) { | ||
765 | int uctl = fdt_path_offset(initial_boot_params, alias_prop); | ||
766 | |||
767 | if (uctl >= 0 && (!OCTEON_IS_MODEL(OCTEON_CN6XXX) || | ||
768 | octeon_bootinfo->board_type == CVMX_BOARD_TYPE_NIC2E)) { | ||
769 | pr_debug("Deleting uctl\n"); | ||
770 | fdt_nop_node(initial_boot_params, uctl); | ||
771 | fdt_nop_property(initial_boot_params, aliases, "uctl"); | ||
772 | } else if (octeon_bootinfo->board_type == CVMX_BOARD_TYPE_NIC10E || | ||
773 | octeon_bootinfo->board_type == CVMX_BOARD_TYPE_NIC4E) { | ||
774 | /* Missing "refclk-type" defaults to crystal. */ | ||
775 | fdt_nop_property(initial_boot_params, uctl, "refclk-type"); | ||
776 | } | ||
777 | } | ||
778 | |||
779 | return 0; | ||
780 | } | ||
781 | |||
782 | static int __init octeon_publish_devices(void) | ||
783 | { | ||
784 | return of_platform_bus_probe(NULL, octeon_ids, NULL); | ||
785 | } | ||
786 | device_initcall(octeon_publish_devices); | ||
787 | |||
443 | MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>"); | 788 | MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>"); |
444 | MODULE_LICENSE("GPL"); | 789 | MODULE_LICENSE("GPL"); |
445 | MODULE_DESCRIPTION("Platform driver for Octeon SOC"); | 790 | MODULE_DESCRIPTION("Platform driver for Octeon SOC"); |
diff --git a/arch/mips/cavium-octeon/octeon_3xxx.dts b/arch/mips/cavium-octeon/octeon_3xxx.dts new file mode 100644 index 000000000000..f28b2d0fde22 --- /dev/null +++ b/arch/mips/cavium-octeon/octeon_3xxx.dts | |||
@@ -0,0 +1,571 @@ | |||
1 | /dts-v1/; | ||
2 | /* | ||
3 | * OCTEON 3XXX, 5XXX, 63XX device tree skeleton. | ||
4 | * | ||
5 | * This device tree is pruned and patched by early boot code before | ||
6 | * use. Because of this, it contains a super-set of the available | ||
7 | * devices and properties. | ||
8 | */ | ||
9 | / { | ||
10 | compatible = "cavium,octeon-3860"; | ||
11 | #address-cells = <2>; | ||
12 | #size-cells = <2>; | ||
13 | interrupt-parent = <&ciu>; | ||
14 | |||
15 | soc@0 { | ||
16 | compatible = "simple-bus"; | ||
17 | #address-cells = <2>; | ||
18 | #size-cells = <2>; | ||
19 | ranges; /* Direct mapping */ | ||
20 | |||
21 | ciu: interrupt-controller@1070000000000 { | ||
22 | compatible = "cavium,octeon-3860-ciu"; | ||
23 | interrupt-controller; | ||
24 | /* Interrupts are specified by two parts: | ||
25 | * 1) Controller register (0 or 1) | ||
26 | * 2) Bit within the register (0..63) | ||
27 | */ | ||
28 | #interrupt-cells = <2>; | ||
29 | reg = <0x10700 0x00000000 0x0 0x7000>; | ||
30 | }; | ||
31 | |||
32 | gpio: gpio-controller@1070000000800 { | ||
33 | #gpio-cells = <2>; | ||
34 | compatible = "cavium,octeon-3860-gpio"; | ||
35 | reg = <0x10700 0x00000800 0x0 0x100>; | ||
36 | gpio-controller; | ||
37 | /* Interrupts are specified by two parts: | ||
38 | * 1) GPIO pin number (0..15) | ||
39 | * 2) Triggering (1 - edge rising | ||
40 | * 2 - edge falling | ||
41 | * 4 - level active high | ||
42 | * 8 - level active low) | ||
43 | */ | ||
44 | interrupt-controller; | ||
45 | #interrupt-cells = <2>; | ||
46 | /* The GPIO pin connect to 16 consecutive CUI bits */ | ||
47 | interrupts = <0 16>, <0 17>, <0 18>, <0 19>, | ||
48 | <0 20>, <0 21>, <0 22>, <0 23>, | ||
49 | <0 24>, <0 25>, <0 26>, <0 27>, | ||
50 | <0 28>, <0 29>, <0 30>, <0 31>; | ||
51 | }; | ||
52 | |||
53 | smi0: mdio@1180000001800 { | ||
54 | compatible = "cavium,octeon-3860-mdio"; | ||
55 | #address-cells = <1>; | ||
56 | #size-cells = <0>; | ||
57 | reg = <0x11800 0x00001800 0x0 0x40>; | ||
58 | |||
59 | phy0: ethernet-phy@0 { | ||
60 | compatible = "marvell,88e1118"; | ||
61 | marvell,reg-init = | ||
62 | /* Fix rx and tx clock transition timing */ | ||
63 | <2 0x15 0xffcf 0>, /* Reg 2,21 Clear bits 4, 5 */ | ||
64 | /* Adjust LED drive. */ | ||
65 | <3 0x11 0 0x442a>, /* Reg 3,17 <- 0442a */ | ||
66 | /* irq, blink-activity, blink-link */ | ||
67 | <3 0x10 0 0x0242>; /* Reg 3,16 <- 0x0242 */ | ||
68 | reg = <0>; | ||
69 | }; | ||
70 | |||
71 | phy1: ethernet-phy@1 { | ||
72 | compatible = "marvell,88e1118"; | ||
73 | marvell,reg-init = | ||
74 | /* Fix rx and tx clock transition timing */ | ||
75 | <2 0x15 0xffcf 0>, /* Reg 2,21 Clear bits 4, 5 */ | ||
76 | /* Adjust LED drive. */ | ||
77 | <3 0x11 0 0x442a>, /* Reg 3,17 <- 0442a */ | ||
78 | /* irq, blink-activity, blink-link */ | ||
79 | <3 0x10 0 0x0242>; /* Reg 3,16 <- 0x0242 */ | ||
80 | reg = <1>; | ||
81 | }; | ||
82 | |||
83 | phy2: ethernet-phy@2 { | ||
84 | reg = <2>; | ||
85 | compatible = "marvell,88e1149r"; | ||
86 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
87 | <3 0x11 0 0x00aa>, | ||
88 | <3 0x12 0 0x4105>, | ||
89 | <3 0x13 0 0x0a60>; | ||
90 | }; | ||
91 | phy3: ethernet-phy@3 { | ||
92 | reg = <3>; | ||
93 | compatible = "marvell,88e1149r"; | ||
94 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
95 | <3 0x11 0 0x00aa>, | ||
96 | <3 0x12 0 0x4105>, | ||
97 | <3 0x13 0 0x0a60>; | ||
98 | }; | ||
99 | phy4: ethernet-phy@4 { | ||
100 | reg = <4>; | ||
101 | compatible = "marvell,88e1149r"; | ||
102 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
103 | <3 0x11 0 0x00aa>, | ||
104 | <3 0x12 0 0x4105>, | ||
105 | <3 0x13 0 0x0a60>; | ||
106 | }; | ||
107 | phy5: ethernet-phy@5 { | ||
108 | reg = <5>; | ||
109 | compatible = "marvell,88e1149r"; | ||
110 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
111 | <3 0x11 0 0x00aa>, | ||
112 | <3 0x12 0 0x4105>, | ||
113 | <3 0x13 0 0x0a60>; | ||
114 | }; | ||
115 | |||
116 | phy6: ethernet-phy@6 { | ||
117 | reg = <6>; | ||
118 | compatible = "marvell,88e1149r"; | ||
119 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
120 | <3 0x11 0 0x00aa>, | ||
121 | <3 0x12 0 0x4105>, | ||
122 | <3 0x13 0 0x0a60>; | ||
123 | }; | ||
124 | phy7: ethernet-phy@7 { | ||
125 | reg = <7>; | ||
126 | compatible = "marvell,88e1149r"; | ||
127 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
128 | <3 0x11 0 0x00aa>, | ||
129 | <3 0x12 0 0x4105>, | ||
130 | <3 0x13 0 0x0a60>; | ||
131 | }; | ||
132 | phy8: ethernet-phy@8 { | ||
133 | reg = <8>; | ||
134 | compatible = "marvell,88e1149r"; | ||
135 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
136 | <3 0x11 0 0x00aa>, | ||
137 | <3 0x12 0 0x4105>, | ||
138 | <3 0x13 0 0x0a60>; | ||
139 | }; | ||
140 | phy9: ethernet-phy@9 { | ||
141 | reg = <9>; | ||
142 | compatible = "marvell,88e1149r"; | ||
143 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
144 | <3 0x11 0 0x00aa>, | ||
145 | <3 0x12 0 0x4105>, | ||
146 | <3 0x13 0 0x0a60>; | ||
147 | }; | ||
148 | }; | ||
149 | |||
150 | smi1: mdio@1180000001900 { | ||
151 | compatible = "cavium,octeon-3860-mdio"; | ||
152 | #address-cells = <1>; | ||
153 | #size-cells = <0>; | ||
154 | reg = <0x11800 0x00001900 0x0 0x40>; | ||
155 | |||
156 | phy100: ethernet-phy@1 { | ||
157 | reg = <1>; | ||
158 | compatible = "marvell,88e1149r"; | ||
159 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
160 | <3 0x11 0 0x00aa>, | ||
161 | <3 0x12 0 0x4105>, | ||
162 | <3 0x13 0 0x0a60>; | ||
163 | interrupt-parent = <&gpio>; | ||
164 | interrupts = <12 8>; /* Pin 12, active low */ | ||
165 | }; | ||
166 | phy101: ethernet-phy@2 { | ||
167 | reg = <2>; | ||
168 | compatible = "marvell,88e1149r"; | ||
169 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
170 | <3 0x11 0 0x00aa>, | ||
171 | <3 0x12 0 0x4105>, | ||
172 | <3 0x13 0 0x0a60>; | ||
173 | interrupt-parent = <&gpio>; | ||
174 | interrupts = <12 8>; /* Pin 12, active low */ | ||
175 | }; | ||
176 | phy102: ethernet-phy@3 { | ||
177 | reg = <3>; | ||
178 | compatible = "marvell,88e1149r"; | ||
179 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
180 | <3 0x11 0 0x00aa>, | ||
181 | <3 0x12 0 0x4105>, | ||
182 | <3 0x13 0 0x0a60>; | ||
183 | interrupt-parent = <&gpio>; | ||
184 | interrupts = <12 8>; /* Pin 12, active low */ | ||
185 | }; | ||
186 | phy103: ethernet-phy@4 { | ||
187 | reg = <4>; | ||
188 | compatible = "marvell,88e1149r"; | ||
189 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
190 | <3 0x11 0 0x00aa>, | ||
191 | <3 0x12 0 0x4105>, | ||
192 | <3 0x13 0 0x0a60>; | ||
193 | interrupt-parent = <&gpio>; | ||
194 | interrupts = <12 8>; /* Pin 12, active low */ | ||
195 | }; | ||
196 | }; | ||
197 | |||
198 | mix0: ethernet@1070000100000 { | ||
199 | compatible = "cavium,octeon-5750-mix"; | ||
200 | reg = <0x10700 0x00100000 0x0 0x100>, /* MIX */ | ||
201 | <0x11800 0xE0000000 0x0 0x300>, /* AGL */ | ||
202 | <0x11800 0xE0000400 0x0 0x400>, /* AGL_SHARED */ | ||
203 | <0x11800 0xE0002000 0x0 0x8>; /* AGL_PRT_CTL */ | ||
204 | cell-index = <0>; | ||
205 | interrupts = <0 62>, <1 46>; | ||
206 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
207 | phy-handle = <&phy0>; | ||
208 | }; | ||
209 | |||
210 | mix1: ethernet@1070000100800 { | ||
211 | compatible = "cavium,octeon-5750-mix"; | ||
212 | reg = <0x10700 0x00100800 0x0 0x100>, /* MIX */ | ||
213 | <0x11800 0xE0000800 0x0 0x300>, /* AGL */ | ||
214 | <0x11800 0xE0000400 0x0 0x400>, /* AGL_SHARED */ | ||
215 | <0x11800 0xE0002008 0x0 0x8>; /* AGL_PRT_CTL */ | ||
216 | cell-index = <1>; | ||
217 | interrupts = <1 18>, < 1 46>; | ||
218 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
219 | phy-handle = <&phy1>; | ||
220 | }; | ||
221 | |||
222 | pip: pip@11800a0000000 { | ||
223 | compatible = "cavium,octeon-3860-pip"; | ||
224 | #address-cells = <1>; | ||
225 | #size-cells = <0>; | ||
226 | reg = <0x11800 0xa0000000 0x0 0x2000>; | ||
227 | |||
228 | interface@0 { | ||
229 | compatible = "cavium,octeon-3860-pip-interface"; | ||
230 | #address-cells = <1>; | ||
231 | #size-cells = <0>; | ||
232 | reg = <0>; /* interface */ | ||
233 | |||
234 | ethernet@0 { | ||
235 | compatible = "cavium,octeon-3860-pip-port"; | ||
236 | reg = <0x0>; /* Port */ | ||
237 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
238 | phy-handle = <&phy2>; | ||
239 | cavium,alt-phy-handle = <&phy100>; | ||
240 | }; | ||
241 | ethernet@1 { | ||
242 | compatible = "cavium,octeon-3860-pip-port"; | ||
243 | reg = <0x1>; /* Port */ | ||
244 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
245 | phy-handle = <&phy3>; | ||
246 | cavium,alt-phy-handle = <&phy101>; | ||
247 | }; | ||
248 | ethernet@2 { | ||
249 | compatible = "cavium,octeon-3860-pip-port"; | ||
250 | reg = <0x2>; /* Port */ | ||
251 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
252 | phy-handle = <&phy4>; | ||
253 | cavium,alt-phy-handle = <&phy102>; | ||
254 | }; | ||
255 | ethernet@3 { | ||
256 | compatible = "cavium,octeon-3860-pip-port"; | ||
257 | reg = <0x3>; /* Port */ | ||
258 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
259 | phy-handle = <&phy5>; | ||
260 | cavium,alt-phy-handle = <&phy103>; | ||
261 | }; | ||
262 | ethernet@4 { | ||
263 | compatible = "cavium,octeon-3860-pip-port"; | ||
264 | reg = <0x4>; /* Port */ | ||
265 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
266 | }; | ||
267 | ethernet@5 { | ||
268 | compatible = "cavium,octeon-3860-pip-port"; | ||
269 | reg = <0x5>; /* Port */ | ||
270 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
271 | }; | ||
272 | ethernet@6 { | ||
273 | compatible = "cavium,octeon-3860-pip-port"; | ||
274 | reg = <0x6>; /* Port */ | ||
275 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
276 | }; | ||
277 | ethernet@7 { | ||
278 | compatible = "cavium,octeon-3860-pip-port"; | ||
279 | reg = <0x7>; /* Port */ | ||
280 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
281 | }; | ||
282 | ethernet@8 { | ||
283 | compatible = "cavium,octeon-3860-pip-port"; | ||
284 | reg = <0x8>; /* Port */ | ||
285 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
286 | }; | ||
287 | ethernet@9 { | ||
288 | compatible = "cavium,octeon-3860-pip-port"; | ||
289 | reg = <0x9>; /* Port */ | ||
290 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
291 | }; | ||
292 | ethernet@a { | ||
293 | compatible = "cavium,octeon-3860-pip-port"; | ||
294 | reg = <0xa>; /* Port */ | ||
295 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
296 | }; | ||
297 | ethernet@b { | ||
298 | compatible = "cavium,octeon-3860-pip-port"; | ||
299 | reg = <0xb>; /* Port */ | ||
300 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
301 | }; | ||
302 | ethernet@c { | ||
303 | compatible = "cavium,octeon-3860-pip-port"; | ||
304 | reg = <0xc>; /* Port */ | ||
305 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
306 | }; | ||
307 | ethernet@d { | ||
308 | compatible = "cavium,octeon-3860-pip-port"; | ||
309 | reg = <0xd>; /* Port */ | ||
310 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
311 | }; | ||
312 | ethernet@e { | ||
313 | compatible = "cavium,octeon-3860-pip-port"; | ||
314 | reg = <0xe>; /* Port */ | ||
315 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
316 | }; | ||
317 | ethernet@f { | ||
318 | compatible = "cavium,octeon-3860-pip-port"; | ||
319 | reg = <0xf>; /* Port */ | ||
320 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
321 | }; | ||
322 | }; | ||
323 | |||
324 | interface@1 { | ||
325 | compatible = "cavium,octeon-3860-pip-interface"; | ||
326 | #address-cells = <1>; | ||
327 | #size-cells = <0>; | ||
328 | reg = <1>; /* interface */ | ||
329 | |||
330 | ethernet@0 { | ||
331 | compatible = "cavium,octeon-3860-pip-port"; | ||
332 | reg = <0x0>; /* Port */ | ||
333 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
334 | phy-handle = <&phy6>; | ||
335 | }; | ||
336 | ethernet@1 { | ||
337 | compatible = "cavium,octeon-3860-pip-port"; | ||
338 | reg = <0x1>; /* Port */ | ||
339 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
340 | phy-handle = <&phy7>; | ||
341 | }; | ||
342 | ethernet@2 { | ||
343 | compatible = "cavium,octeon-3860-pip-port"; | ||
344 | reg = <0x2>; /* Port */ | ||
345 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
346 | phy-handle = <&phy8>; | ||
347 | }; | ||
348 | ethernet@3 { | ||
349 | compatible = "cavium,octeon-3860-pip-port"; | ||
350 | reg = <0x3>; /* Port */ | ||
351 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
352 | phy-handle = <&phy9>; | ||
353 | }; | ||
354 | }; | ||
355 | }; | ||
356 | |||
357 | twsi0: i2c@1180000001000 { | ||
358 | #address-cells = <1>; | ||
359 | #size-cells = <0>; | ||
360 | compatible = "cavium,octeon-3860-twsi"; | ||
361 | reg = <0x11800 0x00001000 0x0 0x200>; | ||
362 | interrupts = <0 45>; | ||
363 | clock-frequency = <100000>; | ||
364 | |||
365 | rtc@68 { | ||
366 | compatible = "dallas,ds1337"; | ||
367 | reg = <0x68>; | ||
368 | }; | ||
369 | tmp@4c { | ||
370 | compatible = "ti,tmp421"; | ||
371 | reg = <0x4c>; | ||
372 | }; | ||
373 | }; | ||
374 | |||
375 | twsi1: i2c@1180000001200 { | ||
376 | #address-cells = <1>; | ||
377 | #size-cells = <0>; | ||
378 | compatible = "cavium,octeon-3860-twsi"; | ||
379 | reg = <0x11800 0x00001200 0x0 0x200>; | ||
380 | interrupts = <0 59>; | ||
381 | clock-frequency = <100000>; | ||
382 | }; | ||
383 | |||
384 | uart0: serial@1180000000800 { | ||
385 | compatible = "cavium,octeon-3860-uart","ns16550"; | ||
386 | reg = <0x11800 0x00000800 0x0 0x400>; | ||
387 | clock-frequency = <0>; | ||
388 | current-speed = <115200>; | ||
389 | reg-shift = <3>; | ||
390 | interrupts = <0 34>; | ||
391 | }; | ||
392 | |||
393 | uart1: serial@1180000000c00 { | ||
394 | compatible = "cavium,octeon-3860-uart","ns16550"; | ||
395 | reg = <0x11800 0x00000c00 0x0 0x400>; | ||
396 | clock-frequency = <0>; | ||
397 | current-speed = <115200>; | ||
398 | reg-shift = <3>; | ||
399 | interrupts = <0 35>; | ||
400 | }; | ||
401 | |||
402 | uart2: serial@1180000000400 { | ||
403 | compatible = "cavium,octeon-3860-uart","ns16550"; | ||
404 | reg = <0x11800 0x00000400 0x0 0x400>; | ||
405 | clock-frequency = <0>; | ||
406 | current-speed = <115200>; | ||
407 | reg-shift = <3>; | ||
408 | interrupts = <1 16>; | ||
409 | }; | ||
410 | |||
411 | bootbus: bootbus@1180000000000 { | ||
412 | compatible = "cavium,octeon-3860-bootbus"; | ||
413 | reg = <0x11800 0x00000000 0x0 0x200>; | ||
414 | /* The chip select number and offset */ | ||
415 | #address-cells = <2>; | ||
416 | /* The size of the chip select region */ | ||
417 | #size-cells = <1>; | ||
418 | ranges = <0 0 0x0 0x1f400000 0xc00000>, | ||
419 | <1 0 0x10000 0x30000000 0>, | ||
420 | <2 0 0x10000 0x40000000 0>, | ||
421 | <3 0 0x10000 0x50000000 0>, | ||
422 | <4 0 0x0 0x1d020000 0x10000>, | ||
423 | <5 0 0x0 0x1d040000 0x10000>, | ||
424 | <6 0 0x0 0x1d050000 0x10000>, | ||
425 | <7 0 0x10000 0x90000000 0>; | ||
426 | |||
427 | cavium,cs-config@0 { | ||
428 | compatible = "cavium,octeon-3860-bootbus-config"; | ||
429 | cavium,cs-index = <0>; | ||
430 | cavium,t-adr = <20>; | ||
431 | cavium,t-ce = <60>; | ||
432 | cavium,t-oe = <60>; | ||
433 | cavium,t-we = <45>; | ||
434 | cavium,t-rd-hld = <35>; | ||
435 | cavium,t-wr-hld = <45>; | ||
436 | cavium,t-pause = <0>; | ||
437 | cavium,t-wait = <0>; | ||
438 | cavium,t-page = <35>; | ||
439 | cavium,t-rd-dly = <0>; | ||
440 | |||
441 | cavium,pages = <0>; | ||
442 | cavium,bus-width = <8>; | ||
443 | }; | ||
444 | cavium,cs-config@4 { | ||
445 | compatible = "cavium,octeon-3860-bootbus-config"; | ||
446 | cavium,cs-index = <4>; | ||
447 | cavium,t-adr = <320>; | ||
448 | cavium,t-ce = <320>; | ||
449 | cavium,t-oe = <320>; | ||
450 | cavium,t-we = <320>; | ||
451 | cavium,t-rd-hld = <320>; | ||
452 | cavium,t-wr-hld = <320>; | ||
453 | cavium,t-pause = <320>; | ||
454 | cavium,t-wait = <320>; | ||
455 | cavium,t-page = <320>; | ||
456 | cavium,t-rd-dly = <0>; | ||
457 | |||
458 | cavium,pages = <0>; | ||
459 | cavium,bus-width = <8>; | ||
460 | }; | ||
461 | cavium,cs-config@5 { | ||
462 | compatible = "cavium,octeon-3860-bootbus-config"; | ||
463 | cavium,cs-index = <5>; | ||
464 | cavium,t-adr = <5>; | ||
465 | cavium,t-ce = <300>; | ||
466 | cavium,t-oe = <125>; | ||
467 | cavium,t-we = <150>; | ||
468 | cavium,t-rd-hld = <100>; | ||
469 | cavium,t-wr-hld = <30>; | ||
470 | cavium,t-pause = <0>; | ||
471 | cavium,t-wait = <30>; | ||
472 | cavium,t-page = <320>; | ||
473 | cavium,t-rd-dly = <0>; | ||
474 | |||
475 | cavium,pages = <0>; | ||
476 | cavium,bus-width = <16>; | ||
477 | }; | ||
478 | cavium,cs-config@6 { | ||
479 | compatible = "cavium,octeon-3860-bootbus-config"; | ||
480 | cavium,cs-index = <6>; | ||
481 | cavium,t-adr = <5>; | ||
482 | cavium,t-ce = <300>; | ||
483 | cavium,t-oe = <270>; | ||
484 | cavium,t-we = <150>; | ||
485 | cavium,t-rd-hld = <100>; | ||
486 | cavium,t-wr-hld = <70>; | ||
487 | cavium,t-pause = <0>; | ||
488 | cavium,t-wait = <0>; | ||
489 | cavium,t-page = <320>; | ||
490 | cavium,t-rd-dly = <0>; | ||
491 | |||
492 | cavium,pages = <0>; | ||
493 | cavium,wait-mode; | ||
494 | cavium,bus-width = <16>; | ||
495 | }; | ||
496 | |||
497 | flash0: nor@0,0 { | ||
498 | compatible = "cfi-flash"; | ||
499 | reg = <0 0 0x800000>; | ||
500 | #address-cells = <1>; | ||
501 | #size-cells = <1>; | ||
502 | }; | ||
503 | |||
504 | led0: led-display@4,0 { | ||
505 | compatible = "avago,hdsp-253x"; | ||
506 | reg = <4 0x20 0x20>, <4 0 0x20>; | ||
507 | }; | ||
508 | |||
509 | cf0: compact-flash@5,0 { | ||
510 | compatible = "cavium,ebt3000-compact-flash"; | ||
511 | reg = <5 0 0x10000>, <6 0 0x10000>; | ||
512 | cavium,bus-width = <16>; | ||
513 | cavium,true-ide; | ||
514 | cavium,dma-engine-handle = <&dma0>; | ||
515 | }; | ||
516 | }; | ||
517 | |||
518 | dma0: dma-engine@1180000000100 { | ||
519 | compatible = "cavium,octeon-5750-bootbus-dma"; | ||
520 | reg = <0x11800 0x00000100 0x0 0x8>; | ||
521 | interrupts = <0 63>; | ||
522 | }; | ||
523 | dma1: dma-engine@1180000000108 { | ||
524 | compatible = "cavium,octeon-5750-bootbus-dma"; | ||
525 | reg = <0x11800 0x00000108 0x0 0x8>; | ||
526 | interrupts = <0 63>; | ||
527 | }; | ||
528 | |||
529 | uctl: uctl@118006f000000 { | ||
530 | compatible = "cavium,octeon-6335-uctl"; | ||
531 | reg = <0x11800 0x6f000000 0x0 0x100>; | ||
532 | ranges; /* Direct mapping */ | ||
533 | #address-cells = <2>; | ||
534 | #size-cells = <2>; | ||
535 | /* 12MHz, 24MHz and 48MHz allowed */ | ||
536 | refclk-frequency = <12000000>; | ||
537 | /* Either "crystal" or "external" */ | ||
538 | refclk-type = "crystal"; | ||
539 | |||
540 | ehci@16f0000000000 { | ||
541 | compatible = "cavium,octeon-6335-ehci","usb-ehci"; | ||
542 | reg = <0x16f00 0x00000000 0x0 0x100>; | ||
543 | interrupts = <0 56>; | ||
544 | big-endian-regs; | ||
545 | }; | ||
546 | ohci@16f0000000400 { | ||
547 | compatible = "cavium,octeon-6335-ohci","usb-ohci"; | ||
548 | reg = <0x16f00 0x00000400 0x0 0x100>; | ||
549 | interrupts = <0 56>; | ||
550 | big-endian-regs; | ||
551 | }; | ||
552 | }; | ||
553 | }; | ||
554 | |||
555 | aliases { | ||
556 | mix0 = &mix0; | ||
557 | mix1 = &mix1; | ||
558 | pip = &pip; | ||
559 | smi0 = &smi0; | ||
560 | smi1 = &smi1; | ||
561 | twsi0 = &twsi0; | ||
562 | twsi1 = &twsi1; | ||
563 | uart0 = &uart0; | ||
564 | uart1 = &uart1; | ||
565 | uart2 = &uart2; | ||
566 | flash0 = &flash0; | ||
567 | cf0 = &cf0; | ||
568 | uctl = &uctl; | ||
569 | led0 = &led0; | ||
570 | }; | ||
571 | }; | ||
diff --git a/arch/mips/cavium-octeon/octeon_68xx.dts b/arch/mips/cavium-octeon/octeon_68xx.dts new file mode 100644 index 000000000000..1839468932b6 --- /dev/null +++ b/arch/mips/cavium-octeon/octeon_68xx.dts | |||
@@ -0,0 +1,625 @@ | |||
1 | /dts-v1/; | ||
2 | /* | ||
3 | * OCTEON 68XX device tree skeleton. | ||
4 | * | ||
5 | * This device tree is pruned and patched by early boot code before | ||
6 | * use. Because of this, it contains a super-set of the available | ||
7 | * devices and properties. | ||
8 | */ | ||
9 | / { | ||
10 | compatible = "cavium,octeon-6880"; | ||
11 | #address-cells = <2>; | ||
12 | #size-cells = <2>; | ||
13 | interrupt-parent = <&ciu2>; | ||
14 | |||
15 | soc@0 { | ||
16 | compatible = "simple-bus"; | ||
17 | #address-cells = <2>; | ||
18 | #size-cells = <2>; | ||
19 | ranges; /* Direct mapping */ | ||
20 | |||
21 | ciu2: interrupt-controller@1070100000000 { | ||
22 | compatible = "cavium,octeon-6880-ciu2"; | ||
23 | interrupt-controller; | ||
24 | /* Interrupts are specified by two parts: | ||
25 | * 1) Controller register (0 or 7) | ||
26 | * 2) Bit within the register (0..63) | ||
27 | */ | ||
28 | #address-cells = <0>; | ||
29 | #interrupt-cells = <2>; | ||
30 | reg = <0x10701 0x00000000 0x0 0x4000000>; | ||
31 | }; | ||
32 | |||
33 | gpio: gpio-controller@1070000000800 { | ||
34 | #gpio-cells = <2>; | ||
35 | compatible = "cavium,octeon-3860-gpio"; | ||
36 | reg = <0x10700 0x00000800 0x0 0x100>; | ||
37 | gpio-controller; | ||
38 | /* Interrupts are specified by two parts: | ||
39 | * 1) GPIO pin number (0..15) | ||
40 | * 2) Triggering (1 - edge rising | ||
41 | * 2 - edge falling | ||
42 | * 4 - level active high | ||
43 | * 8 - level active low) | ||
44 | */ | ||
45 | interrupt-controller; | ||
46 | #interrupt-cells = <2>; | ||
47 | /* The GPIO pins connect to 16 consecutive CUI bits */ | ||
48 | interrupts = <7 0>, <7 1>, <7 2>, <7 3>, | ||
49 | <7 4>, <7 5>, <7 6>, <7 7>, | ||
50 | <7 8>, <7 9>, <7 10>, <7 11>, | ||
51 | <7 12>, <7 13>, <7 14>, <7 15>; | ||
52 | }; | ||
53 | |||
54 | smi0: mdio@1180000003800 { | ||
55 | compatible = "cavium,octeon-3860-mdio"; | ||
56 | #address-cells = <1>; | ||
57 | #size-cells = <0>; | ||
58 | reg = <0x11800 0x00003800 0x0 0x40>; | ||
59 | |||
60 | phy0: ethernet-phy@6 { | ||
61 | compatible = "marvell,88e1118"; | ||
62 | marvell,reg-init = | ||
63 | /* Fix rx and tx clock transition timing */ | ||
64 | <2 0x15 0xffcf 0>, /* Reg 2,21 Clear bits 4, 5 */ | ||
65 | /* Adjust LED drive. */ | ||
66 | <3 0x11 0 0x442a>, /* Reg 3,17 <- 0442a */ | ||
67 | /* irq, blink-activity, blink-link */ | ||
68 | <3 0x10 0 0x0242>; /* Reg 3,16 <- 0x0242 */ | ||
69 | reg = <6>; | ||
70 | }; | ||
71 | |||
72 | phy1: ethernet-phy@1 { | ||
73 | cavium,qlm-trim = "4,sgmii"; | ||
74 | reg = <1>; | ||
75 | compatible = "marvell,88e1149r"; | ||
76 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
77 | <3 0x11 0 0x00aa>, | ||
78 | <3 0x12 0 0x4105>, | ||
79 | <3 0x13 0 0x0a60>; | ||
80 | }; | ||
81 | phy2: ethernet-phy@2 { | ||
82 | cavium,qlm-trim = "4,sgmii"; | ||
83 | reg = <2>; | ||
84 | compatible = "marvell,88e1149r"; | ||
85 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
86 | <3 0x11 0 0x00aa>, | ||
87 | <3 0x12 0 0x4105>, | ||
88 | <3 0x13 0 0x0a60>; | ||
89 | }; | ||
90 | phy3: ethernet-phy@3 { | ||
91 | cavium,qlm-trim = "4,sgmii"; | ||
92 | reg = <3>; | ||
93 | compatible = "marvell,88e1149r"; | ||
94 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
95 | <3 0x11 0 0x00aa>, | ||
96 | <3 0x12 0 0x4105>, | ||
97 | <3 0x13 0 0x0a60>; | ||
98 | }; | ||
99 | phy4: ethernet-phy@4 { | ||
100 | cavium,qlm-trim = "4,sgmii"; | ||
101 | reg = <4>; | ||
102 | compatible = "marvell,88e1149r"; | ||
103 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
104 | <3 0x11 0 0x00aa>, | ||
105 | <3 0x12 0 0x4105>, | ||
106 | <3 0x13 0 0x0a60>; | ||
107 | }; | ||
108 | }; | ||
109 | |||
110 | smi1: mdio@1180000003880 { | ||
111 | compatible = "cavium,octeon-3860-mdio"; | ||
112 | #address-cells = <1>; | ||
113 | #size-cells = <0>; | ||
114 | reg = <0x11800 0x00003880 0x0 0x40>; | ||
115 | |||
116 | phy41: ethernet-phy@1 { | ||
117 | cavium,qlm-trim = "0,sgmii"; | ||
118 | reg = <1>; | ||
119 | compatible = "marvell,88e1149r"; | ||
120 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
121 | <3 0x11 0 0x00aa>, | ||
122 | <3 0x12 0 0x4105>, | ||
123 | <3 0x13 0 0x0a60>; | ||
124 | }; | ||
125 | phy42: ethernet-phy@2 { | ||
126 | cavium,qlm-trim = "0,sgmii"; | ||
127 | reg = <2>; | ||
128 | compatible = "marvell,88e1149r"; | ||
129 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
130 | <3 0x11 0 0x00aa>, | ||
131 | <3 0x12 0 0x4105>, | ||
132 | <3 0x13 0 0x0a60>; | ||
133 | }; | ||
134 | phy43: ethernet-phy@3 { | ||
135 | cavium,qlm-trim = "0,sgmii"; | ||
136 | reg = <3>; | ||
137 | compatible = "marvell,88e1149r"; | ||
138 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
139 | <3 0x11 0 0x00aa>, | ||
140 | <3 0x12 0 0x4105>, | ||
141 | <3 0x13 0 0x0a60>; | ||
142 | }; | ||
143 | phy44: ethernet-phy@4 { | ||
144 | cavium,qlm-trim = "0,sgmii"; | ||
145 | reg = <4>; | ||
146 | compatible = "marvell,88e1149r"; | ||
147 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
148 | <3 0x11 0 0x00aa>, | ||
149 | <3 0x12 0 0x4105>, | ||
150 | <3 0x13 0 0x0a60>; | ||
151 | }; | ||
152 | }; | ||
153 | |||
154 | smi2: mdio@1180000003900 { | ||
155 | compatible = "cavium,octeon-3860-mdio"; | ||
156 | #address-cells = <1>; | ||
157 | #size-cells = <0>; | ||
158 | reg = <0x11800 0x00003900 0x0 0x40>; | ||
159 | |||
160 | phy21: ethernet-phy@1 { | ||
161 | cavium,qlm-trim = "2,sgmii"; | ||
162 | reg = <1>; | ||
163 | compatible = "marvell,88e1149r"; | ||
164 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
165 | <3 0x11 0 0x00aa>, | ||
166 | <3 0x12 0 0x4105>, | ||
167 | <3 0x13 0 0x0a60>; | ||
168 | }; | ||
169 | phy22: ethernet-phy@2 { | ||
170 | cavium,qlm-trim = "2,sgmii"; | ||
171 | reg = <2>; | ||
172 | compatible = "marvell,88e1149r"; | ||
173 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
174 | <3 0x11 0 0x00aa>, | ||
175 | <3 0x12 0 0x4105>, | ||
176 | <3 0x13 0 0x0a60>; | ||
177 | }; | ||
178 | phy23: ethernet-phy@3 { | ||
179 | cavium,qlm-trim = "2,sgmii"; | ||
180 | reg = <3>; | ||
181 | compatible = "marvell,88e1149r"; | ||
182 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
183 | <3 0x11 0 0x00aa>, | ||
184 | <3 0x12 0 0x4105>, | ||
185 | <3 0x13 0 0x0a60>; | ||
186 | }; | ||
187 | phy24: ethernet-phy@4 { | ||
188 | cavium,qlm-trim = "2,sgmii"; | ||
189 | reg = <4>; | ||
190 | compatible = "marvell,88e1149r"; | ||
191 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
192 | <3 0x11 0 0x00aa>, | ||
193 | <3 0x12 0 0x4105>, | ||
194 | <3 0x13 0 0x0a60>; | ||
195 | }; | ||
196 | }; | ||
197 | |||
198 | smi3: mdio@1180000003980 { | ||
199 | compatible = "cavium,octeon-3860-mdio"; | ||
200 | #address-cells = <1>; | ||
201 | #size-cells = <0>; | ||
202 | reg = <0x11800 0x00003980 0x0 0x40>; | ||
203 | |||
204 | phy11: ethernet-phy@1 { | ||
205 | cavium,qlm-trim = "3,sgmii"; | ||
206 | reg = <1>; | ||
207 | compatible = "marvell,88e1149r"; | ||
208 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
209 | <3 0x11 0 0x00aa>, | ||
210 | <3 0x12 0 0x4105>, | ||
211 | <3 0x13 0 0x0a60>; | ||
212 | }; | ||
213 | phy12: ethernet-phy@2 { | ||
214 | cavium,qlm-trim = "3,sgmii"; | ||
215 | reg = <2>; | ||
216 | compatible = "marvell,88e1149r"; | ||
217 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
218 | <3 0x11 0 0x00aa>, | ||
219 | <3 0x12 0 0x4105>, | ||
220 | <3 0x13 0 0x0a60>; | ||
221 | }; | ||
222 | phy13: ethernet-phy@3 { | ||
223 | cavium,qlm-trim = "3,sgmii"; | ||
224 | reg = <3>; | ||
225 | compatible = "marvell,88e1149r"; | ||
226 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
227 | <3 0x11 0 0x00aa>, | ||
228 | <3 0x12 0 0x4105>, | ||
229 | <3 0x13 0 0x0a60>; | ||
230 | }; | ||
231 | phy14: ethernet-phy@4 { | ||
232 | cavium,qlm-trim = "3,sgmii"; | ||
233 | reg = <4>; | ||
234 | compatible = "marvell,88e1149r"; | ||
235 | marvell,reg-init = <3 0x10 0 0x5777>, | ||
236 | <3 0x11 0 0x00aa>, | ||
237 | <3 0x12 0 0x4105>, | ||
238 | <3 0x13 0 0x0a60>; | ||
239 | }; | ||
240 | }; | ||
241 | |||
242 | mix0: ethernet@1070000100000 { | ||
243 | compatible = "cavium,octeon-5750-mix"; | ||
244 | reg = <0x10700 0x00100000 0x0 0x100>, /* MIX */ | ||
245 | <0x11800 0xE0000000 0x0 0x300>, /* AGL */ | ||
246 | <0x11800 0xE0000400 0x0 0x400>, /* AGL_SHARED */ | ||
247 | <0x11800 0xE0002000 0x0 0x8>; /* AGL_PRT_CTL */ | ||
248 | cell-index = <0>; | ||
249 | interrupts = <6 40>, <6 32>; | ||
250 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
251 | phy-handle = <&phy0>; | ||
252 | }; | ||
253 | |||
254 | pip: pip@11800a0000000 { | ||
255 | compatible = "cavium,octeon-3860-pip"; | ||
256 | #address-cells = <1>; | ||
257 | #size-cells = <0>; | ||
258 | reg = <0x11800 0xa0000000 0x0 0x2000>; | ||
259 | |||
260 | interface@4 { | ||
261 | compatible = "cavium,octeon-3860-pip-interface"; | ||
262 | #address-cells = <1>; | ||
263 | #size-cells = <0>; | ||
264 | reg = <0x4>; /* interface */ | ||
265 | |||
266 | ethernet@0 { | ||
267 | compatible = "cavium,octeon-3860-pip-port"; | ||
268 | reg = <0x0>; /* Port */ | ||
269 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
270 | phy-handle = <&phy1>; | ||
271 | }; | ||
272 | ethernet@1 { | ||
273 | compatible = "cavium,octeon-3860-pip-port"; | ||
274 | reg = <0x1>; /* Port */ | ||
275 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
276 | phy-handle = <&phy2>; | ||
277 | }; | ||
278 | ethernet@2 { | ||
279 | compatible = "cavium,octeon-3860-pip-port"; | ||
280 | reg = <0x2>; /* Port */ | ||
281 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
282 | phy-handle = <&phy3>; | ||
283 | }; | ||
284 | ethernet@3 { | ||
285 | compatible = "cavium,octeon-3860-pip-port"; | ||
286 | reg = <0x3>; /* Port */ | ||
287 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
288 | phy-handle = <&phy4>; | ||
289 | }; | ||
290 | }; | ||
291 | |||
292 | interface@3 { | ||
293 | compatible = "cavium,octeon-3860-pip-interface"; | ||
294 | #address-cells = <1>; | ||
295 | #size-cells = <0>; | ||
296 | reg = <0x3>; /* interface */ | ||
297 | |||
298 | ethernet@0 { | ||
299 | compatible = "cavium,octeon-3860-pip-port"; | ||
300 | reg = <0x0>; /* Port */ | ||
301 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
302 | phy-handle = <&phy11>; | ||
303 | }; | ||
304 | ethernet@1 { | ||
305 | compatible = "cavium,octeon-3860-pip-port"; | ||
306 | reg = <0x1>; /* Port */ | ||
307 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
308 | phy-handle = <&phy12>; | ||
309 | }; | ||
310 | ethernet@2 { | ||
311 | compatible = "cavium,octeon-3860-pip-port"; | ||
312 | reg = <0x2>; /* Port */ | ||
313 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
314 | phy-handle = <&phy13>; | ||
315 | }; | ||
316 | ethernet@3 { | ||
317 | compatible = "cavium,octeon-3860-pip-port"; | ||
318 | reg = <0x3>; /* Port */ | ||
319 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
320 | phy-handle = <&phy14>; | ||
321 | }; | ||
322 | }; | ||
323 | |||
324 | interface@2 { | ||
325 | compatible = "cavium,octeon-3860-pip-interface"; | ||
326 | #address-cells = <1>; | ||
327 | #size-cells = <0>; | ||
328 | reg = <0x2>; /* interface */ | ||
329 | |||
330 | ethernet@0 { | ||
331 | compatible = "cavium,octeon-3860-pip-port"; | ||
332 | reg = <0x0>; /* Port */ | ||
333 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
334 | phy-handle = <&phy21>; | ||
335 | }; | ||
336 | ethernet@1 { | ||
337 | compatible = "cavium,octeon-3860-pip-port"; | ||
338 | reg = <0x1>; /* Port */ | ||
339 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
340 | phy-handle = <&phy22>; | ||
341 | }; | ||
342 | ethernet@2 { | ||
343 | compatible = "cavium,octeon-3860-pip-port"; | ||
344 | reg = <0x2>; /* Port */ | ||
345 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
346 | phy-handle = <&phy23>; | ||
347 | }; | ||
348 | ethernet@3 { | ||
349 | compatible = "cavium,octeon-3860-pip-port"; | ||
350 | reg = <0x3>; /* Port */ | ||
351 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
352 | phy-handle = <&phy24>; | ||
353 | }; | ||
354 | }; | ||
355 | |||
356 | interface@1 { | ||
357 | compatible = "cavium,octeon-3860-pip-interface"; | ||
358 | #address-cells = <1>; | ||
359 | #size-cells = <0>; | ||
360 | reg = <0x1>; /* interface */ | ||
361 | |||
362 | ethernet@0 { | ||
363 | compatible = "cavium,octeon-3860-pip-port"; | ||
364 | reg = <0x0>; /* Port */ | ||
365 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
366 | }; | ||
367 | }; | ||
368 | |||
369 | interface@0 { | ||
370 | compatible = "cavium,octeon-3860-pip-interface"; | ||
371 | #address-cells = <1>; | ||
372 | #size-cells = <0>; | ||
373 | reg = <0x0>; /* interface */ | ||
374 | |||
375 | ethernet@0 { | ||
376 | compatible = "cavium,octeon-3860-pip-port"; | ||
377 | reg = <0x0>; /* Port */ | ||
378 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
379 | phy-handle = <&phy41>; | ||
380 | }; | ||
381 | ethernet@1 { | ||
382 | compatible = "cavium,octeon-3860-pip-port"; | ||
383 | reg = <0x1>; /* Port */ | ||
384 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
385 | phy-handle = <&phy42>; | ||
386 | }; | ||
387 | ethernet@2 { | ||
388 | compatible = "cavium,octeon-3860-pip-port"; | ||
389 | reg = <0x2>; /* Port */ | ||
390 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
391 | phy-handle = <&phy43>; | ||
392 | }; | ||
393 | ethernet@3 { | ||
394 | compatible = "cavium,octeon-3860-pip-port"; | ||
395 | reg = <0x3>; /* Port */ | ||
396 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
397 | phy-handle = <&phy44>; | ||
398 | }; | ||
399 | }; | ||
400 | }; | ||
401 | |||
402 | twsi0: i2c@1180000001000 { | ||
403 | #address-cells = <1>; | ||
404 | #size-cells = <0>; | ||
405 | compatible = "cavium,octeon-3860-twsi"; | ||
406 | reg = <0x11800 0x00001000 0x0 0x200>; | ||
407 | interrupts = <3 32>; | ||
408 | clock-frequency = <100000>; | ||
409 | |||
410 | rtc@68 { | ||
411 | compatible = "dallas,ds1337"; | ||
412 | reg = <0x68>; | ||
413 | }; | ||
414 | tmp@4c { | ||
415 | compatible = "ti,tmp421"; | ||
416 | reg = <0x4c>; | ||
417 | }; | ||
418 | }; | ||
419 | |||
420 | twsi1: i2c@1180000001200 { | ||
421 | #address-cells = <1>; | ||
422 | #size-cells = <0>; | ||
423 | compatible = "cavium,octeon-3860-twsi"; | ||
424 | reg = <0x11800 0x00001200 0x0 0x200>; | ||
425 | interrupts = <3 33>; | ||
426 | clock-frequency = <100000>; | ||
427 | }; | ||
428 | |||
429 | uart0: serial@1180000000800 { | ||
430 | compatible = "cavium,octeon-3860-uart","ns16550"; | ||
431 | reg = <0x11800 0x00000800 0x0 0x400>; | ||
432 | clock-frequency = <0>; | ||
433 | current-speed = <115200>; | ||
434 | reg-shift = <3>; | ||
435 | interrupts = <3 36>; | ||
436 | }; | ||
437 | |||
438 | uart1: serial@1180000000c00 { | ||
439 | compatible = "cavium,octeon-3860-uart","ns16550"; | ||
440 | reg = <0x11800 0x00000c00 0x0 0x400>; | ||
441 | clock-frequency = <0>; | ||
442 | current-speed = <115200>; | ||
443 | reg-shift = <3>; | ||
444 | interrupts = <3 37>; | ||
445 | }; | ||
446 | |||
447 | bootbus: bootbus@1180000000000 { | ||
448 | compatible = "cavium,octeon-3860-bootbus"; | ||
449 | reg = <0x11800 0x00000000 0x0 0x200>; | ||
450 | /* The chip select number and offset */ | ||
451 | #address-cells = <2>; | ||
452 | /* The size of the chip select region */ | ||
453 | #size-cells = <1>; | ||
454 | ranges = <0 0 0 0x1f400000 0xc00000>, | ||
455 | <1 0 0x10000 0x30000000 0>, | ||
456 | <2 0 0x10000 0x40000000 0>, | ||
457 | <3 0 0x10000 0x50000000 0>, | ||
458 | <4 0 0 0x1d020000 0x10000>, | ||
459 | <5 0 0 0x1d040000 0x10000>, | ||
460 | <6 0 0 0x1d050000 0x10000>, | ||
461 | <7 0 0x10000 0x90000000 0>; | ||
462 | |||
463 | cavium,cs-config@0 { | ||
464 | compatible = "cavium,octeon-3860-bootbus-config"; | ||
465 | cavium,cs-index = <0>; | ||
466 | cavium,t-adr = <10>; | ||
467 | cavium,t-ce = <50>; | ||
468 | cavium,t-oe = <50>; | ||
469 | cavium,t-we = <35>; | ||
470 | cavium,t-rd-hld = <25>; | ||
471 | cavium,t-wr-hld = <35>; | ||
472 | cavium,t-pause = <0>; | ||
473 | cavium,t-wait = <300>; | ||
474 | cavium,t-page = <25>; | ||
475 | cavium,t-rd-dly = <0>; | ||
476 | |||
477 | cavium,pages = <0>; | ||
478 | cavium,bus-width = <8>; | ||
479 | }; | ||
480 | cavium,cs-config@4 { | ||
481 | compatible = "cavium,octeon-3860-bootbus-config"; | ||
482 | cavium,cs-index = <4>; | ||
483 | cavium,t-adr = <320>; | ||
484 | cavium,t-ce = <320>; | ||
485 | cavium,t-oe = <320>; | ||
486 | cavium,t-we = <320>; | ||
487 | cavium,t-rd-hld = <320>; | ||
488 | cavium,t-wr-hld = <320>; | ||
489 | cavium,t-pause = <320>; | ||
490 | cavium,t-wait = <320>; | ||
491 | cavium,t-page = <320>; | ||
492 | cavium,t-rd-dly = <0>; | ||
493 | |||
494 | cavium,pages = <0>; | ||
495 | cavium,bus-width = <8>; | ||
496 | }; | ||
497 | cavium,cs-config@5 { | ||
498 | compatible = "cavium,octeon-3860-bootbus-config"; | ||
499 | cavium,cs-index = <5>; | ||
500 | cavium,t-adr = <0>; | ||
501 | cavium,t-ce = <300>; | ||
502 | cavium,t-oe = <125>; | ||
503 | cavium,t-we = <150>; | ||
504 | cavium,t-rd-hld = <100>; | ||
505 | cavium,t-wr-hld = <300>; | ||
506 | cavium,t-pause = <0>; | ||
507 | cavium,t-wait = <300>; | ||
508 | cavium,t-page = <310>; | ||
509 | cavium,t-rd-dly = <0>; | ||
510 | |||
511 | cavium,pages = <0>; | ||
512 | cavium,bus-width = <16>; | ||
513 | }; | ||
514 | cavium,cs-config@6 { | ||
515 | compatible = "cavium,octeon-3860-bootbus-config"; | ||
516 | cavium,cs-index = <6>; | ||
517 | cavium,t-adr = <0>; | ||
518 | cavium,t-ce = <30>; | ||
519 | cavium,t-oe = <125>; | ||
520 | cavium,t-we = <150>; | ||
521 | cavium,t-rd-hld = <100>; | ||
522 | cavium,t-wr-hld = <30>; | ||
523 | cavium,t-pause = <0>; | ||
524 | cavium,t-wait = <30>; | ||
525 | cavium,t-page = <310>; | ||
526 | cavium,t-rd-dly = <0>; | ||
527 | |||
528 | cavium,pages = <0>; | ||
529 | cavium,wait-mode; | ||
530 | cavium,bus-width = <16>; | ||
531 | }; | ||
532 | |||
533 | flash0: nor@0,0 { | ||
534 | compatible = "cfi-flash"; | ||
535 | reg = <0 0 0x800000>; | ||
536 | #address-cells = <1>; | ||
537 | #size-cells = <1>; | ||
538 | |||
539 | partition@0 { | ||
540 | label = "bootloader"; | ||
541 | reg = <0 0x200000>; | ||
542 | read-only; | ||
543 | }; | ||
544 | partition@200000 { | ||
545 | label = "kernel"; | ||
546 | reg = <0x200000 0x200000>; | ||
547 | }; | ||
548 | partition@400000 { | ||
549 | label = "cramfs"; | ||
550 | reg = <0x400000 0x3fe000>; | ||
551 | }; | ||
552 | partition@7fe000 { | ||
553 | label = "environment"; | ||
554 | reg = <0x7fe000 0x2000>; | ||
555 | read-only; | ||
556 | }; | ||
557 | }; | ||
558 | |||
559 | led0: led-display@4,0 { | ||
560 | compatible = "avago,hdsp-253x"; | ||
561 | reg = <4 0x20 0x20>, <4 0 0x20>; | ||
562 | }; | ||
563 | |||
564 | compact-flash@5,0 { | ||
565 | compatible = "cavium,ebt3000-compact-flash"; | ||
566 | reg = <5 0 0x10000>, <6 0 0x10000>; | ||
567 | cavium,bus-width = <16>; | ||
568 | cavium,true-ide; | ||
569 | cavium,dma-engine-handle = <&dma0>; | ||
570 | }; | ||
571 | }; | ||
572 | |||
573 | dma0: dma-engine@1180000000100 { | ||
574 | compatible = "cavium,octeon-5750-bootbus-dma"; | ||
575 | reg = <0x11800 0x00000100 0x0 0x8>; | ||
576 | interrupts = <0 63>; | ||
577 | }; | ||
578 | dma1: dma-engine@1180000000108 { | ||
579 | compatible = "cavium,octeon-5750-bootbus-dma"; | ||
580 | reg = <0x11800 0x00000108 0x0 0x8>; | ||
581 | interrupts = <0 63>; | ||
582 | }; | ||
583 | |||
584 | uctl: uctl@118006f000000 { | ||
585 | compatible = "cavium,octeon-6335-uctl"; | ||
586 | reg = <0x11800 0x6f000000 0x0 0x100>; | ||
587 | ranges; /* Direct mapping */ | ||
588 | #address-cells = <2>; | ||
589 | #size-cells = <2>; | ||
590 | /* 12MHz, 24MHz and 48MHz allowed */ | ||
591 | refclk-frequency = <12000000>; | ||
592 | /* Either "crystal" or "external" */ | ||
593 | refclk-type = "crystal"; | ||
594 | |||
595 | ehci@16f0000000000 { | ||
596 | compatible = "cavium,octeon-6335-ehci","usb-ehci"; | ||
597 | reg = <0x16f00 0x00000000 0x0 0x100>; | ||
598 | interrupts = <3 44>; | ||
599 | big-endian-regs; | ||
600 | }; | ||
601 | ohci@16f0000000400 { | ||
602 | compatible = "cavium,octeon-6335-ohci","usb-ohci"; | ||
603 | reg = <0x16f00 0x00000400 0x0 0x100>; | ||
604 | interrupts = <3 44>; | ||
605 | big-endian-regs; | ||
606 | }; | ||
607 | }; | ||
608 | }; | ||
609 | |||
610 | aliases { | ||
611 | mix0 = &mix0; | ||
612 | pip = &pip; | ||
613 | smi0 = &smi0; | ||
614 | smi1 = &smi1; | ||
615 | smi2 = &smi2; | ||
616 | smi3 = &smi3; | ||
617 | twsi0 = &twsi0; | ||
618 | twsi1 = &twsi1; | ||
619 | uart0 = &uart0; | ||
620 | uart1 = &uart1; | ||
621 | uctl = &uctl; | ||
622 | led0 = &led0; | ||
623 | flash0 = &flash0; | ||
624 | }; | ||
625 | }; | ||
diff --git a/arch/mips/cavium-octeon/serial.c b/arch/mips/cavium-octeon/serial.c index 057f0ae88c99..138b2216b4f8 100644 --- a/arch/mips/cavium-octeon/serial.c +++ b/arch/mips/cavium-octeon/serial.c | |||
@@ -43,95 +43,67 @@ void octeon_serial_out(struct uart_port *up, int offset, int value) | |||
43 | cvmx_write_csr((uint64_t)(up->membase + (offset << 3)), (u8)value); | 43 | cvmx_write_csr((uint64_t)(up->membase + (offset << 3)), (u8)value); |
44 | } | 44 | } |
45 | 45 | ||
46 | /* | 46 | static int __devinit octeon_serial_probe(struct platform_device *pdev) |
47 | * Allocated in .bss, so it is all zeroed. | ||
48 | */ | ||
49 | #define OCTEON_MAX_UARTS 3 | ||
50 | static struct plat_serial8250_port octeon_uart8250_data[OCTEON_MAX_UARTS + 1]; | ||
51 | static struct platform_device octeon_uart8250_device = { | ||
52 | .name = "serial8250", | ||
53 | .id = PLAT8250_DEV_PLATFORM, | ||
54 | .dev = { | ||
55 | .platform_data = octeon_uart8250_data, | ||
56 | }, | ||
57 | }; | ||
58 | |||
59 | static void __init octeon_uart_set_common(struct plat_serial8250_port *p) | ||
60 | { | 47 | { |
61 | p->flags = ASYNC_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE; | 48 | int irq, res; |
62 | p->type = PORT_OCTEON; | 49 | struct resource *res_mem; |
63 | p->iotype = UPIO_MEM; | 50 | struct uart_port port; |
64 | p->regshift = 3; /* I/O addresses are every 8 bytes */ | 51 | |
52 | /* All adaptors have an irq. */ | ||
53 | irq = platform_get_irq(pdev, 0); | ||
54 | if (irq < 0) | ||
55 | return irq; | ||
56 | |||
57 | memset(&port, 0, sizeof(port)); | ||
58 | |||
59 | port.flags = ASYNC_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE; | ||
60 | port.type = PORT_OCTEON; | ||
61 | port.iotype = UPIO_MEM; | ||
62 | port.regshift = 3; | ||
63 | port.dev = &pdev->dev; | ||
64 | |||
65 | if (octeon_is_simulation()) | 65 | if (octeon_is_simulation()) |
66 | /* Make simulator output fast*/ | 66 | /* Make simulator output fast*/ |
67 | p->uartclk = 115200 * 16; | 67 | port.uartclk = 115200 * 16; |
68 | else | 68 | else |
69 | p->uartclk = octeon_get_io_clock_rate(); | 69 | port.uartclk = octeon_get_io_clock_rate(); |
70 | p->serial_in = octeon_serial_in; | ||
71 | p->serial_out = octeon_serial_out; | ||
72 | } | ||
73 | 70 | ||
74 | static int __init octeon_serial_init(void) | 71 | port.serial_in = octeon_serial_in; |
75 | { | 72 | port.serial_out = octeon_serial_out; |
76 | int enable_uart0; | 73 | port.irq = irq; |
77 | int enable_uart1; | ||
78 | int enable_uart2; | ||
79 | struct plat_serial8250_port *p; | ||
80 | |||
81 | #ifdef CONFIG_CAVIUM_OCTEON_2ND_KERNEL | ||
82 | /* | ||
83 | * If we are configured to run as the second of two kernels, | ||
84 | * disable uart0 and enable uart1. Uart0 is owned by the first | ||
85 | * kernel | ||
86 | */ | ||
87 | enable_uart0 = 0; | ||
88 | enable_uart1 = 1; | ||
89 | #else | ||
90 | /* | ||
91 | * We are configured for the first kernel. We'll enable uart0 | ||
92 | * if the bootloader told us to use 0, otherwise will enable | ||
93 | * uart 1. | ||
94 | */ | ||
95 | enable_uart0 = (octeon_get_boot_uart() == 0); | ||
96 | enable_uart1 = (octeon_get_boot_uart() == 1); | ||
97 | #ifdef CONFIG_KGDB | ||
98 | enable_uart1 = 1; | ||
99 | #endif | ||
100 | #endif | ||
101 | |||
102 | /* Right now CN52XX is the only chip with a third uart */ | ||
103 | enable_uart2 = OCTEON_IS_MODEL(OCTEON_CN52XX); | ||
104 | |||
105 | p = octeon_uart8250_data; | ||
106 | if (enable_uart0) { | ||
107 | /* Add a ttyS device for hardware uart 0 */ | ||
108 | octeon_uart_set_common(p); | ||
109 | p->membase = (void *) CVMX_MIO_UARTX_RBR(0); | ||
110 | p->mapbase = CVMX_MIO_UARTX_RBR(0) & ((1ull << 49) - 1); | ||
111 | p->irq = OCTEON_IRQ_UART0; | ||
112 | p++; | ||
113 | } | ||
114 | 74 | ||
115 | if (enable_uart1) { | 75 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
116 | /* Add a ttyS device for hardware uart 1 */ | 76 | if (res_mem == NULL) { |
117 | octeon_uart_set_common(p); | 77 | dev_err(&pdev->dev, "found no memory resource\n"); |
118 | p->membase = (void *) CVMX_MIO_UARTX_RBR(1); | 78 | return -ENXIO; |
119 | p->mapbase = CVMX_MIO_UARTX_RBR(1) & ((1ull << 49) - 1); | ||
120 | p->irq = OCTEON_IRQ_UART1; | ||
121 | p++; | ||
122 | } | ||
123 | if (enable_uart2) { | ||
124 | /* Add a ttyS device for hardware uart 2 */ | ||
125 | octeon_uart_set_common(p); | ||
126 | p->membase = (void *) CVMX_MIO_UART2_RBR; | ||
127 | p->mapbase = CVMX_MIO_UART2_RBR & ((1ull << 49) - 1); | ||
128 | p->irq = OCTEON_IRQ_UART2; | ||
129 | p++; | ||
130 | } | 79 | } |
80 | port.mapbase = res_mem->start; | ||
81 | port.membase = ioremap(res_mem->start, resource_size(res_mem)); | ||
131 | 82 | ||
132 | BUG_ON(p > &octeon_uart8250_data[OCTEON_MAX_UARTS]); | 83 | res = serial8250_register_port(&port); |
133 | 84 | ||
134 | return platform_device_register(&octeon_uart8250_device); | 85 | return res >= 0 ? 0 : res; |
135 | } | 86 | } |
136 | 87 | ||
137 | device_initcall(octeon_serial_init); | 88 | static struct of_device_id octeon_serial_match[] = { |
89 | { | ||
90 | .compatible = "cavium,octeon-3860-uart", | ||
91 | }, | ||
92 | {}, | ||
93 | }; | ||
94 | MODULE_DEVICE_TABLE(of, octeon_serial_match); | ||
95 | |||
96 | static struct platform_driver octeon_serial_driver = { | ||
97 | .probe = octeon_serial_probe, | ||
98 | .driver = { | ||
99 | .owner = THIS_MODULE, | ||
100 | .name = "octeon_serial", | ||
101 | .of_match_table = octeon_serial_match, | ||
102 | }, | ||
103 | }; | ||
104 | |||
105 | static int __init octeon_serial_init(void) | ||
106 | { | ||
107 | return platform_driver_register(&octeon_serial_driver); | ||
108 | } | ||
109 | late_initcall(octeon_serial_init); | ||
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c index 260dc247c052..919b0fb7bb1a 100644 --- a/arch/mips/cavium-octeon/setup.c +++ b/arch/mips/cavium-octeon/setup.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/serial_core.h> | 22 | #include <linux/serial_core.h> |
23 | #include <linux/serial_8250.h> | 23 | #include <linux/serial_8250.h> |
24 | #include <linux/of_fdt.h> | ||
25 | #include <linux/libfdt.h> | ||
24 | 26 | ||
25 | #include <asm/processor.h> | 27 | #include <asm/processor.h> |
26 | #include <asm/reboot.h> | 28 | #include <asm/reboot.h> |
@@ -775,3 +777,46 @@ void prom_free_prom_memory(void) | |||
775 | } | 777 | } |
776 | #endif | 778 | #endif |
777 | } | 779 | } |
780 | |||
781 | int octeon_prune_device_tree(void); | ||
782 | |||
783 | extern const char __dtb_octeon_3xxx_begin; | ||
784 | extern const char __dtb_octeon_3xxx_end; | ||
785 | extern const char __dtb_octeon_68xx_begin; | ||
786 | extern const char __dtb_octeon_68xx_end; | ||
787 | void __init device_tree_init(void) | ||
788 | { | ||
789 | int dt_size; | ||
790 | struct boot_param_header *fdt; | ||
791 | bool do_prune; | ||
792 | |||
793 | if (octeon_bootinfo->minor_version >= 3 && octeon_bootinfo->fdt_addr) { | ||
794 | fdt = phys_to_virt(octeon_bootinfo->fdt_addr); | ||
795 | if (fdt_check_header(fdt)) | ||
796 | panic("Corrupt Device Tree passed to kernel."); | ||
797 | dt_size = be32_to_cpu(fdt->totalsize); | ||
798 | do_prune = false; | ||
799 | } else if (OCTEON_IS_MODEL(OCTEON_CN68XX)) { | ||
800 | fdt = (struct boot_param_header *)&__dtb_octeon_68xx_begin; | ||
801 | dt_size = &__dtb_octeon_68xx_end - &__dtb_octeon_68xx_begin; | ||
802 | do_prune = true; | ||
803 | } else { | ||
804 | fdt = (struct boot_param_header *)&__dtb_octeon_3xxx_begin; | ||
805 | dt_size = &__dtb_octeon_3xxx_end - &__dtb_octeon_3xxx_begin; | ||
806 | do_prune = true; | ||
807 | } | ||
808 | |||
809 | /* Copy the default tree from init memory. */ | ||
810 | initial_boot_params = early_init_dt_alloc_memory_arch(dt_size, 8); | ||
811 | if (initial_boot_params == NULL) | ||
812 | panic("Could not allocate initial_boot_params\n"); | ||
813 | memcpy(initial_boot_params, fdt, dt_size); | ||
814 | |||
815 | if (do_prune) { | ||
816 | octeon_prune_device_tree(); | ||
817 | pr_info("Using internal Device Tree.\n"); | ||
818 | } else { | ||
819 | pr_info("Using passed Device Tree.\n"); | ||
820 | } | ||
821 | unflatten_device_tree(); | ||
822 | } | ||
diff --git a/arch/mips/configs/ls1b_defconfig b/arch/mips/configs/ls1b_defconfig new file mode 100644 index 000000000000..80cff8bea8e8 --- /dev/null +++ b/arch/mips/configs/ls1b_defconfig | |||
@@ -0,0 +1,109 @@ | |||
1 | CONFIG_MACH_LOONGSON1=y | ||
2 | CONFIG_PREEMPT=y | ||
3 | # CONFIG_SECCOMP is not set | ||
4 | CONFIG_EXPERIMENTAL=y | ||
5 | # CONFIG_LOCALVERSION_AUTO is not set | ||
6 | CONFIG_SYSVIPC=y | ||
7 | CONFIG_BSD_PROCESS_ACCT=y | ||
8 | CONFIG_BSD_PROCESS_ACCT_V3=y | ||
9 | CONFIG_HIGH_RES_TIMERS=y | ||
10 | CONFIG_IKCONFIG=y | ||
11 | CONFIG_IKCONFIG_PROC=y | ||
12 | CONFIG_LOG_BUF_SHIFT=16 | ||
13 | CONFIG_NAMESPACES=y | ||
14 | CONFIG_BLK_DEV_INITRD=y | ||
15 | CONFIG_RD_BZIP2=y | ||
16 | CONFIG_RD_LZMA=y | ||
17 | CONFIG_EXPERT=y | ||
18 | CONFIG_PERF_EVENTS=y | ||
19 | # CONFIG_COMPAT_BRK is not set | ||
20 | CONFIG_MODULES=y | ||
21 | CONFIG_MODULE_UNLOAD=y | ||
22 | CONFIG_MODVERSIONS=y | ||
23 | # CONFIG_LBDAF is not set | ||
24 | # CONFIG_BLK_DEV_BSG is not set | ||
25 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | ||
26 | # CONFIG_SUSPEND is not set | ||
27 | CONFIG_NET=y | ||
28 | CONFIG_PACKET=y | ||
29 | CONFIG_UNIX=y | ||
30 | CONFIG_INET=y | ||
31 | CONFIG_IP_PNP=y | ||
32 | CONFIG_IP_PNP_DHCP=y | ||
33 | CONFIG_SYN_COOKIES=y | ||
34 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set | ||
35 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set | ||
36 | # CONFIG_INET_XFRM_MODE_BEET is not set | ||
37 | # CONFIG_INET_DIAG is not set | ||
38 | # CONFIG_IPV6 is not set | ||
39 | # CONFIG_WIRELESS is not set | ||
40 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
41 | CONFIG_DEVTMPFS=y | ||
42 | CONFIG_DEVTMPFS_MOUNT=y | ||
43 | # CONFIG_STANDALONE is not set | ||
44 | CONFIG_BLK_DEV_LOOP=y | ||
45 | CONFIG_SCSI=m | ||
46 | # CONFIG_SCSI_PROC_FS is not set | ||
47 | CONFIG_BLK_DEV_SD=m | ||
48 | # CONFIG_SCSI_LOWLEVEL is not set | ||
49 | CONFIG_NETDEVICES=y | ||
50 | # CONFIG_NET_VENDOR_BROADCOM is not set | ||
51 | # CONFIG_NET_VENDOR_CHELSIO is not set | ||
52 | # CONFIG_NET_VENDOR_INTEL is not set | ||
53 | # CONFIG_NET_VENDOR_MARVELL is not set | ||
54 | # CONFIG_NET_VENDOR_MICREL is not set | ||
55 | # CONFIG_NET_VENDOR_NATSEMI is not set | ||
56 | # CONFIG_NET_VENDOR_SEEQ is not set | ||
57 | # CONFIG_NET_VENDOR_SMSC is not set | ||
58 | CONFIG_STMMAC_ETH=y | ||
59 | CONFIG_STMMAC_DA=y | ||
60 | # CONFIG_NET_VENDOR_WIZNET is not set | ||
61 | # CONFIG_WLAN is not set | ||
62 | CONFIG_INPUT_EVDEV=y | ||
63 | # CONFIG_INPUT_KEYBOARD is not set | ||
64 | # CONFIG_INPUT_MOUSE is not set | ||
65 | # CONFIG_SERIO is not set | ||
66 | CONFIG_VT_HW_CONSOLE_BINDING=y | ||
67 | CONFIG_LEGACY_PTY_COUNT=8 | ||
68 | # CONFIG_DEVKMEM is not set | ||
69 | CONFIG_SERIAL_8250=y | ||
70 | CONFIG_SERIAL_8250_CONSOLE=y | ||
71 | # CONFIG_HW_RANDOM is not set | ||
72 | # CONFIG_HWMON is not set | ||
73 | # CONFIG_VGA_CONSOLE is not set | ||
74 | CONFIG_USB_HID=m | ||
75 | CONFIG_HID_GENERIC=m | ||
76 | CONFIG_USB=y | ||
77 | CONFIG_USB_ANNOUNCE_NEW_DEVICES=y | ||
78 | CONFIG_USB_EHCI_HCD=y | ||
79 | # CONFIG_USB_EHCI_TT_NEWSCHED is not set | ||
80 | CONFIG_USB_STORAGE=m | ||
81 | CONFIG_USB_SERIAL=m | ||
82 | CONFIG_USB_SERIAL_PL2303=m | ||
83 | CONFIG_RTC_CLASS=y | ||
84 | CONFIG_RTC_DRV_LOONGSON1=y | ||
85 | # CONFIG_IOMMU_SUPPORT is not set | ||
86 | CONFIG_EXT2_FS=y | ||
87 | CONFIG_EXT2_FS_XATTR=y | ||
88 | CONFIG_EXT2_FS_POSIX_ACL=y | ||
89 | CONFIG_EXT2_FS_SECURITY=y | ||
90 | CONFIG_EXT3_FS=y | ||
91 | CONFIG_EXT3_FS_POSIX_ACL=y | ||
92 | CONFIG_EXT3_FS_SECURITY=y | ||
93 | # CONFIG_DNOTIFY is not set | ||
94 | CONFIG_VFAT_FS=y | ||
95 | CONFIG_PROC_KCORE=y | ||
96 | CONFIG_TMPFS=y | ||
97 | CONFIG_TMPFS_POSIX_ACL=y | ||
98 | # CONFIG_MISC_FILESYSTEMS is not set | ||
99 | CONFIG_NFS_FS=y | ||
100 | CONFIG_ROOT_NFS=y | ||
101 | CONFIG_NLS_CODEPAGE_437=m | ||
102 | CONFIG_NLS_ISO8859_1=m | ||
103 | # CONFIG_ENABLE_WARN_DEPRECATED is not set | ||
104 | # CONFIG_ENABLE_MUST_CHECK is not set | ||
105 | CONFIG_MAGIC_SYSRQ=y | ||
106 | # CONFIG_SCHED_DEBUG is not set | ||
107 | # CONFIG_DEBUG_PREEMPT is not set | ||
108 | # CONFIG_FTRACE is not set | ||
109 | # CONFIG_EARLY_PRINTK is not set | ||
diff --git a/arch/mips/configs/nlm_xlr_defconfig b/arch/mips/configs/nlm_xlr_defconfig index d0b857d98c91..138f698d7c00 100644 --- a/arch/mips/configs/nlm_xlr_defconfig +++ b/arch/mips/configs/nlm_xlr_defconfig | |||
@@ -367,6 +367,10 @@ CONFIG_SERIAL_8250_RSA=y | |||
367 | CONFIG_HW_RANDOM=y | 367 | CONFIG_HW_RANDOM=y |
368 | CONFIG_HW_RANDOM_TIMERIOMEM=m | 368 | CONFIG_HW_RANDOM_TIMERIOMEM=m |
369 | CONFIG_RAW_DRIVER=m | 369 | CONFIG_RAW_DRIVER=m |
370 | CONFIG_I2C=y | ||
371 | CONFIG_I2C_XLR=y | ||
372 | CONFIG_RTC_CLASS=y | ||
373 | CONFIG_RTC_DRV_DS1374=y | ||
370 | # CONFIG_HWMON is not set | 374 | # CONFIG_HWMON is not set |
371 | # CONFIG_VGA_CONSOLE is not set | 375 | # CONFIG_VGA_CONSOLE is not set |
372 | # CONFIG_HID_SUPPORT is not set | 376 | # CONFIG_HID_SUPPORT is not set |
diff --git a/arch/mips/dec/prom/memory.c b/arch/mips/dec/prom/memory.c index e95ff3054ff6..8c62316f22f4 100644 --- a/arch/mips/dec/prom/memory.c +++ b/arch/mips/dec/prom/memory.c | |||
@@ -101,7 +101,7 @@ void __init prom_free_prom_memory(void) | |||
101 | * the first page reserved for the exception handlers. | 101 | * the first page reserved for the exception handlers. |
102 | */ | 102 | */ |
103 | 103 | ||
104 | #if defined(CONFIG_DECLANCE) || defined(CONFIG_DECLANCE_MODULE) | 104 | #if IS_ENABLED(CONFIG_DECLANCE) |
105 | /* | 105 | /* |
106 | * Leave 128 KB reserved for Lance memory for | 106 | * Leave 128 KB reserved for Lance memory for |
107 | * IOASIC DECstations. | 107 | * IOASIC DECstations. |
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h index 95e40c1e8ed1..f21b7c04e95a 100644 --- a/arch/mips/include/asm/cpu.h +++ b/arch/mips/include/asm/cpu.h | |||
@@ -197,6 +197,7 @@ | |||
197 | #define PRID_REV_VR4181A 0x0070 /* Same as VR4122 */ | 197 | #define PRID_REV_VR4181A 0x0070 /* Same as VR4122 */ |
198 | #define PRID_REV_VR4130 0x0080 | 198 | #define PRID_REV_VR4130 0x0080 |
199 | #define PRID_REV_34K_V1_0_2 0x0022 | 199 | #define PRID_REV_34K_V1_0_2 0x0022 |
200 | #define PRID_REV_LOONGSON1B 0x0020 | ||
200 | #define PRID_REV_LOONGSON2E 0x0002 | 201 | #define PRID_REV_LOONGSON2E 0x0002 |
201 | #define PRID_REV_LOONGSON2F 0x0003 | 202 | #define PRID_REV_LOONGSON2F 0x0003 |
202 | 203 | ||
@@ -261,7 +262,7 @@ enum cpu_type_enum { | |||
261 | */ | 262 | */ |
262 | CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K, | 263 | CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K, |
263 | CPU_ALCHEMY, CPU_PR4450, CPU_BMIPS32, CPU_BMIPS3300, CPU_BMIPS4350, | 264 | CPU_ALCHEMY, CPU_PR4450, CPU_BMIPS32, CPU_BMIPS3300, CPU_BMIPS4350, |
264 | CPU_BMIPS4380, CPU_BMIPS5000, CPU_JZRISC, CPU_M14KC, | 265 | CPU_BMIPS4380, CPU_BMIPS5000, CPU_JZRISC, CPU_LOONGSON1, CPU_M14KC, |
265 | 266 | ||
266 | /* | 267 | /* |
267 | * MIPS64 class processors | 268 | * MIPS64 class processors |
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h index 5b8d15bb5fe8..e104ddb694a8 100644 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | |||
@@ -9,6 +9,7 @@ | |||
9 | * compile time if only one CPU support is enabled (idea stolen from | 9 | * compile time if only one CPU support is enabled (idea stolen from |
10 | * arm mach-types) | 10 | * arm mach-types) |
11 | */ | 11 | */ |
12 | #define BCM6328_CPU_ID 0x6328 | ||
12 | #define BCM6338_CPU_ID 0x6338 | 13 | #define BCM6338_CPU_ID 0x6338 |
13 | #define BCM6345_CPU_ID 0x6345 | 14 | #define BCM6345_CPU_ID 0x6345 |
14 | #define BCM6348_CPU_ID 0x6348 | 15 | #define BCM6348_CPU_ID 0x6348 |
@@ -20,6 +21,19 @@ u16 __bcm63xx_get_cpu_id(void); | |||
20 | u16 bcm63xx_get_cpu_rev(void); | 21 | u16 bcm63xx_get_cpu_rev(void); |
21 | unsigned int bcm63xx_get_cpu_freq(void); | 22 | unsigned int bcm63xx_get_cpu_freq(void); |
22 | 23 | ||
24 | #ifdef CONFIG_BCM63XX_CPU_6328 | ||
25 | # ifdef bcm63xx_get_cpu_id | ||
26 | # undef bcm63xx_get_cpu_id | ||
27 | # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id() | ||
28 | # define BCMCPU_RUNTIME_DETECT | ||
29 | # else | ||
30 | # define bcm63xx_get_cpu_id() BCM6328_CPU_ID | ||
31 | # endif | ||
32 | # define BCMCPU_IS_6328() (bcm63xx_get_cpu_id() == BCM6328_CPU_ID) | ||
33 | #else | ||
34 | # define BCMCPU_IS_6328() (0) | ||
35 | #endif | ||
36 | |||
23 | #ifdef CONFIG_BCM63XX_CPU_6338 | 37 | #ifdef CONFIG_BCM63XX_CPU_6338 |
24 | # ifdef bcm63xx_get_cpu_id | 38 | # ifdef bcm63xx_get_cpu_id |
25 | # undef bcm63xx_get_cpu_id | 39 | # undef bcm63xx_get_cpu_id |
@@ -102,13 +116,13 @@ enum bcm63xx_regs_set { | |||
102 | RSET_UART1, | 116 | RSET_UART1, |
103 | RSET_GPIO, | 117 | RSET_GPIO, |
104 | RSET_SPI, | 118 | RSET_SPI, |
105 | RSET_SPI2, | ||
106 | RSET_UDC0, | 119 | RSET_UDC0, |
107 | RSET_OHCI0, | 120 | RSET_OHCI0, |
108 | RSET_OHCI_PRIV, | 121 | RSET_OHCI_PRIV, |
109 | RSET_USBH_PRIV, | 122 | RSET_USBH_PRIV, |
110 | RSET_MPI, | 123 | RSET_MPI, |
111 | RSET_PCMCIA, | 124 | RSET_PCMCIA, |
125 | RSET_PCIE, | ||
112 | RSET_DSL, | 126 | RSET_DSL, |
113 | RSET_ENET0, | 127 | RSET_ENET0, |
114 | RSET_ENET1, | 128 | RSET_ENET1, |
@@ -130,11 +144,17 @@ enum bcm63xx_regs_set { | |||
130 | RSET_PCMDMA, | 144 | RSET_PCMDMA, |
131 | RSET_PCMDMAC, | 145 | RSET_PCMDMAC, |
132 | RSET_PCMDMAS, | 146 | RSET_PCMDMAS, |
147 | RSET_RNG, | ||
148 | RSET_MISC | ||
133 | }; | 149 | }; |
134 | 150 | ||
135 | #define RSET_DSL_LMEM_SIZE (64 * 1024 * 4) | 151 | #define RSET_DSL_LMEM_SIZE (64 * 1024 * 4) |
136 | #define RSET_DSL_SIZE 4096 | 152 | #define RSET_DSL_SIZE 4096 |
137 | #define RSET_WDT_SIZE 12 | 153 | #define RSET_WDT_SIZE 12 |
154 | #define BCM_6338_RSET_SPI_SIZE 64 | ||
155 | #define BCM_6348_RSET_SPI_SIZE 64 | ||
156 | #define BCM_6358_RSET_SPI_SIZE 1804 | ||
157 | #define BCM_6368_RSET_SPI_SIZE 1804 | ||
138 | #define RSET_ENET_SIZE 2048 | 158 | #define RSET_ENET_SIZE 2048 |
139 | #define RSET_ENETDMA_SIZE 2048 | 159 | #define RSET_ENETDMA_SIZE 2048 |
140 | #define RSET_ENETSW_SIZE 65536 | 160 | #define RSET_ENETSW_SIZE 65536 |
@@ -149,8 +169,53 @@ enum bcm63xx_regs_set { | |||
149 | #define RSET_XTMDMA_SIZE 256 | 169 | #define RSET_XTMDMA_SIZE 256 |
150 | #define RSET_XTMDMAC_SIZE(chans) (16 * (chans)) | 170 | #define RSET_XTMDMAC_SIZE(chans) (16 * (chans)) |
151 | #define RSET_XTMDMAS_SIZE(chans) (16 * (chans)) | 171 | #define RSET_XTMDMAS_SIZE(chans) (16 * (chans)) |
172 | #define RSET_RNG_SIZE 20 | ||
152 | 173 | ||
153 | /* | 174 | /* |
175 | * 6328 register sets base address | ||
176 | */ | ||
177 | #define BCM_6328_DSL_LMEM_BASE (0xdeadbeef) | ||
178 | #define BCM_6328_PERF_BASE (0xb0000000) | ||
179 | #define BCM_6328_TIMER_BASE (0xb0000040) | ||
180 | #define BCM_6328_WDT_BASE (0xb000005c) | ||
181 | #define BCM_6328_UART0_BASE (0xb0000100) | ||
182 | #define BCM_6328_UART1_BASE (0xb0000120) | ||
183 | #define BCM_6328_GPIO_BASE (0xb0000080) | ||
184 | #define BCM_6328_SPI_BASE (0xdeadbeef) | ||
185 | #define BCM_6328_UDC0_BASE (0xdeadbeef) | ||
186 | #define BCM_6328_USBDMA_BASE (0xdeadbeef) | ||
187 | #define BCM_6328_OHCI0_BASE (0xdeadbeef) | ||
188 | #define BCM_6328_OHCI_PRIV_BASE (0xdeadbeef) | ||
189 | #define BCM_6328_USBH_PRIV_BASE (0xdeadbeef) | ||
190 | #define BCM_6328_MPI_BASE (0xdeadbeef) | ||
191 | #define BCM_6328_PCMCIA_BASE (0xdeadbeef) | ||
192 | #define BCM_6328_PCIE_BASE (0xb0e40000) | ||
193 | #define BCM_6328_SDRAM_REGS_BASE (0xdeadbeef) | ||
194 | #define BCM_6328_DSL_BASE (0xb0001900) | ||
195 | #define BCM_6328_UBUS_BASE (0xdeadbeef) | ||
196 | #define BCM_6328_ENET0_BASE (0xdeadbeef) | ||
197 | #define BCM_6328_ENET1_BASE (0xdeadbeef) | ||
198 | #define BCM_6328_ENETDMA_BASE (0xb000d800) | ||
199 | #define BCM_6328_ENETDMAC_BASE (0xb000da00) | ||
200 | #define BCM_6328_ENETDMAS_BASE (0xb000dc00) | ||
201 | #define BCM_6328_ENETSW_BASE (0xb0e00000) | ||
202 | #define BCM_6328_EHCI0_BASE (0x10002500) | ||
203 | #define BCM_6328_SDRAM_BASE (0xdeadbeef) | ||
204 | #define BCM_6328_MEMC_BASE (0xdeadbeef) | ||
205 | #define BCM_6328_DDR_BASE (0xb0003000) | ||
206 | #define BCM_6328_M2M_BASE (0xdeadbeef) | ||
207 | #define BCM_6328_ATM_BASE (0xdeadbeef) | ||
208 | #define BCM_6328_XTM_BASE (0xdeadbeef) | ||
209 | #define BCM_6328_XTMDMA_BASE (0xb000b800) | ||
210 | #define BCM_6328_XTMDMAC_BASE (0xdeadbeef) | ||
211 | #define BCM_6328_XTMDMAS_BASE (0xdeadbeef) | ||
212 | #define BCM_6328_PCM_BASE (0xb000a800) | ||
213 | #define BCM_6328_PCMDMA_BASE (0xdeadbeef) | ||
214 | #define BCM_6328_PCMDMAC_BASE (0xdeadbeef) | ||
215 | #define BCM_6328_PCMDMAS_BASE (0xdeadbeef) | ||
216 | #define BCM_6328_RNG_BASE (0xdeadbeef) | ||
217 | #define BCM_6328_MISC_BASE (0xb0001800) | ||
218 | /* | ||
154 | * 6338 register sets base address | 219 | * 6338 register sets base address |
155 | */ | 220 | */ |
156 | #define BCM_6338_DSL_LMEM_BASE (0xfff00000) | 221 | #define BCM_6338_DSL_LMEM_BASE (0xfff00000) |
@@ -162,7 +227,6 @@ enum bcm63xx_regs_set { | |||
162 | #define BCM_6338_UART1_BASE (0xdeadbeef) | 227 | #define BCM_6338_UART1_BASE (0xdeadbeef) |
163 | #define BCM_6338_GPIO_BASE (0xfffe0400) | 228 | #define BCM_6338_GPIO_BASE (0xfffe0400) |
164 | #define BCM_6338_SPI_BASE (0xfffe0c00) | 229 | #define BCM_6338_SPI_BASE (0xfffe0c00) |
165 | #define BCM_6338_SPI2_BASE (0xdeadbeef) | ||
166 | #define BCM_6338_UDC0_BASE (0xdeadbeef) | 230 | #define BCM_6338_UDC0_BASE (0xdeadbeef) |
167 | #define BCM_6338_USBDMA_BASE (0xfffe2400) | 231 | #define BCM_6338_USBDMA_BASE (0xfffe2400) |
168 | #define BCM_6338_OHCI0_BASE (0xdeadbeef) | 232 | #define BCM_6338_OHCI0_BASE (0xdeadbeef) |
@@ -170,6 +234,7 @@ enum bcm63xx_regs_set { | |||
170 | #define BCM_6338_USBH_PRIV_BASE (0xdeadbeef) | 234 | #define BCM_6338_USBH_PRIV_BASE (0xdeadbeef) |
171 | #define BCM_6338_MPI_BASE (0xfffe3160) | 235 | #define BCM_6338_MPI_BASE (0xfffe3160) |
172 | #define BCM_6338_PCMCIA_BASE (0xdeadbeef) | 236 | #define BCM_6338_PCMCIA_BASE (0xdeadbeef) |
237 | #define BCM_6338_PCIE_BASE (0xdeadbeef) | ||
173 | #define BCM_6338_SDRAM_REGS_BASE (0xfffe3100) | 238 | #define BCM_6338_SDRAM_REGS_BASE (0xfffe3100) |
174 | #define BCM_6338_DSL_BASE (0xfffe1000) | 239 | #define BCM_6338_DSL_BASE (0xfffe1000) |
175 | #define BCM_6338_UBUS_BASE (0xdeadbeef) | 240 | #define BCM_6338_UBUS_BASE (0xdeadbeef) |
@@ -193,6 +258,8 @@ enum bcm63xx_regs_set { | |||
193 | #define BCM_6338_PCMDMA_BASE (0xdeadbeef) | 258 | #define BCM_6338_PCMDMA_BASE (0xdeadbeef) |
194 | #define BCM_6338_PCMDMAC_BASE (0xdeadbeef) | 259 | #define BCM_6338_PCMDMAC_BASE (0xdeadbeef) |
195 | #define BCM_6338_PCMDMAS_BASE (0xdeadbeef) | 260 | #define BCM_6338_PCMDMAS_BASE (0xdeadbeef) |
261 | #define BCM_6338_RNG_BASE (0xdeadbeef) | ||
262 | #define BCM_6338_MISC_BASE (0xdeadbeef) | ||
196 | 263 | ||
197 | /* | 264 | /* |
198 | * 6345 register sets base address | 265 | * 6345 register sets base address |
@@ -206,7 +273,6 @@ enum bcm63xx_regs_set { | |||
206 | #define BCM_6345_UART1_BASE (0xdeadbeef) | 273 | #define BCM_6345_UART1_BASE (0xdeadbeef) |
207 | #define BCM_6345_GPIO_BASE (0xfffe0400) | 274 | #define BCM_6345_GPIO_BASE (0xfffe0400) |
208 | #define BCM_6345_SPI_BASE (0xdeadbeef) | 275 | #define BCM_6345_SPI_BASE (0xdeadbeef) |
209 | #define BCM_6345_SPI2_BASE (0xdeadbeef) | ||
210 | #define BCM_6345_UDC0_BASE (0xdeadbeef) | 276 | #define BCM_6345_UDC0_BASE (0xdeadbeef) |
211 | #define BCM_6345_USBDMA_BASE (0xfffe2800) | 277 | #define BCM_6345_USBDMA_BASE (0xfffe2800) |
212 | #define BCM_6345_ENET0_BASE (0xfffe1800) | 278 | #define BCM_6345_ENET0_BASE (0xfffe1800) |
@@ -216,6 +282,7 @@ enum bcm63xx_regs_set { | |||
216 | #define BCM_6345_ENETSW_BASE (0xdeadbeef) | 282 | #define BCM_6345_ENETSW_BASE (0xdeadbeef) |
217 | #define BCM_6345_PCMCIA_BASE (0xfffe2028) | 283 | #define BCM_6345_PCMCIA_BASE (0xfffe2028) |
218 | #define BCM_6345_MPI_BASE (0xfffe2000) | 284 | #define BCM_6345_MPI_BASE (0xfffe2000) |
285 | #define BCM_6345_PCIE_BASE (0xdeadbeef) | ||
219 | #define BCM_6345_OHCI0_BASE (0xfffe2100) | 286 | #define BCM_6345_OHCI0_BASE (0xfffe2100) |
220 | #define BCM_6345_OHCI_PRIV_BASE (0xfffe2200) | 287 | #define BCM_6345_OHCI_PRIV_BASE (0xfffe2200) |
221 | #define BCM_6345_USBH_PRIV_BASE (0xdeadbeef) | 288 | #define BCM_6345_USBH_PRIV_BASE (0xdeadbeef) |
@@ -237,6 +304,8 @@ enum bcm63xx_regs_set { | |||
237 | #define BCM_6345_PCMDMA_BASE (0xdeadbeef) | 304 | #define BCM_6345_PCMDMA_BASE (0xdeadbeef) |
238 | #define BCM_6345_PCMDMAC_BASE (0xdeadbeef) | 305 | #define BCM_6345_PCMDMAC_BASE (0xdeadbeef) |
239 | #define BCM_6345_PCMDMAS_BASE (0xdeadbeef) | 306 | #define BCM_6345_PCMDMAS_BASE (0xdeadbeef) |
307 | #define BCM_6345_RNG_BASE (0xdeadbeef) | ||
308 | #define BCM_6345_MISC_BASE (0xdeadbeef) | ||
240 | 309 | ||
241 | /* | 310 | /* |
242 | * 6348 register sets base address | 311 | * 6348 register sets base address |
@@ -249,13 +318,13 @@ enum bcm63xx_regs_set { | |||
249 | #define BCM_6348_UART1_BASE (0xdeadbeef) | 318 | #define BCM_6348_UART1_BASE (0xdeadbeef) |
250 | #define BCM_6348_GPIO_BASE (0xfffe0400) | 319 | #define BCM_6348_GPIO_BASE (0xfffe0400) |
251 | #define BCM_6348_SPI_BASE (0xfffe0c00) | 320 | #define BCM_6348_SPI_BASE (0xfffe0c00) |
252 | #define BCM_6348_SPI2_BASE (0xdeadbeef) | ||
253 | #define BCM_6348_UDC0_BASE (0xfffe1000) | 321 | #define BCM_6348_UDC0_BASE (0xfffe1000) |
254 | #define BCM_6348_OHCI0_BASE (0xfffe1b00) | 322 | #define BCM_6348_OHCI0_BASE (0xfffe1b00) |
255 | #define BCM_6348_OHCI_PRIV_BASE (0xfffe1c00) | 323 | #define BCM_6348_OHCI_PRIV_BASE (0xfffe1c00) |
256 | #define BCM_6348_USBH_PRIV_BASE (0xdeadbeef) | 324 | #define BCM_6348_USBH_PRIV_BASE (0xdeadbeef) |
257 | #define BCM_6348_MPI_BASE (0xfffe2000) | 325 | #define BCM_6348_MPI_BASE (0xfffe2000) |
258 | #define BCM_6348_PCMCIA_BASE (0xfffe2054) | 326 | #define BCM_6348_PCMCIA_BASE (0xfffe2054) |
327 | #define BCM_6348_PCIE_BASE (0xdeadbeef) | ||
259 | #define BCM_6348_SDRAM_REGS_BASE (0xfffe2300) | 328 | #define BCM_6348_SDRAM_REGS_BASE (0xfffe2300) |
260 | #define BCM_6348_M2M_BASE (0xfffe2800) | 329 | #define BCM_6348_M2M_BASE (0xfffe2800) |
261 | #define BCM_6348_DSL_BASE (0xfffe3000) | 330 | #define BCM_6348_DSL_BASE (0xfffe3000) |
@@ -278,6 +347,8 @@ enum bcm63xx_regs_set { | |||
278 | #define BCM_6348_PCMDMA_BASE (0xdeadbeef) | 347 | #define BCM_6348_PCMDMA_BASE (0xdeadbeef) |
279 | #define BCM_6348_PCMDMAC_BASE (0xdeadbeef) | 348 | #define BCM_6348_PCMDMAC_BASE (0xdeadbeef) |
280 | #define BCM_6348_PCMDMAS_BASE (0xdeadbeef) | 349 | #define BCM_6348_PCMDMAS_BASE (0xdeadbeef) |
350 | #define BCM_6348_RNG_BASE (0xdeadbeef) | ||
351 | #define BCM_6348_MISC_BASE (0xdeadbeef) | ||
281 | 352 | ||
282 | /* | 353 | /* |
283 | * 6358 register sets base address | 354 | * 6358 register sets base address |
@@ -289,14 +360,14 @@ enum bcm63xx_regs_set { | |||
289 | #define BCM_6358_UART0_BASE (0xfffe0100) | 360 | #define BCM_6358_UART0_BASE (0xfffe0100) |
290 | #define BCM_6358_UART1_BASE (0xfffe0120) | 361 | #define BCM_6358_UART1_BASE (0xfffe0120) |
291 | #define BCM_6358_GPIO_BASE (0xfffe0080) | 362 | #define BCM_6358_GPIO_BASE (0xfffe0080) |
292 | #define BCM_6358_SPI_BASE (0xdeadbeef) | 363 | #define BCM_6358_SPI_BASE (0xfffe0800) |
293 | #define BCM_6358_SPI2_BASE (0xfffe0800) | ||
294 | #define BCM_6358_UDC0_BASE (0xfffe0800) | 364 | #define BCM_6358_UDC0_BASE (0xfffe0800) |
295 | #define BCM_6358_OHCI0_BASE (0xfffe1400) | 365 | #define BCM_6358_OHCI0_BASE (0xfffe1400) |
296 | #define BCM_6358_OHCI_PRIV_BASE (0xdeadbeef) | 366 | #define BCM_6358_OHCI_PRIV_BASE (0xdeadbeef) |
297 | #define BCM_6358_USBH_PRIV_BASE (0xfffe1500) | 367 | #define BCM_6358_USBH_PRIV_BASE (0xfffe1500) |
298 | #define BCM_6358_MPI_BASE (0xfffe1000) | 368 | #define BCM_6358_MPI_BASE (0xfffe1000) |
299 | #define BCM_6358_PCMCIA_BASE (0xfffe1054) | 369 | #define BCM_6358_PCMCIA_BASE (0xfffe1054) |
370 | #define BCM_6358_PCIE_BASE (0xdeadbeef) | ||
300 | #define BCM_6358_SDRAM_REGS_BASE (0xfffe2300) | 371 | #define BCM_6358_SDRAM_REGS_BASE (0xfffe2300) |
301 | #define BCM_6358_M2M_BASE (0xdeadbeef) | 372 | #define BCM_6358_M2M_BASE (0xdeadbeef) |
302 | #define BCM_6358_DSL_BASE (0xfffe3000) | 373 | #define BCM_6358_DSL_BASE (0xfffe3000) |
@@ -319,6 +390,8 @@ enum bcm63xx_regs_set { | |||
319 | #define BCM_6358_PCMDMA_BASE (0xfffe1800) | 390 | #define BCM_6358_PCMDMA_BASE (0xfffe1800) |
320 | #define BCM_6358_PCMDMAC_BASE (0xfffe1900) | 391 | #define BCM_6358_PCMDMAC_BASE (0xfffe1900) |
321 | #define BCM_6358_PCMDMAS_BASE (0xfffe1a00) | 392 | #define BCM_6358_PCMDMAS_BASE (0xfffe1a00) |
393 | #define BCM_6358_RNG_BASE (0xdeadbeef) | ||
394 | #define BCM_6358_MISC_BASE (0xdeadbeef) | ||
322 | 395 | ||
323 | 396 | ||
324 | /* | 397 | /* |
@@ -331,14 +404,14 @@ enum bcm63xx_regs_set { | |||
331 | #define BCM_6368_UART0_BASE (0xb0000100) | 404 | #define BCM_6368_UART0_BASE (0xb0000100) |
332 | #define BCM_6368_UART1_BASE (0xb0000120) | 405 | #define BCM_6368_UART1_BASE (0xb0000120) |
333 | #define BCM_6368_GPIO_BASE (0xb0000080) | 406 | #define BCM_6368_GPIO_BASE (0xb0000080) |
334 | #define BCM_6368_SPI_BASE (0xdeadbeef) | 407 | #define BCM_6368_SPI_BASE (0xb0000800) |
335 | #define BCM_6368_SPI2_BASE (0xb0000800) | ||
336 | #define BCM_6368_UDC0_BASE (0xdeadbeef) | 408 | #define BCM_6368_UDC0_BASE (0xdeadbeef) |
337 | #define BCM_6368_OHCI0_BASE (0xb0001600) | 409 | #define BCM_6368_OHCI0_BASE (0xb0001600) |
338 | #define BCM_6368_OHCI_PRIV_BASE (0xdeadbeef) | 410 | #define BCM_6368_OHCI_PRIV_BASE (0xdeadbeef) |
339 | #define BCM_6368_USBH_PRIV_BASE (0xb0001700) | 411 | #define BCM_6368_USBH_PRIV_BASE (0xb0001700) |
340 | #define BCM_6368_MPI_BASE (0xb0001000) | 412 | #define BCM_6368_MPI_BASE (0xb0001000) |
341 | #define BCM_6368_PCMCIA_BASE (0xb0001054) | 413 | #define BCM_6368_PCMCIA_BASE (0xb0001054) |
414 | #define BCM_6368_PCIE_BASE (0xdeadbeef) | ||
342 | #define BCM_6368_SDRAM_REGS_BASE (0xdeadbeef) | 415 | #define BCM_6368_SDRAM_REGS_BASE (0xdeadbeef) |
343 | #define BCM_6368_M2M_BASE (0xdeadbeef) | 416 | #define BCM_6368_M2M_BASE (0xdeadbeef) |
344 | #define BCM_6368_DSL_BASE (0xdeadbeef) | 417 | #define BCM_6368_DSL_BASE (0xdeadbeef) |
@@ -361,6 +434,8 @@ enum bcm63xx_regs_set { | |||
361 | #define BCM_6368_PCMDMA_BASE (0xb0005800) | 434 | #define BCM_6368_PCMDMA_BASE (0xb0005800) |
362 | #define BCM_6368_PCMDMAC_BASE (0xb0005a00) | 435 | #define BCM_6368_PCMDMAC_BASE (0xb0005a00) |
363 | #define BCM_6368_PCMDMAS_BASE (0xb0005c00) | 436 | #define BCM_6368_PCMDMAS_BASE (0xb0005c00) |
437 | #define BCM_6368_RNG_BASE (0xb0004180) | ||
438 | #define BCM_6368_MISC_BASE (0xdeadbeef) | ||
364 | 439 | ||
365 | 440 | ||
366 | extern const unsigned long *bcm63xx_regs_base; | 441 | extern const unsigned long *bcm63xx_regs_base; |
@@ -379,13 +454,13 @@ extern const unsigned long *bcm63xx_regs_base; | |||
379 | __GEN_RSET_BASE(__cpu, UART1) \ | 454 | __GEN_RSET_BASE(__cpu, UART1) \ |
380 | __GEN_RSET_BASE(__cpu, GPIO) \ | 455 | __GEN_RSET_BASE(__cpu, GPIO) \ |
381 | __GEN_RSET_BASE(__cpu, SPI) \ | 456 | __GEN_RSET_BASE(__cpu, SPI) \ |
382 | __GEN_RSET_BASE(__cpu, SPI2) \ | ||
383 | __GEN_RSET_BASE(__cpu, UDC0) \ | 457 | __GEN_RSET_BASE(__cpu, UDC0) \ |
384 | __GEN_RSET_BASE(__cpu, OHCI0) \ | 458 | __GEN_RSET_BASE(__cpu, OHCI0) \ |
385 | __GEN_RSET_BASE(__cpu, OHCI_PRIV) \ | 459 | __GEN_RSET_BASE(__cpu, OHCI_PRIV) \ |
386 | __GEN_RSET_BASE(__cpu, USBH_PRIV) \ | 460 | __GEN_RSET_BASE(__cpu, USBH_PRIV) \ |
387 | __GEN_RSET_BASE(__cpu, MPI) \ | 461 | __GEN_RSET_BASE(__cpu, MPI) \ |
388 | __GEN_RSET_BASE(__cpu, PCMCIA) \ | 462 | __GEN_RSET_BASE(__cpu, PCMCIA) \ |
463 | __GEN_RSET_BASE(__cpu, PCIE) \ | ||
389 | __GEN_RSET_BASE(__cpu, DSL) \ | 464 | __GEN_RSET_BASE(__cpu, DSL) \ |
390 | __GEN_RSET_BASE(__cpu, ENET0) \ | 465 | __GEN_RSET_BASE(__cpu, ENET0) \ |
391 | __GEN_RSET_BASE(__cpu, ENET1) \ | 466 | __GEN_RSET_BASE(__cpu, ENET1) \ |
@@ -407,6 +482,8 @@ extern const unsigned long *bcm63xx_regs_base; | |||
407 | __GEN_RSET_BASE(__cpu, PCMDMA) \ | 482 | __GEN_RSET_BASE(__cpu, PCMDMA) \ |
408 | __GEN_RSET_BASE(__cpu, PCMDMAC) \ | 483 | __GEN_RSET_BASE(__cpu, PCMDMAC) \ |
409 | __GEN_RSET_BASE(__cpu, PCMDMAS) \ | 484 | __GEN_RSET_BASE(__cpu, PCMDMAS) \ |
485 | __GEN_RSET_BASE(__cpu, RNG) \ | ||
486 | __GEN_RSET_BASE(__cpu, MISC) \ | ||
410 | } | 487 | } |
411 | 488 | ||
412 | #define __GEN_CPU_REGS_TABLE(__cpu) \ | 489 | #define __GEN_CPU_REGS_TABLE(__cpu) \ |
@@ -418,13 +495,13 @@ extern const unsigned long *bcm63xx_regs_base; | |||
418 | [RSET_UART1] = BCM_## __cpu ##_UART1_BASE, \ | 495 | [RSET_UART1] = BCM_## __cpu ##_UART1_BASE, \ |
419 | [RSET_GPIO] = BCM_## __cpu ##_GPIO_BASE, \ | 496 | [RSET_GPIO] = BCM_## __cpu ##_GPIO_BASE, \ |
420 | [RSET_SPI] = BCM_## __cpu ##_SPI_BASE, \ | 497 | [RSET_SPI] = BCM_## __cpu ##_SPI_BASE, \ |
421 | [RSET_SPI2] = BCM_## __cpu ##_SPI2_BASE, \ | ||
422 | [RSET_UDC0] = BCM_## __cpu ##_UDC0_BASE, \ | 498 | [RSET_UDC0] = BCM_## __cpu ##_UDC0_BASE, \ |
423 | [RSET_OHCI0] = BCM_## __cpu ##_OHCI0_BASE, \ | 499 | [RSET_OHCI0] = BCM_## __cpu ##_OHCI0_BASE, \ |
424 | [RSET_OHCI_PRIV] = BCM_## __cpu ##_OHCI_PRIV_BASE, \ | 500 | [RSET_OHCI_PRIV] = BCM_## __cpu ##_OHCI_PRIV_BASE, \ |
425 | [RSET_USBH_PRIV] = BCM_## __cpu ##_USBH_PRIV_BASE, \ | 501 | [RSET_USBH_PRIV] = BCM_## __cpu ##_USBH_PRIV_BASE, \ |
426 | [RSET_MPI] = BCM_## __cpu ##_MPI_BASE, \ | 502 | [RSET_MPI] = BCM_## __cpu ##_MPI_BASE, \ |
427 | [RSET_PCMCIA] = BCM_## __cpu ##_PCMCIA_BASE, \ | 503 | [RSET_PCMCIA] = BCM_## __cpu ##_PCMCIA_BASE, \ |
504 | [RSET_PCIE] = BCM_## __cpu ##_PCIE_BASE, \ | ||
428 | [RSET_DSL] = BCM_## __cpu ##_DSL_BASE, \ | 505 | [RSET_DSL] = BCM_## __cpu ##_DSL_BASE, \ |
429 | [RSET_ENET0] = BCM_## __cpu ##_ENET0_BASE, \ | 506 | [RSET_ENET0] = BCM_## __cpu ##_ENET0_BASE, \ |
430 | [RSET_ENET1] = BCM_## __cpu ##_ENET1_BASE, \ | 507 | [RSET_ENET1] = BCM_## __cpu ##_ENET1_BASE, \ |
@@ -446,6 +523,8 @@ extern const unsigned long *bcm63xx_regs_base; | |||
446 | [RSET_PCMDMA] = BCM_## __cpu ##_PCMDMA_BASE, \ | 523 | [RSET_PCMDMA] = BCM_## __cpu ##_PCMDMA_BASE, \ |
447 | [RSET_PCMDMAC] = BCM_## __cpu ##_PCMDMAC_BASE, \ | 524 | [RSET_PCMDMAC] = BCM_## __cpu ##_PCMDMAC_BASE, \ |
448 | [RSET_PCMDMAS] = BCM_## __cpu ##_PCMDMAS_BASE, \ | 525 | [RSET_PCMDMAS] = BCM_## __cpu ##_PCMDMAS_BASE, \ |
526 | [RSET_RNG] = BCM_## __cpu ##_RNG_BASE, \ | ||
527 | [RSET_MISC] = BCM_## __cpu ##_MISC_BASE, \ | ||
449 | 528 | ||
450 | 529 | ||
451 | static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set) | 530 | static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set) |
@@ -453,6 +532,9 @@ static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set) | |||
453 | #ifdef BCMCPU_RUNTIME_DETECT | 532 | #ifdef BCMCPU_RUNTIME_DETECT |
454 | return bcm63xx_regs_base[set]; | 533 | return bcm63xx_regs_base[set]; |
455 | #else | 534 | #else |
535 | #ifdef CONFIG_BCM63XX_CPU_6328 | ||
536 | __GEN_RSET(6328) | ||
537 | #endif | ||
456 | #ifdef CONFIG_BCM63XX_CPU_6338 | 538 | #ifdef CONFIG_BCM63XX_CPU_6338 |
457 | __GEN_RSET(6338) | 539 | __GEN_RSET(6338) |
458 | #endif | 540 | #endif |
@@ -478,6 +560,7 @@ static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set) | |||
478 | */ | 560 | */ |
479 | enum bcm63xx_irq { | 561 | enum bcm63xx_irq { |
480 | IRQ_TIMER = 0, | 562 | IRQ_TIMER = 0, |
563 | IRQ_SPI, | ||
481 | IRQ_UART0, | 564 | IRQ_UART0, |
482 | IRQ_UART1, | 565 | IRQ_UART1, |
483 | IRQ_DSL, | 566 | IRQ_DSL, |
@@ -506,9 +589,51 @@ enum bcm63xx_irq { | |||
506 | }; | 589 | }; |
507 | 590 | ||
508 | /* | 591 | /* |
592 | * 6328 irqs | ||
593 | */ | ||
594 | #define BCM_6328_HIGH_IRQ_BASE (IRQ_INTERNAL_BASE + 32) | ||
595 | |||
596 | #define BCM_6328_TIMER_IRQ (IRQ_INTERNAL_BASE + 31) | ||
597 | #define BCM_6328_SPI_IRQ 0 | ||
598 | #define BCM_6328_UART0_IRQ (IRQ_INTERNAL_BASE + 28) | ||
599 | #define BCM_6328_UART1_IRQ (BCM_6328_HIGH_IRQ_BASE + 7) | ||
600 | #define BCM_6328_DSL_IRQ (IRQ_INTERNAL_BASE + 4) | ||
601 | #define BCM_6328_UDC0_IRQ 0 | ||
602 | #define BCM_6328_ENET0_IRQ 0 | ||
603 | #define BCM_6328_ENET1_IRQ 0 | ||
604 | #define BCM_6328_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12) | ||
605 | #define BCM_6328_OHCI0_IRQ (IRQ_INTERNAL_BASE + 9) | ||
606 | #define BCM_6328_EHCI0_IRQ (IRQ_INTERNAL_BASE + 10) | ||
607 | #define BCM_6328_PCMCIA_IRQ 0 | ||
608 | #define BCM_6328_ENET0_RXDMA_IRQ 0 | ||
609 | #define BCM_6328_ENET0_TXDMA_IRQ 0 | ||
610 | #define BCM_6328_ENET1_RXDMA_IRQ 0 | ||
611 | #define BCM_6328_ENET1_TXDMA_IRQ 0 | ||
612 | #define BCM_6328_PCI_IRQ (IRQ_INTERNAL_BASE + 23) | ||
613 | #define BCM_6328_ATM_IRQ 0 | ||
614 | #define BCM_6328_ENETSW_RXDMA0_IRQ (BCM_6328_HIGH_IRQ_BASE + 0) | ||
615 | #define BCM_6328_ENETSW_RXDMA1_IRQ (BCM_6328_HIGH_IRQ_BASE + 1) | ||
616 | #define BCM_6328_ENETSW_RXDMA2_IRQ (BCM_6328_HIGH_IRQ_BASE + 2) | ||
617 | #define BCM_6328_ENETSW_RXDMA3_IRQ (BCM_6328_HIGH_IRQ_BASE + 3) | ||
618 | #define BCM_6328_ENETSW_TXDMA0_IRQ (BCM_6328_HIGH_IRQ_BASE + 4) | ||
619 | #define BCM_6328_ENETSW_TXDMA1_IRQ (BCM_6328_HIGH_IRQ_BASE + 5) | ||
620 | #define BCM_6328_ENETSW_TXDMA2_IRQ (BCM_6328_HIGH_IRQ_BASE + 6) | ||
621 | #define BCM_6328_ENETSW_TXDMA3_IRQ (BCM_6328_HIGH_IRQ_BASE + 7) | ||
622 | #define BCM_6328_XTM_IRQ (BCM_6328_HIGH_IRQ_BASE + 31) | ||
623 | #define BCM_6328_XTM_DMA0_IRQ (BCM_6328_HIGH_IRQ_BASE + 11) | ||
624 | |||
625 | #define BCM_6328_PCM_DMA0_IRQ (IRQ_INTERNAL_BASE + 2) | ||
626 | #define BCM_6328_PCM_DMA1_IRQ (IRQ_INTERNAL_BASE + 3) | ||
627 | #define BCM_6328_EXT_IRQ0 (IRQ_INTERNAL_BASE + 24) | ||
628 | #define BCM_6328_EXT_IRQ1 (IRQ_INTERNAL_BASE + 25) | ||
629 | #define BCM_6328_EXT_IRQ2 (IRQ_INTERNAL_BASE + 26) | ||
630 | #define BCM_6328_EXT_IRQ3 (IRQ_INTERNAL_BASE + 27) | ||
631 | |||
632 | /* | ||
509 | * 6338 irqs | 633 | * 6338 irqs |
510 | */ | 634 | */ |
511 | #define BCM_6338_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) | 635 | #define BCM_6338_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) |
636 | #define BCM_6338_SPI_IRQ (IRQ_INTERNAL_BASE + 1) | ||
512 | #define BCM_6338_UART0_IRQ (IRQ_INTERNAL_BASE + 2) | 637 | #define BCM_6338_UART0_IRQ (IRQ_INTERNAL_BASE + 2) |
513 | #define BCM_6338_UART1_IRQ 0 | 638 | #define BCM_6338_UART1_IRQ 0 |
514 | #define BCM_6338_DSL_IRQ (IRQ_INTERNAL_BASE + 5) | 639 | #define BCM_6338_DSL_IRQ (IRQ_INTERNAL_BASE + 5) |
@@ -539,6 +664,7 @@ enum bcm63xx_irq { | |||
539 | * 6345 irqs | 664 | * 6345 irqs |
540 | */ | 665 | */ |
541 | #define BCM_6345_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) | 666 | #define BCM_6345_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) |
667 | #define BCM_6345_SPI_IRQ 0 | ||
542 | #define BCM_6345_UART0_IRQ (IRQ_INTERNAL_BASE + 2) | 668 | #define BCM_6345_UART0_IRQ (IRQ_INTERNAL_BASE + 2) |
543 | #define BCM_6345_UART1_IRQ 0 | 669 | #define BCM_6345_UART1_IRQ 0 |
544 | #define BCM_6345_DSL_IRQ (IRQ_INTERNAL_BASE + 3) | 670 | #define BCM_6345_DSL_IRQ (IRQ_INTERNAL_BASE + 3) |
@@ -569,6 +695,7 @@ enum bcm63xx_irq { | |||
569 | * 6348 irqs | 695 | * 6348 irqs |
570 | */ | 696 | */ |
571 | #define BCM_6348_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) | 697 | #define BCM_6348_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) |
698 | #define BCM_6348_SPI_IRQ (IRQ_INTERNAL_BASE + 1) | ||
572 | #define BCM_6348_UART0_IRQ (IRQ_INTERNAL_BASE + 2) | 699 | #define BCM_6348_UART0_IRQ (IRQ_INTERNAL_BASE + 2) |
573 | #define BCM_6348_UART1_IRQ 0 | 700 | #define BCM_6348_UART1_IRQ 0 |
574 | #define BCM_6348_DSL_IRQ (IRQ_INTERNAL_BASE + 4) | 701 | #define BCM_6348_DSL_IRQ (IRQ_INTERNAL_BASE + 4) |
@@ -599,6 +726,7 @@ enum bcm63xx_irq { | |||
599 | * 6358 irqs | 726 | * 6358 irqs |
600 | */ | 727 | */ |
601 | #define BCM_6358_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) | 728 | #define BCM_6358_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) |
729 | #define BCM_6358_SPI_IRQ (IRQ_INTERNAL_BASE + 1) | ||
602 | #define BCM_6358_UART0_IRQ (IRQ_INTERNAL_BASE + 2) | 730 | #define BCM_6358_UART0_IRQ (IRQ_INTERNAL_BASE + 2) |
603 | #define BCM_6358_UART1_IRQ (IRQ_INTERNAL_BASE + 3) | 731 | #define BCM_6358_UART1_IRQ (IRQ_INTERNAL_BASE + 3) |
604 | #define BCM_6358_DSL_IRQ (IRQ_INTERNAL_BASE + 29) | 732 | #define BCM_6358_DSL_IRQ (IRQ_INTERNAL_BASE + 29) |
@@ -638,6 +766,7 @@ enum bcm63xx_irq { | |||
638 | #define BCM_6368_HIGH_IRQ_BASE (IRQ_INTERNAL_BASE + 32) | 766 | #define BCM_6368_HIGH_IRQ_BASE (IRQ_INTERNAL_BASE + 32) |
639 | 767 | ||
640 | #define BCM_6368_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) | 768 | #define BCM_6368_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) |
769 | #define BCM_6368_SPI_IRQ (IRQ_INTERNAL_BASE + 1) | ||
641 | #define BCM_6368_UART0_IRQ (IRQ_INTERNAL_BASE + 2) | 770 | #define BCM_6368_UART0_IRQ (IRQ_INTERNAL_BASE + 2) |
642 | #define BCM_6368_UART1_IRQ (IRQ_INTERNAL_BASE + 3) | 771 | #define BCM_6368_UART1_IRQ (IRQ_INTERNAL_BASE + 3) |
643 | #define BCM_6368_DSL_IRQ (IRQ_INTERNAL_BASE + 4) | 772 | #define BCM_6368_DSL_IRQ (IRQ_INTERNAL_BASE + 4) |
@@ -677,6 +806,7 @@ extern const int *bcm63xx_irqs; | |||
677 | 806 | ||
678 | #define __GEN_CPU_IRQ_TABLE(__cpu) \ | 807 | #define __GEN_CPU_IRQ_TABLE(__cpu) \ |
679 | [IRQ_TIMER] = BCM_## __cpu ##_TIMER_IRQ, \ | 808 | [IRQ_TIMER] = BCM_## __cpu ##_TIMER_IRQ, \ |
809 | [IRQ_SPI] = BCM_## __cpu ##_SPI_IRQ, \ | ||
680 | [IRQ_UART0] = BCM_## __cpu ##_UART0_IRQ, \ | 810 | [IRQ_UART0] = BCM_## __cpu ##_UART0_IRQ, \ |
681 | [IRQ_UART1] = BCM_## __cpu ##_UART1_IRQ, \ | 811 | [IRQ_UART1] = BCM_## __cpu ##_UART1_IRQ, \ |
682 | [IRQ_DSL] = BCM_## __cpu ##_DSL_IRQ, \ | 812 | [IRQ_DSL] = BCM_## __cpu ##_DSL_IRQ, \ |
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h new file mode 100644 index 000000000000..354b8481ec4a --- /dev/null +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __BCM63XX_FLASH_H | ||
2 | #define __BCM63XX_FLASH_H | ||
3 | |||
4 | enum { | ||
5 | BCM63XX_FLASH_TYPE_PARALLEL, | ||
6 | BCM63XX_FLASH_TYPE_SERIAL, | ||
7 | BCM63XX_FLASH_TYPE_NAND, | ||
8 | }; | ||
9 | |||
10 | int __init bcm63xx_flash_register(void); | ||
11 | |||
12 | #endif /* __BCM63XX_FLASH_H */ | ||
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h new file mode 100644 index 000000000000..7d98dbe5d4b5 --- /dev/null +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h | |||
@@ -0,0 +1,89 @@ | |||
1 | #ifndef BCM63XX_DEV_SPI_H | ||
2 | #define BCM63XX_DEV_SPI_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <bcm63xx_io.h> | ||
6 | #include <bcm63xx_regs.h> | ||
7 | |||
8 | int __init bcm63xx_spi_register(void); | ||
9 | |||
10 | struct bcm63xx_spi_pdata { | ||
11 | unsigned int fifo_size; | ||
12 | int bus_num; | ||
13 | int num_chipselect; | ||
14 | u32 speed_hz; | ||
15 | }; | ||
16 | |||
17 | enum bcm63xx_regs_spi { | ||
18 | SPI_CMD, | ||
19 | SPI_INT_STATUS, | ||
20 | SPI_INT_MASK_ST, | ||
21 | SPI_INT_MASK, | ||
22 | SPI_ST, | ||
23 | SPI_CLK_CFG, | ||
24 | SPI_FILL_BYTE, | ||
25 | SPI_MSG_TAIL, | ||
26 | SPI_RX_TAIL, | ||
27 | SPI_MSG_CTL, | ||
28 | SPI_MSG_DATA, | ||
29 | SPI_RX_DATA, | ||
30 | }; | ||
31 | |||
32 | #define __GEN_SPI_RSET_BASE(__cpu, __rset) \ | ||
33 | case SPI_## __rset: \ | ||
34 | return SPI_## __cpu ##_## __rset; | ||
35 | |||
36 | #define __GEN_SPI_RSET(__cpu) \ | ||
37 | switch (reg) { \ | ||
38 | __GEN_SPI_RSET_BASE(__cpu, CMD) \ | ||
39 | __GEN_SPI_RSET_BASE(__cpu, INT_STATUS) \ | ||
40 | __GEN_SPI_RSET_BASE(__cpu, INT_MASK_ST) \ | ||
41 | __GEN_SPI_RSET_BASE(__cpu, INT_MASK) \ | ||
42 | __GEN_SPI_RSET_BASE(__cpu, ST) \ | ||
43 | __GEN_SPI_RSET_BASE(__cpu, CLK_CFG) \ | ||
44 | __GEN_SPI_RSET_BASE(__cpu, FILL_BYTE) \ | ||
45 | __GEN_SPI_RSET_BASE(__cpu, MSG_TAIL) \ | ||
46 | __GEN_SPI_RSET_BASE(__cpu, RX_TAIL) \ | ||
47 | __GEN_SPI_RSET_BASE(__cpu, MSG_CTL) \ | ||
48 | __GEN_SPI_RSET_BASE(__cpu, MSG_DATA) \ | ||
49 | __GEN_SPI_RSET_BASE(__cpu, RX_DATA) \ | ||
50 | } | ||
51 | |||
52 | #define __GEN_SPI_REGS_TABLE(__cpu) \ | ||
53 | [SPI_CMD] = SPI_## __cpu ##_CMD, \ | ||
54 | [SPI_INT_STATUS] = SPI_## __cpu ##_INT_STATUS, \ | ||
55 | [SPI_INT_MASK_ST] = SPI_## __cpu ##_INT_MASK_ST, \ | ||
56 | [SPI_INT_MASK] = SPI_## __cpu ##_INT_MASK, \ | ||
57 | [SPI_ST] = SPI_## __cpu ##_ST, \ | ||
58 | [SPI_CLK_CFG] = SPI_## __cpu ##_CLK_CFG, \ | ||
59 | [SPI_FILL_BYTE] = SPI_## __cpu ##_FILL_BYTE, \ | ||
60 | [SPI_MSG_TAIL] = SPI_## __cpu ##_MSG_TAIL, \ | ||
61 | [SPI_RX_TAIL] = SPI_## __cpu ##_RX_TAIL, \ | ||
62 | [SPI_MSG_CTL] = SPI_## __cpu ##_MSG_CTL, \ | ||
63 | [SPI_MSG_DATA] = SPI_## __cpu ##_MSG_DATA, \ | ||
64 | [SPI_RX_DATA] = SPI_## __cpu ##_RX_DATA, | ||
65 | |||
66 | static inline unsigned long bcm63xx_spireg(enum bcm63xx_regs_spi reg) | ||
67 | { | ||
68 | #ifdef BCMCPU_RUNTIME_DETECT | ||
69 | extern const unsigned long *bcm63xx_regs_spi; | ||
70 | |||
71 | return bcm63xx_regs_spi[reg]; | ||
72 | #else | ||
73 | #ifdef CONFIG_BCM63XX_CPU_6338 | ||
74 | __GEN_SPI_RSET(6338) | ||
75 | #endif | ||
76 | #ifdef CONFIG_BCM63XX_CPU_6348 | ||
77 | __GEN_SPI_RSET(6348) | ||
78 | #endif | ||
79 | #ifdef CONFIG_BCM63XX_CPU_6358 | ||
80 | __GEN_SPI_RSET(6358) | ||
81 | #endif | ||
82 | #ifdef CONFIG_BCM63XX_CPU_6368 | ||
83 | __GEN_SPI_RSET(6368) | ||
84 | #endif | ||
85 | #endif | ||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | #endif /* BCM63XX_DEV_SPI_H */ | ||
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h index 1d7dd96aa460..0a9891f7580d 100644 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h | |||
@@ -9,6 +9,8 @@ int __init bcm63xx_gpio_init(void); | |||
9 | static inline unsigned long bcm63xx_gpio_count(void) | 9 | static inline unsigned long bcm63xx_gpio_count(void) |
10 | { | 10 | { |
11 | switch (bcm63xx_get_cpu_id()) { | 11 | switch (bcm63xx_get_cpu_id()) { |
12 | case BCM6328_CPU_ID: | ||
13 | return 32; | ||
12 | case BCM6358_CPU_ID: | 14 | case BCM6358_CPU_ID: |
13 | return 40; | 15 | return 40; |
14 | case BCM6338_CPU_ID: | 16 | case BCM6338_CPU_ID: |
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h index 72477a6441dd..9203d90e610c 100644 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h | |||
@@ -40,6 +40,10 @@ | |||
40 | #define BCM_CB_MEM_END_PA (BCM_CB_MEM_BASE_PA + \ | 40 | #define BCM_CB_MEM_END_PA (BCM_CB_MEM_BASE_PA + \ |
41 | BCM_CB_MEM_SIZE - 1) | 41 | BCM_CB_MEM_SIZE - 1) |
42 | 42 | ||
43 | #define BCM_PCIE_MEM_BASE_PA 0x10f00000 | ||
44 | #define BCM_PCIE_MEM_SIZE (16 * 1024 * 1024) | ||
45 | #define BCM_PCIE_MEM_END_PA (BCM_PCIE_MEM_BASE_PA + \ | ||
46 | BCM_PCIE_MEM_SIZE - 1) | ||
43 | 47 | ||
44 | /* | 48 | /* |
45 | * Internal registers are accessed through KSEG3 | 49 | * Internal registers are accessed through KSEG3 |
@@ -85,11 +89,15 @@ | |||
85 | #define bcm_mpi_writel(v, o) bcm_rset_writel(RSET_MPI, (v), (o)) | 89 | #define bcm_mpi_writel(v, o) bcm_rset_writel(RSET_MPI, (v), (o)) |
86 | #define bcm_pcmcia_readl(o) bcm_rset_readl(RSET_PCMCIA, (o)) | 90 | #define bcm_pcmcia_readl(o) bcm_rset_readl(RSET_PCMCIA, (o)) |
87 | #define bcm_pcmcia_writel(v, o) bcm_rset_writel(RSET_PCMCIA, (v), (o)) | 91 | #define bcm_pcmcia_writel(v, o) bcm_rset_writel(RSET_PCMCIA, (v), (o)) |
92 | #define bcm_pcie_readl(o) bcm_rset_readl(RSET_PCIE, (o)) | ||
93 | #define bcm_pcie_writel(v, o) bcm_rset_writel(RSET_PCIE, (v), (o)) | ||
88 | #define bcm_sdram_readl(o) bcm_rset_readl(RSET_SDRAM, (o)) | 94 | #define bcm_sdram_readl(o) bcm_rset_readl(RSET_SDRAM, (o)) |
89 | #define bcm_sdram_writel(v, o) bcm_rset_writel(RSET_SDRAM, (v), (o)) | 95 | #define bcm_sdram_writel(v, o) bcm_rset_writel(RSET_SDRAM, (v), (o)) |
90 | #define bcm_memc_readl(o) bcm_rset_readl(RSET_MEMC, (o)) | 96 | #define bcm_memc_readl(o) bcm_rset_readl(RSET_MEMC, (o)) |
91 | #define bcm_memc_writel(v, o) bcm_rset_writel(RSET_MEMC, (v), (o)) | 97 | #define bcm_memc_writel(v, o) bcm_rset_writel(RSET_MEMC, (v), (o)) |
92 | #define bcm_ddr_readl(o) bcm_rset_readl(RSET_DDR, (o)) | 98 | #define bcm_ddr_readl(o) bcm_rset_readl(RSET_DDR, (o)) |
93 | #define bcm_ddr_writel(v, o) bcm_rset_writel(RSET_DDR, (v), (o)) | 99 | #define bcm_ddr_writel(v, o) bcm_rset_writel(RSET_DDR, (v), (o)) |
100 | #define bcm_misc_readl(o) bcm_rset_readl(RSET_MISC, (o)) | ||
101 | #define bcm_misc_writel(v, o) bcm_rset_writel(RSET_MISC, (v), (o)) | ||
94 | 102 | ||
95 | #endif /* ! BCM63XX_IO_H_ */ | 103 | #endif /* ! BCM63XX_IO_H_ */ |
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h index fdcd78ca1b03..4ccc2a748aff 100644 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | |||
@@ -15,6 +15,30 @@ | |||
15 | /* Clock Control register */ | 15 | /* Clock Control register */ |
16 | #define PERF_CKCTL_REG 0x4 | 16 | #define PERF_CKCTL_REG 0x4 |
17 | 17 | ||
18 | #define CKCTL_6328_PHYMIPS_EN (1 << 0) | ||
19 | #define CKCTL_6328_ADSL_QPROC_EN (1 << 1) | ||
20 | #define CKCTL_6328_ADSL_AFE_EN (1 << 2) | ||
21 | #define CKCTL_6328_ADSL_EN (1 << 3) | ||
22 | #define CKCTL_6328_MIPS_EN (1 << 4) | ||
23 | #define CKCTL_6328_SAR_EN (1 << 5) | ||
24 | #define CKCTL_6328_PCM_EN (1 << 6) | ||
25 | #define CKCTL_6328_USBD_EN (1 << 7) | ||
26 | #define CKCTL_6328_USBH_EN (1 << 8) | ||
27 | #define CKCTL_6328_HSSPI_EN (1 << 9) | ||
28 | #define CKCTL_6328_PCIE_EN (1 << 10) | ||
29 | #define CKCTL_6328_ROBOSW_EN (1 << 11) | ||
30 | |||
31 | #define CKCTL_6328_ALL_SAFE_EN (CKCTL_6328_PHYMIPS_EN | \ | ||
32 | CKCTL_6328_ADSL_QPROC_EN | \ | ||
33 | CKCTL_6328_ADSL_AFE_EN | \ | ||
34 | CKCTL_6328_ADSL_EN | \ | ||
35 | CKCTL_6328_SAR_EN | \ | ||
36 | CKCTL_6328_PCM_EN | \ | ||
37 | CKCTL_6328_USBD_EN | \ | ||
38 | CKCTL_6328_USBH_EN | \ | ||
39 | CKCTL_6328_ROBOSW_EN | \ | ||
40 | CKCTL_6328_PCIE_EN) | ||
41 | |||
18 | #define CKCTL_6338_ADSLPHY_EN (1 << 0) | 42 | #define CKCTL_6338_ADSLPHY_EN (1 << 0) |
19 | #define CKCTL_6338_MPI_EN (1 << 1) | 43 | #define CKCTL_6338_MPI_EN (1 << 1) |
20 | #define CKCTL_6338_DRAM_EN (1 << 2) | 44 | #define CKCTL_6338_DRAM_EN (1 << 2) |
@@ -90,35 +114,36 @@ | |||
90 | #define CKCTL_6368_PHYMIPS_EN (1 << 6) | 114 | #define CKCTL_6368_PHYMIPS_EN (1 << 6) |
91 | #define CKCTL_6368_SWPKT_USB_EN (1 << 7) | 115 | #define CKCTL_6368_SWPKT_USB_EN (1 << 7) |
92 | #define CKCTL_6368_SWPKT_SAR_EN (1 << 8) | 116 | #define CKCTL_6368_SWPKT_SAR_EN (1 << 8) |
93 | #define CKCTL_6368_SPI_CLK_EN (1 << 9) | 117 | #define CKCTL_6368_SPI_EN (1 << 9) |
94 | #define CKCTL_6368_USBD_CLK_EN (1 << 10) | 118 | #define CKCTL_6368_USBD_EN (1 << 10) |
95 | #define CKCTL_6368_SAR_CLK_EN (1 << 11) | 119 | #define CKCTL_6368_SAR_EN (1 << 11) |
96 | #define CKCTL_6368_ROBOSW_CLK_EN (1 << 12) | 120 | #define CKCTL_6368_ROBOSW_EN (1 << 12) |
97 | #define CKCTL_6368_UTOPIA_CLK_EN (1 << 13) | 121 | #define CKCTL_6368_UTOPIA_EN (1 << 13) |
98 | #define CKCTL_6368_PCM_CLK_EN (1 << 14) | 122 | #define CKCTL_6368_PCM_EN (1 << 14) |
99 | #define CKCTL_6368_USBH_CLK_EN (1 << 15) | 123 | #define CKCTL_6368_USBH_EN (1 << 15) |
100 | #define CKCTL_6368_DISABLE_GLESS_EN (1 << 16) | 124 | #define CKCTL_6368_DISABLE_GLESS_EN (1 << 16) |
101 | #define CKCTL_6368_NAND_CLK_EN (1 << 17) | 125 | #define CKCTL_6368_NAND_EN (1 << 17) |
102 | #define CKCTL_6368_IPSEC_CLK_EN (1 << 18) | 126 | #define CKCTL_6368_IPSEC_EN (1 << 18) |
103 | 127 | ||
104 | #define CKCTL_6368_ALL_SAFE_EN (CKCTL_6368_SWPKT_USB_EN | \ | 128 | #define CKCTL_6368_ALL_SAFE_EN (CKCTL_6368_SWPKT_USB_EN | \ |
105 | CKCTL_6368_SWPKT_SAR_EN | \ | 129 | CKCTL_6368_SWPKT_SAR_EN | \ |
106 | CKCTL_6368_SPI_CLK_EN | \ | 130 | CKCTL_6368_SPI_EN | \ |
107 | CKCTL_6368_USBD_CLK_EN | \ | 131 | CKCTL_6368_USBD_EN | \ |
108 | CKCTL_6368_SAR_CLK_EN | \ | 132 | CKCTL_6368_SAR_EN | \ |
109 | CKCTL_6368_ROBOSW_CLK_EN | \ | 133 | CKCTL_6368_ROBOSW_EN | \ |
110 | CKCTL_6368_UTOPIA_CLK_EN | \ | 134 | CKCTL_6368_UTOPIA_EN | \ |
111 | CKCTL_6368_PCM_CLK_EN | \ | 135 | CKCTL_6368_PCM_EN | \ |
112 | CKCTL_6368_USBH_CLK_EN | \ | 136 | CKCTL_6368_USBH_EN | \ |
113 | CKCTL_6368_DISABLE_GLESS_EN | \ | 137 | CKCTL_6368_DISABLE_GLESS_EN | \ |
114 | CKCTL_6368_NAND_CLK_EN | \ | 138 | CKCTL_6368_NAND_EN | \ |
115 | CKCTL_6368_IPSEC_CLK_EN) | 139 | CKCTL_6368_IPSEC_EN) |
116 | 140 | ||
117 | /* System PLL Control register */ | 141 | /* System PLL Control register */ |
118 | #define PERF_SYS_PLL_CTL_REG 0x8 | 142 | #define PERF_SYS_PLL_CTL_REG 0x8 |
119 | #define SYS_PLL_SOFT_RESET 0x1 | 143 | #define SYS_PLL_SOFT_RESET 0x1 |
120 | 144 | ||
121 | /* Interrupt Mask register */ | 145 | /* Interrupt Mask register */ |
146 | #define PERF_IRQMASK_6328_REG 0x20 | ||
122 | #define PERF_IRQMASK_6338_REG 0xc | 147 | #define PERF_IRQMASK_6338_REG 0xc |
123 | #define PERF_IRQMASK_6345_REG 0xc | 148 | #define PERF_IRQMASK_6345_REG 0xc |
124 | #define PERF_IRQMASK_6348_REG 0xc | 149 | #define PERF_IRQMASK_6348_REG 0xc |
@@ -126,6 +151,7 @@ | |||
126 | #define PERF_IRQMASK_6368_REG 0x20 | 151 | #define PERF_IRQMASK_6368_REG 0x20 |
127 | 152 | ||
128 | /* Interrupt Status register */ | 153 | /* Interrupt Status register */ |
154 | #define PERF_IRQSTAT_6328_REG 0x28 | ||
129 | #define PERF_IRQSTAT_6338_REG 0x10 | 155 | #define PERF_IRQSTAT_6338_REG 0x10 |
130 | #define PERF_IRQSTAT_6345_REG 0x10 | 156 | #define PERF_IRQSTAT_6345_REG 0x10 |
131 | #define PERF_IRQSTAT_6348_REG 0x10 | 157 | #define PERF_IRQSTAT_6348_REG 0x10 |
@@ -133,6 +159,7 @@ | |||
133 | #define PERF_IRQSTAT_6368_REG 0x28 | 159 | #define PERF_IRQSTAT_6368_REG 0x28 |
134 | 160 | ||
135 | /* External Interrupt Configuration register */ | 161 | /* External Interrupt Configuration register */ |
162 | #define PERF_EXTIRQ_CFG_REG_6328 0x18 | ||
136 | #define PERF_EXTIRQ_CFG_REG_6338 0x14 | 163 | #define PERF_EXTIRQ_CFG_REG_6338 0x14 |
137 | #define PERF_EXTIRQ_CFG_REG_6348 0x14 | 164 | #define PERF_EXTIRQ_CFG_REG_6348 0x14 |
138 | #define PERF_EXTIRQ_CFG_REG_6358 0x14 | 165 | #define PERF_EXTIRQ_CFG_REG_6358 0x14 |
@@ -162,8 +189,21 @@ | |||
162 | 189 | ||
163 | /* Soft Reset register */ | 190 | /* Soft Reset register */ |
164 | #define PERF_SOFTRESET_REG 0x28 | 191 | #define PERF_SOFTRESET_REG 0x28 |
192 | #define PERF_SOFTRESET_6328_REG 0x10 | ||
165 | #define PERF_SOFTRESET_6368_REG 0x10 | 193 | #define PERF_SOFTRESET_6368_REG 0x10 |
166 | 194 | ||
195 | #define SOFTRESET_6328_SPI_MASK (1 << 0) | ||
196 | #define SOFTRESET_6328_EPHY_MASK (1 << 1) | ||
197 | #define SOFTRESET_6328_SAR_MASK (1 << 2) | ||
198 | #define SOFTRESET_6328_ENETSW_MASK (1 << 3) | ||
199 | #define SOFTRESET_6328_USBS_MASK (1 << 4) | ||
200 | #define SOFTRESET_6328_USBH_MASK (1 << 5) | ||
201 | #define SOFTRESET_6328_PCM_MASK (1 << 6) | ||
202 | #define SOFTRESET_6328_PCIE_CORE_MASK (1 << 7) | ||
203 | #define SOFTRESET_6328_PCIE_MASK (1 << 8) | ||
204 | #define SOFTRESET_6328_PCIE_EXT_MASK (1 << 9) | ||
205 | #define SOFTRESET_6328_PCIE_HARD_MASK (1 << 10) | ||
206 | |||
167 | #define SOFTRESET_6338_SPI_MASK (1 << 0) | 207 | #define SOFTRESET_6338_SPI_MASK (1 << 0) |
168 | #define SOFTRESET_6338_ENET_MASK (1 << 2) | 208 | #define SOFTRESET_6338_ENET_MASK (1 << 2) |
169 | #define SOFTRESET_6338_USBH_MASK (1 << 3) | 209 | #define SOFTRESET_6338_USBH_MASK (1 << 3) |
@@ -307,6 +347,8 @@ | |||
307 | /* Watchdog reset length register */ | 347 | /* Watchdog reset length register */ |
308 | #define WDT_RSTLEN_REG 0x8 | 348 | #define WDT_RSTLEN_REG 0x8 |
309 | 349 | ||
350 | /* Watchdog soft reset register (BCM6328 only) */ | ||
351 | #define WDT_SOFTRESET_REG 0xc | ||
310 | 352 | ||
311 | /************************************************************************* | 353 | /************************************************************************* |
312 | * _REG relative to RSET_UARTx | 354 | * _REG relative to RSET_UARTx |
@@ -507,6 +549,15 @@ | |||
507 | #define GPIO_BASEMODE_6368_MASK 0x7 | 549 | #define GPIO_BASEMODE_6368_MASK 0x7 |
508 | /* those bits must be kept as read in gpio basemode register*/ | 550 | /* those bits must be kept as read in gpio basemode register*/ |
509 | 551 | ||
552 | #define GPIO_STRAPBUS_REG 0x40 | ||
553 | #define STRAPBUS_6358_BOOT_SEL_PARALLEL (1 << 1) | ||
554 | #define STRAPBUS_6358_BOOT_SEL_SERIAL (0 << 1) | ||
555 | #define STRAPBUS_6368_BOOT_SEL_MASK 0x3 | ||
556 | #define STRAPBUS_6368_BOOT_SEL_NAND 0 | ||
557 | #define STRAPBUS_6368_BOOT_SEL_SERIAL 1 | ||
558 | #define STRAPBUS_6368_BOOT_SEL_PARALLEL 3 | ||
559 | |||
560 | |||
510 | /************************************************************************* | 561 | /************************************************************************* |
511 | * _REG relative to RSET_ENET | 562 | * _REG relative to RSET_ENET |
512 | *************************************************************************/ | 563 | *************************************************************************/ |
@@ -924,6 +975,8 @@ | |||
924 | * _REG relative to RSET_DDR | 975 | * _REG relative to RSET_DDR |
925 | *************************************************************************/ | 976 | *************************************************************************/ |
926 | 977 | ||
978 | #define DDR_CSEND_REG 0x8 | ||
979 | |||
927 | #define DDR_DMIPSPLLCFG_REG 0x18 | 980 | #define DDR_DMIPSPLLCFG_REG 0x18 |
928 | #define DMIPSPLLCFG_M1_SHIFT 0 | 981 | #define DMIPSPLLCFG_M1_SHIFT 0 |
929 | #define DMIPSPLLCFG_M1_MASK (0xff << DMIPSPLLCFG_M1_SHIFT) | 982 | #define DMIPSPLLCFG_M1_MASK (0xff << DMIPSPLLCFG_M1_SHIFT) |
@@ -973,4 +1026,201 @@ | |||
973 | #define M2M_SRCID_REG(x) ((x) * 0x40 + 0x14) | 1026 | #define M2M_SRCID_REG(x) ((x) * 0x40 + 0x14) |
974 | #define M2M_DSTID_REG(x) ((x) * 0x40 + 0x18) | 1027 | #define M2M_DSTID_REG(x) ((x) * 0x40 + 0x18) |
975 | 1028 | ||
1029 | /************************************************************************* | ||
1030 | * _REG relative to RSET_RNG | ||
1031 | *************************************************************************/ | ||
1032 | |||
1033 | #define RNG_CTRL 0x00 | ||
1034 | #define RNG_EN (1 << 0) | ||
1035 | |||
1036 | #define RNG_STAT 0x04 | ||
1037 | #define RNG_AVAIL_MASK (0xff000000) | ||
1038 | |||
1039 | #define RNG_DATA 0x08 | ||
1040 | #define RNG_THRES 0x0c | ||
1041 | #define RNG_MASK 0x10 | ||
1042 | |||
1043 | /************************************************************************* | ||
1044 | * _REG relative to RSET_SPI | ||
1045 | *************************************************************************/ | ||
1046 | |||
1047 | /* BCM 6338 SPI core */ | ||
1048 | #define SPI_6338_CMD 0x00 /* 16-bits register */ | ||
1049 | #define SPI_6338_INT_STATUS 0x02 | ||
1050 | #define SPI_6338_INT_MASK_ST 0x03 | ||
1051 | #define SPI_6338_INT_MASK 0x04 | ||
1052 | #define SPI_6338_ST 0x05 | ||
1053 | #define SPI_6338_CLK_CFG 0x06 | ||
1054 | #define SPI_6338_FILL_BYTE 0x07 | ||
1055 | #define SPI_6338_MSG_TAIL 0x09 | ||
1056 | #define SPI_6338_RX_TAIL 0x0b | ||
1057 | #define SPI_6338_MSG_CTL 0x40 | ||
1058 | #define SPI_6338_MSG_DATA 0x41 | ||
1059 | #define SPI_6338_MSG_DATA_SIZE 0x3f | ||
1060 | #define SPI_6338_RX_DATA 0x80 | ||
1061 | #define SPI_6338_RX_DATA_SIZE 0x3f | ||
1062 | |||
1063 | /* BCM 6348 SPI core */ | ||
1064 | #define SPI_6348_CMD 0x00 /* 16-bits register */ | ||
1065 | #define SPI_6348_INT_STATUS 0x02 | ||
1066 | #define SPI_6348_INT_MASK_ST 0x03 | ||
1067 | #define SPI_6348_INT_MASK 0x04 | ||
1068 | #define SPI_6348_ST 0x05 | ||
1069 | #define SPI_6348_CLK_CFG 0x06 | ||
1070 | #define SPI_6348_FILL_BYTE 0x07 | ||
1071 | #define SPI_6348_MSG_TAIL 0x09 | ||
1072 | #define SPI_6348_RX_TAIL 0x0b | ||
1073 | #define SPI_6348_MSG_CTL 0x40 | ||
1074 | #define SPI_6348_MSG_DATA 0x41 | ||
1075 | #define SPI_6348_MSG_DATA_SIZE 0x3f | ||
1076 | #define SPI_6348_RX_DATA 0x80 | ||
1077 | #define SPI_6348_RX_DATA_SIZE 0x3f | ||
1078 | |||
1079 | /* BCM 6358 SPI core */ | ||
1080 | #define SPI_6358_MSG_CTL 0x00 /* 16-bits register */ | ||
1081 | #define SPI_6358_MSG_DATA 0x02 | ||
1082 | #define SPI_6358_MSG_DATA_SIZE 0x21e | ||
1083 | #define SPI_6358_RX_DATA 0x400 | ||
1084 | #define SPI_6358_RX_DATA_SIZE 0x220 | ||
1085 | #define SPI_6358_CMD 0x700 /* 16-bits register */ | ||
1086 | #define SPI_6358_INT_STATUS 0x702 | ||
1087 | #define SPI_6358_INT_MASK_ST 0x703 | ||
1088 | #define SPI_6358_INT_MASK 0x704 | ||
1089 | #define SPI_6358_ST 0x705 | ||
1090 | #define SPI_6358_CLK_CFG 0x706 | ||
1091 | #define SPI_6358_FILL_BYTE 0x707 | ||
1092 | #define SPI_6358_MSG_TAIL 0x709 | ||
1093 | #define SPI_6358_RX_TAIL 0x70B | ||
1094 | |||
1095 | /* BCM 6358 SPI core */ | ||
1096 | #define SPI_6368_MSG_CTL 0x00 /* 16-bits register */ | ||
1097 | #define SPI_6368_MSG_DATA 0x02 | ||
1098 | #define SPI_6368_MSG_DATA_SIZE 0x21e | ||
1099 | #define SPI_6368_RX_DATA 0x400 | ||
1100 | #define SPI_6368_RX_DATA_SIZE 0x220 | ||
1101 | #define SPI_6368_CMD 0x700 /* 16-bits register */ | ||
1102 | #define SPI_6368_INT_STATUS 0x702 | ||
1103 | #define SPI_6368_INT_MASK_ST 0x703 | ||
1104 | #define SPI_6368_INT_MASK 0x704 | ||
1105 | #define SPI_6368_ST 0x705 | ||
1106 | #define SPI_6368_CLK_CFG 0x706 | ||
1107 | #define SPI_6368_FILL_BYTE 0x707 | ||
1108 | #define SPI_6368_MSG_TAIL 0x709 | ||
1109 | #define SPI_6368_RX_TAIL 0x70B | ||
1110 | |||
1111 | /* Shared SPI definitions */ | ||
1112 | |||
1113 | /* Message configuration */ | ||
1114 | #define SPI_FD_RW 0x00 | ||
1115 | #define SPI_HD_W 0x01 | ||
1116 | #define SPI_HD_R 0x02 | ||
1117 | #define SPI_BYTE_CNT_SHIFT 0 | ||
1118 | #define SPI_MSG_TYPE_SHIFT 14 | ||
1119 | |||
1120 | /* Command */ | ||
1121 | #define SPI_CMD_NOOP 0x00 | ||
1122 | #define SPI_CMD_SOFT_RESET 0x01 | ||
1123 | #define SPI_CMD_HARD_RESET 0x02 | ||
1124 | #define SPI_CMD_START_IMMEDIATE 0x03 | ||
1125 | #define SPI_CMD_COMMAND_SHIFT 0 | ||
1126 | #define SPI_CMD_COMMAND_MASK 0x000f | ||
1127 | #define SPI_CMD_DEVICE_ID_SHIFT 4 | ||
1128 | #define SPI_CMD_PREPEND_BYTE_CNT_SHIFT 8 | ||
1129 | #define SPI_CMD_ONE_BYTE_SHIFT 11 | ||
1130 | #define SPI_CMD_ONE_WIRE_SHIFT 12 | ||
1131 | #define SPI_DEV_ID_0 0 | ||
1132 | #define SPI_DEV_ID_1 1 | ||
1133 | #define SPI_DEV_ID_2 2 | ||
1134 | #define SPI_DEV_ID_3 3 | ||
1135 | |||
1136 | /* Interrupt mask */ | ||
1137 | #define SPI_INTR_CMD_DONE 0x01 | ||
1138 | #define SPI_INTR_RX_OVERFLOW 0x02 | ||
1139 | #define SPI_INTR_TX_UNDERFLOW 0x04 | ||
1140 | #define SPI_INTR_TX_OVERFLOW 0x08 | ||
1141 | #define SPI_INTR_RX_UNDERFLOW 0x10 | ||
1142 | #define SPI_INTR_CLEAR_ALL 0x1f | ||
1143 | |||
1144 | /* Status */ | ||
1145 | #define SPI_RX_EMPTY 0x02 | ||
1146 | #define SPI_CMD_BUSY 0x04 | ||
1147 | #define SPI_SERIAL_BUSY 0x08 | ||
1148 | |||
1149 | /* Clock configuration */ | ||
1150 | #define SPI_CLK_20MHZ 0x00 | ||
1151 | #define SPI_CLK_0_391MHZ 0x01 | ||
1152 | #define SPI_CLK_0_781MHZ 0x02 /* default */ | ||
1153 | #define SPI_CLK_1_563MHZ 0x03 | ||
1154 | #define SPI_CLK_3_125MHZ 0x04 | ||
1155 | #define SPI_CLK_6_250MHZ 0x05 | ||
1156 | #define SPI_CLK_12_50MHZ 0x06 | ||
1157 | #define SPI_CLK_MASK 0x07 | ||
1158 | #define SPI_SSOFFTIME_MASK 0x38 | ||
1159 | #define SPI_SSOFFTIME_SHIFT 3 | ||
1160 | #define SPI_BYTE_SWAP 0x80 | ||
1161 | |||
1162 | /************************************************************************* | ||
1163 | * _REG relative to RSET_MISC | ||
1164 | *************************************************************************/ | ||
1165 | #define MISC_SERDES_CTRL_REG 0x0 | ||
1166 | #define SERDES_PCIE_EN (1 << 0) | ||
1167 | #define SERDES_PCIE_EXD_EN (1 << 15) | ||
1168 | |||
1169 | #define MISC_STRAPBUS_6328_REG 0x240 | ||
1170 | #define STRAPBUS_6328_FCVO_SHIFT 7 | ||
1171 | #define STRAPBUS_6328_FCVO_MASK (0x1f << STRAPBUS_6328_FCVO_SHIFT) | ||
1172 | #define STRAPBUS_6328_BOOT_SEL_SERIAL (1 << 28) | ||
1173 | #define STRAPBUS_6328_BOOT_SEL_NAND (0 << 28) | ||
1174 | |||
1175 | /************************************************************************* | ||
1176 | * _REG relative to RSET_PCIE | ||
1177 | *************************************************************************/ | ||
1178 | |||
1179 | #define PCIE_CONFIG2_REG 0x408 | ||
1180 | #define CONFIG2_BAR1_SIZE_EN 1 | ||
1181 | #define CONFIG2_BAR1_SIZE_MASK 0xf | ||
1182 | |||
1183 | #define PCIE_IDVAL3_REG 0x43c | ||
1184 | #define IDVAL3_CLASS_CODE_MASK 0xffffff | ||
1185 | #define IDVAL3_SUBCLASS_SHIFT 8 | ||
1186 | #define IDVAL3_CLASS_SHIFT 16 | ||
1187 | |||
1188 | #define PCIE_DLSTATUS_REG 0x1048 | ||
1189 | #define DLSTATUS_PHYLINKUP (1 << 13) | ||
1190 | |||
1191 | #define PCIE_BRIDGE_OPT1_REG 0x2820 | ||
1192 | #define OPT1_RD_BE_OPT_EN (1 << 7) | ||
1193 | #define OPT1_RD_REPLY_BE_FIX_EN (1 << 9) | ||
1194 | #define OPT1_PCIE_BRIDGE_HOLE_DET_EN (1 << 11) | ||
1195 | #define OPT1_L1_INT_STATUS_MASK_POL (1 << 12) | ||
1196 | |||
1197 | #define PCIE_BRIDGE_OPT2_REG 0x2824 | ||
1198 | #define OPT2_UBUS_UR_DECODE_DIS (1 << 2) | ||
1199 | #define OPT2_TX_CREDIT_CHK_EN (1 << 4) | ||
1200 | #define OPT2_CFG_TYPE1_BD_SEL (1 << 7) | ||
1201 | #define OPT2_CFG_TYPE1_BUS_NO_SHIFT 16 | ||
1202 | #define OPT2_CFG_TYPE1_BUS_NO_MASK (0xff << OPT2_CFG_TYPE1_BUS_NO_SHIFT) | ||
1203 | |||
1204 | #define PCIE_BRIDGE_BAR0_BASEMASK_REG 0x2828 | ||
1205 | #define PCIE_BRIDGE_BAR1_BASEMASK_REG 0x2830 | ||
1206 | #define BASEMASK_REMAP_EN (1 << 0) | ||
1207 | #define BASEMASK_SWAP_EN (1 << 1) | ||
1208 | #define BASEMASK_MASK_SHIFT 4 | ||
1209 | #define BASEMASK_MASK_MASK (0xfff << BASEMASK_MASK_SHIFT) | ||
1210 | #define BASEMASK_BASE_SHIFT 20 | ||
1211 | #define BASEMASK_BASE_MASK (0xfff << BASEMASK_BASE_SHIFT) | ||
1212 | |||
1213 | #define PCIE_BRIDGE_BAR0_REBASE_ADDR_REG 0x282c | ||
1214 | #define PCIE_BRIDGE_BAR1_REBASE_ADDR_REG 0x2834 | ||
1215 | #define REBASE_ADDR_BASE_SHIFT 20 | ||
1216 | #define REBASE_ADDR_BASE_MASK (0xfff << REBASE_ADDR_BASE_SHIFT) | ||
1217 | |||
1218 | #define PCIE_BRIDGE_RC_INT_MASK_REG 0x2854 | ||
1219 | #define PCIE_RC_INT_A (1 << 0) | ||
1220 | #define PCIE_RC_INT_B (1 << 1) | ||
1221 | #define PCIE_RC_INT_C (1 << 2) | ||
1222 | #define PCIE_RC_INT_D (1 << 3) | ||
1223 | |||
1224 | #define PCIE_DEVICE_OFFSET 0x8000 | ||
1225 | |||
976 | #endif /* BCM63XX_REGS_H_ */ | 1226 | #endif /* BCM63XX_REGS_H_ */ |
diff --git a/arch/mips/include/asm/mach-bcm63xx/ioremap.h b/arch/mips/include/asm/mach-bcm63xx/ioremap.h index ef94ba73646e..30931c42379d 100644 --- a/arch/mips/include/asm/mach-bcm63xx/ioremap.h +++ b/arch/mips/include/asm/mach-bcm63xx/ioremap.h | |||
@@ -18,6 +18,7 @@ static inline int is_bcm63xx_internal_registers(phys_t offset) | |||
18 | if (offset >= 0xfff00000) | 18 | if (offset >= 0xfff00000) |
19 | return 1; | 19 | return 1; |
20 | break; | 20 | break; |
21 | case BCM6328_CPU_ID: | ||
21 | case BCM6368_CPU_ID: | 22 | case BCM6368_CPU_ID: |
22 | if (offset >= 0xb0000000 && offset < 0xb1000000) | 23 | if (offset >= 0xb0000000 && offset < 0xb1000000) |
23 | return 1; | 24 | return 1; |
diff --git a/arch/mips/include/asm/mach-cavium-octeon/irq.h b/arch/mips/include/asm/mach-cavium-octeon/irq.h index 5b05f186e395..418992042f6f 100644 --- a/arch/mips/include/asm/mach-cavium-octeon/irq.h +++ b/arch/mips/include/asm/mach-cavium-octeon/irq.h | |||
@@ -41,61 +41,26 @@ enum octeon_irq { | |||
41 | OCTEON_IRQ_TWSI, | 41 | OCTEON_IRQ_TWSI, |
42 | OCTEON_IRQ_TWSI2, | 42 | OCTEON_IRQ_TWSI2, |
43 | OCTEON_IRQ_RML, | 43 | OCTEON_IRQ_RML, |
44 | OCTEON_IRQ_TRACE0, | ||
45 | OCTEON_IRQ_GMX_DRP0 = OCTEON_IRQ_TRACE0 + 4, | ||
46 | OCTEON_IRQ_IPD_DRP = OCTEON_IRQ_GMX_DRP0 + 5, | ||
47 | OCTEON_IRQ_KEY_ZERO, | ||
48 | OCTEON_IRQ_TIMER0, | 44 | OCTEON_IRQ_TIMER0, |
49 | OCTEON_IRQ_TIMER1, | 45 | OCTEON_IRQ_TIMER1, |
50 | OCTEON_IRQ_TIMER2, | 46 | OCTEON_IRQ_TIMER2, |
51 | OCTEON_IRQ_TIMER3, | 47 | OCTEON_IRQ_TIMER3, |
52 | OCTEON_IRQ_USB0, | 48 | OCTEON_IRQ_USB0, |
53 | OCTEON_IRQ_USB1, | 49 | OCTEON_IRQ_USB1, |
54 | OCTEON_IRQ_PCM, | ||
55 | OCTEON_IRQ_MPI, | ||
56 | OCTEON_IRQ_POWIQ, | ||
57 | OCTEON_IRQ_IPDPPTHR, | ||
58 | OCTEON_IRQ_MII0, | 50 | OCTEON_IRQ_MII0, |
59 | OCTEON_IRQ_MII1, | 51 | OCTEON_IRQ_MII1, |
60 | OCTEON_IRQ_BOOTDMA, | 52 | OCTEON_IRQ_BOOTDMA, |
61 | 53 | #ifndef CONFIG_PCI_MSI | |
62 | OCTEON_IRQ_NAND, | 54 | OCTEON_IRQ_LAST = 127 |
63 | OCTEON_IRQ_MIO, /* Summary of MIO_BOOT_ERR */ | 55 | #endif |
64 | OCTEON_IRQ_IOB, /* Summary of IOB_INT_SUM */ | ||
65 | OCTEON_IRQ_FPA, /* Summary of FPA_INT_SUM */ | ||
66 | OCTEON_IRQ_POW, /* Summary of POW_ECC_ERR */ | ||
67 | OCTEON_IRQ_L2C, /* Summary of L2C_INT_STAT */ | ||
68 | OCTEON_IRQ_IPD, /* Summary of IPD_INT_SUM */ | ||
69 | OCTEON_IRQ_PIP, /* Summary of PIP_INT_REG */ | ||
70 | OCTEON_IRQ_PKO, /* Summary of PKO_REG_ERROR */ | ||
71 | OCTEON_IRQ_ZIP, /* Summary of ZIP_ERROR */ | ||
72 | OCTEON_IRQ_TIM, /* Summary of TIM_REG_ERROR */ | ||
73 | OCTEON_IRQ_RAD, /* Summary of RAD_REG_ERROR */ | ||
74 | OCTEON_IRQ_KEY, /* Summary of KEY_INT_SUM */ | ||
75 | OCTEON_IRQ_DFA, /* Summary of DFA */ | ||
76 | OCTEON_IRQ_USBCTL, /* Summary of USBN0_INT_SUM */ | ||
77 | OCTEON_IRQ_SLI, /* Summary of SLI_INT_SUM */ | ||
78 | OCTEON_IRQ_DPI, /* Summary of DPI_INT_SUM */ | ||
79 | OCTEON_IRQ_AGX0, /* Summary of GMX0*+PCS0_INT*_REG */ | ||
80 | OCTEON_IRQ_AGL = OCTEON_IRQ_AGX0 + 5, | ||
81 | OCTEON_IRQ_PTP, | ||
82 | OCTEON_IRQ_PEM0, | ||
83 | OCTEON_IRQ_PEM1, | ||
84 | OCTEON_IRQ_SRIO0, | ||
85 | OCTEON_IRQ_SRIO1, | ||
86 | OCTEON_IRQ_LMC0, | ||
87 | OCTEON_IRQ_DFM = OCTEON_IRQ_LMC0 + 4, /* Summary of DFM */ | ||
88 | OCTEON_IRQ_RST, | ||
89 | }; | 56 | }; |
90 | 57 | ||
91 | #ifdef CONFIG_PCI_MSI | 58 | #ifdef CONFIG_PCI_MSI |
92 | /* 152 - 407 represent the MSI interrupts 0-255 */ | 59 | /* 256 - 511 represent the MSI interrupts 0-255 */ |
93 | #define OCTEON_IRQ_MSI_BIT0 (OCTEON_IRQ_RST + 1) | 60 | #define OCTEON_IRQ_MSI_BIT0 (256) |
94 | 61 | ||
95 | #define OCTEON_IRQ_MSI_LAST (OCTEON_IRQ_MSI_BIT0 + 255) | 62 | #define OCTEON_IRQ_MSI_LAST (OCTEON_IRQ_MSI_BIT0 + 255) |
96 | #define OCTEON_IRQ_LAST (OCTEON_IRQ_MSI_LAST + 1) | 63 | #define OCTEON_IRQ_LAST (OCTEON_IRQ_MSI_LAST + 1) |
97 | #else | ||
98 | #define OCTEON_IRQ_LAST (OCTEON_IRQ_RST + 1) | ||
99 | #endif | 64 | #endif |
100 | 65 | ||
101 | #endif | 66 | #endif |
diff --git a/arch/mips/include/asm/mach-jz4740/jz4740_nand.h b/arch/mips/include/asm/mach-jz4740/jz4740_nand.h index bb5b9a4e29c8..986982db7c38 100644 --- a/arch/mips/include/asm/mach-jz4740/jz4740_nand.h +++ b/arch/mips/include/asm/mach-jz4740/jz4740_nand.h | |||
@@ -19,6 +19,8 @@ | |||
19 | #include <linux/mtd/nand.h> | 19 | #include <linux/mtd/nand.h> |
20 | #include <linux/mtd/partitions.h> | 20 | #include <linux/mtd/partitions.h> |
21 | 21 | ||
22 | #define JZ_NAND_NUM_BANKS 4 | ||
23 | |||
22 | struct jz_nand_platform_data { | 24 | struct jz_nand_platform_data { |
23 | int num_partitions; | 25 | int num_partitions; |
24 | struct mtd_partition *partitions; | 26 | struct mtd_partition *partitions; |
@@ -27,6 +29,8 @@ struct jz_nand_platform_data { | |||
27 | 29 | ||
28 | unsigned int busy_gpio; | 30 | unsigned int busy_gpio; |
29 | 31 | ||
32 | unsigned char banks[JZ_NAND_NUM_BANKS]; | ||
33 | |||
30 | void (*ident_callback)(struct platform_device *, struct nand_chip *, | 34 | void (*ident_callback)(struct platform_device *, struct nand_chip *, |
31 | struct mtd_partition **, int *num_partitions); | 35 | struct mtd_partition **, int *num_partitions); |
32 | }; | 36 | }; |
diff --git a/arch/mips/include/asm/mach-loongson/loongson.h b/arch/mips/include/asm/mach-loongson/loongson.h index 1e29b9dd1d73..06367c37e1b2 100644 --- a/arch/mips/include/asm/mach-loongson/loongson.h +++ b/arch/mips/include/asm/mach-loongson/loongson.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/irq.h> | 16 | #include <linux/irq.h> |
17 | #include <linux/kconfig.h> | ||
17 | 18 | ||
18 | /* loongson internal northbridge initialization */ | 19 | /* loongson internal northbridge initialization */ |
19 | extern void bonito_irq_init(void); | 20 | extern void bonito_irq_init(void); |
@@ -66,7 +67,7 @@ extern int mach_i8259_irq(void); | |||
66 | #include <linux/interrupt.h> | 67 | #include <linux/interrupt.h> |
67 | static inline void do_perfcnt_IRQ(void) | 68 | static inline void do_perfcnt_IRQ(void) |
68 | { | 69 | { |
69 | #if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE) | 70 | #if IS_ENABLED(CONFIG_OPROFILE) |
70 | do_IRQ(LOONGSON2_PERFCNT_IRQ); | 71 | do_IRQ(LOONGSON2_PERFCNT_IRQ); |
71 | #endif | 72 | #endif |
72 | } | 73 | } |
diff --git a/arch/mips/include/asm/mach-loongson1/irq.h b/arch/mips/include/asm/mach-loongson1/irq.h new file mode 100644 index 000000000000..da96ed42f733 --- /dev/null +++ b/arch/mips/include/asm/mach-loongson1/irq.h | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> | ||
3 | * | ||
4 | * IRQ mappings for Loongson 1 | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | */ | ||
11 | |||
12 | |||
13 | #ifndef __ASM_MACH_LOONGSON1_IRQ_H | ||
14 | #define __ASM_MACH_LOONGSON1_IRQ_H | ||
15 | |||
16 | /* | ||
17 | * CPU core Interrupt Numbers | ||
18 | */ | ||
19 | #define MIPS_CPU_IRQ_BASE 0 | ||
20 | #define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x)) | ||
21 | |||
22 | #define SOFTINT0_IRQ MIPS_CPU_IRQ(0) | ||
23 | #define SOFTINT1_IRQ MIPS_CPU_IRQ(1) | ||
24 | #define INT0_IRQ MIPS_CPU_IRQ(2) | ||
25 | #define INT1_IRQ MIPS_CPU_IRQ(3) | ||
26 | #define INT2_IRQ MIPS_CPU_IRQ(4) | ||
27 | #define INT3_IRQ MIPS_CPU_IRQ(5) | ||
28 | #define INT4_IRQ MIPS_CPU_IRQ(6) | ||
29 | #define TIMER_IRQ MIPS_CPU_IRQ(7) /* cpu timer */ | ||
30 | |||
31 | #define MIPS_CPU_IRQS (MIPS_CPU_IRQ(7) + 1 - MIPS_CPU_IRQ_BASE) | ||
32 | |||
33 | /* | ||
34 | * INT0~3 Interrupt Numbers | ||
35 | */ | ||
36 | #define LS1X_IRQ_BASE MIPS_CPU_IRQS | ||
37 | #define LS1X_IRQ(n, x) (LS1X_IRQ_BASE + (n << 5) + (x)) | ||
38 | |||
39 | #define LS1X_UART0_IRQ LS1X_IRQ(0, 2) | ||
40 | #define LS1X_UART1_IRQ LS1X_IRQ(0, 3) | ||
41 | #define LS1X_UART2_IRQ LS1X_IRQ(0, 4) | ||
42 | #define LS1X_UART3_IRQ LS1X_IRQ(0, 5) | ||
43 | #define LS1X_CAN0_IRQ LS1X_IRQ(0, 6) | ||
44 | #define LS1X_CAN1_IRQ LS1X_IRQ(0, 7) | ||
45 | #define LS1X_SPI0_IRQ LS1X_IRQ(0, 8) | ||
46 | #define LS1X_SPI1_IRQ LS1X_IRQ(0, 9) | ||
47 | #define LS1X_AC97_IRQ LS1X_IRQ(0, 10) | ||
48 | #define LS1X_DMA0_IRQ LS1X_IRQ(0, 13) | ||
49 | #define LS1X_DMA1_IRQ LS1X_IRQ(0, 14) | ||
50 | #define LS1X_DMA2_IRQ LS1X_IRQ(0, 15) | ||
51 | #define LS1X_PWM0_IRQ LS1X_IRQ(0, 17) | ||
52 | #define LS1X_PWM1_IRQ LS1X_IRQ(0, 18) | ||
53 | #define LS1X_PWM2_IRQ LS1X_IRQ(0, 19) | ||
54 | #define LS1X_PWM3_IRQ LS1X_IRQ(0, 20) | ||
55 | #define LS1X_RTC_INT0_IRQ LS1X_IRQ(0, 21) | ||
56 | #define LS1X_RTC_INT1_IRQ LS1X_IRQ(0, 22) | ||
57 | #define LS1X_RTC_INT2_IRQ LS1X_IRQ(0, 23) | ||
58 | #define LS1X_TOY_INT0_IRQ LS1X_IRQ(0, 24) | ||
59 | #define LS1X_TOY_INT1_IRQ LS1X_IRQ(0, 25) | ||
60 | #define LS1X_TOY_INT2_IRQ LS1X_IRQ(0, 26) | ||
61 | #define LS1X_RTC_TICK_IRQ LS1X_IRQ(0, 27) | ||
62 | #define LS1X_TOY_TICK_IRQ LS1X_IRQ(0, 28) | ||
63 | |||
64 | #define LS1X_EHCI_IRQ LS1X_IRQ(1, 0) | ||
65 | #define LS1X_OHCI_IRQ LS1X_IRQ(1, 1) | ||
66 | #define LS1X_GMAC0_IRQ LS1X_IRQ(1, 2) | ||
67 | #define LS1X_GMAC1_IRQ LS1X_IRQ(1, 3) | ||
68 | |||
69 | #define LS1X_IRQS (LS1X_IRQ(4, 31) + 1 - LS1X_IRQ_BASE) | ||
70 | |||
71 | #define NR_IRQS (MIPS_CPU_IRQS + LS1X_IRQS) | ||
72 | |||
73 | #endif /* __ASM_MACH_LOONGSON1_IRQ_H */ | ||
diff --git a/arch/mips/include/asm/mach-loongson1/loongson1.h b/arch/mips/include/asm/mach-loongson1/loongson1.h new file mode 100644 index 000000000000..4e18e88cebbf --- /dev/null +++ b/arch/mips/include/asm/mach-loongson1/loongson1.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> | ||
3 | * | ||
4 | * Register mappings for Loongson 1 | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | */ | ||
11 | |||
12 | |||
13 | #ifndef __ASM_MACH_LOONGSON1_LOONGSON1_H | ||
14 | #define __ASM_MACH_LOONGSON1_LOONGSON1_H | ||
15 | |||
16 | #define DEFAULT_MEMSIZE 256 /* If no memsize provided */ | ||
17 | |||
18 | /* Loongson 1 Register Bases */ | ||
19 | #define LS1X_INTC_BASE 0x1fd01040 | ||
20 | #define LS1X_EHCI_BASE 0x1fe00000 | ||
21 | #define LS1X_OHCI_BASE 0x1fe08000 | ||
22 | #define LS1X_GMAC0_BASE 0x1fe10000 | ||
23 | #define LS1X_GMAC1_BASE 0x1fe20000 | ||
24 | |||
25 | #define LS1X_UART0_BASE 0x1fe40000 | ||
26 | #define LS1X_UART1_BASE 0x1fe44000 | ||
27 | #define LS1X_UART2_BASE 0x1fe48000 | ||
28 | #define LS1X_UART3_BASE 0x1fe4c000 | ||
29 | #define LS1X_CAN0_BASE 0x1fe50000 | ||
30 | #define LS1X_CAN1_BASE 0x1fe54000 | ||
31 | #define LS1X_I2C0_BASE 0x1fe58000 | ||
32 | #define LS1X_I2C1_BASE 0x1fe68000 | ||
33 | #define LS1X_I2C2_BASE 0x1fe70000 | ||
34 | #define LS1X_PWM_BASE 0x1fe5c000 | ||
35 | #define LS1X_WDT_BASE 0x1fe5c060 | ||
36 | #define LS1X_RTC_BASE 0x1fe64000 | ||
37 | #define LS1X_AC97_BASE 0x1fe74000 | ||
38 | #define LS1X_NAND_BASE 0x1fe78000 | ||
39 | #define LS1X_CLK_BASE 0x1fe78030 | ||
40 | |||
41 | #include <regs-clk.h> | ||
42 | #include <regs-wdt.h> | ||
43 | |||
44 | #endif /* __ASM_MACH_LOONGSON1_LOONGSON1_H */ | ||
diff --git a/arch/mips/include/asm/mach-loongson1/platform.h b/arch/mips/include/asm/mach-loongson1/platform.h new file mode 100644 index 000000000000..2f171617bade --- /dev/null +++ b/arch/mips/include/asm/mach-loongson1/platform.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | */ | ||
9 | |||
10 | |||
11 | #ifndef __ASM_MACH_LOONGSON1_PLATFORM_H | ||
12 | #define __ASM_MACH_LOONGSON1_PLATFORM_H | ||
13 | |||
14 | #include <linux/platform_device.h> | ||
15 | |||
16 | extern struct platform_device ls1x_uart_device; | ||
17 | extern struct platform_device ls1x_eth0_device; | ||
18 | extern struct platform_device ls1x_ehci_device; | ||
19 | extern struct platform_device ls1x_rtc_device; | ||
20 | |||
21 | void ls1x_serial_setup(void); | ||
22 | |||
23 | #endif /* __ASM_MACH_LOONGSON1_PLATFORM_H */ | ||
diff --git a/arch/mips/include/asm/mach-loongson1/prom.h b/arch/mips/include/asm/mach-loongson1/prom.h new file mode 100644 index 000000000000..b871dc41b8d9 --- /dev/null +++ b/arch/mips/include/asm/mach-loongson1/prom.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | */ | ||
9 | |||
10 | #ifndef __ASM_MACH_LOONGSON1_PROM_H | ||
11 | #define __ASM_MACH_LOONGSON1_PROM_H | ||
12 | |||
13 | #include <linux/io.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/irq.h> | ||
16 | |||
17 | /* environment arguments from bootloader */ | ||
18 | extern unsigned long memsize, highmemsize; | ||
19 | |||
20 | /* loongson-specific command line, env and memory initialization */ | ||
21 | extern char *prom_getenv(char *name); | ||
22 | extern void __init prom_init_cmdline(void); | ||
23 | |||
24 | #endif /* __ASM_MACH_LOONGSON1_PROM_H */ | ||
diff --git a/arch/mips/include/asm/mach-loongson1/regs-clk.h b/arch/mips/include/asm/mach-loongson1/regs-clk.h new file mode 100644 index 000000000000..8efa7fb9f73a --- /dev/null +++ b/arch/mips/include/asm/mach-loongson1/regs-clk.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> | ||
3 | * | ||
4 | * Loongson 1 Clock Register Definitions. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __ASM_MACH_LOONGSON1_REGS_CLK_H | ||
13 | #define __ASM_MACH_LOONGSON1_REGS_CLK_H | ||
14 | |||
15 | #define LS1X_CLK_REG(x) \ | ||
16 | ((void __iomem *)KSEG1ADDR(LS1X_CLK_BASE + (x))) | ||
17 | |||
18 | #define LS1X_CLK_PLL_FREQ LS1X_CLK_REG(0x0) | ||
19 | #define LS1X_CLK_PLL_DIV LS1X_CLK_REG(0x4) | ||
20 | |||
21 | /* Clock PLL Divisor Register Bits */ | ||
22 | #define DIV_DC_EN (0x1 << 31) | ||
23 | #define DIV_DC (0x1f << 26) | ||
24 | #define DIV_CPU_EN (0x1 << 25) | ||
25 | #define DIV_CPU (0x1f << 20) | ||
26 | #define DIV_DDR_EN (0x1 << 19) | ||
27 | #define DIV_DDR (0x1f << 14) | ||
28 | |||
29 | #define DIV_DC_SHIFT 26 | ||
30 | #define DIV_CPU_SHIFT 20 | ||
31 | #define DIV_DDR_SHIFT 14 | ||
32 | |||
33 | #endif /* __ASM_MACH_LOONGSON1_REGS_CLK_H */ | ||
diff --git a/arch/mips/include/asm/mach-loongson1/regs-wdt.h b/arch/mips/include/asm/mach-loongson1/regs-wdt.h new file mode 100644 index 000000000000..f897de68c527 --- /dev/null +++ b/arch/mips/include/asm/mach-loongson1/regs-wdt.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> | ||
3 | * | ||
4 | * Loongson 1 watchdog register definitions. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __ASM_MACH_LOONGSON1_REGS_WDT_H | ||
13 | #define __ASM_MACH_LOONGSON1_REGS_WDT_H | ||
14 | |||
15 | #define LS1X_WDT_REG(x) \ | ||
16 | ((void __iomem *)KSEG1ADDR(LS1X_WDT_BASE + (x))) | ||
17 | |||
18 | #define LS1X_WDT_EN LS1X_WDT_REG(0x0) | ||
19 | #define LS1X_WDT_SET LS1X_WDT_REG(0x4) | ||
20 | #define LS1X_WDT_TIMER LS1X_WDT_REG(0x8) | ||
21 | |||
22 | #endif /* __ASM_MACH_LOONGSON1_REGS_WDT_H */ | ||
diff --git a/arch/mips/include/asm/mach-loongson1/war.h b/arch/mips/include/asm/mach-loongson1/war.h new file mode 100644 index 000000000000..e3680a8fb349 --- /dev/null +++ b/arch/mips/include/asm/mach-loongson1/war.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org> | ||
7 | */ | ||
8 | #ifndef __ASM_MACH_LOONGSON1_WAR_H | ||
9 | #define __ASM_MACH_LOONGSON1_WAR_H | ||
10 | |||
11 | #define R4600_V1_INDEX_ICACHEOP_WAR 0 | ||
12 | #define R4600_V1_HIT_CACHEOP_WAR 0 | ||
13 | #define R4600_V2_HIT_CACHEOP_WAR 0 | ||
14 | #define R5432_CP0_INTERRUPT_WAR 0 | ||
15 | #define BCM1250_M3_WAR 0 | ||
16 | #define SIBYTE_1956_WAR 0 | ||
17 | #define MIPS4K_ICACHE_REFILL_WAR 0 | ||
18 | #define MIPS_CACHE_SYNC_WAR 0 | ||
19 | #define TX49XX_ICACHE_INDEX_INV_WAR 0 | ||
20 | #define RM9000_CDEX_SMP_WAR 0 | ||
21 | #define ICACHE_REFILLS_WORKAROUND_WAR 0 | ||
22 | #define R10000_LLSC_WAR 0 | ||
23 | #define MIPS34K_MISSED_ITLB_WAR 0 | ||
24 | |||
25 | #endif /* __ASM_MACH_LOONGSON1_WAR_H */ | ||
diff --git a/arch/mips/include/asm/mach-netlogic/cpu-feature-overrides.h b/arch/mips/include/asm/mach-netlogic/cpu-feature-overrides.h index d193fb68cf27..966db4be377c 100644 --- a/arch/mips/include/asm/mach-netlogic/cpu-feature-overrides.h +++ b/arch/mips/include/asm/mach-netlogic/cpu-feature-overrides.h | |||
@@ -48,7 +48,6 @@ | |||
48 | #define cpu_has_userlocal 1 | 48 | #define cpu_has_userlocal 1 |
49 | #define cpu_has_mips32r2 1 | 49 | #define cpu_has_mips32r2 1 |
50 | #define cpu_has_mips64r2 1 | 50 | #define cpu_has_mips64r2 1 |
51 | #define cpu_has_dc_aliases 1 | ||
52 | #else | 51 | #else |
53 | #error "Unknown Netlogic CPU" | 52 | #error "Unknown Netlogic CPU" |
54 | #endif | 53 | #endif |
diff --git a/arch/mips/include/asm/mach-tx49xx/mangle-port.h b/arch/mips/include/asm/mach-tx49xx/mangle-port.h index 5e6912fdd0ed..490867b03c8f 100644 --- a/arch/mips/include/asm/mach-tx49xx/mangle-port.h +++ b/arch/mips/include/asm/mach-tx49xx/mangle-port.h | |||
@@ -9,7 +9,7 @@ | |||
9 | #define ioswabb(a, x) (x) | 9 | #define ioswabb(a, x) (x) |
10 | #define __mem_ioswabb(a, x) (x) | 10 | #define __mem_ioswabb(a, x) (x) |
11 | #if defined(CONFIG_TOSHIBA_RBTX4939) && \ | 11 | #if defined(CONFIG_TOSHIBA_RBTX4939) && \ |
12 | (defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)) && \ | 12 | IS_ENABLED(CONFIG_SMC91X) && \ |
13 | defined(__BIG_ENDIAN) | 13 | defined(__BIG_ENDIAN) |
14 | #define NEEDS_TXX9_IOSWABW | 14 | #define NEEDS_TXX9_IOSWABW |
15 | extern u16 (*ioswabw)(volatile u16 *a, u16 x); | 15 | extern u16 (*ioswabw)(volatile u16 *a, u16 x); |
diff --git a/arch/mips/include/asm/mipsmtregs.h b/arch/mips/include/asm/mipsmtregs.h index e71ff4c317f2..5b3cb8553e9a 100644 --- a/arch/mips/include/asm/mipsmtregs.h +++ b/arch/mips/include/asm/mipsmtregs.h | |||
@@ -28,6 +28,9 @@ | |||
28 | #define read_c0_vpeconf0() __read_32bit_c0_register($1, 2) | 28 | #define read_c0_vpeconf0() __read_32bit_c0_register($1, 2) |
29 | #define write_c0_vpeconf0(val) __write_32bit_c0_register($1, 2, val) | 29 | #define write_c0_vpeconf0(val) __write_32bit_c0_register($1, 2, val) |
30 | 30 | ||
31 | #define read_c0_vpeconf1() __read_32bit_c0_register($1, 3) | ||
32 | #define write_c0_vpeconf1(val) __write_32bit_c0_register($1, 3, val) | ||
33 | |||
31 | #define read_c0_tcstatus() __read_32bit_c0_register($2, 1) | 34 | #define read_c0_tcstatus() __read_32bit_c0_register($2, 1) |
32 | #define write_c0_tcstatus(val) __write_32bit_c0_register($2, 1, val) | 35 | #define write_c0_tcstatus(val) __write_32bit_c0_register($2, 1, val) |
33 | 36 | ||
@@ -124,6 +127,14 @@ | |||
124 | #define VPECONF0_XTC_SHIFT 21 | 127 | #define VPECONF0_XTC_SHIFT 21 |
125 | #define VPECONF0_XTC (_ULCAST_(0xff) << VPECONF0_XTC_SHIFT) | 128 | #define VPECONF0_XTC (_ULCAST_(0xff) << VPECONF0_XTC_SHIFT) |
126 | 129 | ||
130 | /* VPEConf1 fields (per VPE) */ | ||
131 | #define VPECONF1_NCP1_SHIFT 0 | ||
132 | #define VPECONF1_NCP1 (_ULCAST_(0xff) << VPECONF1_NCP1_SHIFT) | ||
133 | #define VPECONF1_NCP2_SHIFT 10 | ||
134 | #define VPECONF1_NCP2 (_ULCAST_(0xff) << VPECONF1_NCP2_SHIFT) | ||
135 | #define VPECONF1_NCX_SHIFT 20 | ||
136 | #define VPECONF1_NCX (_ULCAST_(0xff) << VPECONF1_NCX_SHIFT) | ||
137 | |||
127 | /* TCStatus fields (per TC) */ | 138 | /* TCStatus fields (per TC) */ |
128 | #define TCSTATUS_TASID (_ULCAST_(0xff)) | 139 | #define TCSTATUS_TASID (_ULCAST_(0xff)) |
129 | #define TCSTATUS_IXMT_SHIFT 10 | 140 | #define TCSTATUS_IXMT_SHIFT 10 |
@@ -350,6 +361,8 @@ do { \ | |||
350 | #define write_vpe_c0_vpecontrol(val) mttc0(1, 1, val) | 361 | #define write_vpe_c0_vpecontrol(val) mttc0(1, 1, val) |
351 | #define read_vpe_c0_vpeconf0() mftc0(1, 2) | 362 | #define read_vpe_c0_vpeconf0() mftc0(1, 2) |
352 | #define write_vpe_c0_vpeconf0(val) mttc0(1, 2, val) | 363 | #define write_vpe_c0_vpeconf0(val) mttc0(1, 2, val) |
364 | #define read_vpe_c0_vpeconf1() mftc0(1, 3) | ||
365 | #define write_vpe_c0_vpeconf1(val) mttc0(1, 3, val) | ||
353 | #define read_vpe_c0_count() mftc0(9, 0) | 366 | #define read_vpe_c0_count() mftc0(9, 0) |
354 | #define write_vpe_c0_count(val) mttc0(9, 0, val) | 367 | #define write_vpe_c0_count(val) mttc0(9, 0, val) |
355 | #define read_vpe_c0_status() mftc0(12, 0) | 368 | #define read_vpe_c0_status() mftc0(12, 0) |
diff --git a/arch/mips/include/asm/module.h b/arch/mips/include/asm/module.h index 530008048c62..7531ecd654d6 100644 --- a/arch/mips/include/asm/module.h +++ b/arch/mips/include/asm/module.h | |||
@@ -117,6 +117,8 @@ search_module_dbetables(unsigned long addr) | |||
117 | #define MODULE_PROC_FAMILY "RM9000 " | 117 | #define MODULE_PROC_FAMILY "RM9000 " |
118 | #elif defined CONFIG_CPU_SB1 | 118 | #elif defined CONFIG_CPU_SB1 |
119 | #define MODULE_PROC_FAMILY "SB1 " | 119 | #define MODULE_PROC_FAMILY "SB1 " |
120 | #elif defined CONFIG_CPU_LOONGSON1 | ||
121 | #define MODULE_PROC_FAMILY "LOONGSON1 " | ||
120 | #elif defined CONFIG_CPU_LOONGSON2 | 122 | #elif defined CONFIG_CPU_LOONGSON2 |
121 | #define MODULE_PROC_FAMILY "LOONGSON2 " | 123 | #define MODULE_PROC_FAMILY "LOONGSON2 " |
122 | #elif defined CONFIG_CPU_CAVIUM_OCTEON | 124 | #elif defined CONFIG_CPU_CAVIUM_OCTEON |
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/cpucontrol.h b/arch/mips/include/asm/netlogic/xlp-hal/cpucontrol.h index bf7d41deb9be..7b63a6b722a0 100644 --- a/arch/mips/include/asm/netlogic/xlp-hal/cpucontrol.h +++ b/arch/mips/include/asm/netlogic/xlp-hal/cpucontrol.h | |||
@@ -47,7 +47,9 @@ | |||
47 | #define CPU_BLOCKID_MAP 10 | 47 | #define CPU_BLOCKID_MAP 10 |
48 | 48 | ||
49 | #define LSU_DEFEATURE 0x304 | 49 | #define LSU_DEFEATURE 0x304 |
50 | #define LSU_CERRLOG_REGID 0x09 | 50 | #define LSU_DEBUG_ADDR 0x305 |
51 | #define LSU_DEBUG_DATA0 0x306 | ||
52 | #define LSU_CERRLOG_REGID 0x309 | ||
51 | #define SCHED_DEFEATURE 0x700 | 53 | #define SCHED_DEFEATURE 0x700 |
52 | 54 | ||
53 | /* Offsets of interest from the 'MAP' Block */ | 55 | /* Offsets of interest from the 'MAP' Block */ |
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/iomap.h b/arch/mips/include/asm/netlogic/xlp-hal/iomap.h index 86cc3391e50c..2c63f9754640 100644 --- a/arch/mips/include/asm/netlogic/xlp-hal/iomap.h +++ b/arch/mips/include/asm/netlogic/xlp-hal/iomap.h | |||
@@ -36,6 +36,9 @@ | |||
36 | #define __NLM_HAL_IOMAP_H__ | 36 | #define __NLM_HAL_IOMAP_H__ |
37 | 37 | ||
38 | #define XLP_DEFAULT_IO_BASE 0x18000000 | 38 | #define XLP_DEFAULT_IO_BASE 0x18000000 |
39 | #define XLP_DEFAULT_PCI_ECFG_BASE XLP_DEFAULT_IO_BASE | ||
40 | #define XLP_DEFAULT_PCI_CFG_BASE 0x1c000000 | ||
41 | |||
39 | #define NMI_BASE 0xbfc00000 | 42 | #define NMI_BASE 0xbfc00000 |
40 | #define XLP_IO_CLK 133333333 | 43 | #define XLP_IO_CLK 133333333 |
41 | 44 | ||
@@ -129,7 +132,7 @@ | |||
129 | #define PCI_DEVICE_ID_NLM_PIC 0x1003 | 132 | #define PCI_DEVICE_ID_NLM_PIC 0x1003 |
130 | #define PCI_DEVICE_ID_NLM_PCIE 0x1004 | 133 | #define PCI_DEVICE_ID_NLM_PCIE 0x1004 |
131 | #define PCI_DEVICE_ID_NLM_EHCI 0x1007 | 134 | #define PCI_DEVICE_ID_NLM_EHCI 0x1007 |
132 | #define PCI_DEVICE_ID_NLM_ILK 0x1008 | 135 | #define PCI_DEVICE_ID_NLM_OHCI 0x1008 |
133 | #define PCI_DEVICE_ID_NLM_NAE 0x1009 | 136 | #define PCI_DEVICE_ID_NLM_NAE 0x1009 |
134 | #define PCI_DEVICE_ID_NLM_POE 0x100A | 137 | #define PCI_DEVICE_ID_NLM_POE 0x100A |
135 | #define PCI_DEVICE_ID_NLM_FMN 0x100B | 138 | #define PCI_DEVICE_ID_NLM_FMN 0x100B |
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h b/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h new file mode 100644 index 000000000000..66c323d1bd7d --- /dev/null +++ b/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2003-2012 Broadcom Corporation | ||
3 | * All Rights Reserved | ||
4 | * | ||
5 | * This software is available to you under a choice of one of two | ||
6 | * licenses. You may choose to be licensed under the terms of the GNU | ||
7 | * General Public License (GPL) Version 2, available from the file | ||
8 | * COPYING in the main directory of this source tree, or the Broadcom | ||
9 | * license below: | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions and the following disclaimer. | ||
17 | * 2. Redistributions in binary form must reproduce the above copyright | ||
18 | * notice, this list of conditions and the following disclaimer in | ||
19 | * the documentation and/or other materials provided with the | ||
20 | * distribution. | ||
21 | * | ||
22 | * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR | ||
23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
24 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
25 | * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE | ||
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
29 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
30 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
31 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||
32 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | */ | ||
34 | |||
35 | #ifndef __NLM_HAL_PCIBUS_H__ | ||
36 | #define __NLM_HAL_PCIBUS_H__ | ||
37 | |||
38 | /* PCIE Memory and IO regions */ | ||
39 | #define PCIE_MEM_BASE 0xd0000000ULL | ||
40 | #define PCIE_MEM_LIMIT 0xdfffffffULL | ||
41 | #define PCIE_IO_BASE 0x14000000ULL | ||
42 | #define PCIE_IO_LIMIT 0x15ffffffULL | ||
43 | |||
44 | #define PCIE_BRIDGE_CMD 0x1 | ||
45 | #define PCIE_BRIDGE_MSI_CAP 0x14 | ||
46 | #define PCIE_BRIDGE_MSI_ADDRL 0x15 | ||
47 | #define PCIE_BRIDGE_MSI_ADDRH 0x16 | ||
48 | #define PCIE_BRIDGE_MSI_DATA 0x17 | ||
49 | |||
50 | /* XLP Global PCIE configuration space registers */ | ||
51 | #define PCIE_BYTE_SWAP_MEM_BASE 0x247 | ||
52 | #define PCIE_BYTE_SWAP_MEM_LIM 0x248 | ||
53 | #define PCIE_BYTE_SWAP_IO_BASE 0x249 | ||
54 | #define PCIE_BYTE_SWAP_IO_LIM 0x24A | ||
55 | #define PCIE_MSI_STATUS 0x25A | ||
56 | #define PCIE_MSI_EN 0x25B | ||
57 | #define PCIE_INT_EN0 0x261 | ||
58 | |||
59 | /* PCIE_MSI_EN */ | ||
60 | #define PCIE_MSI_VECTOR_INT_EN 0xFFFFFFFF | ||
61 | |||
62 | /* PCIE_INT_EN0 */ | ||
63 | #define PCIE_MSI_INT_EN (1 << 9) | ||
64 | |||
65 | #ifndef __ASSEMBLY__ | ||
66 | |||
67 | #define nlm_read_pcie_reg(b, r) nlm_read_reg(b, r) | ||
68 | #define nlm_write_pcie_reg(b, r, v) nlm_write_reg(b, r, v) | ||
69 | #define nlm_get_pcie_base(node, inst) \ | ||
70 | nlm_pcicfg_base(XLP_IO_PCIE_OFFSET(node, inst)) | ||
71 | #define nlm_get_pcie_regbase(node, inst) \ | ||
72 | (nlm_get_pcie_base(node, inst) + XLP_IO_PCI_HDRSZ) | ||
73 | |||
74 | int xlp_pcie_link_irt(int link); | ||
75 | #endif | ||
76 | #endif /* __NLM_HAL_PCIBUS_H__ */ | ||
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/pic.h b/arch/mips/include/asm/netlogic/xlp-hal/pic.h index b6628f7ccf74..ad8b80233a63 100644 --- a/arch/mips/include/asm/netlogic/xlp-hal/pic.h +++ b/arch/mips/include/asm/netlogic/xlp-hal/pic.h | |||
@@ -201,7 +201,11 @@ | |||
201 | #define PIC_NUM_USB_IRTS 6 | 201 | #define PIC_NUM_USB_IRTS 6 |
202 | #define PIC_IRT_USB_0_INDEX 115 | 202 | #define PIC_IRT_USB_0_INDEX 115 |
203 | #define PIC_IRT_EHCI_0_INDEX 115 | 203 | #define PIC_IRT_EHCI_0_INDEX 115 |
204 | #define PIC_IRT_OHCI_0_INDEX 116 | ||
205 | #define PIC_IRT_OHCI_1_INDEX 117 | ||
204 | #define PIC_IRT_EHCI_1_INDEX 118 | 206 | #define PIC_IRT_EHCI_1_INDEX 118 |
207 | #define PIC_IRT_OHCI_2_INDEX 119 | ||
208 | #define PIC_IRT_OHCI_3_INDEX 120 | ||
205 | #define PIC_IRT_USB_INDEX(num) ((num) + PIC_IRT_USB_0_INDEX) | 209 | #define PIC_IRT_USB_INDEX(num) ((num) + PIC_IRT_USB_0_INDEX) |
206 | /* 115 to 120 */ | 210 | /* 115 to 120 */ |
207 | #define PIC_IRT_GDX_INDEX 121 | 211 | #define PIC_IRT_GDX_INDEX 121 |
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/usb.h b/arch/mips/include/asm/netlogic/xlp-hal/usb.h new file mode 100644 index 000000000000..a9cd350dfb6c --- /dev/null +++ b/arch/mips/include/asm/netlogic/xlp-hal/usb.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2003-2012 Broadcom Corporation | ||
3 | * All Rights Reserved | ||
4 | * | ||
5 | * This software is available to you under a choice of one of two | ||
6 | * licenses. You may choose to be licensed under the terms of the GNU | ||
7 | * General Public License (GPL) Version 2, available from the file | ||
8 | * COPYING in the main directory of this source tree, or the Broadcom | ||
9 | * license below: | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions and the following disclaimer. | ||
17 | * 2. Redistributions in binary form must reproduce the above copyright | ||
18 | * notice, this list of conditions and the following disclaimer in | ||
19 | * the documentation and/or other materials provided with the | ||
20 | * distribution. | ||
21 | * | ||
22 | * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR | ||
23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
24 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
25 | * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE | ||
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
29 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
30 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
31 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||
32 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | */ | ||
34 | |||
35 | #ifndef __NLM_HAL_USB_H__ | ||
36 | #define __NLM_HAL_USB_H__ | ||
37 | |||
38 | #define USB_CTL_0 0x01 | ||
39 | #define USB_PHY_0 0x0A | ||
40 | #define USB_PHY_RESET 0x01 | ||
41 | #define USB_PHY_PORT_RESET_0 0x10 | ||
42 | #define USB_PHY_PORT_RESET_1 0x20 | ||
43 | #define USB_CONTROLLER_RESET 0x01 | ||
44 | #define USB_INT_STATUS 0x0E | ||
45 | #define USB_INT_EN 0x0F | ||
46 | #define USB_PHY_INTERRUPT_EN 0x01 | ||
47 | #define USB_OHCI_INTERRUPT_EN 0x02 | ||
48 | #define USB_OHCI_INTERRUPT1_EN 0x04 | ||
49 | #define USB_OHCI_INTERRUPT2_EN 0x08 | ||
50 | #define USB_CTRL_INTERRUPT_EN 0x10 | ||
51 | |||
52 | #ifndef __ASSEMBLY__ | ||
53 | |||
54 | #define nlm_read_usb_reg(b, r) nlm_read_reg(b, r) | ||
55 | #define nlm_write_usb_reg(b, r, v) nlm_write_reg(b, r, v) | ||
56 | #define nlm_get_usb_pcibase(node, inst) \ | ||
57 | nlm_pcicfg_base(XLP_IO_USB_OFFSET(node, inst)) | ||
58 | #define nlm_get_usb_hcd_base(node, inst) \ | ||
59 | nlm_xkphys_map_pcibar0(nlm_get_usb_pcibase(node, inst)) | ||
60 | #define nlm_get_usb_regbase(node, inst) \ | ||
61 | (nlm_get_usb_pcibase(node, inst) + XLP_IO_PCI_HDRSZ) | ||
62 | |||
63 | #endif | ||
64 | #endif /* __NLM_HAL_USB_H__ */ | ||
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h index 1540588e396d..7e47209327a5 100644 --- a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h +++ b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h | |||
@@ -35,8 +35,21 @@ | |||
35 | #ifndef _NLM_HAL_XLP_H | 35 | #ifndef _NLM_HAL_XLP_H |
36 | #define _NLM_HAL_XLP_H | 36 | #define _NLM_HAL_XLP_H |
37 | 37 | ||
38 | #define PIC_UART_0_IRQ 17 | 38 | #define PIC_UART_0_IRQ 17 |
39 | #define PIC_UART_1_IRQ 18 | 39 | #define PIC_UART_1_IRQ 18 |
40 | #define PIC_PCIE_LINK_0_IRQ 19 | ||
41 | #define PIC_PCIE_LINK_1_IRQ 20 | ||
42 | #define PIC_PCIE_LINK_2_IRQ 21 | ||
43 | #define PIC_PCIE_LINK_3_IRQ 22 | ||
44 | #define PIC_EHCI_0_IRQ 23 | ||
45 | #define PIC_EHCI_1_IRQ 24 | ||
46 | #define PIC_OHCI_0_IRQ 25 | ||
47 | #define PIC_OHCI_1_IRQ 26 | ||
48 | #define PIC_OHCI_2_IRQ 27 | ||
49 | #define PIC_OHCI_3_IRQ 28 | ||
50 | #define PIC_MMC_IRQ 29 | ||
51 | #define PIC_I2C_0_IRQ 30 | ||
52 | #define PIC_I2C_1_IRQ 31 | ||
40 | 53 | ||
41 | #ifndef __ASSEMBLY__ | 54 | #ifndef __ASSEMBLY__ |
42 | 55 | ||
diff --git a/arch/mips/include/asm/netlogic/xlr/bridge.h b/arch/mips/include/asm/netlogic/xlr/bridge.h new file mode 100644 index 000000000000..2d02428c4f1b --- /dev/null +++ b/arch/mips/include/asm/netlogic/xlr/bridge.h | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2003-2012 Broadcom Corporation | ||
3 | * All Rights Reserved | ||
4 | * | ||
5 | * This software is available to you under a choice of one of two | ||
6 | * licenses. You may choose to be licensed under the terms of the GNU | ||
7 | * General Public License (GPL) Version 2, available from the file | ||
8 | * COPYING in the main directory of this source tree, or the Broadcom | ||
9 | * license below: | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions and the following disclaimer. | ||
17 | * 2. Redistributions in binary form must reproduce the above copyright | ||
18 | * notice, this list of conditions and the following disclaimer in | ||
19 | * the documentation and/or other materials provided with the | ||
20 | * distribution. | ||
21 | * | ||
22 | * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR | ||
23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
24 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
25 | * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE | ||
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
29 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
30 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
31 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||
32 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | */ | ||
34 | #ifndef _ASM_NLM_BRIDGE_H_ | ||
35 | #define _ASM_NLM_BRIDGE_H_ | ||
36 | |||
37 | #define BRIDGE_DRAM_0_BAR 0 | ||
38 | #define BRIDGE_DRAM_1_BAR 1 | ||
39 | #define BRIDGE_DRAM_2_BAR 2 | ||
40 | #define BRIDGE_DRAM_3_BAR 3 | ||
41 | #define BRIDGE_DRAM_4_BAR 4 | ||
42 | #define BRIDGE_DRAM_5_BAR 5 | ||
43 | #define BRIDGE_DRAM_6_BAR 6 | ||
44 | #define BRIDGE_DRAM_7_BAR 7 | ||
45 | #define BRIDGE_DRAM_CHN_0_MTR_0_BAR 8 | ||
46 | #define BRIDGE_DRAM_CHN_0_MTR_1_BAR 9 | ||
47 | #define BRIDGE_DRAM_CHN_0_MTR_2_BAR 10 | ||
48 | #define BRIDGE_DRAM_CHN_0_MTR_3_BAR 11 | ||
49 | #define BRIDGE_DRAM_CHN_0_MTR_4_BAR 12 | ||
50 | #define BRIDGE_DRAM_CHN_0_MTR_5_BAR 13 | ||
51 | #define BRIDGE_DRAM_CHN_0_MTR_6_BAR 14 | ||
52 | #define BRIDGE_DRAM_CHN_0_MTR_7_BAR 15 | ||
53 | #define BRIDGE_DRAM_CHN_1_MTR_0_BAR 16 | ||
54 | #define BRIDGE_DRAM_CHN_1_MTR_1_BAR 17 | ||
55 | #define BRIDGE_DRAM_CHN_1_MTR_2_BAR 18 | ||
56 | #define BRIDGE_DRAM_CHN_1_MTR_3_BAR 19 | ||
57 | #define BRIDGE_DRAM_CHN_1_MTR_4_BAR 20 | ||
58 | #define BRIDGE_DRAM_CHN_1_MTR_5_BAR 21 | ||
59 | #define BRIDGE_DRAM_CHN_1_MTR_6_BAR 22 | ||
60 | #define BRIDGE_DRAM_CHN_1_MTR_7_BAR 23 | ||
61 | #define BRIDGE_CFG_BAR 24 | ||
62 | #define BRIDGE_PHNX_IO_BAR 25 | ||
63 | #define BRIDGE_FLASH_BAR 26 | ||
64 | #define BRIDGE_SRAM_BAR 27 | ||
65 | #define BRIDGE_HTMEM_BAR 28 | ||
66 | #define BRIDGE_HTINT_BAR 29 | ||
67 | #define BRIDGE_HTPIC_BAR 30 | ||
68 | #define BRIDGE_HTSM_BAR 31 | ||
69 | #define BRIDGE_HTIO_BAR 32 | ||
70 | #define BRIDGE_HTCFG_BAR 33 | ||
71 | #define BRIDGE_PCIXCFG_BAR 34 | ||
72 | #define BRIDGE_PCIXMEM_BAR 35 | ||
73 | #define BRIDGE_PCIXIO_BAR 36 | ||
74 | #define BRIDGE_DEVICE_MASK 37 | ||
75 | #define BRIDGE_AERR_INTR_LOG1 38 | ||
76 | #define BRIDGE_AERR_INTR_LOG2 39 | ||
77 | #define BRIDGE_AERR_INTR_LOG3 40 | ||
78 | #define BRIDGE_AERR_DEV_STAT 41 | ||
79 | #define BRIDGE_AERR1_LOG1 42 | ||
80 | #define BRIDGE_AERR1_LOG2 43 | ||
81 | #define BRIDGE_AERR1_LOG3 44 | ||
82 | #define BRIDGE_AERR1_DEV_STAT 45 | ||
83 | #define BRIDGE_AERR_INTR_EN 46 | ||
84 | #define BRIDGE_AERR_UPG 47 | ||
85 | #define BRIDGE_AERR_CLEAR 48 | ||
86 | #define BRIDGE_AERR1_CLEAR 49 | ||
87 | #define BRIDGE_SBE_COUNTS 50 | ||
88 | #define BRIDGE_DBE_COUNTS 51 | ||
89 | #define BRIDGE_BITERR_INT_EN 52 | ||
90 | |||
91 | #define BRIDGE_SYS2IO_CREDITS 53 | ||
92 | #define BRIDGE_EVNT_CNT_CTRL1 54 | ||
93 | #define BRIDGE_EVNT_COUNTER1 55 | ||
94 | #define BRIDGE_EVNT_CNT_CTRL2 56 | ||
95 | #define BRIDGE_EVNT_COUNTER2 57 | ||
96 | #define BRIDGE_RESERVED1 58 | ||
97 | |||
98 | #define BRIDGE_DEFEATURE 59 | ||
99 | #define BRIDGE_SCRATCH0 60 | ||
100 | #define BRIDGE_SCRATCH1 61 | ||
101 | #define BRIDGE_SCRATCH2 62 | ||
102 | #define BRIDGE_SCRATCH3 63 | ||
103 | |||
104 | #endif | ||
diff --git a/arch/mips/include/asm/netlogic/xlr/flash.h b/arch/mips/include/asm/netlogic/xlr/flash.h new file mode 100644 index 000000000000..f8aca5472b6c --- /dev/null +++ b/arch/mips/include/asm/netlogic/xlr/flash.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2003-2012 Broadcom Corporation | ||
3 | * All Rights Reserved | ||
4 | * | ||
5 | * This software is available to you under a choice of one of two | ||
6 | * licenses. You may choose to be licensed under the terms of the GNU | ||
7 | * General Public License (GPL) Version 2, available from the file | ||
8 | * COPYING in the main directory of this source tree, or the Broadcom | ||
9 | * license below: | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions and the following disclaimer. | ||
17 | * 2. Redistributions in binary form must reproduce the above copyright | ||
18 | * notice, this list of conditions and the following disclaimer in | ||
19 | * the documentation and/or other materials provided with the | ||
20 | * distribution. | ||
21 | * | ||
22 | * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR | ||
23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
24 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
25 | * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE | ||
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
29 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
30 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
31 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||
32 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | */ | ||
34 | #ifndef _ASM_NLM_FLASH_H_ | ||
35 | #define _ASM_NLM_FLASH_H_ | ||
36 | |||
37 | #define FLASH_CSBASE_ADDR(cs) (cs) | ||
38 | #define FLASH_CSADDR_MASK(cs) (0x10 + (cs)) | ||
39 | #define FLASH_CSDEV_PARM(cs) (0x20 + (cs)) | ||
40 | #define FLASH_CSTIME_PARMA(cs) (0x30 + (cs)) | ||
41 | #define FLASH_CSTIME_PARMB(cs) (0x40 + (cs)) | ||
42 | |||
43 | #define FLASH_INT_MASK 0x50 | ||
44 | #define FLASH_INT_STATUS 0x60 | ||
45 | #define FLASH_ERROR_STATUS 0x70 | ||
46 | #define FLASH_ERROR_ADDR 0x80 | ||
47 | |||
48 | #define FLASH_NAND_CLE(cs) (0x90 + (cs)) | ||
49 | #define FLASH_NAND_ALE(cs) (0xa0 + (cs)) | ||
50 | |||
51 | #define FLASH_NAND_CSDEV_PARAM 0x000041e6 | ||
52 | #define FLASH_NAND_CSTIME_PARAMA 0x4f400e22 | ||
53 | #define FLASH_NAND_CSTIME_PARAMB 0x000083cf | ||
54 | |||
55 | #endif | ||
diff --git a/arch/mips/include/asm/netlogic/xlr/gpio.h b/arch/mips/include/asm/netlogic/xlr/gpio.h index 51f6ad4aeb14..8492e835b110 100644 --- a/arch/mips/include/asm/netlogic/xlr/gpio.h +++ b/arch/mips/include/asm/netlogic/xlr/gpio.h | |||
@@ -35,39 +35,40 @@ | |||
35 | #ifndef _ASM_NLM_GPIO_H | 35 | #ifndef _ASM_NLM_GPIO_H |
36 | #define _ASM_NLM_GPIO_H | 36 | #define _ASM_NLM_GPIO_H |
37 | 37 | ||
38 | #define NETLOGIC_GPIO_INT_EN_REG 0 | 38 | #define GPIO_INT_EN_REG 0 |
39 | #define NETLOGIC_GPIO_INPUT_INVERSION_REG 1 | 39 | #define GPIO_INPUT_INVERSION_REG 1 |
40 | #define NETLOGIC_GPIO_IO_DIR_REG 2 | 40 | #define GPIO_IO_DIR_REG 2 |
41 | #define NETLOGIC_GPIO_IO_DATA_WR_REG 3 | 41 | #define GPIO_IO_DATA_WR_REG 3 |
42 | #define NETLOGIC_GPIO_IO_DATA_RD_REG 4 | 42 | #define GPIO_IO_DATA_RD_REG 4 |
43 | 43 | ||
44 | #define NETLOGIC_GPIO_SWRESET_REG 8 | 44 | #define GPIO_SWRESET_REG 8 |
45 | #define NETLOGIC_GPIO_DRAM1_CNTRL_REG 9 | 45 | #define GPIO_DRAM1_CNTRL_REG 9 |
46 | #define NETLOGIC_GPIO_DRAM1_RATIO_REG 10 | 46 | #define GPIO_DRAM1_RATIO_REG 10 |
47 | #define NETLOGIC_GPIO_DRAM1_RESET_REG 11 | 47 | #define GPIO_DRAM1_RESET_REG 11 |
48 | #define NETLOGIC_GPIO_DRAM1_STATUS_REG 12 | 48 | #define GPIO_DRAM1_STATUS_REG 12 |
49 | #define NETLOGIC_GPIO_DRAM2_CNTRL_REG 13 | 49 | #define GPIO_DRAM2_CNTRL_REG 13 |
50 | #define NETLOGIC_GPIO_DRAM2_RATIO_REG 14 | 50 | #define GPIO_DRAM2_RATIO_REG 14 |
51 | #define NETLOGIC_GPIO_DRAM2_RESET_REG 15 | 51 | #define GPIO_DRAM2_RESET_REG 15 |
52 | #define NETLOGIC_GPIO_DRAM2_STATUS_REG 16 | 52 | #define GPIO_DRAM2_STATUS_REG 16 |
53 | 53 | ||
54 | #define NETLOGIC_GPIO_PWRON_RESET_CFG_REG 21 | 54 | #define GPIO_PWRON_RESET_CFG_REG 21 |
55 | #define NETLOGIC_GPIO_BIST_ALL_GO_STATUS_REG 24 | 55 | #define GPIO_BIST_ALL_GO_STATUS_REG 24 |
56 | #define NETLOGIC_GPIO_BIST_CPU_GO_STATUS_REG 25 | 56 | #define GPIO_BIST_CPU_GO_STATUS_REG 25 |
57 | #define NETLOGIC_GPIO_BIST_DEV_GO_STATUS_REG 26 | 57 | #define GPIO_BIST_DEV_GO_STATUS_REG 26 |
58 | 58 | ||
59 | #define NETLOGIC_GPIO_FUSE_BANK_REG 35 | 59 | #define GPIO_FUSE_BANK_REG 35 |
60 | #define NETLOGIC_GPIO_CPU_RESET_REG 40 | 60 | #define GPIO_CPU_RESET_REG 40 |
61 | #define NETLOGIC_GPIO_RNG_REG 43 | 61 | #define GPIO_RNG_REG 43 |
62 | 62 | ||
63 | #define NETLOGIC_PWRON_RESET_PCMCIA_BOOT 17 | 63 | #define PWRON_RESET_PCMCIA_BOOT 17 |
64 | #define NETLOGIC_GPIO_LED_BITMAP 0x1700000 | ||
65 | #define NETLOGIC_GPIO_LED_0_SHIFT 20 | ||
66 | #define NETLOGIC_GPIO_LED_1_SHIFT 24 | ||
67 | 64 | ||
68 | #define NETLOGIC_GPIO_LED_OUTPUT_CODE_RESET 0x01 | 65 | #define GPIO_LED_BITMAP 0x1700000 |
69 | #define NETLOGIC_GPIO_LED_OUTPUT_CODE_HARD_RESET 0x02 | 66 | #define GPIO_LED_0_SHIFT 20 |
70 | #define NETLOGIC_GPIO_LED_OUTPUT_CODE_SOFT_RESET 0x03 | 67 | #define GPIO_LED_1_SHIFT 24 |
71 | #define NETLOGIC_GPIO_LED_OUTPUT_CODE_MAIN 0x04 | 68 | |
69 | #define GPIO_LED_OUTPUT_CODE_RESET 0x01 | ||
70 | #define GPIO_LED_OUTPUT_CODE_HARD_RESET 0x02 | ||
71 | #define GPIO_LED_OUTPUT_CODE_SOFT_RESET 0x03 | ||
72 | #define GPIO_LED_OUTPUT_CODE_MAIN 0x04 | ||
72 | 73 | ||
73 | #endif | 74 | #endif |
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-fpa.h b/arch/mips/include/asm/octeon/cvmx-helper-fpa.h deleted file mode 100644 index 5ff8c93198de..000000000000 --- a/arch/mips/include/asm/octeon/cvmx-helper-fpa.h +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | /***********************license start*************** | ||
2 | * Author: Cavium Networks | ||
3 | * | ||
4 | * Contact: support@caviumnetworks.com | ||
5 | * This file is part of the OCTEON SDK | ||
6 | * | ||
7 | * Copyright (c) 2003-2008 Cavium Networks | ||
8 | * | ||
9 | * This file is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License, Version 2, as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This file is distributed in the hope that it will be useful, but | ||
14 | * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty | ||
15 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or | ||
16 | * NONINFRINGEMENT. See the GNU General Public License for more | ||
17 | * details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this file; if not, write to the Free Software | ||
21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
22 | * or visit http://www.gnu.org/licenses/. | ||
23 | * | ||
24 | * This file may also be available under a different license from Cavium. | ||
25 | * Contact Cavium Networks for more information | ||
26 | ***********************license end**************************************/ | ||
27 | |||
28 | /** | ||
29 | * @file | ||
30 | * | ||
31 | * Helper functions for FPA setup. | ||
32 | * | ||
33 | */ | ||
34 | #ifndef __CVMX_HELPER_H_FPA__ | ||
35 | #define __CVMX_HELPER_H_FPA__ | ||
36 | |||
37 | /** | ||
38 | * Allocate memory and initialize the FPA pools using memory | ||
39 | * from cvmx-bootmem. Sizes of each element in the pools is | ||
40 | * controlled by the cvmx-config.h header file. Specifying | ||
41 | * zero for any parameter will cause that FPA pool to not be | ||
42 | * setup. This is useful if you aren't using some of the | ||
43 | * hardware and want to save memory. | ||
44 | * | ||
45 | * @packet_buffers: | ||
46 | * Number of packet buffers to allocate | ||
47 | * @work_queue_entries: | ||
48 | * Number of work queue entries | ||
49 | * @pko_buffers: | ||
50 | * PKO Command buffers. You should at minimum have two per | ||
51 | * each PKO queue. | ||
52 | * @tim_buffers: | ||
53 | * TIM ring buffer command queues. At least two per timer bucket | ||
54 | * is recommened. | ||
55 | * @dfa_buffers: | ||
56 | * DFA command buffer. A relatively small (32 for example) | ||
57 | * number should work. | ||
58 | * Returns Zero on success, non-zero if out of memory | ||
59 | */ | ||
60 | extern int cvmx_helper_initialize_fpa(int packet_buffers, | ||
61 | int work_queue_entries, int pko_buffers, | ||
62 | int tim_buffers, int dfa_buffers); | ||
63 | |||
64 | #endif /* __CVMX_HELPER_H__ */ | ||
diff --git a/arch/mips/include/asm/octeon/cvmx-helper.h b/arch/mips/include/asm/octeon/cvmx-helper.h index 3169cd79f2ac..0ac6b9f412be 100644 --- a/arch/mips/include/asm/octeon/cvmx-helper.h +++ b/arch/mips/include/asm/octeon/cvmx-helper.h | |||
@@ -61,8 +61,6 @@ typedef union { | |||
61 | } s; | 61 | } s; |
62 | } cvmx_helper_link_info_t; | 62 | } cvmx_helper_link_info_t; |
63 | 63 | ||
64 | #include "cvmx-helper-fpa.h" | ||
65 | |||
66 | #include <asm/octeon/cvmx-helper-errata.h> | 64 | #include <asm/octeon/cvmx-helper-errata.h> |
67 | #include "cvmx-helper-loop.h" | 65 | #include "cvmx-helper-loop.h" |
68 | #include "cvmx-helper-npi.h" | 66 | #include "cvmx-helper-npi.h" |
diff --git a/arch/mips/include/asm/octeon/octeon.h b/arch/mips/include/asm/octeon/octeon.h index f72f768cd3a4..1e2486e23573 100644 --- a/arch/mips/include/asm/octeon/octeon.h +++ b/arch/mips/include/asm/octeon/octeon.h | |||
@@ -215,11 +215,6 @@ struct octeon_cf_data { | |||
215 | int dma_engine; /* -1 for no DMA */ | 215 | int dma_engine; /* -1 for no DMA */ |
216 | }; | 216 | }; |
217 | 217 | ||
218 | struct octeon_i2c_data { | ||
219 | unsigned int sys_freq; | ||
220 | unsigned int i2c_freq; | ||
221 | }; | ||
222 | |||
223 | extern void octeon_write_lcd(const char *s); | 218 | extern void octeon_write_lcd(const char *s); |
224 | extern void octeon_check_cpu_bist(void); | 219 | extern void octeon_check_cpu_bist(void); |
225 | extern int octeon_get_boot_debug_flag(void); | 220 | extern int octeon_get_boot_debug_flag(void); |
diff --git a/arch/mips/include/asm/prom.h b/arch/mips/include/asm/prom.h index 7206d445bab8..8808bf548b99 100644 --- a/arch/mips/include/asm/prom.h +++ b/arch/mips/include/asm/prom.h | |||
@@ -20,9 +20,6 @@ | |||
20 | extern int early_init_dt_scan_memory_arch(unsigned long node, | 20 | extern int early_init_dt_scan_memory_arch(unsigned long node, |
21 | const char *uname, int depth, void *data); | 21 | const char *uname, int depth, void *data); |
22 | 22 | ||
23 | extern int reserve_mem_mach(unsigned long addr, unsigned long size); | ||
24 | extern void free_mem_mach(unsigned long addr, unsigned long size); | ||
25 | |||
26 | extern void device_tree_init(void); | 23 | extern void device_tree_init(void); |
27 | 24 | ||
28 | static inline unsigned long pci_address_to_pio(phys_addr_t address) | 25 | static inline unsigned long pci_address_to_pio(phys_addr_t address) |
diff --git a/arch/mips/include/asm/smtc.h b/arch/mips/include/asm/smtc.h index c9736fc06325..8935426a56ab 100644 --- a/arch/mips/include/asm/smtc.h +++ b/arch/mips/include/asm/smtc.h | |||
@@ -33,6 +33,12 @@ typedef long asiduse; | |||
33 | #endif | 33 | #endif |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | /* | ||
37 | * VPE Management information | ||
38 | */ | ||
39 | |||
40 | #define MAX_SMTC_VPES MAX_SMTC_TLBS /* FIXME: May not always be true. */ | ||
41 | |||
36 | extern asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS]; | 42 | extern asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS]; |
37 | 43 | ||
38 | struct mm_struct; | 44 | struct mm_struct; |
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h index 653a412c036c..3b92efef56d3 100644 --- a/arch/mips/include/asm/uaccess.h +++ b/arch/mips/include/asm/uaccess.h | |||
@@ -687,7 +687,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n); | |||
687 | __MODULE_JAL(__copy_user) \ | 687 | __MODULE_JAL(__copy_user) \ |
688 | : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \ | 688 | : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \ |
689 | : \ | 689 | : \ |
690 | : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \ | 690 | : "$8", "$9", "$10", "$11", "$12", "$14", "$15", "$24", "$31", \ |
691 | DADDI_SCRATCH, "memory"); \ | 691 | DADDI_SCRATCH, "memory"); \ |
692 | __cu_len_r; \ | 692 | __cu_len_r; \ |
693 | }) | 693 | }) |
@@ -797,7 +797,7 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n); | |||
797 | ".set\treorder" \ | 797 | ".set\treorder" \ |
798 | : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \ | 798 | : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \ |
799 | : \ | 799 | : \ |
800 | : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \ | 800 | : "$8", "$9", "$10", "$11", "$12", "$14", "$15", "$24", "$31", \ |
801 | DADDI_SCRATCH, "memory"); \ | 801 | DADDI_SCRATCH, "memory"); \ |
802 | __cu_len_r; \ | 802 | __cu_len_r; \ |
803 | }) | 803 | }) |
@@ -820,7 +820,7 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n); | |||
820 | ".set\treorder" \ | 820 | ".set\treorder" \ |
821 | : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \ | 821 | : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \ |
822 | : \ | 822 | : \ |
823 | : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \ | 823 | : "$8", "$9", "$10", "$11", "$12", "$14", "$15", "$24", "$31", \ |
824 | DADDI_SCRATCH, "memory"); \ | 824 | DADDI_SCRATCH, "memory"); \ |
825 | __cu_len_r; \ | 825 | __cu_len_r; \ |
826 | }) | 826 | }) |
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h index 440a21dab575..3d9f75f7ffc9 100644 --- a/arch/mips/include/asm/uasm.h +++ b/arch/mips/include/asm/uasm.h | |||
@@ -6,6 +6,7 @@ | |||
6 | * Copyright (C) 2004, 2005, 2006, 2008 Thiemo Seufer | 6 | * Copyright (C) 2004, 2005, 2006, 2008 Thiemo Seufer |
7 | * Copyright (C) 2005 Maciej W. Rozycki | 7 | * Copyright (C) 2005 Maciej W. Rozycki |
8 | * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org) | 8 | * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org) |
9 | * Copyright (C) 2012 MIPS Technologies, Inc. | ||
9 | */ | 10 | */ |
10 | 11 | ||
11 | #include <linux/types.h> | 12 | #include <linux/types.h> |
@@ -62,8 +63,10 @@ void __uasminit uasm_i##op(u32 **buf, unsigned int a, signed int b) | |||
62 | 63 | ||
63 | Ip_u2u1s3(_addiu); | 64 | Ip_u2u1s3(_addiu); |
64 | Ip_u3u1u2(_addu); | 65 | Ip_u3u1u2(_addu); |
65 | Ip_u2u1u3(_andi); | ||
66 | Ip_u3u1u2(_and); | 66 | Ip_u3u1u2(_and); |
67 | Ip_u2u1u3(_andi); | ||
68 | Ip_u1u2s3(_bbit0); | ||
69 | Ip_u1u2s3(_bbit1); | ||
67 | Ip_u1u2s3(_beq); | 70 | Ip_u1u2s3(_beq); |
68 | Ip_u1u2s3(_beql); | 71 | Ip_u1u2s3(_beql); |
69 | Ip_u1s2(_bgez); | 72 | Ip_u1s2(_bgez); |
@@ -72,55 +75,54 @@ Ip_u1s2(_bltz); | |||
72 | Ip_u1s2(_bltzl); | 75 | Ip_u1s2(_bltzl); |
73 | Ip_u1u2s3(_bne); | 76 | Ip_u1u2s3(_bne); |
74 | Ip_u2s3u1(_cache); | 77 | Ip_u2s3u1(_cache); |
75 | Ip_u1u2u3(_dmfc0); | ||
76 | Ip_u1u2u3(_dmtc0); | ||
77 | Ip_u2u1s3(_daddiu); | 78 | Ip_u2u1s3(_daddiu); |
78 | Ip_u3u1u2(_daddu); | 79 | Ip_u3u1u2(_daddu); |
80 | Ip_u2u1msbu3(_dins); | ||
81 | Ip_u2u1msbu3(_dinsm); | ||
82 | Ip_u1u2u3(_dmfc0); | ||
83 | Ip_u1u2u3(_dmtc0); | ||
84 | Ip_u2u1u3(_drotr); | ||
85 | Ip_u2u1u3(_drotr32); | ||
79 | Ip_u2u1u3(_dsll); | 86 | Ip_u2u1u3(_dsll); |
80 | Ip_u2u1u3(_dsll32); | 87 | Ip_u2u1u3(_dsll32); |
81 | Ip_u2u1u3(_dsra); | 88 | Ip_u2u1u3(_dsra); |
82 | Ip_u2u1u3(_dsrl); | 89 | Ip_u2u1u3(_dsrl); |
83 | Ip_u2u1u3(_dsrl32); | 90 | Ip_u2u1u3(_dsrl32); |
84 | Ip_u2u1u3(_drotr); | ||
85 | Ip_u2u1u3(_drotr32); | ||
86 | Ip_u3u1u2(_dsubu); | 91 | Ip_u3u1u2(_dsubu); |
87 | Ip_0(_eret); | 92 | Ip_0(_eret); |
88 | Ip_u1(_j); | 93 | Ip_u1(_j); |
89 | Ip_u1(_jal); | 94 | Ip_u1(_jal); |
90 | Ip_u1(_jr); | 95 | Ip_u1(_jr); |
91 | Ip_u2s3u1(_ld); | 96 | Ip_u2s3u1(_ld); |
97 | Ip_u3u1u2(_ldx); | ||
92 | Ip_u2s3u1(_ll); | 98 | Ip_u2s3u1(_ll); |
93 | Ip_u2s3u1(_lld); | 99 | Ip_u2s3u1(_lld); |
94 | Ip_u1s2(_lui); | 100 | Ip_u1s2(_lui); |
95 | Ip_u2s3u1(_lw); | 101 | Ip_u2s3u1(_lw); |
102 | Ip_u3u1u2(_lwx); | ||
96 | Ip_u1u2u3(_mfc0); | 103 | Ip_u1u2u3(_mfc0); |
97 | Ip_u1u2u3(_mtc0); | 104 | Ip_u1u2u3(_mtc0); |
98 | Ip_u2u1u3(_ori); | ||
99 | Ip_u3u1u2(_or); | 105 | Ip_u3u1u2(_or); |
106 | Ip_u2u1u3(_ori); | ||
100 | Ip_u2s3u1(_pref); | 107 | Ip_u2s3u1(_pref); |
101 | Ip_0(_rfe); | 108 | Ip_0(_rfe); |
109 | Ip_u2u1u3(_rotr); | ||
102 | Ip_u2s3u1(_sc); | 110 | Ip_u2s3u1(_sc); |
103 | Ip_u2s3u1(_scd); | 111 | Ip_u2s3u1(_scd); |
104 | Ip_u2s3u1(_sd); | 112 | Ip_u2s3u1(_sd); |
105 | Ip_u2u1u3(_sll); | 113 | Ip_u2u1u3(_sll); |
106 | Ip_u2u1u3(_sra); | 114 | Ip_u2u1u3(_sra); |
107 | Ip_u2u1u3(_srl); | 115 | Ip_u2u1u3(_srl); |
108 | Ip_u2u1u3(_rotr); | ||
109 | Ip_u3u1u2(_subu); | 116 | Ip_u3u1u2(_subu); |
110 | Ip_u2s3u1(_sw); | 117 | Ip_u2s3u1(_sw); |
118 | Ip_u1(_syscall); | ||
111 | Ip_0(_tlbp); | 119 | Ip_0(_tlbp); |
112 | Ip_0(_tlbr); | 120 | Ip_0(_tlbr); |
113 | Ip_0(_tlbwi); | 121 | Ip_0(_tlbwi); |
114 | Ip_0(_tlbwr); | 122 | Ip_0(_tlbwr); |
115 | Ip_u3u1u2(_xor); | 123 | Ip_u3u1u2(_xor); |
116 | Ip_u2u1u3(_xori); | 124 | Ip_u2u1u3(_xori); |
117 | Ip_u2u1msbu3(_dins); | 125 | |
118 | Ip_u2u1msbu3(_dinsm); | ||
119 | Ip_u1(_syscall); | ||
120 | Ip_u1u2s3(_bbit0); | ||
121 | Ip_u1u2s3(_bbit1); | ||
122 | Ip_u3u1u2(_lwx); | ||
123 | Ip_u3u1u2(_ldx); | ||
124 | 126 | ||
125 | /* Handle labels. */ | 127 | /* Handle labels. */ |
126 | struct uasm_label { | 128 | struct uasm_label { |
@@ -145,37 +147,37 @@ static inline void __uasminit uasm_l##lb(struct uasm_label **lab, u32 *addr) \ | |||
145 | 147 | ||
146 | /* convenience macros for instructions */ | 148 | /* convenience macros for instructions */ |
147 | #ifdef CONFIG_64BIT | 149 | #ifdef CONFIG_64BIT |
150 | # define UASM_i_ADDIU(buf, rs, rt, val) uasm_i_daddiu(buf, rs, rt, val) | ||
151 | # define UASM_i_ADDU(buf, rs, rt, rd) uasm_i_daddu(buf, rs, rt, rd) | ||
152 | # define UASM_i_LL(buf, rs, rt, off) uasm_i_lld(buf, rs, rt, off) | ||
148 | # define UASM_i_LW(buf, rs, rt, off) uasm_i_ld(buf, rs, rt, off) | 153 | # define UASM_i_LW(buf, rs, rt, off) uasm_i_ld(buf, rs, rt, off) |
149 | # define UASM_i_SW(buf, rs, rt, off) uasm_i_sd(buf, rs, rt, off) | 154 | # define UASM_i_LWX(buf, rs, rt, rd) uasm_i_ldx(buf, rs, rt, rd) |
155 | # define UASM_i_MFC0(buf, rt, rd...) uasm_i_dmfc0(buf, rt, rd) | ||
156 | # define UASM_i_MTC0(buf, rt, rd...) uasm_i_dmtc0(buf, rt, rd) | ||
157 | # define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_drotr(buf, rs, rt, sh) | ||
158 | # define UASM_i_SC(buf, rs, rt, off) uasm_i_scd(buf, rs, rt, off) | ||
150 | # define UASM_i_SLL(buf, rs, rt, sh) uasm_i_dsll(buf, rs, rt, sh) | 159 | # define UASM_i_SLL(buf, rs, rt, sh) uasm_i_dsll(buf, rs, rt, sh) |
151 | # define UASM_i_SRA(buf, rs, rt, sh) uasm_i_dsra(buf, rs, rt, sh) | 160 | # define UASM_i_SRA(buf, rs, rt, sh) uasm_i_dsra(buf, rs, rt, sh) |
152 | # define UASM_i_SRL(buf, rs, rt, sh) uasm_i_dsrl(buf, rs, rt, sh) | 161 | # define UASM_i_SRL(buf, rs, rt, sh) uasm_i_dsrl(buf, rs, rt, sh) |
153 | # define UASM_i_SRL_SAFE(buf, rs, rt, sh) uasm_i_dsrl_safe(buf, rs, rt, sh) | 162 | # define UASM_i_SRL_SAFE(buf, rs, rt, sh) uasm_i_dsrl_safe(buf, rs, rt, sh) |
154 | # define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_drotr(buf, rs, rt, sh) | ||
155 | # define UASM_i_MFC0(buf, rt, rd...) uasm_i_dmfc0(buf, rt, rd) | ||
156 | # define UASM_i_MTC0(buf, rt, rd...) uasm_i_dmtc0(buf, rt, rd) | ||
157 | # define UASM_i_ADDIU(buf, rs, rt, val) uasm_i_daddiu(buf, rs, rt, val) | ||
158 | # define UASM_i_ADDU(buf, rs, rt, rd) uasm_i_daddu(buf, rs, rt, rd) | ||
159 | # define UASM_i_SUBU(buf, rs, rt, rd) uasm_i_dsubu(buf, rs, rt, rd) | 163 | # define UASM_i_SUBU(buf, rs, rt, rd) uasm_i_dsubu(buf, rs, rt, rd) |
160 | # define UASM_i_LL(buf, rs, rt, off) uasm_i_lld(buf, rs, rt, off) | 164 | # define UASM_i_SW(buf, rs, rt, off) uasm_i_sd(buf, rs, rt, off) |
161 | # define UASM_i_SC(buf, rs, rt, off) uasm_i_scd(buf, rs, rt, off) | ||
162 | # define UASM_i_LWX(buf, rs, rt, rd) uasm_i_ldx(buf, rs, rt, rd) | ||
163 | #else | 165 | #else |
166 | # define UASM_i_ADDIU(buf, rs, rt, val) uasm_i_addiu(buf, rs, rt, val) | ||
167 | # define UASM_i_ADDU(buf, rs, rt, rd) uasm_i_addu(buf, rs, rt, rd) | ||
168 | # define UASM_i_LL(buf, rs, rt, off) uasm_i_ll(buf, rs, rt, off) | ||
164 | # define UASM_i_LW(buf, rs, rt, off) uasm_i_lw(buf, rs, rt, off) | 169 | # define UASM_i_LW(buf, rs, rt, off) uasm_i_lw(buf, rs, rt, off) |
165 | # define UASM_i_SW(buf, rs, rt, off) uasm_i_sw(buf, rs, rt, off) | 170 | # define UASM_i_LWX(buf, rs, rt, rd) uasm_i_lwx(buf, rs, rt, rd) |
171 | # define UASM_i_MFC0(buf, rt, rd...) uasm_i_mfc0(buf, rt, rd) | ||
172 | # define UASM_i_MTC0(buf, rt, rd...) uasm_i_mtc0(buf, rt, rd) | ||
173 | # define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_rotr(buf, rs, rt, sh) | ||
174 | # define UASM_i_SC(buf, rs, rt, off) uasm_i_sc(buf, rs, rt, off) | ||
166 | # define UASM_i_SLL(buf, rs, rt, sh) uasm_i_sll(buf, rs, rt, sh) | 175 | # define UASM_i_SLL(buf, rs, rt, sh) uasm_i_sll(buf, rs, rt, sh) |
167 | # define UASM_i_SRA(buf, rs, rt, sh) uasm_i_sra(buf, rs, rt, sh) | 176 | # define UASM_i_SRA(buf, rs, rt, sh) uasm_i_sra(buf, rs, rt, sh) |
168 | # define UASM_i_SRL(buf, rs, rt, sh) uasm_i_srl(buf, rs, rt, sh) | 177 | # define UASM_i_SRL(buf, rs, rt, sh) uasm_i_srl(buf, rs, rt, sh) |
169 | # define UASM_i_SRL_SAFE(buf, rs, rt, sh) uasm_i_srl(buf, rs, rt, sh) | 178 | # define UASM_i_SRL_SAFE(buf, rs, rt, sh) uasm_i_srl(buf, rs, rt, sh) |
170 | # define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_rotr(buf, rs, rt, sh) | ||
171 | # define UASM_i_MFC0(buf, rt, rd...) uasm_i_mfc0(buf, rt, rd) | ||
172 | # define UASM_i_MTC0(buf, rt, rd...) uasm_i_mtc0(buf, rt, rd) | ||
173 | # define UASM_i_ADDIU(buf, rs, rt, val) uasm_i_addiu(buf, rs, rt, val) | ||
174 | # define UASM_i_ADDU(buf, rs, rt, rd) uasm_i_addu(buf, rs, rt, rd) | ||
175 | # define UASM_i_SUBU(buf, rs, rt, rd) uasm_i_subu(buf, rs, rt, rd) | 179 | # define UASM_i_SUBU(buf, rs, rt, rd) uasm_i_subu(buf, rs, rt, rd) |
176 | # define UASM_i_LL(buf, rs, rt, off) uasm_i_ll(buf, rs, rt, off) | 180 | # define UASM_i_SW(buf, rs, rt, off) uasm_i_sw(buf, rs, rt, off) |
177 | # define UASM_i_SC(buf, rs, rt, off) uasm_i_sc(buf, rs, rt, off) | ||
178 | # define UASM_i_LWX(buf, rs, rt, rd) uasm_i_lwx(buf, rs, rt, rd) | ||
179 | #endif | 181 | #endif |
180 | 182 | ||
181 | #define uasm_i_b(buf, off) uasm_i_beq(buf, 0, 0, off) | 183 | #define uasm_i_b(buf, off) uasm_i_beq(buf, 0, 0, off) |
@@ -183,19 +185,10 @@ static inline void __uasminit uasm_l##lb(struct uasm_label **lab, u32 *addr) \ | |||
183 | #define uasm_i_beqzl(buf, rs, off) uasm_i_beql(buf, rs, 0, off) | 185 | #define uasm_i_beqzl(buf, rs, off) uasm_i_beql(buf, rs, 0, off) |
184 | #define uasm_i_bnez(buf, rs, off) uasm_i_bne(buf, rs, 0, off) | 186 | #define uasm_i_bnez(buf, rs, off) uasm_i_bne(buf, rs, 0, off) |
185 | #define uasm_i_bnezl(buf, rs, off) uasm_i_bnel(buf, rs, 0, off) | 187 | #define uasm_i_bnezl(buf, rs, off) uasm_i_bnel(buf, rs, 0, off) |
188 | #define uasm_i_ehb(buf) uasm_i_sll(buf, 0, 0, 3) | ||
186 | #define uasm_i_move(buf, a, b) UASM_i_ADDU(buf, a, 0, b) | 189 | #define uasm_i_move(buf, a, b) UASM_i_ADDU(buf, a, 0, b) |
187 | #define uasm_i_nop(buf) uasm_i_sll(buf, 0, 0, 0) | 190 | #define uasm_i_nop(buf) uasm_i_sll(buf, 0, 0, 0) |
188 | #define uasm_i_ssnop(buf) uasm_i_sll(buf, 0, 0, 1) | 191 | #define uasm_i_ssnop(buf) uasm_i_sll(buf, 0, 0, 1) |
189 | #define uasm_i_ehb(buf) uasm_i_sll(buf, 0, 0, 3) | ||
190 | |||
191 | static inline void uasm_i_dsrl_safe(u32 **p, unsigned int a1, | ||
192 | unsigned int a2, unsigned int a3) | ||
193 | { | ||
194 | if (a3 < 32) | ||
195 | uasm_i_dsrl(p, a1, a2, a3); | ||
196 | else | ||
197 | uasm_i_dsrl32(p, a1, a2, a3 - 32); | ||
198 | } | ||
199 | 192 | ||
200 | static inline void uasm_i_drotr_safe(u32 **p, unsigned int a1, | 193 | static inline void uasm_i_drotr_safe(u32 **p, unsigned int a1, |
201 | unsigned int a2, unsigned int a3) | 194 | unsigned int a2, unsigned int a3) |
@@ -215,6 +208,15 @@ static inline void uasm_i_dsll_safe(u32 **p, unsigned int a1, | |||
215 | uasm_i_dsll32(p, a1, a2, a3 - 32); | 208 | uasm_i_dsll32(p, a1, a2, a3 - 32); |
216 | } | 209 | } |
217 | 210 | ||
211 | static inline void uasm_i_dsrl_safe(u32 **p, unsigned int a1, | ||
212 | unsigned int a2, unsigned int a3) | ||
213 | { | ||
214 | if (a3 < 32) | ||
215 | uasm_i_dsrl(p, a1, a2, a3); | ||
216 | else | ||
217 | uasm_i_dsrl32(p, a1, a2, a3 - 32); | ||
218 | } | ||
219 | |||
218 | /* Handle relocations. */ | 220 | /* Handle relocations. */ |
219 | struct uasm_reloc { | 221 | struct uasm_reloc { |
220 | u32 *addr; | 222 | u32 *addr; |
@@ -234,16 +236,16 @@ void uasm_copy_handler(struct uasm_reloc *rel, struct uasm_label *lab, | |||
234 | int uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr); | 236 | int uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr); |
235 | 237 | ||
236 | /* Convenience functions for labeled branches. */ | 238 | /* Convenience functions for labeled branches. */ |
237 | void uasm_il_bltz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); | ||
238 | void uasm_il_b(u32 **p, struct uasm_reloc **r, int lid); | 239 | void uasm_il_b(u32 **p, struct uasm_reloc **r, int lid); |
240 | void uasm_il_bbit0(u32 **p, struct uasm_reloc **r, unsigned int reg, | ||
241 | unsigned int bit, int lid); | ||
242 | void uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg, | ||
243 | unsigned int bit, int lid); | ||
239 | void uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); | 244 | void uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); |
240 | void uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); | 245 | void uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); |
246 | void uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); | ||
247 | void uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); | ||
248 | void uasm_il_bltz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); | ||
241 | void uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1, | 249 | void uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1, |
242 | unsigned int reg2, int lid); | 250 | unsigned int reg2, int lid); |
243 | void uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); | 251 | void uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); |
244 | void uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); | ||
245 | void uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); | ||
246 | void uasm_il_bbit0(u32 **p, struct uasm_reloc **r, unsigned int reg, | ||
247 | unsigned int bit, int lid); | ||
248 | void uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg, | ||
249 | unsigned int bit, int lid); | ||
diff --git a/arch/mips/jz4740/board-qi_lb60.c b/arch/mips/jz4740/board-qi_lb60.c index 9a91fe9de696..9a3d9de4d04e 100644 --- a/arch/mips/jz4740/board-qi_lb60.c +++ b/arch/mips/jz4740/board-qi_lb60.c | |||
@@ -140,6 +140,7 @@ static void qi_lb60_nand_ident(struct platform_device *pdev, | |||
140 | static struct jz_nand_platform_data qi_lb60_nand_pdata = { | 140 | static struct jz_nand_platform_data qi_lb60_nand_pdata = { |
141 | .ident_callback = qi_lb60_nand_ident, | 141 | .ident_callback = qi_lb60_nand_ident, |
142 | .busy_gpio = 94, | 142 | .busy_gpio = 94, |
143 | .banks = { 1 }, | ||
143 | }; | 144 | }; |
144 | 145 | ||
145 | /* Keyboard*/ | 146 | /* Keyboard*/ |
diff --git a/arch/mips/jz4740/platform.c b/arch/mips/jz4740/platform.c index 10929e2bc6d8..e342ed4cbd43 100644 --- a/arch/mips/jz4740/platform.c +++ b/arch/mips/jz4740/platform.c | |||
@@ -157,11 +157,29 @@ static struct resource jz4740_nand_resources[] = { | |||
157 | .flags = IORESOURCE_MEM, | 157 | .flags = IORESOURCE_MEM, |
158 | }, | 158 | }, |
159 | { | 159 | { |
160 | .name = "bank", | 160 | .name = "bank1", |
161 | .start = 0x18000000, | 161 | .start = 0x18000000, |
162 | .end = 0x180C0000 - 1, | 162 | .end = 0x180C0000 - 1, |
163 | .flags = IORESOURCE_MEM, | 163 | .flags = IORESOURCE_MEM, |
164 | }, | 164 | }, |
165 | { | ||
166 | .name = "bank2", | ||
167 | .start = 0x14000000, | ||
168 | .end = 0x140C0000 - 1, | ||
169 | .flags = IORESOURCE_MEM, | ||
170 | }, | ||
171 | { | ||
172 | .name = "bank3", | ||
173 | .start = 0x0C000000, | ||
174 | .end = 0x0C0C0000 - 1, | ||
175 | .flags = IORESOURCE_MEM, | ||
176 | }, | ||
177 | { | ||
178 | .name = "bank4", | ||
179 | .start = 0x08000000, | ||
180 | .end = 0x080C0000 - 1, | ||
181 | .flags = IORESOURCE_MEM, | ||
182 | }, | ||
165 | }; | 183 | }; |
166 | 184 | ||
167 | struct platform_device jz4740_nand_device = { | 185 | struct platform_device jz4740_nand_device = { |
diff --git a/arch/mips/jz4740/reset.c b/arch/mips/jz4740/reset.c index 5f1fb95c0d0d..6c0da5afcf17 100644 --- a/arch/mips/jz4740/reset.c +++ b/arch/mips/jz4740/reset.c | |||
@@ -21,6 +21,9 @@ | |||
21 | #include <asm/mach-jz4740/base.h> | 21 | #include <asm/mach-jz4740/base.h> |
22 | #include <asm/mach-jz4740/timer.h> | 22 | #include <asm/mach-jz4740/timer.h> |
23 | 23 | ||
24 | #include "reset.h" | ||
25 | #include "clock.h" | ||
26 | |||
24 | static void jz4740_halt(void) | 27 | static void jz4740_halt(void) |
25 | { | 28 | { |
26 | while (1) { | 29 | while (1) { |
@@ -53,21 +56,57 @@ static void jz4740_restart(char *command) | |||
53 | jz4740_halt(); | 56 | jz4740_halt(); |
54 | } | 57 | } |
55 | 58 | ||
56 | #define JZ_REG_RTC_CTRL 0x00 | 59 | #define JZ_REG_RTC_CTRL 0x00 |
57 | #define JZ_REG_RTC_HIBERNATE 0x20 | 60 | #define JZ_REG_RTC_HIBERNATE 0x20 |
61 | #define JZ_REG_RTC_WAKEUP_FILTER 0x24 | ||
62 | #define JZ_REG_RTC_RESET_COUNTER 0x28 | ||
58 | 63 | ||
59 | #define JZ_RTC_CTRL_WRDY BIT(7) | 64 | #define JZ_RTC_CTRL_WRDY BIT(7) |
65 | #define JZ_RTC_WAKEUP_FILTER_MASK 0x0000FFE0 | ||
66 | #define JZ_RTC_RESET_COUNTER_MASK 0x00000FE0 | ||
60 | 67 | ||
61 | static void jz4740_power_off(void) | 68 | static inline void jz4740_rtc_wait_ready(void __iomem *rtc_base) |
62 | { | 69 | { |
63 | void __iomem *rtc_base = ioremap(JZ4740_RTC_BASE_ADDR, 0x24); | ||
64 | uint32_t ctrl; | 70 | uint32_t ctrl; |
65 | 71 | ||
66 | do { | 72 | do { |
67 | ctrl = readl(rtc_base + JZ_REG_RTC_CTRL); | 73 | ctrl = readl(rtc_base + JZ_REG_RTC_CTRL); |
68 | } while (!(ctrl & JZ_RTC_CTRL_WRDY)); | 74 | } while (!(ctrl & JZ_RTC_CTRL_WRDY)); |
75 | } | ||
69 | 76 | ||
77 | static void jz4740_power_off(void) | ||
78 | { | ||
79 | void __iomem *rtc_base = ioremap(JZ4740_RTC_BASE_ADDR, 0x38); | ||
80 | unsigned long wakeup_filter_ticks; | ||
81 | unsigned long reset_counter_ticks; | ||
82 | |||
83 | /* | ||
84 | * Set minimum wakeup pin assertion time: 100 ms. | ||
85 | * Range is 0 to 2 sec if RTC is clocked at 32 kHz. | ||
86 | */ | ||
87 | wakeup_filter_ticks = (100 * jz4740_clock_bdata.rtc_rate) / 1000; | ||
88 | if (wakeup_filter_ticks < JZ_RTC_WAKEUP_FILTER_MASK) | ||
89 | wakeup_filter_ticks &= JZ_RTC_WAKEUP_FILTER_MASK; | ||
90 | else | ||
91 | wakeup_filter_ticks = JZ_RTC_WAKEUP_FILTER_MASK; | ||
92 | jz4740_rtc_wait_ready(rtc_base); | ||
93 | writel(wakeup_filter_ticks, rtc_base + JZ_REG_RTC_WAKEUP_FILTER); | ||
94 | |||
95 | /* | ||
96 | * Set reset pin low-level assertion time after wakeup: 60 ms. | ||
97 | * Range is 0 to 125 ms if RTC is clocked at 32 kHz. | ||
98 | */ | ||
99 | reset_counter_ticks = (60 * jz4740_clock_bdata.rtc_rate) / 1000; | ||
100 | if (reset_counter_ticks < JZ_RTC_RESET_COUNTER_MASK) | ||
101 | reset_counter_ticks &= JZ_RTC_RESET_COUNTER_MASK; | ||
102 | else | ||
103 | reset_counter_ticks = JZ_RTC_RESET_COUNTER_MASK; | ||
104 | jz4740_rtc_wait_ready(rtc_base); | ||
105 | writel(reset_counter_ticks, rtc_base + JZ_REG_RTC_RESET_COUNTER); | ||
106 | |||
107 | jz4740_rtc_wait_ready(rtc_base); | ||
70 | writel(1, rtc_base + JZ_REG_RTC_HIBERNATE); | 108 | writel(1, rtc_base + JZ_REG_RTC_HIBERNATE); |
109 | |||
71 | jz4740_halt(); | 110 | jz4740_halt(); |
72 | } | 111 | } |
73 | 112 | ||
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index f4630e1082ab..1b51046191e8 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -190,6 +190,7 @@ void __init check_wait(void) | |||
190 | case CPU_CAVIUM_OCTEON_PLUS: | 190 | case CPU_CAVIUM_OCTEON_PLUS: |
191 | case CPU_CAVIUM_OCTEON2: | 191 | case CPU_CAVIUM_OCTEON2: |
192 | case CPU_JZRISC: | 192 | case CPU_JZRISC: |
193 | case CPU_LOONGSON1: | ||
193 | case CPU_XLR: | 194 | case CPU_XLR: |
194 | case CPU_XLP: | 195 | case CPU_XLP: |
195 | cpu_wait = r4k_wait; | 196 | cpu_wait = r4k_wait; |
@@ -330,6 +331,154 @@ static inline void cpu_probe_vmbits(struct cpuinfo_mips *c) | |||
330 | #endif | 331 | #endif |
331 | } | 332 | } |
332 | 333 | ||
334 | static char unknown_isa[] __cpuinitdata = KERN_ERR \ | ||
335 | "Unsupported ISA type, c0.config0: %d."; | ||
336 | |||
337 | static inline unsigned int decode_config0(struct cpuinfo_mips *c) | ||
338 | { | ||
339 | unsigned int config0; | ||
340 | int isa; | ||
341 | |||
342 | config0 = read_c0_config(); | ||
343 | |||
344 | if (((config0 & MIPS_CONF_MT) >> 7) == 1) | ||
345 | c->options |= MIPS_CPU_TLB; | ||
346 | isa = (config0 & MIPS_CONF_AT) >> 13; | ||
347 | switch (isa) { | ||
348 | case 0: | ||
349 | switch ((config0 & MIPS_CONF_AR) >> 10) { | ||
350 | case 0: | ||
351 | c->isa_level = MIPS_CPU_ISA_M32R1; | ||
352 | break; | ||
353 | case 1: | ||
354 | c->isa_level = MIPS_CPU_ISA_M32R2; | ||
355 | break; | ||
356 | default: | ||
357 | goto unknown; | ||
358 | } | ||
359 | break; | ||
360 | case 2: | ||
361 | switch ((config0 & MIPS_CONF_AR) >> 10) { | ||
362 | case 0: | ||
363 | c->isa_level = MIPS_CPU_ISA_M64R1; | ||
364 | break; | ||
365 | case 1: | ||
366 | c->isa_level = MIPS_CPU_ISA_M64R2; | ||
367 | break; | ||
368 | default: | ||
369 | goto unknown; | ||
370 | } | ||
371 | break; | ||
372 | default: | ||
373 | goto unknown; | ||
374 | } | ||
375 | |||
376 | return config0 & MIPS_CONF_M; | ||
377 | |||
378 | unknown: | ||
379 | panic(unknown_isa, config0); | ||
380 | } | ||
381 | |||
382 | static inline unsigned int decode_config1(struct cpuinfo_mips *c) | ||
383 | { | ||
384 | unsigned int config1; | ||
385 | |||
386 | config1 = read_c0_config1(); | ||
387 | |||
388 | if (config1 & MIPS_CONF1_MD) | ||
389 | c->ases |= MIPS_ASE_MDMX; | ||
390 | if (config1 & MIPS_CONF1_WR) | ||
391 | c->options |= MIPS_CPU_WATCH; | ||
392 | if (config1 & MIPS_CONF1_CA) | ||
393 | c->ases |= MIPS_ASE_MIPS16; | ||
394 | if (config1 & MIPS_CONF1_EP) | ||
395 | c->options |= MIPS_CPU_EJTAG; | ||
396 | if (config1 & MIPS_CONF1_FP) { | ||
397 | c->options |= MIPS_CPU_FPU; | ||
398 | c->options |= MIPS_CPU_32FPR; | ||
399 | } | ||
400 | if (cpu_has_tlb) | ||
401 | c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1; | ||
402 | |||
403 | return config1 & MIPS_CONF_M; | ||
404 | } | ||
405 | |||
406 | static inline unsigned int decode_config2(struct cpuinfo_mips *c) | ||
407 | { | ||
408 | unsigned int config2; | ||
409 | |||
410 | config2 = read_c0_config2(); | ||
411 | |||
412 | if (config2 & MIPS_CONF2_SL) | ||
413 | c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT; | ||
414 | |||
415 | return config2 & MIPS_CONF_M; | ||
416 | } | ||
417 | |||
418 | static inline unsigned int decode_config3(struct cpuinfo_mips *c) | ||
419 | { | ||
420 | unsigned int config3; | ||
421 | |||
422 | config3 = read_c0_config3(); | ||
423 | |||
424 | if (config3 & MIPS_CONF3_SM) | ||
425 | c->ases |= MIPS_ASE_SMARTMIPS; | ||
426 | if (config3 & MIPS_CONF3_DSP) | ||
427 | c->ases |= MIPS_ASE_DSP; | ||
428 | if (config3 & MIPS_CONF3_VINT) | ||
429 | c->options |= MIPS_CPU_VINT; | ||
430 | if (config3 & MIPS_CONF3_VEIC) | ||
431 | c->options |= MIPS_CPU_VEIC; | ||
432 | if (config3 & MIPS_CONF3_MT) | ||
433 | c->ases |= MIPS_ASE_MIPSMT; | ||
434 | if (config3 & MIPS_CONF3_ULRI) | ||
435 | c->options |= MIPS_CPU_ULRI; | ||
436 | |||
437 | return config3 & MIPS_CONF_M; | ||
438 | } | ||
439 | |||
440 | static inline unsigned int decode_config4(struct cpuinfo_mips *c) | ||
441 | { | ||
442 | unsigned int config4; | ||
443 | |||
444 | config4 = read_c0_config4(); | ||
445 | |||
446 | if ((config4 & MIPS_CONF4_MMUEXTDEF) == MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT | ||
447 | && cpu_has_tlb) | ||
448 | c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40; | ||
449 | |||
450 | c->kscratch_mask = (config4 >> 16) & 0xff; | ||
451 | |||
452 | return config4 & MIPS_CONF_M; | ||
453 | } | ||
454 | |||
455 | static void __cpuinit decode_configs(struct cpuinfo_mips *c) | ||
456 | { | ||
457 | int ok; | ||
458 | |||
459 | /* MIPS32 or MIPS64 compliant CPU. */ | ||
460 | c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER | | ||
461 | MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK; | ||
462 | |||
463 | c->scache.flags = MIPS_CACHE_NOT_PRESENT; | ||
464 | |||
465 | ok = decode_config0(c); /* Read Config registers. */ | ||
466 | BUG_ON(!ok); /* Arch spec violation! */ | ||
467 | if (ok) | ||
468 | ok = decode_config1(c); | ||
469 | if (ok) | ||
470 | ok = decode_config2(c); | ||
471 | if (ok) | ||
472 | ok = decode_config3(c); | ||
473 | if (ok) | ||
474 | ok = decode_config4(c); | ||
475 | |||
476 | mips_probe_watch_registers(c); | ||
477 | |||
478 | if (cpu_has_mips_r2) | ||
479 | c->core = read_c0_ebase() & 0x3ff; | ||
480 | } | ||
481 | |||
333 | #define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \ | 482 | #define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \ |
334 | | MIPS_CPU_COUNTER) | 483 | | MIPS_CPU_COUNTER) |
335 | 484 | ||
@@ -638,155 +787,19 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) | |||
638 | MIPS_CPU_32FPR; | 787 | MIPS_CPU_32FPR; |
639 | c->tlbsize = 64; | 788 | c->tlbsize = 64; |
640 | break; | 789 | break; |
641 | } | 790 | case PRID_IMP_LOONGSON1: |
642 | } | 791 | decode_configs(c); |
643 | |||
644 | static char unknown_isa[] __cpuinitdata = KERN_ERR \ | ||
645 | "Unsupported ISA type, c0.config0: %d."; | ||
646 | 792 | ||
647 | static inline unsigned int decode_config0(struct cpuinfo_mips *c) | 793 | c->cputype = CPU_LOONGSON1; |
648 | { | ||
649 | unsigned int config0; | ||
650 | int isa; | ||
651 | 794 | ||
652 | config0 = read_c0_config(); | 795 | switch (c->processor_id & PRID_REV_MASK) { |
653 | 796 | case PRID_REV_LOONGSON1B: | |
654 | if (((config0 & MIPS_CONF_MT) >> 7) == 1) | 797 | __cpu_name[cpu] = "Loongson 1B"; |
655 | c->options |= MIPS_CPU_TLB; | ||
656 | isa = (config0 & MIPS_CONF_AT) >> 13; | ||
657 | switch (isa) { | ||
658 | case 0: | ||
659 | switch ((config0 & MIPS_CONF_AR) >> 10) { | ||
660 | case 0: | ||
661 | c->isa_level = MIPS_CPU_ISA_M32R1; | ||
662 | break; | ||
663 | case 1: | ||
664 | c->isa_level = MIPS_CPU_ISA_M32R2; | ||
665 | break; | 798 | break; |
666 | default: | ||
667 | goto unknown; | ||
668 | } | 799 | } |
669 | break; | ||
670 | case 2: | ||
671 | switch ((config0 & MIPS_CONF_AR) >> 10) { | ||
672 | case 0: | ||
673 | c->isa_level = MIPS_CPU_ISA_M64R1; | ||
674 | break; | ||
675 | case 1: | ||
676 | c->isa_level = MIPS_CPU_ISA_M64R2; | ||
677 | break; | ||
678 | default: | ||
679 | goto unknown; | ||
680 | } | ||
681 | break; | ||
682 | default: | ||
683 | goto unknown; | ||
684 | } | ||
685 | |||
686 | return config0 & MIPS_CONF_M; | ||
687 | |||
688 | unknown: | ||
689 | panic(unknown_isa, config0); | ||
690 | } | ||
691 | 800 | ||
692 | static inline unsigned int decode_config1(struct cpuinfo_mips *c) | 801 | break; |
693 | { | ||
694 | unsigned int config1; | ||
695 | |||
696 | config1 = read_c0_config1(); | ||
697 | |||
698 | if (config1 & MIPS_CONF1_MD) | ||
699 | c->ases |= MIPS_ASE_MDMX; | ||
700 | if (config1 & MIPS_CONF1_WR) | ||
701 | c->options |= MIPS_CPU_WATCH; | ||
702 | if (config1 & MIPS_CONF1_CA) | ||
703 | c->ases |= MIPS_ASE_MIPS16; | ||
704 | if (config1 & MIPS_CONF1_EP) | ||
705 | c->options |= MIPS_CPU_EJTAG; | ||
706 | if (config1 & MIPS_CONF1_FP) { | ||
707 | c->options |= MIPS_CPU_FPU; | ||
708 | c->options |= MIPS_CPU_32FPR; | ||
709 | } | 802 | } |
710 | if (cpu_has_tlb) | ||
711 | c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1; | ||
712 | |||
713 | return config1 & MIPS_CONF_M; | ||
714 | } | ||
715 | |||
716 | static inline unsigned int decode_config2(struct cpuinfo_mips *c) | ||
717 | { | ||
718 | unsigned int config2; | ||
719 | |||
720 | config2 = read_c0_config2(); | ||
721 | |||
722 | if (config2 & MIPS_CONF2_SL) | ||
723 | c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT; | ||
724 | |||
725 | return config2 & MIPS_CONF_M; | ||
726 | } | ||
727 | |||
728 | static inline unsigned int decode_config3(struct cpuinfo_mips *c) | ||
729 | { | ||
730 | unsigned int config3; | ||
731 | |||
732 | config3 = read_c0_config3(); | ||
733 | |||
734 | if (config3 & MIPS_CONF3_SM) | ||
735 | c->ases |= MIPS_ASE_SMARTMIPS; | ||
736 | if (config3 & MIPS_CONF3_DSP) | ||
737 | c->ases |= MIPS_ASE_DSP; | ||
738 | if (config3 & MIPS_CONF3_VINT) | ||
739 | c->options |= MIPS_CPU_VINT; | ||
740 | if (config3 & MIPS_CONF3_VEIC) | ||
741 | c->options |= MIPS_CPU_VEIC; | ||
742 | if (config3 & MIPS_CONF3_MT) | ||
743 | c->ases |= MIPS_ASE_MIPSMT; | ||
744 | if (config3 & MIPS_CONF3_ULRI) | ||
745 | c->options |= MIPS_CPU_ULRI; | ||
746 | |||
747 | return config3 & MIPS_CONF_M; | ||
748 | } | ||
749 | |||
750 | static inline unsigned int decode_config4(struct cpuinfo_mips *c) | ||
751 | { | ||
752 | unsigned int config4; | ||
753 | |||
754 | config4 = read_c0_config4(); | ||
755 | |||
756 | if ((config4 & MIPS_CONF4_MMUEXTDEF) == MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT | ||
757 | && cpu_has_tlb) | ||
758 | c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40; | ||
759 | |||
760 | c->kscratch_mask = (config4 >> 16) & 0xff; | ||
761 | |||
762 | return config4 & MIPS_CONF_M; | ||
763 | } | ||
764 | |||
765 | static void __cpuinit decode_configs(struct cpuinfo_mips *c) | ||
766 | { | ||
767 | int ok; | ||
768 | |||
769 | /* MIPS32 or MIPS64 compliant CPU. */ | ||
770 | c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER | | ||
771 | MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK; | ||
772 | |||
773 | c->scache.flags = MIPS_CACHE_NOT_PRESENT; | ||
774 | |||
775 | ok = decode_config0(c); /* Read Config registers. */ | ||
776 | BUG_ON(!ok); /* Arch spec violation! */ | ||
777 | if (ok) | ||
778 | ok = decode_config1(c); | ||
779 | if (ok) | ||
780 | ok = decode_config2(c); | ||
781 | if (ok) | ||
782 | ok = decode_config3(c); | ||
783 | if (ok) | ||
784 | ok = decode_config4(c); | ||
785 | |||
786 | mips_probe_watch_registers(c); | ||
787 | |||
788 | if (cpu_has_mips_r2) | ||
789 | c->core = read_c0_ebase() & 0x3ff; | ||
790 | } | 803 | } |
791 | 804 | ||
792 | static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu) | 805 | static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu) |
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c index eb5e394a4650..2f28d3b55687 100644 --- a/arch/mips/kernel/perf_event_mipsxx.c +++ b/arch/mips/kernel/perf_event_mipsxx.c | |||
@@ -1559,6 +1559,11 @@ init_hw_perf_events(void) | |||
1559 | mipspmu.general_event_map = &mipsxxcore_event_map; | 1559 | mipspmu.general_event_map = &mipsxxcore_event_map; |
1560 | mipspmu.cache_event_map = &mipsxxcore_cache_map; | 1560 | mipspmu.cache_event_map = &mipsxxcore_cache_map; |
1561 | break; | 1561 | break; |
1562 | case CPU_LOONGSON1: | ||
1563 | mipspmu.name = "mips/loongson1"; | ||
1564 | mipspmu.general_event_map = &mipsxxcore_event_map; | ||
1565 | mipspmu.cache_event_map = &mipsxxcore_cache_map; | ||
1566 | break; | ||
1562 | case CPU_CAVIUM_OCTEON: | 1567 | case CPU_CAVIUM_OCTEON: |
1563 | case CPU_CAVIUM_OCTEON_PLUS: | 1568 | case CPU_CAVIUM_OCTEON_PLUS: |
1564 | case CPU_CAVIUM_OCTEON2: | 1569 | case CPU_CAVIUM_OCTEON2: |
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c index f11b2bbb826d..028f6f837ef9 100644 --- a/arch/mips/kernel/prom.c +++ b/arch/mips/kernel/prom.c | |||
@@ -35,16 +35,6 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) | |||
35 | return add_memory_region(base, size, BOOT_MEM_RAM); | 35 | return add_memory_region(base, size, BOOT_MEM_RAM); |
36 | } | 36 | } |
37 | 37 | ||
38 | int __init reserve_mem_mach(unsigned long addr, unsigned long size) | ||
39 | { | ||
40 | return reserve_bootmem(addr, size, BOOTMEM_DEFAULT); | ||
41 | } | ||
42 | |||
43 | void __init free_mem_mach(unsigned long addr, unsigned long size) | ||
44 | { | ||
45 | return free_bootmem(addr, size); | ||
46 | } | ||
47 | |||
48 | void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) | 38 | void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) |
49 | { | 39 | { |
50 | return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)); | 40 | return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)); |
@@ -77,25 +67,6 @@ void __init early_init_devtree(void *params) | |||
77 | of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL); | 67 | of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL); |
78 | } | 68 | } |
79 | 69 | ||
80 | void __init device_tree_init(void) | ||
81 | { | ||
82 | unsigned long base, size; | ||
83 | |||
84 | if (!initial_boot_params) | ||
85 | return; | ||
86 | |||
87 | base = virt_to_phys((void *)initial_boot_params); | ||
88 | size = be32_to_cpu(initial_boot_params->totalsize); | ||
89 | |||
90 | /* Before we do anything, lets reserve the dt blob */ | ||
91 | reserve_mem_mach(base, size); | ||
92 | |||
93 | unflatten_device_tree(); | ||
94 | |||
95 | /* free the space reserved for the dt blob */ | ||
96 | free_mem_mach(base, size); | ||
97 | } | ||
98 | |||
99 | void __init __dt_setup_arch(struct boot_param_header *bph) | 70 | void __init __dt_setup_arch(struct boot_param_header *bph) |
100 | { | 71 | { |
101 | if (be32_to_cpu(bph->magic) != OF_DT_HEADER) { | 72 | if (be32_to_cpu(bph->magic) != OF_DT_HEADER) { |
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 1268392f1d27..31637d8c8738 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -102,7 +102,9 @@ asmlinkage __cpuinit void start_secondary(void) | |||
102 | 102 | ||
103 | #ifdef CONFIG_MIPS_MT_SMTC | 103 | #ifdef CONFIG_MIPS_MT_SMTC |
104 | /* Only do cpu_probe for first TC of CPU */ | 104 | /* Only do cpu_probe for first TC of CPU */ |
105 | if ((read_c0_tcbind() & TCBIND_CURTC) == 0) | 105 | if ((read_c0_tcbind() & TCBIND_CURTC) != 0) |
106 | __cpu_name[smp_processor_id()] = __cpu_name[0]; | ||
107 | else | ||
106 | #endif /* CONFIG_MIPS_MT_SMTC */ | 108 | #endif /* CONFIG_MIPS_MT_SMTC */ |
107 | cpu_probe(); | 109 | cpu_probe(); |
108 | cpu_report(); | 110 | cpu_report(); |
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c index 15b5f3cfd20c..1d47843d3cc0 100644 --- a/arch/mips/kernel/smtc.c +++ b/arch/mips/kernel/smtc.c | |||
@@ -86,6 +86,13 @@ struct smtc_ipi_q IPIQ[NR_CPUS]; | |||
86 | static struct smtc_ipi_q freeIPIq; | 86 | static struct smtc_ipi_q freeIPIq; |
87 | 87 | ||
88 | 88 | ||
89 | /* | ||
90 | * Number of FPU contexts for each VPE | ||
91 | */ | ||
92 | |||
93 | static int smtc_nconf1[MAX_SMTC_VPES]; | ||
94 | |||
95 | |||
89 | /* Forward declarations */ | 96 | /* Forward declarations */ |
90 | 97 | ||
91 | void ipi_decode(struct smtc_ipi *); | 98 | void ipi_decode(struct smtc_ipi *); |
@@ -174,9 +181,9 @@ static int __init tintq(char *str) | |||
174 | 181 | ||
175 | __setup("tintq=", tintq); | 182 | __setup("tintq=", tintq); |
176 | 183 | ||
177 | static int imstuckcount[2][8]; | 184 | static int imstuckcount[MAX_SMTC_VPES][8]; |
178 | /* vpemask represents IM/IE bits of per-VPE Status registers, low-to-high */ | 185 | /* vpemask represents IM/IE bits of per-VPE Status registers, low-to-high */ |
179 | static int vpemask[2][8] = { | 186 | static int vpemask[MAX_SMTC_VPES][8] = { |
180 | {0, 0, 1, 0, 0, 0, 0, 1}, | 187 | {0, 0, 1, 0, 0, 0, 0, 1}, |
181 | {0, 0, 0, 0, 0, 0, 0, 1} | 188 | {0, 0, 0, 0, 0, 0, 0, 1} |
182 | }; | 189 | }; |
@@ -331,6 +338,22 @@ int __init smtc_build_cpu_map(int start_cpu_slot) | |||
331 | 338 | ||
332 | static void smtc_tc_setup(int vpe, int tc, int cpu) | 339 | static void smtc_tc_setup(int vpe, int tc, int cpu) |
333 | { | 340 | { |
341 | static int cp1contexts[MAX_SMTC_VPES]; | ||
342 | |||
343 | /* | ||
344 | * Make a local copy of the available FPU contexts in order | ||
345 | * to keep track of TCs that can have one. | ||
346 | */ | ||
347 | if (tc == 1) | ||
348 | { | ||
349 | /* | ||
350 | * FIXME: Multi-core SMTC hasn't been tested and the | ||
351 | * maximum number of VPEs may change. | ||
352 | */ | ||
353 | cp1contexts[0] = smtc_nconf1[0] - 1; | ||
354 | cp1contexts[1] = smtc_nconf1[1]; | ||
355 | } | ||
356 | |||
334 | settc(tc); | 357 | settc(tc); |
335 | write_tc_c0_tchalt(TCHALT_H); | 358 | write_tc_c0_tchalt(TCHALT_H); |
336 | mips_ihb(); | 359 | mips_ihb(); |
@@ -343,22 +366,29 @@ static void smtc_tc_setup(int vpe, int tc, int cpu) | |||
343 | * an active IPI queue. | 366 | * an active IPI queue. |
344 | */ | 367 | */ |
345 | write_tc_c0_tccontext((sizeof(struct smtc_ipi_q) * cpu) << 16); | 368 | write_tc_c0_tccontext((sizeof(struct smtc_ipi_q) * cpu) << 16); |
346 | /* Bind tc to vpe */ | 369 | |
370 | /* Bind TC to VPE. */ | ||
347 | write_tc_c0_tcbind(vpe); | 371 | write_tc_c0_tcbind(vpe); |
372 | |||
348 | /* In general, all TCs should have the same cpu_data indications. */ | 373 | /* In general, all TCs should have the same cpu_data indications. */ |
349 | memcpy(&cpu_data[cpu], &cpu_data[0], sizeof(struct cpuinfo_mips)); | 374 | memcpy(&cpu_data[cpu], &cpu_data[0], sizeof(struct cpuinfo_mips)); |
350 | /* For 34Kf, start with TC/CPU 0 as sole owner of single FPU context */ | 375 | |
351 | if (cpu_data[0].cputype == CPU_34K || | 376 | /* Check to see if there is a FPU context available for this TC. */ |
352 | cpu_data[0].cputype == CPU_1004K) | 377 | if (!cp1contexts[vpe]) |
353 | cpu_data[cpu].options &= ~MIPS_CPU_FPU; | 378 | cpu_data[cpu].options &= ~MIPS_CPU_FPU; |
379 | else | ||
380 | cp1contexts[vpe]--; | ||
381 | |||
382 | /* Store the TC and VPE into the cpu_data structure. */ | ||
354 | cpu_data[cpu].vpe_id = vpe; | 383 | cpu_data[cpu].vpe_id = vpe; |
355 | cpu_data[cpu].tc_id = tc; | 384 | cpu_data[cpu].tc_id = tc; |
356 | /* Multi-core SMTC hasn't been tested, but be prepared */ | 385 | |
386 | /* FIXME: Multi-core SMTC hasn't been tested, but be prepared. */ | ||
357 | cpu_data[cpu].core = (read_vpe_c0_ebase() >> 1) & 0xff; | 387 | cpu_data[cpu].core = (read_vpe_c0_ebase() >> 1) & 0xff; |
358 | } | 388 | } |
359 | 389 | ||
360 | /* | 390 | /* |
361 | * Tweak to get Count registes in as close a sync as possible. The | 391 | * Tweak to get Count registers synced as closely as possible. The |
362 | * value seems good for 34K-class cores. | 392 | * value seems good for 34K-class cores. |
363 | */ | 393 | */ |
364 | 394 | ||
@@ -466,6 +496,24 @@ void smtc_prepare_cpus(int cpus) | |||
466 | smtc_configure_tlb(); | 496 | smtc_configure_tlb(); |
467 | 497 | ||
468 | for (tc = 0, vpe = 0 ; (vpe < nvpe) && (tc < ntc) ; vpe++) { | 498 | for (tc = 0, vpe = 0 ; (vpe < nvpe) && (tc < ntc) ; vpe++) { |
499 | /* Get number of CP1 contexts for each VPE. */ | ||
500 | if (tc == 0) | ||
501 | { | ||
502 | /* | ||
503 | * Do not call settc() for TC0 or the FPU context | ||
504 | * value will be incorrect. Besides, we know that | ||
505 | * we are TC0 anyway. | ||
506 | */ | ||
507 | smtc_nconf1[0] = ((read_vpe_c0_vpeconf1() & | ||
508 | VPECONF1_NCP1) >> VPECONF1_NCP1_SHIFT); | ||
509 | if (nvpe == 2) | ||
510 | { | ||
511 | settc(1); | ||
512 | smtc_nconf1[1] = ((read_vpe_c0_vpeconf1() & | ||
513 | VPECONF1_NCP1) >> VPECONF1_NCP1_SHIFT); | ||
514 | settc(0); | ||
515 | } | ||
516 | } | ||
469 | if (tcpervpe[vpe] == 0) | 517 | if (tcpervpe[vpe] == 0) |
470 | continue; | 518 | continue; |
471 | if (vpe != 0) | 519 | if (vpe != 0) |
@@ -479,6 +527,18 @@ void smtc_prepare_cpus(int cpus) | |||
479 | */ | 527 | */ |
480 | if (tc != 0) { | 528 | if (tc != 0) { |
481 | smtc_tc_setup(vpe, tc, cpu); | 529 | smtc_tc_setup(vpe, tc, cpu); |
530 | if (vpe != 0) { | ||
531 | /* | ||
532 | * Set MVP bit (possibly again). Do it | ||
533 | * here to catch CPUs that have no TCs | ||
534 | * bound to the VPE at reset. In that | ||
535 | * case, a TC must be bound to the VPE | ||
536 | * before we can set VPEControl[MVP] | ||
537 | */ | ||
538 | write_vpe_c0_vpeconf0( | ||
539 | read_vpe_c0_vpeconf0() | | ||
540 | VPECONF0_MVP); | ||
541 | } | ||
482 | cpu++; | 542 | cpu++; |
483 | } | 543 | } |
484 | printk(" %d", tc); | 544 | printk(" %d", tc); |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index c3c293543703..9be3df1fa8a4 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -1253,6 +1253,7 @@ static inline void parity_protection_init(void) | |||
1253 | 1253 | ||
1254 | case CPU_5KC: | 1254 | case CPU_5KC: |
1255 | case CPU_5KE: | 1255 | case CPU_5KE: |
1256 | case CPU_LOONGSON1: | ||
1256 | write_c0_ecc(0x80000000); | 1257 | write_c0_ecc(0x80000000); |
1257 | back_to_back_c0_hazard(); | 1258 | back_to_back_c0_hazard(); |
1258 | /* Set the PE bit (bit 31) in the c0_errctl register. */ | 1259 | /* Set the PE bit (bit 31) in the c0_errctl register. */ |
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile index 2a7c74fc15fc..399a50a541d4 100644 --- a/arch/mips/lib/Makefile +++ b/arch/mips/lib/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for MIPS-specific library files.. | 2 | # Makefile for MIPS-specific library files.. |
3 | # | 3 | # |
4 | 4 | ||
5 | lib-y += csum_partial.o delay.o memcpy.o memcpy-inatomic.o memset.o \ | 5 | lib-y += csum_partial.o delay.o memcpy.o memset.o \ |
6 | strlen_user.o strncpy_user.o strnlen_user.o uncached.o | 6 | strlen_user.o strncpy_user.o strnlen_user.o uncached.o |
7 | 7 | ||
8 | obj-y += iomap.o | 8 | obj-y += iomap.o |
diff --git a/arch/mips/lib/memcpy-inatomic.S b/arch/mips/lib/memcpy-inatomic.S deleted file mode 100644 index 68853a038d3f..000000000000 --- a/arch/mips/lib/memcpy-inatomic.S +++ /dev/null | |||
@@ -1,451 +0,0 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Unified implementation of memcpy, memmove and the __copy_user backend. | ||
7 | * | ||
8 | * Copyright (C) 1998, 99, 2000, 01, 2002 Ralf Baechle (ralf@gnu.org) | ||
9 | * Copyright (C) 1999, 2000, 01, 2002 Silicon Graphics, Inc. | ||
10 | * Copyright (C) 2002 Broadcom, Inc. | ||
11 | * memcpy/copy_user author: Mark Vandevoorde | ||
12 | * Copyright (C) 2007 Maciej W. Rozycki | ||
13 | * | ||
14 | * Mnemonic names for arguments to memcpy/__copy_user | ||
15 | */ | ||
16 | |||
17 | /* | ||
18 | * Hack to resolve longstanding prefetch issue | ||
19 | * | ||
20 | * Prefetching may be fatal on some systems if we're prefetching beyond the | ||
21 | * end of memory on some systems. It's also a seriously bad idea on non | ||
22 | * dma-coherent systems. | ||
23 | */ | ||
24 | #ifdef CONFIG_DMA_NONCOHERENT | ||
25 | #undef CONFIG_CPU_HAS_PREFETCH | ||
26 | #endif | ||
27 | #ifdef CONFIG_MIPS_MALTA | ||
28 | #undef CONFIG_CPU_HAS_PREFETCH | ||
29 | #endif | ||
30 | |||
31 | #include <asm/asm.h> | ||
32 | #include <asm/asm-offsets.h> | ||
33 | #include <asm/regdef.h> | ||
34 | |||
35 | #define dst a0 | ||
36 | #define src a1 | ||
37 | #define len a2 | ||
38 | |||
39 | /* | ||
40 | * Spec | ||
41 | * | ||
42 | * memcpy copies len bytes from src to dst and sets v0 to dst. | ||
43 | * It assumes that | ||
44 | * - src and dst don't overlap | ||
45 | * - src is readable | ||
46 | * - dst is writable | ||
47 | * memcpy uses the standard calling convention | ||
48 | * | ||
49 | * __copy_user copies up to len bytes from src to dst and sets a2 (len) to | ||
50 | * the number of uncopied bytes due to an exception caused by a read or write. | ||
51 | * __copy_user assumes that src and dst don't overlap, and that the call is | ||
52 | * implementing one of the following: | ||
53 | * copy_to_user | ||
54 | * - src is readable (no exceptions when reading src) | ||
55 | * copy_from_user | ||
56 | * - dst is writable (no exceptions when writing dst) | ||
57 | * __copy_user uses a non-standard calling convention; see | ||
58 | * include/asm-mips/uaccess.h | ||
59 | * | ||
60 | * When an exception happens on a load, the handler must | ||
61 | # ensure that all of the destination buffer is overwritten to prevent | ||
62 | * leaking information to user mode programs. | ||
63 | */ | ||
64 | |||
65 | /* | ||
66 | * Implementation | ||
67 | */ | ||
68 | |||
69 | /* | ||
70 | * The exception handler for loads requires that: | ||
71 | * 1- AT contain the address of the byte just past the end of the source | ||
72 | * of the copy, | ||
73 | * 2- src_entry <= src < AT, and | ||
74 | * 3- (dst - src) == (dst_entry - src_entry), | ||
75 | * The _entry suffix denotes values when __copy_user was called. | ||
76 | * | ||
77 | * (1) is set up up by uaccess.h and maintained by not writing AT in copy_user | ||
78 | * (2) is met by incrementing src by the number of bytes copied | ||
79 | * (3) is met by not doing loads between a pair of increments of dst and src | ||
80 | * | ||
81 | * The exception handlers for stores adjust len (if necessary) and return. | ||
82 | * These handlers do not need to overwrite any data. | ||
83 | * | ||
84 | * For __rmemcpy and memmove an exception is always a kernel bug, therefore | ||
85 | * they're not protected. | ||
86 | */ | ||
87 | |||
88 | #define EXC(inst_reg,addr,handler) \ | ||
89 | 9: inst_reg, addr; \ | ||
90 | .section __ex_table,"a"; \ | ||
91 | PTR 9b, handler; \ | ||
92 | .previous | ||
93 | |||
94 | /* | ||
95 | * Only on the 64-bit kernel we can made use of 64-bit registers. | ||
96 | */ | ||
97 | #ifdef CONFIG_64BIT | ||
98 | #define USE_DOUBLE | ||
99 | #endif | ||
100 | |||
101 | #ifdef USE_DOUBLE | ||
102 | |||
103 | #define LOAD ld | ||
104 | #define LOADL ldl | ||
105 | #define LOADR ldr | ||
106 | #define STOREL sdl | ||
107 | #define STORER sdr | ||
108 | #define STORE sd | ||
109 | #define ADD daddu | ||
110 | #define SUB dsubu | ||
111 | #define SRL dsrl | ||
112 | #define SRA dsra | ||
113 | #define SLL dsll | ||
114 | #define SLLV dsllv | ||
115 | #define SRLV dsrlv | ||
116 | #define NBYTES 8 | ||
117 | #define LOG_NBYTES 3 | ||
118 | |||
119 | /* | ||
120 | * As we are sharing code base with the mips32 tree (which use the o32 ABI | ||
121 | * register definitions). We need to redefine the register definitions from | ||
122 | * the n64 ABI register naming to the o32 ABI register naming. | ||
123 | */ | ||
124 | #undef t0 | ||
125 | #undef t1 | ||
126 | #undef t2 | ||
127 | #undef t3 | ||
128 | #define t0 $8 | ||
129 | #define t1 $9 | ||
130 | #define t2 $10 | ||
131 | #define t3 $11 | ||
132 | #define t4 $12 | ||
133 | #define t5 $13 | ||
134 | #define t6 $14 | ||
135 | #define t7 $15 | ||
136 | |||
137 | #else | ||
138 | |||
139 | #define LOAD lw | ||
140 | #define LOADL lwl | ||
141 | #define LOADR lwr | ||
142 | #define STOREL swl | ||
143 | #define STORER swr | ||
144 | #define STORE sw | ||
145 | #define ADD addu | ||
146 | #define SUB subu | ||
147 | #define SRL srl | ||
148 | #define SLL sll | ||
149 | #define SRA sra | ||
150 | #define SLLV sllv | ||
151 | #define SRLV srlv | ||
152 | #define NBYTES 4 | ||
153 | #define LOG_NBYTES 2 | ||
154 | |||
155 | #endif /* USE_DOUBLE */ | ||
156 | |||
157 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | ||
158 | #define LDFIRST LOADR | ||
159 | #define LDREST LOADL | ||
160 | #define STFIRST STORER | ||
161 | #define STREST STOREL | ||
162 | #define SHIFT_DISCARD SLLV | ||
163 | #else | ||
164 | #define LDFIRST LOADL | ||
165 | #define LDREST LOADR | ||
166 | #define STFIRST STOREL | ||
167 | #define STREST STORER | ||
168 | #define SHIFT_DISCARD SRLV | ||
169 | #endif | ||
170 | |||
171 | #define FIRST(unit) ((unit)*NBYTES) | ||
172 | #define REST(unit) (FIRST(unit)+NBYTES-1) | ||
173 | #define UNIT(unit) FIRST(unit) | ||
174 | |||
175 | #define ADDRMASK (NBYTES-1) | ||
176 | |||
177 | .text | ||
178 | .set noreorder | ||
179 | #ifndef CONFIG_CPU_DADDI_WORKAROUNDS | ||
180 | .set noat | ||
181 | #else | ||
182 | .set at=v1 | ||
183 | #endif | ||
184 | |||
185 | /* | ||
186 | * A combined memcpy/__copy_user | ||
187 | * __copy_user sets len to 0 for success; else to an upper bound of | ||
188 | * the number of uncopied bytes. | ||
189 | * memcpy sets v0 to dst. | ||
190 | */ | ||
191 | .align 5 | ||
192 | LEAF(__copy_user_inatomic) | ||
193 | /* | ||
194 | * Note: dst & src may be unaligned, len may be 0 | ||
195 | * Temps | ||
196 | */ | ||
197 | #define rem t8 | ||
198 | |||
199 | /* | ||
200 | * The "issue break"s below are very approximate. | ||
201 | * Issue delays for dcache fills will perturb the schedule, as will | ||
202 | * load queue full replay traps, etc. | ||
203 | * | ||
204 | * If len < NBYTES use byte operations. | ||
205 | */ | ||
206 | PREF( 0, 0(src) ) | ||
207 | PREF( 1, 0(dst) ) | ||
208 | sltu t2, len, NBYTES | ||
209 | and t1, dst, ADDRMASK | ||
210 | PREF( 0, 1*32(src) ) | ||
211 | PREF( 1, 1*32(dst) ) | ||
212 | bnez t2, .Lcopy_bytes_checklen | ||
213 | and t0, src, ADDRMASK | ||
214 | PREF( 0, 2*32(src) ) | ||
215 | PREF( 1, 2*32(dst) ) | ||
216 | bnez t1, .Ldst_unaligned | ||
217 | nop | ||
218 | bnez t0, .Lsrc_unaligned_dst_aligned | ||
219 | /* | ||
220 | * use delay slot for fall-through | ||
221 | * src and dst are aligned; need to compute rem | ||
222 | */ | ||
223 | .Lboth_aligned: | ||
224 | SRL t0, len, LOG_NBYTES+3 # +3 for 8 units/iter | ||
225 | beqz t0, .Lcleanup_both_aligned # len < 8*NBYTES | ||
226 | and rem, len, (8*NBYTES-1) # rem = len % (8*NBYTES) | ||
227 | PREF( 0, 3*32(src) ) | ||
228 | PREF( 1, 3*32(dst) ) | ||
229 | .align 4 | ||
230 | 1: | ||
231 | EXC( LOAD t0, UNIT(0)(src), .Ll_exc) | ||
232 | EXC( LOAD t1, UNIT(1)(src), .Ll_exc_copy) | ||
233 | EXC( LOAD t2, UNIT(2)(src), .Ll_exc_copy) | ||
234 | EXC( LOAD t3, UNIT(3)(src), .Ll_exc_copy) | ||
235 | SUB len, len, 8*NBYTES | ||
236 | EXC( LOAD t4, UNIT(4)(src), .Ll_exc_copy) | ||
237 | EXC( LOAD t7, UNIT(5)(src), .Ll_exc_copy) | ||
238 | STORE t0, UNIT(0)(dst) | ||
239 | STORE t1, UNIT(1)(dst) | ||
240 | EXC( LOAD t0, UNIT(6)(src), .Ll_exc_copy) | ||
241 | EXC( LOAD t1, UNIT(7)(src), .Ll_exc_copy) | ||
242 | ADD src, src, 8*NBYTES | ||
243 | ADD dst, dst, 8*NBYTES | ||
244 | STORE t2, UNIT(-6)(dst) | ||
245 | STORE t3, UNIT(-5)(dst) | ||
246 | STORE t4, UNIT(-4)(dst) | ||
247 | STORE t7, UNIT(-3)(dst) | ||
248 | STORE t0, UNIT(-2)(dst) | ||
249 | STORE t1, UNIT(-1)(dst) | ||
250 | PREF( 0, 8*32(src) ) | ||
251 | PREF( 1, 8*32(dst) ) | ||
252 | bne len, rem, 1b | ||
253 | nop | ||
254 | |||
255 | /* | ||
256 | * len == rem == the number of bytes left to copy < 8*NBYTES | ||
257 | */ | ||
258 | .Lcleanup_both_aligned: | ||
259 | beqz len, .Ldone | ||
260 | sltu t0, len, 4*NBYTES | ||
261 | bnez t0, .Lless_than_4units | ||
262 | and rem, len, (NBYTES-1) # rem = len % NBYTES | ||
263 | /* | ||
264 | * len >= 4*NBYTES | ||
265 | */ | ||
266 | EXC( LOAD t0, UNIT(0)(src), .Ll_exc) | ||
267 | EXC( LOAD t1, UNIT(1)(src), .Ll_exc_copy) | ||
268 | EXC( LOAD t2, UNIT(2)(src), .Ll_exc_copy) | ||
269 | EXC( LOAD t3, UNIT(3)(src), .Ll_exc_copy) | ||
270 | SUB len, len, 4*NBYTES | ||
271 | ADD src, src, 4*NBYTES | ||
272 | STORE t0, UNIT(0)(dst) | ||
273 | STORE t1, UNIT(1)(dst) | ||
274 | STORE t2, UNIT(2)(dst) | ||
275 | STORE t3, UNIT(3)(dst) | ||
276 | .set reorder /* DADDI_WAR */ | ||
277 | ADD dst, dst, 4*NBYTES | ||
278 | beqz len, .Ldone | ||
279 | .set noreorder | ||
280 | .Lless_than_4units: | ||
281 | /* | ||
282 | * rem = len % NBYTES | ||
283 | */ | ||
284 | beq rem, len, .Lcopy_bytes | ||
285 | nop | ||
286 | 1: | ||
287 | EXC( LOAD t0, 0(src), .Ll_exc) | ||
288 | ADD src, src, NBYTES | ||
289 | SUB len, len, NBYTES | ||
290 | STORE t0, 0(dst) | ||
291 | .set reorder /* DADDI_WAR */ | ||
292 | ADD dst, dst, NBYTES | ||
293 | bne rem, len, 1b | ||
294 | .set noreorder | ||
295 | |||
296 | /* | ||
297 | * src and dst are aligned, need to copy rem bytes (rem < NBYTES) | ||
298 | * A loop would do only a byte at a time with possible branch | ||
299 | * mispredicts. Can't do an explicit LOAD dst,mask,or,STORE | ||
300 | * because can't assume read-access to dst. Instead, use | ||
301 | * STREST dst, which doesn't require read access to dst. | ||
302 | * | ||
303 | * This code should perform better than a simple loop on modern, | ||
304 | * wide-issue mips processors because the code has fewer branches and | ||
305 | * more instruction-level parallelism. | ||
306 | */ | ||
307 | #define bits t2 | ||
308 | beqz len, .Ldone | ||
309 | ADD t1, dst, len # t1 is just past last byte of dst | ||
310 | li bits, 8*NBYTES | ||
311 | SLL rem, len, 3 # rem = number of bits to keep | ||
312 | EXC( LOAD t0, 0(src), .Ll_exc) | ||
313 | SUB bits, bits, rem # bits = number of bits to discard | ||
314 | SHIFT_DISCARD t0, t0, bits | ||
315 | STREST t0, -1(t1) | ||
316 | jr ra | ||
317 | move len, zero | ||
318 | .Ldst_unaligned: | ||
319 | /* | ||
320 | * dst is unaligned | ||
321 | * t0 = src & ADDRMASK | ||
322 | * t1 = dst & ADDRMASK; T1 > 0 | ||
323 | * len >= NBYTES | ||
324 | * | ||
325 | * Copy enough bytes to align dst | ||
326 | * Set match = (src and dst have same alignment) | ||
327 | */ | ||
328 | #define match rem | ||
329 | EXC( LDFIRST t3, FIRST(0)(src), .Ll_exc) | ||
330 | ADD t2, zero, NBYTES | ||
331 | EXC( LDREST t3, REST(0)(src), .Ll_exc_copy) | ||
332 | SUB t2, t2, t1 # t2 = number of bytes copied | ||
333 | xor match, t0, t1 | ||
334 | STFIRST t3, FIRST(0)(dst) | ||
335 | beq len, t2, .Ldone | ||
336 | SUB len, len, t2 | ||
337 | ADD dst, dst, t2 | ||
338 | beqz match, .Lboth_aligned | ||
339 | ADD src, src, t2 | ||
340 | |||
341 | .Lsrc_unaligned_dst_aligned: | ||
342 | SRL t0, len, LOG_NBYTES+2 # +2 for 4 units/iter | ||
343 | PREF( 0, 3*32(src) ) | ||
344 | beqz t0, .Lcleanup_src_unaligned | ||
345 | and rem, len, (4*NBYTES-1) # rem = len % 4*NBYTES | ||
346 | PREF( 1, 3*32(dst) ) | ||
347 | 1: | ||
348 | /* | ||
349 | * Avoid consecutive LD*'s to the same register since some mips | ||
350 | * implementations can't issue them in the same cycle. | ||
351 | * It's OK to load FIRST(N+1) before REST(N) because the two addresses | ||
352 | * are to the same unit (unless src is aligned, but it's not). | ||
353 | */ | ||
354 | EXC( LDFIRST t0, FIRST(0)(src), .Ll_exc) | ||
355 | EXC( LDFIRST t1, FIRST(1)(src), .Ll_exc_copy) | ||
356 | SUB len, len, 4*NBYTES | ||
357 | EXC( LDREST t0, REST(0)(src), .Ll_exc_copy) | ||
358 | EXC( LDREST t1, REST(1)(src), .Ll_exc_copy) | ||
359 | EXC( LDFIRST t2, FIRST(2)(src), .Ll_exc_copy) | ||
360 | EXC( LDFIRST t3, FIRST(3)(src), .Ll_exc_copy) | ||
361 | EXC( LDREST t2, REST(2)(src), .Ll_exc_copy) | ||
362 | EXC( LDREST t3, REST(3)(src), .Ll_exc_copy) | ||
363 | PREF( 0, 9*32(src) ) # 0 is PREF_LOAD (not streamed) | ||
364 | ADD src, src, 4*NBYTES | ||
365 | #ifdef CONFIG_CPU_SB1 | ||
366 | nop # improves slotting | ||
367 | #endif | ||
368 | STORE t0, UNIT(0)(dst) | ||
369 | STORE t1, UNIT(1)(dst) | ||
370 | STORE t2, UNIT(2)(dst) | ||
371 | STORE t3, UNIT(3)(dst) | ||
372 | PREF( 1, 9*32(dst) ) # 1 is PREF_STORE (not streamed) | ||
373 | .set reorder /* DADDI_WAR */ | ||
374 | ADD dst, dst, 4*NBYTES | ||
375 | bne len, rem, 1b | ||
376 | .set noreorder | ||
377 | |||
378 | .Lcleanup_src_unaligned: | ||
379 | beqz len, .Ldone | ||
380 | and rem, len, NBYTES-1 # rem = len % NBYTES | ||
381 | beq rem, len, .Lcopy_bytes | ||
382 | nop | ||
383 | 1: | ||
384 | EXC( LDFIRST t0, FIRST(0)(src), .Ll_exc) | ||
385 | EXC( LDREST t0, REST(0)(src), .Ll_exc_copy) | ||
386 | ADD src, src, NBYTES | ||
387 | SUB len, len, NBYTES | ||
388 | STORE t0, 0(dst) | ||
389 | .set reorder /* DADDI_WAR */ | ||
390 | ADD dst, dst, NBYTES | ||
391 | bne len, rem, 1b | ||
392 | .set noreorder | ||
393 | |||
394 | .Lcopy_bytes_checklen: | ||
395 | beqz len, .Ldone | ||
396 | nop | ||
397 | .Lcopy_bytes: | ||
398 | /* 0 < len < NBYTES */ | ||
399 | #define COPY_BYTE(N) \ | ||
400 | EXC( lb t0, N(src), .Ll_exc); \ | ||
401 | SUB len, len, 1; \ | ||
402 | beqz len, .Ldone; \ | ||
403 | sb t0, N(dst) | ||
404 | |||
405 | COPY_BYTE(0) | ||
406 | COPY_BYTE(1) | ||
407 | #ifdef USE_DOUBLE | ||
408 | COPY_BYTE(2) | ||
409 | COPY_BYTE(3) | ||
410 | COPY_BYTE(4) | ||
411 | COPY_BYTE(5) | ||
412 | #endif | ||
413 | EXC( lb t0, NBYTES-2(src), .Ll_exc) | ||
414 | SUB len, len, 1 | ||
415 | jr ra | ||
416 | sb t0, NBYTES-2(dst) | ||
417 | .Ldone: | ||
418 | jr ra | ||
419 | nop | ||
420 | END(__copy_user_inatomic) | ||
421 | |||
422 | .Ll_exc_copy: | ||
423 | /* | ||
424 | * Copy bytes from src until faulting load address (or until a | ||
425 | * lb faults) | ||
426 | * | ||
427 | * When reached by a faulting LDFIRST/LDREST, THREAD_BUADDR($28) | ||
428 | * may be more than a byte beyond the last address. | ||
429 | * Hence, the lb below may get an exception. | ||
430 | * | ||
431 | * Assumes src < THREAD_BUADDR($28) | ||
432 | */ | ||
433 | LOAD t0, TI_TASK($28) | ||
434 | nop | ||
435 | LOAD t0, THREAD_BUADDR(t0) | ||
436 | 1: | ||
437 | EXC( lb t1, 0(src), .Ll_exc) | ||
438 | ADD src, src, 1 | ||
439 | sb t1, 0(dst) # can't fault -- we're copy_from_user | ||
440 | .set reorder /* DADDI_WAR */ | ||
441 | ADD dst, dst, 1 | ||
442 | bne src, t0, 1b | ||
443 | .set noreorder | ||
444 | .Ll_exc: | ||
445 | LOAD t0, TI_TASK($28) | ||
446 | nop | ||
447 | LOAD t0, THREAD_BUADDR(t0) # t0 is just past last good address | ||
448 | nop | ||
449 | SUB len, AT, t0 # len number of uncopied bytes | ||
450 | jr ra | ||
451 | nop | ||
diff --git a/arch/mips/lib/memcpy.S b/arch/mips/lib/memcpy.S index 56a1f85a1ce8..65192c06781e 100644 --- a/arch/mips/lib/memcpy.S +++ b/arch/mips/lib/memcpy.S | |||
@@ -183,6 +183,14 @@ | |||
183 | #endif | 183 | #endif |
184 | 184 | ||
185 | /* | 185 | /* |
186 | * t6 is used as a flag to note inatomic mode. | ||
187 | */ | ||
188 | LEAF(__copy_user_inatomic) | ||
189 | b __copy_user_common | ||
190 | li t6, 1 | ||
191 | END(__copy_user_inatomic) | ||
192 | |||
193 | /* | ||
186 | * A combined memcpy/__copy_user | 194 | * A combined memcpy/__copy_user |
187 | * __copy_user sets len to 0 for success; else to an upper bound of | 195 | * __copy_user sets len to 0 for success; else to an upper bound of |
188 | * the number of uncopied bytes. | 196 | * the number of uncopied bytes. |
@@ -193,6 +201,8 @@ LEAF(memcpy) /* a0=dst a1=src a2=len */ | |||
193 | move v0, dst /* return value */ | 201 | move v0, dst /* return value */ |
194 | .L__memcpy: | 202 | .L__memcpy: |
195 | FEXPORT(__copy_user) | 203 | FEXPORT(__copy_user) |
204 | li t6, 0 /* not inatomic */ | ||
205 | __copy_user_common: | ||
196 | /* | 206 | /* |
197 | * Note: dst & src may be unaligned, len may be 0 | 207 | * Note: dst & src may be unaligned, len may be 0 |
198 | * Temps | 208 | * Temps |
@@ -458,6 +468,7 @@ EXC( lb t1, 0(src), .Ll_exc) | |||
458 | LOAD t0, THREAD_BUADDR(t0) # t0 is just past last good address | 468 | LOAD t0, THREAD_BUADDR(t0) # t0 is just past last good address |
459 | nop | 469 | nop |
460 | SUB len, AT, t0 # len number of uncopied bytes | 470 | SUB len, AT, t0 # len number of uncopied bytes |
471 | bnez t6, .Ldone /* Skip the zeroing part if inatomic */ | ||
461 | /* | 472 | /* |
462 | * Here's where we rely on src and dst being incremented in tandem, | 473 | * Here's where we rely on src and dst being incremented in tandem, |
463 | * See (3) above. | 474 | * See (3) above. |
diff --git a/arch/mips/loongson1/Kconfig b/arch/mips/loongson1/Kconfig new file mode 100644 index 000000000000..237fa214de9f --- /dev/null +++ b/arch/mips/loongson1/Kconfig | |||
@@ -0,0 +1,21 @@ | |||
1 | if MACH_LOONGSON1 | ||
2 | |||
3 | choice | ||
4 | prompt "Machine Type" | ||
5 | |||
6 | config LOONGSON1_LS1B | ||
7 | bool "Loongson LS1B board" | ||
8 | select CEVT_R4K | ||
9 | select CSRC_R4K | ||
10 | select SYS_HAS_CPU_LOONGSON1B | ||
11 | select DMA_NONCOHERENT | ||
12 | select BOOT_ELF32 | ||
13 | select IRQ_CPU | ||
14 | select SYS_SUPPORTS_32BIT_KERNEL | ||
15 | select SYS_SUPPORTS_LITTLE_ENDIAN | ||
16 | select SYS_SUPPORTS_HIGHMEM | ||
17 | select SYS_HAS_EARLY_PRINTK | ||
18 | |||
19 | endchoice | ||
20 | |||
21 | endif # MACH_LOONGSON1 | ||
diff --git a/arch/mips/loongson1/Makefile b/arch/mips/loongson1/Makefile new file mode 100644 index 000000000000..9719c75886f5 --- /dev/null +++ b/arch/mips/loongson1/Makefile | |||
@@ -0,0 +1,11 @@ | |||
1 | # | ||
2 | # Common code for all Loongson 1 based systems | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_MACH_LOONGSON1) += common/ | ||
6 | |||
7 | # | ||
8 | # Loongson LS1B board | ||
9 | # | ||
10 | |||
11 | obj-$(CONFIG_LOONGSON1_LS1B) += ls1b/ | ||
diff --git a/arch/mips/loongson1/Platform b/arch/mips/loongson1/Platform new file mode 100644 index 000000000000..99bdefe627af --- /dev/null +++ b/arch/mips/loongson1/Platform | |||
@@ -0,0 +1,7 @@ | |||
1 | cflags-$(CONFIG_CPU_LOONGSON1) += \ | ||
2 | $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ | ||
3 | -Wa,-mips32r2 -Wa,--trap | ||
4 | |||
5 | platform-$(CONFIG_MACH_LOONGSON1) += loongson1/ | ||
6 | cflags-$(CONFIG_MACH_LOONGSON1) += -I$(srctree)/arch/mips/include/asm/mach-loongson1 | ||
7 | load-$(CONFIG_LOONGSON1_LS1B) += 0xffffffff80100000 | ||
diff --git a/arch/mips/loongson1/common/Makefile b/arch/mips/loongson1/common/Makefile new file mode 100644 index 000000000000..b2797709ef5b --- /dev/null +++ b/arch/mips/loongson1/common/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for common code of loongson1 based machines. | ||
3 | # | ||
4 | |||
5 | obj-y += clock.o irq.o platform.o prom.o reset.o setup.o | ||
diff --git a/arch/mips/loongson1/common/clock.c b/arch/mips/loongson1/common/clock.c new file mode 100644 index 000000000000..2d98fb030596 --- /dev/null +++ b/arch/mips/loongson1/common/clock.c | |||
@@ -0,0 +1,165 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include <linux/module.h> | ||
11 | #include <linux/list.h> | ||
12 | #include <linux/mutex.h> | ||
13 | #include <linux/clk.h> | ||
14 | #include <linux/err.h> | ||
15 | #include <asm/clock.h> | ||
16 | #include <asm/time.h> | ||
17 | |||
18 | #include <loongson1.h> | ||
19 | |||
20 | static LIST_HEAD(clocks); | ||
21 | static DEFINE_MUTEX(clocks_mutex); | ||
22 | |||
23 | struct clk *clk_get(struct device *dev, const char *name) | ||
24 | { | ||
25 | struct clk *c; | ||
26 | struct clk *ret = NULL; | ||
27 | |||
28 | mutex_lock(&clocks_mutex); | ||
29 | list_for_each_entry(c, &clocks, node) { | ||
30 | if (!strcmp(c->name, name)) { | ||
31 | ret = c; | ||
32 | break; | ||
33 | } | ||
34 | } | ||
35 | mutex_unlock(&clocks_mutex); | ||
36 | |||
37 | return ret; | ||
38 | } | ||
39 | EXPORT_SYMBOL(clk_get); | ||
40 | |||
41 | unsigned long clk_get_rate(struct clk *clk) | ||
42 | { | ||
43 | return clk->rate; | ||
44 | } | ||
45 | EXPORT_SYMBOL(clk_get_rate); | ||
46 | |||
47 | static void pll_clk_init(struct clk *clk) | ||
48 | { | ||
49 | u32 pll; | ||
50 | |||
51 | pll = __raw_readl(LS1X_CLK_PLL_FREQ); | ||
52 | clk->rate = (12 + (pll & 0x3f)) * 33 / 2 | ||
53 | + ((pll >> 8) & 0x3ff) * 33 / 1024 / 2; | ||
54 | clk->rate *= 1000000; | ||
55 | } | ||
56 | |||
57 | static void cpu_clk_init(struct clk *clk) | ||
58 | { | ||
59 | u32 pll, ctrl; | ||
60 | |||
61 | pll = clk_get_rate(clk->parent); | ||
62 | ctrl = __raw_readl(LS1X_CLK_PLL_DIV) & DIV_CPU; | ||
63 | clk->rate = pll / (ctrl >> DIV_CPU_SHIFT); | ||
64 | } | ||
65 | |||
66 | static void ddr_clk_init(struct clk *clk) | ||
67 | { | ||
68 | u32 pll, ctrl; | ||
69 | |||
70 | pll = clk_get_rate(clk->parent); | ||
71 | ctrl = __raw_readl(LS1X_CLK_PLL_DIV) & DIV_DDR; | ||
72 | clk->rate = pll / (ctrl >> DIV_DDR_SHIFT); | ||
73 | } | ||
74 | |||
75 | static void dc_clk_init(struct clk *clk) | ||
76 | { | ||
77 | u32 pll, ctrl; | ||
78 | |||
79 | pll = clk_get_rate(clk->parent); | ||
80 | ctrl = __raw_readl(LS1X_CLK_PLL_DIV) & DIV_DC; | ||
81 | clk->rate = pll / (ctrl >> DIV_DC_SHIFT); | ||
82 | } | ||
83 | |||
84 | static struct clk_ops pll_clk_ops = { | ||
85 | .init = pll_clk_init, | ||
86 | }; | ||
87 | |||
88 | static struct clk_ops cpu_clk_ops = { | ||
89 | .init = cpu_clk_init, | ||
90 | }; | ||
91 | |||
92 | static struct clk_ops ddr_clk_ops = { | ||
93 | .init = ddr_clk_init, | ||
94 | }; | ||
95 | |||
96 | static struct clk_ops dc_clk_ops = { | ||
97 | .init = dc_clk_init, | ||
98 | }; | ||
99 | |||
100 | static struct clk pll_clk = { | ||
101 | .name = "pll", | ||
102 | .ops = &pll_clk_ops, | ||
103 | }; | ||
104 | |||
105 | static struct clk cpu_clk = { | ||
106 | .name = "cpu", | ||
107 | .parent = &pll_clk, | ||
108 | .ops = &cpu_clk_ops, | ||
109 | }; | ||
110 | |||
111 | static struct clk ddr_clk = { | ||
112 | .name = "ddr", | ||
113 | .parent = &pll_clk, | ||
114 | .ops = &ddr_clk_ops, | ||
115 | }; | ||
116 | |||
117 | static struct clk dc_clk = { | ||
118 | .name = "dc", | ||
119 | .parent = &pll_clk, | ||
120 | .ops = &dc_clk_ops, | ||
121 | }; | ||
122 | |||
123 | int clk_register(struct clk *clk) | ||
124 | { | ||
125 | mutex_lock(&clocks_mutex); | ||
126 | list_add(&clk->node, &clocks); | ||
127 | if (clk->ops->init) | ||
128 | clk->ops->init(clk); | ||
129 | mutex_unlock(&clocks_mutex); | ||
130 | |||
131 | return 0; | ||
132 | } | ||
133 | EXPORT_SYMBOL(clk_register); | ||
134 | |||
135 | static struct clk *ls1x_clks[] = { | ||
136 | &pll_clk, | ||
137 | &cpu_clk, | ||
138 | &ddr_clk, | ||
139 | &dc_clk, | ||
140 | }; | ||
141 | |||
142 | int __init ls1x_clock_init(void) | ||
143 | { | ||
144 | int i; | ||
145 | |||
146 | for (i = 0; i < ARRAY_SIZE(ls1x_clks); i++) | ||
147 | clk_register(ls1x_clks[i]); | ||
148 | |||
149 | return 0; | ||
150 | } | ||
151 | |||
152 | void __init plat_time_init(void) | ||
153 | { | ||
154 | struct clk *clk; | ||
155 | |||
156 | /* Initialize LS1X clocks */ | ||
157 | ls1x_clock_init(); | ||
158 | |||
159 | /* setup mips r4k timer */ | ||
160 | clk = clk_get(NULL, "cpu"); | ||
161 | if (IS_ERR(clk)) | ||
162 | panic("unable to get dc clock, err=%ld", PTR_ERR(clk)); | ||
163 | |||
164 | mips_hpt_frequency = clk_get_rate(clk) / 2; | ||
165 | } | ||
diff --git a/arch/mips/loongson1/common/irq.c b/arch/mips/loongson1/common/irq.c new file mode 100644 index 000000000000..41bc8ffe7bba --- /dev/null +++ b/arch/mips/loongson1/common/irq.c | |||
@@ -0,0 +1,147 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include <linux/interrupt.h> | ||
11 | #include <linux/irq.h> | ||
12 | #include <asm/irq_cpu.h> | ||
13 | |||
14 | #include <loongson1.h> | ||
15 | #include <irq.h> | ||
16 | |||
17 | #define LS1X_INTC_REG(n, x) \ | ||
18 | ((void __iomem *)KSEG1ADDR(LS1X_INTC_BASE + (n * 0x18) + (x))) | ||
19 | |||
20 | #define LS1X_INTC_INTISR(n) LS1X_INTC_REG(n, 0x0) | ||
21 | #define LS1X_INTC_INTIEN(n) LS1X_INTC_REG(n, 0x4) | ||
22 | #define LS1X_INTC_INTSET(n) LS1X_INTC_REG(n, 0x8) | ||
23 | #define LS1X_INTC_INTCLR(n) LS1X_INTC_REG(n, 0xc) | ||
24 | #define LS1X_INTC_INTPOL(n) LS1X_INTC_REG(n, 0x10) | ||
25 | #define LS1X_INTC_INTEDGE(n) LS1X_INTC_REG(n, 0x14) | ||
26 | |||
27 | static void ls1x_irq_ack(struct irq_data *d) | ||
28 | { | ||
29 | unsigned int bit = (d->irq - LS1X_IRQ_BASE) & 0x1f; | ||
30 | unsigned int n = (d->irq - LS1X_IRQ_BASE) >> 5; | ||
31 | |||
32 | __raw_writel(__raw_readl(LS1X_INTC_INTCLR(n)) | ||
33 | | (1 << bit), LS1X_INTC_INTCLR(n)); | ||
34 | } | ||
35 | |||
36 | static void ls1x_irq_mask(struct irq_data *d) | ||
37 | { | ||
38 | unsigned int bit = (d->irq - LS1X_IRQ_BASE) & 0x1f; | ||
39 | unsigned int n = (d->irq - LS1X_IRQ_BASE) >> 5; | ||
40 | |||
41 | __raw_writel(__raw_readl(LS1X_INTC_INTIEN(n)) | ||
42 | & ~(1 << bit), LS1X_INTC_INTIEN(n)); | ||
43 | } | ||
44 | |||
45 | static void ls1x_irq_mask_ack(struct irq_data *d) | ||
46 | { | ||
47 | unsigned int bit = (d->irq - LS1X_IRQ_BASE) & 0x1f; | ||
48 | unsigned int n = (d->irq - LS1X_IRQ_BASE) >> 5; | ||
49 | |||
50 | __raw_writel(__raw_readl(LS1X_INTC_INTIEN(n)) | ||
51 | & ~(1 << bit), LS1X_INTC_INTIEN(n)); | ||
52 | __raw_writel(__raw_readl(LS1X_INTC_INTCLR(n)) | ||
53 | | (1 << bit), LS1X_INTC_INTCLR(n)); | ||
54 | } | ||
55 | |||
56 | static void ls1x_irq_unmask(struct irq_data *d) | ||
57 | { | ||
58 | unsigned int bit = (d->irq - LS1X_IRQ_BASE) & 0x1f; | ||
59 | unsigned int n = (d->irq - LS1X_IRQ_BASE) >> 5; | ||
60 | |||
61 | __raw_writel(__raw_readl(LS1X_INTC_INTIEN(n)) | ||
62 | | (1 << bit), LS1X_INTC_INTIEN(n)); | ||
63 | } | ||
64 | |||
65 | static struct irq_chip ls1x_irq_chip = { | ||
66 | .name = "LS1X-INTC", | ||
67 | .irq_ack = ls1x_irq_ack, | ||
68 | .irq_mask = ls1x_irq_mask, | ||
69 | .irq_mask_ack = ls1x_irq_mask_ack, | ||
70 | .irq_unmask = ls1x_irq_unmask, | ||
71 | }; | ||
72 | |||
73 | static void ls1x_irq_dispatch(int n) | ||
74 | { | ||
75 | u32 int_status, irq; | ||
76 | |||
77 | /* Get pending sources, masked by current enables */ | ||
78 | int_status = __raw_readl(LS1X_INTC_INTISR(n)) & | ||
79 | __raw_readl(LS1X_INTC_INTIEN(n)); | ||
80 | |||
81 | if (int_status) { | ||
82 | irq = LS1X_IRQ(n, __ffs(int_status)); | ||
83 | do_IRQ(irq); | ||
84 | } | ||
85 | } | ||
86 | |||
87 | asmlinkage void plat_irq_dispatch(void) | ||
88 | { | ||
89 | unsigned int pending; | ||
90 | |||
91 | pending = read_c0_cause() & read_c0_status() & ST0_IM; | ||
92 | |||
93 | if (pending & CAUSEF_IP7) | ||
94 | do_IRQ(TIMER_IRQ); | ||
95 | else if (pending & CAUSEF_IP2) | ||
96 | ls1x_irq_dispatch(0); /* INT0 */ | ||
97 | else if (pending & CAUSEF_IP3) | ||
98 | ls1x_irq_dispatch(1); /* INT1 */ | ||
99 | else if (pending & CAUSEF_IP4) | ||
100 | ls1x_irq_dispatch(2); /* INT2 */ | ||
101 | else if (pending & CAUSEF_IP5) | ||
102 | ls1x_irq_dispatch(3); /* INT3 */ | ||
103 | else if (pending & CAUSEF_IP6) | ||
104 | ls1x_irq_dispatch(4); /* INT4 */ | ||
105 | else | ||
106 | spurious_interrupt(); | ||
107 | |||
108 | } | ||
109 | |||
110 | struct irqaction cascade_irqaction = { | ||
111 | .handler = no_action, | ||
112 | .name = "cascade", | ||
113 | .flags = IRQF_NO_THREAD, | ||
114 | }; | ||
115 | |||
116 | static void __init ls1x_irq_init(int base) | ||
117 | { | ||
118 | int n; | ||
119 | |||
120 | /* Disable interrupts and clear pending, | ||
121 | * setup all IRQs as high level triggered | ||
122 | */ | ||
123 | for (n = 0; n < 4; n++) { | ||
124 | __raw_writel(0x0, LS1X_INTC_INTIEN(n)); | ||
125 | __raw_writel(0xffffffff, LS1X_INTC_INTCLR(n)); | ||
126 | __raw_writel(0xffffffff, LS1X_INTC_INTPOL(n)); | ||
127 | /* set DMA0, DMA1 and DMA2 to edge trigger */ | ||
128 | __raw_writel(n ? 0x0 : 0xe000, LS1X_INTC_INTEDGE(n)); | ||
129 | } | ||
130 | |||
131 | |||
132 | for (n = base; n < LS1X_IRQS; n++) { | ||
133 | irq_set_chip_and_handler(n, &ls1x_irq_chip, | ||
134 | handle_level_irq); | ||
135 | } | ||
136 | |||
137 | setup_irq(INT0_IRQ, &cascade_irqaction); | ||
138 | setup_irq(INT1_IRQ, &cascade_irqaction); | ||
139 | setup_irq(INT2_IRQ, &cascade_irqaction); | ||
140 | setup_irq(INT3_IRQ, &cascade_irqaction); | ||
141 | } | ||
142 | |||
143 | void __init arch_init_irq(void) | ||
144 | { | ||
145 | mips_cpu_irq_init(); | ||
146 | ls1x_irq_init(LS1X_IRQ_BASE); | ||
147 | } | ||
diff --git a/arch/mips/loongson1/common/platform.c b/arch/mips/loongson1/common/platform.c new file mode 100644 index 000000000000..e92d59c4bd78 --- /dev/null +++ b/arch/mips/loongson1/common/platform.c | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include <linux/clk.h> | ||
11 | #include <linux/dma-mapping.h> | ||
12 | #include <linux/err.h> | ||
13 | #include <linux/phy.h> | ||
14 | #include <linux/serial_8250.h> | ||
15 | #include <linux/stmmac.h> | ||
16 | #include <asm-generic/sizes.h> | ||
17 | |||
18 | #include <loongson1.h> | ||
19 | |||
20 | #define LS1X_UART(_id) \ | ||
21 | { \ | ||
22 | .mapbase = LS1X_UART ## _id ## _BASE, \ | ||
23 | .irq = LS1X_UART ## _id ## _IRQ, \ | ||
24 | .iotype = UPIO_MEM, \ | ||
25 | .flags = UPF_IOREMAP | UPF_FIXED_TYPE, \ | ||
26 | .type = PORT_16550A, \ | ||
27 | } | ||
28 | |||
29 | static struct plat_serial8250_port ls1x_serial8250_port[] = { | ||
30 | LS1X_UART(0), | ||
31 | LS1X_UART(1), | ||
32 | LS1X_UART(2), | ||
33 | LS1X_UART(3), | ||
34 | {}, | ||
35 | }; | ||
36 | |||
37 | struct platform_device ls1x_uart_device = { | ||
38 | .name = "serial8250", | ||
39 | .id = PLAT8250_DEV_PLATFORM, | ||
40 | .dev = { | ||
41 | .platform_data = ls1x_serial8250_port, | ||
42 | }, | ||
43 | }; | ||
44 | |||
45 | void __init ls1x_serial_setup(void) | ||
46 | { | ||
47 | struct clk *clk; | ||
48 | struct plat_serial8250_port *p; | ||
49 | |||
50 | clk = clk_get(NULL, "dc"); | ||
51 | if (IS_ERR(clk)) | ||
52 | panic("unable to get dc clock, err=%ld", PTR_ERR(clk)); | ||
53 | |||
54 | for (p = ls1x_serial8250_port; p->flags != 0; ++p) | ||
55 | p->uartclk = clk_get_rate(clk); | ||
56 | } | ||
57 | |||
58 | /* Synopsys Ethernet GMAC */ | ||
59 | static struct resource ls1x_eth0_resources[] = { | ||
60 | [0] = { | ||
61 | .start = LS1X_GMAC0_BASE, | ||
62 | .end = LS1X_GMAC0_BASE + SZ_64K - 1, | ||
63 | .flags = IORESOURCE_MEM, | ||
64 | }, | ||
65 | [1] = { | ||
66 | .name = "macirq", | ||
67 | .start = LS1X_GMAC0_IRQ, | ||
68 | .flags = IORESOURCE_IRQ, | ||
69 | }, | ||
70 | }; | ||
71 | |||
72 | static struct stmmac_mdio_bus_data ls1x_mdio_bus_data = { | ||
73 | .bus_id = 0, | ||
74 | .phy_mask = 0, | ||
75 | }; | ||
76 | |||
77 | static struct plat_stmmacenet_data ls1x_eth_data = { | ||
78 | .bus_id = 0, | ||
79 | .phy_addr = -1, | ||
80 | .mdio_bus_data = &ls1x_mdio_bus_data, | ||
81 | .has_gmac = 1, | ||
82 | .tx_coe = 1, | ||
83 | }; | ||
84 | |||
85 | struct platform_device ls1x_eth0_device = { | ||
86 | .name = "stmmaceth", | ||
87 | .id = 0, | ||
88 | .num_resources = ARRAY_SIZE(ls1x_eth0_resources), | ||
89 | .resource = ls1x_eth0_resources, | ||
90 | .dev = { | ||
91 | .platform_data = &ls1x_eth_data, | ||
92 | }, | ||
93 | }; | ||
94 | |||
95 | /* USB EHCI */ | ||
96 | static u64 ls1x_ehci_dmamask = DMA_BIT_MASK(32); | ||
97 | |||
98 | static struct resource ls1x_ehci_resources[] = { | ||
99 | [0] = { | ||
100 | .start = LS1X_EHCI_BASE, | ||
101 | .end = LS1X_EHCI_BASE + SZ_32K - 1, | ||
102 | .flags = IORESOURCE_MEM, | ||
103 | }, | ||
104 | [1] = { | ||
105 | .start = LS1X_EHCI_IRQ, | ||
106 | .flags = IORESOURCE_IRQ, | ||
107 | }, | ||
108 | }; | ||
109 | |||
110 | struct platform_device ls1x_ehci_device = { | ||
111 | .name = "ls1x-ehci", | ||
112 | .id = -1, | ||
113 | .num_resources = ARRAY_SIZE(ls1x_ehci_resources), | ||
114 | .resource = ls1x_ehci_resources, | ||
115 | .dev = { | ||
116 | .dma_mask = &ls1x_ehci_dmamask, | ||
117 | }, | ||
118 | }; | ||
119 | |||
120 | /* Real Time Clock */ | ||
121 | struct platform_device ls1x_rtc_device = { | ||
122 | .name = "ls1x-rtc", | ||
123 | .id = -1, | ||
124 | }; | ||
diff --git a/arch/mips/loongson1/common/prom.c b/arch/mips/loongson1/common/prom.c new file mode 100644 index 000000000000..1f8e49f9886d --- /dev/null +++ b/arch/mips/loongson1/common/prom.c | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> | ||
3 | * | ||
4 | * Modified from arch/mips/pnx833x/common/prom.c. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/serial_reg.h> | ||
13 | #include <asm/bootinfo.h> | ||
14 | |||
15 | #include <loongson1.h> | ||
16 | #include <prom.h> | ||
17 | |||
18 | int prom_argc; | ||
19 | char **prom_argv, **prom_envp; | ||
20 | unsigned long memsize, highmemsize; | ||
21 | |||
22 | char *prom_getenv(char *envname) | ||
23 | { | ||
24 | char **env = prom_envp; | ||
25 | int i; | ||
26 | |||
27 | i = strlen(envname); | ||
28 | |||
29 | while (*env) { | ||
30 | if (strncmp(envname, *env, i) == 0 && *(*env+i) == '=') | ||
31 | return *env + i + 1; | ||
32 | env++; | ||
33 | } | ||
34 | |||
35 | return 0; | ||
36 | } | ||
37 | |||
38 | static inline unsigned long env_or_default(char *env, unsigned long dfl) | ||
39 | { | ||
40 | char *str = prom_getenv(env); | ||
41 | return str ? simple_strtol(str, 0, 0) : dfl; | ||
42 | } | ||
43 | |||
44 | void __init prom_init_cmdline(void) | ||
45 | { | ||
46 | char *c = &(arcs_cmdline[0]); | ||
47 | int i; | ||
48 | |||
49 | for (i = 1; i < prom_argc; i++) { | ||
50 | strcpy(c, prom_argv[i]); | ||
51 | c += strlen(prom_argv[i]); | ||
52 | if (i < prom_argc-1) | ||
53 | *c++ = ' '; | ||
54 | } | ||
55 | *c = 0; | ||
56 | } | ||
57 | |||
58 | void __init prom_init(void) | ||
59 | { | ||
60 | prom_argc = fw_arg0; | ||
61 | prom_argv = (char **)fw_arg1; | ||
62 | prom_envp = (char **)fw_arg2; | ||
63 | |||
64 | prom_init_cmdline(); | ||
65 | |||
66 | memsize = env_or_default("memsize", DEFAULT_MEMSIZE); | ||
67 | highmemsize = env_or_default("highmemsize", 0x0); | ||
68 | } | ||
69 | |||
70 | void __init prom_free_prom_memory(void) | ||
71 | { | ||
72 | } | ||
73 | |||
74 | #define PORT(offset) (u8 *)(KSEG1ADDR(LS1X_UART0_BASE + offset)) | ||
75 | |||
76 | void __init prom_putchar(char c) | ||
77 | { | ||
78 | int timeout; | ||
79 | |||
80 | timeout = 1024; | ||
81 | |||
82 | while (((readb(PORT(UART_LSR)) & UART_LSR_THRE) == 0) | ||
83 | && (timeout-- > 0)) | ||
84 | ; | ||
85 | |||
86 | writeb(c, PORT(UART_TX)); | ||
87 | } | ||
diff --git a/arch/mips/loongson1/common/reset.c b/arch/mips/loongson1/common/reset.c new file mode 100644 index 000000000000..fb979a784eca --- /dev/null +++ b/arch/mips/loongson1/common/reset.c | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include <linux/io.h> | ||
11 | #include <linux/pm.h> | ||
12 | #include <asm/reboot.h> | ||
13 | |||
14 | #include <loongson1.h> | ||
15 | |||
16 | static void ls1x_restart(char *command) | ||
17 | { | ||
18 | __raw_writel(0x1, LS1X_WDT_EN); | ||
19 | __raw_writel(0x5000000, LS1X_WDT_TIMER); | ||
20 | __raw_writel(0x1, LS1X_WDT_SET); | ||
21 | } | ||
22 | |||
23 | static void ls1x_halt(void) | ||
24 | { | ||
25 | while (1) { | ||
26 | if (cpu_wait) | ||
27 | cpu_wait(); | ||
28 | } | ||
29 | } | ||
30 | |||
31 | static void ls1x_power_off(void) | ||
32 | { | ||
33 | ls1x_halt(); | ||
34 | } | ||
35 | |||
36 | static int __init ls1x_reboot_setup(void) | ||
37 | { | ||
38 | _machine_restart = ls1x_restart; | ||
39 | _machine_halt = ls1x_halt; | ||
40 | pm_power_off = ls1x_power_off; | ||
41 | |||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | arch_initcall(ls1x_reboot_setup); | ||
diff --git a/arch/mips/loongson1/common/setup.c b/arch/mips/loongson1/common/setup.c new file mode 100644 index 000000000000..62128cc27e68 --- /dev/null +++ b/arch/mips/loongson1/common/setup.c | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include <asm/bootinfo.h> | ||
11 | |||
12 | #include <prom.h> | ||
13 | |||
14 | void __init plat_mem_setup(void) | ||
15 | { | ||
16 | add_memory_region(0x0, (memsize << 20), BOOT_MEM_RAM); | ||
17 | } | ||
18 | |||
19 | const char *get_system_type(void) | ||
20 | { | ||
21 | unsigned int processor_id = (¤t_cpu_data)->processor_id; | ||
22 | |||
23 | switch (processor_id & PRID_REV_MASK) { | ||
24 | case PRID_REV_LOONGSON1B: | ||
25 | return "LOONGSON LS1B"; | ||
26 | default: | ||
27 | return "LOONGSON (unknown)"; | ||
28 | } | ||
29 | } | ||
diff --git a/arch/mips/loongson1/ls1b/Makefile b/arch/mips/loongson1/ls1b/Makefile new file mode 100644 index 000000000000..891eac482b82 --- /dev/null +++ b/arch/mips/loongson1/ls1b/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for loongson1B based machines. | ||
3 | # | ||
4 | |||
5 | obj-y += board.o | ||
diff --git a/arch/mips/loongson1/ls1b/board.c b/arch/mips/loongson1/ls1b/board.c new file mode 100644 index 000000000000..295b1be893e3 --- /dev/null +++ b/arch/mips/loongson1/ls1b/board.c | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include <platform.h> | ||
11 | |||
12 | #include <linux/serial_8250.h> | ||
13 | #include <loongson1.h> | ||
14 | |||
15 | static struct platform_device *ls1b_platform_devices[] __initdata = { | ||
16 | &ls1x_uart_device, | ||
17 | &ls1x_eth0_device, | ||
18 | &ls1x_ehci_device, | ||
19 | &ls1x_rtc_device, | ||
20 | }; | ||
21 | |||
22 | static int __init ls1b_platform_init(void) | ||
23 | { | ||
24 | int err; | ||
25 | |||
26 | ls1x_serial_setup(); | ||
27 | |||
28 | err = platform_add_devices(ls1b_platform_devices, | ||
29 | ARRAY_SIZE(ls1b_platform_devices)); | ||
30 | return err; | ||
31 | } | ||
32 | |||
33 | arch_initcall(ls1b_platform_init); | ||
diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c index 5fa185151fc8..64a28e819064 100644 --- a/arch/mips/mm/uasm.c +++ b/arch/mips/mm/uasm.c | |||
@@ -58,18 +58,16 @@ enum fields { | |||
58 | 58 | ||
59 | enum opcode { | 59 | enum opcode { |
60 | insn_invalid, | 60 | insn_invalid, |
61 | insn_addu, insn_addiu, insn_and, insn_andi, insn_beq, | 61 | insn_addiu, insn_addu, insn_and, insn_andi, insn_bbit0, insn_bbit1, |
62 | insn_beql, insn_bgez, insn_bgezl, insn_bltz, insn_bltzl, | 62 | insn_beq, insn_beql, insn_bgez, insn_bgezl, insn_bltz, insn_bltzl, |
63 | insn_bne, insn_cache, insn_daddu, insn_daddiu, insn_dmfc0, | 63 | insn_bne, insn_cache, insn_daddiu, insn_daddu, insn_dins, insn_dinsm, |
64 | insn_dmtc0, insn_dsll, insn_dsll32, insn_dsra, insn_dsrl, | 64 | insn_dmfc0, insn_dmtc0, insn_drotr, insn_drotr32, insn_dsll, |
65 | insn_dsrl32, insn_drotr, insn_drotr32, insn_dsubu, insn_eret, | 65 | insn_dsll32, insn_dsra, insn_dsrl, insn_dsrl32, insn_dsubu, insn_eret, |
66 | insn_j, insn_jal, insn_jr, insn_ld, insn_ll, insn_lld, | 66 | insn_j, insn_jal, insn_jr, insn_ld, insn_ldx, insn_ll, insn_lld, |
67 | insn_lui, insn_lw, insn_mfc0, insn_mtc0, insn_or, insn_ori, | 67 | insn_lui, insn_lw, insn_lwx, insn_mfc0, insn_mtc0, insn_or, insn_ori, |
68 | insn_pref, insn_rfe, insn_sc, insn_scd, insn_sd, insn_sll, | 68 | insn_pref, insn_rfe, insn_rotr, insn_sc, insn_scd, insn_sd, insn_sll, |
69 | insn_sra, insn_srl, insn_rotr, insn_subu, insn_sw, insn_tlbp, | 69 | insn_sra, insn_srl, insn_subu, insn_sw, insn_syscall, insn_tlbp, |
70 | insn_tlbr, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori, | 70 | insn_tlbr, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori, |
71 | insn_dins, insn_dinsm, insn_syscall, insn_bbit0, insn_bbit1, | ||
72 | insn_lwx, insn_ldx | ||
73 | }; | 71 | }; |
74 | 72 | ||
75 | struct insn { | 73 | struct insn { |
@@ -90,65 +88,65 @@ struct insn { | |||
90 | static struct insn insn_table[] __uasminitdata = { | 88 | static struct insn insn_table[] __uasminitdata = { |
91 | { insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 89 | { insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
92 | { insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD }, | 90 | { insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD }, |
93 | { insn_and, M(spec_op, 0, 0, 0, 0, and_op), RS | RT | RD }, | ||
94 | { insn_andi, M(andi_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, | 91 | { insn_andi, M(andi_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, |
95 | { insn_beq, M(beq_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, | 92 | { insn_and, M(spec_op, 0, 0, 0, 0, and_op), RS | RT | RD }, |
93 | { insn_bbit0, M(lwc2_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, | ||
94 | { insn_bbit1, M(swc2_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, | ||
96 | { insn_beql, M(beql_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, | 95 | { insn_beql, M(beql_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, |
97 | { insn_bgez, M(bcond_op, 0, bgez_op, 0, 0, 0), RS | BIMM }, | 96 | { insn_beq, M(beq_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, |
98 | { insn_bgezl, M(bcond_op, 0, bgezl_op, 0, 0, 0), RS | BIMM }, | 97 | { insn_bgezl, M(bcond_op, 0, bgezl_op, 0, 0, 0), RS | BIMM }, |
99 | { insn_bltz, M(bcond_op, 0, bltz_op, 0, 0, 0), RS | BIMM }, | 98 | { insn_bgez, M(bcond_op, 0, bgez_op, 0, 0, 0), RS | BIMM }, |
100 | { insn_bltzl, M(bcond_op, 0, bltzl_op, 0, 0, 0), RS | BIMM }, | 99 | { insn_bltzl, M(bcond_op, 0, bltzl_op, 0, 0, 0), RS | BIMM }, |
100 | { insn_bltz, M(bcond_op, 0, bltz_op, 0, 0, 0), RS | BIMM }, | ||
101 | { insn_bne, M(bne_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, | 101 | { insn_bne, M(bne_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, |
102 | { insn_cache, M(cache_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 102 | { insn_cache, M(cache_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
103 | { insn_daddiu, M(daddiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 103 | { insn_daddiu, M(daddiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
104 | { insn_daddu, M(spec_op, 0, 0, 0, 0, daddu_op), RS | RT | RD }, | 104 | { insn_daddu, M(spec_op, 0, 0, 0, 0, daddu_op), RS | RT | RD }, |
105 | { insn_dinsm, M(spec3_op, 0, 0, 0, 0, dinsm_op), RS | RT | RD | RE }, | ||
106 | { insn_dins, M(spec3_op, 0, 0, 0, 0, dins_op), RS | RT | RD | RE }, | ||
105 | { insn_dmfc0, M(cop0_op, dmfc_op, 0, 0, 0, 0), RT | RD | SET}, | 107 | { insn_dmfc0, M(cop0_op, dmfc_op, 0, 0, 0, 0), RT | RD | SET}, |
106 | { insn_dmtc0, M(cop0_op, dmtc_op, 0, 0, 0, 0), RT | RD | SET}, | 108 | { insn_dmtc0, M(cop0_op, dmtc_op, 0, 0, 0, 0), RT | RD | SET}, |
107 | { insn_dsll, M(spec_op, 0, 0, 0, 0, dsll_op), RT | RD | RE }, | 109 | { insn_drotr32, M(spec_op, 1, 0, 0, 0, dsrl32_op), RT | RD | RE }, |
110 | { insn_drotr, M(spec_op, 1, 0, 0, 0, dsrl_op), RT | RD | RE }, | ||
108 | { insn_dsll32, M(spec_op, 0, 0, 0, 0, dsll32_op), RT | RD | RE }, | 111 | { insn_dsll32, M(spec_op, 0, 0, 0, 0, dsll32_op), RT | RD | RE }, |
112 | { insn_dsll, M(spec_op, 0, 0, 0, 0, dsll_op), RT | RD | RE }, | ||
109 | { insn_dsra, M(spec_op, 0, 0, 0, 0, dsra_op), RT | RD | RE }, | 113 | { insn_dsra, M(spec_op, 0, 0, 0, 0, dsra_op), RT | RD | RE }, |
110 | { insn_dsrl, M(spec_op, 0, 0, 0, 0, dsrl_op), RT | RD | RE }, | ||
111 | { insn_dsrl32, M(spec_op, 0, 0, 0, 0, dsrl32_op), RT | RD | RE }, | 114 | { insn_dsrl32, M(spec_op, 0, 0, 0, 0, dsrl32_op), RT | RD | RE }, |
112 | { insn_drotr, M(spec_op, 1, 0, 0, 0, dsrl_op), RT | RD | RE }, | 115 | { insn_dsrl, M(spec_op, 0, 0, 0, 0, dsrl_op), RT | RD | RE }, |
113 | { insn_drotr32, M(spec_op, 1, 0, 0, 0, dsrl32_op), RT | RD | RE }, | ||
114 | { insn_dsubu, M(spec_op, 0, 0, 0, 0, dsubu_op), RS | RT | RD }, | 116 | { insn_dsubu, M(spec_op, 0, 0, 0, 0, dsubu_op), RS | RT | RD }, |
115 | { insn_eret, M(cop0_op, cop_op, 0, 0, 0, eret_op), 0 }, | 117 | { insn_eret, M(cop0_op, cop_op, 0, 0, 0, eret_op), 0 }, |
116 | { insn_j, M(j_op, 0, 0, 0, 0, 0), JIMM }, | ||
117 | { insn_jal, M(jal_op, 0, 0, 0, 0, 0), JIMM }, | 118 | { insn_jal, M(jal_op, 0, 0, 0, 0, 0), JIMM }, |
119 | { insn_j, M(j_op, 0, 0, 0, 0, 0), JIMM }, | ||
118 | { insn_jr, M(spec_op, 0, 0, 0, 0, jr_op), RS }, | 120 | { insn_jr, M(spec_op, 0, 0, 0, 0, jr_op), RS }, |
119 | { insn_ld, M(ld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 121 | { insn_ld, M(ld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
120 | { insn_ll, M(ll_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 122 | { insn_ldx, M(spec3_op, 0, 0, 0, ldx_op, lx_op), RS | RT | RD }, |
121 | { insn_lld, M(lld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 123 | { insn_lld, M(lld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
124 | { insn_ll, M(ll_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | ||
122 | { insn_lui, M(lui_op, 0, 0, 0, 0, 0), RT | SIMM }, | 125 | { insn_lui, M(lui_op, 0, 0, 0, 0, 0), RT | SIMM }, |
123 | { insn_lw, M(lw_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 126 | { insn_lw, M(lw_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
127 | { insn_lwx, M(spec3_op, 0, 0, 0, lwx_op, lx_op), RS | RT | RD }, | ||
124 | { insn_mfc0, M(cop0_op, mfc_op, 0, 0, 0, 0), RT | RD | SET}, | 128 | { insn_mfc0, M(cop0_op, mfc_op, 0, 0, 0, 0), RT | RD | SET}, |
125 | { insn_mtc0, M(cop0_op, mtc_op, 0, 0, 0, 0), RT | RD | SET}, | 129 | { insn_mtc0, M(cop0_op, mtc_op, 0, 0, 0, 0), RT | RD | SET}, |
126 | { insn_or, M(spec_op, 0, 0, 0, 0, or_op), RS | RT | RD }, | ||
127 | { insn_ori, M(ori_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, | 130 | { insn_ori, M(ori_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, |
131 | { insn_or, M(spec_op, 0, 0, 0, 0, or_op), RS | RT | RD }, | ||
128 | { insn_pref, M(pref_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 132 | { insn_pref, M(pref_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
129 | { insn_rfe, M(cop0_op, cop_op, 0, 0, 0, rfe_op), 0 }, | 133 | { insn_rfe, M(cop0_op, cop_op, 0, 0, 0, rfe_op), 0 }, |
130 | { insn_sc, M(sc_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 134 | { insn_rotr, M(spec_op, 1, 0, 0, 0, srl_op), RT | RD | RE }, |
131 | { insn_scd, M(scd_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 135 | { insn_scd, M(scd_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
136 | { insn_sc, M(sc_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | ||
132 | { insn_sd, M(sd_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 137 | { insn_sd, M(sd_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
133 | { insn_sll, M(spec_op, 0, 0, 0, 0, sll_op), RT | RD | RE }, | 138 | { insn_sll, M(spec_op, 0, 0, 0, 0, sll_op), RT | RD | RE }, |
134 | { insn_sra, M(spec_op, 0, 0, 0, 0, sra_op), RT | RD | RE }, | 139 | { insn_sra, M(spec_op, 0, 0, 0, 0, sra_op), RT | RD | RE }, |
135 | { insn_srl, M(spec_op, 0, 0, 0, 0, srl_op), RT | RD | RE }, | 140 | { insn_srl, M(spec_op, 0, 0, 0, 0, srl_op), RT | RD | RE }, |
136 | { insn_rotr, M(spec_op, 1, 0, 0, 0, srl_op), RT | RD | RE }, | ||
137 | { insn_subu, M(spec_op, 0, 0, 0, 0, subu_op), RS | RT | RD }, | 141 | { insn_subu, M(spec_op, 0, 0, 0, 0, subu_op), RS | RT | RD }, |
138 | { insn_sw, M(sw_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 142 | { insn_sw, M(sw_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
143 | { insn_syscall, M(spec_op, 0, 0, 0, 0, syscall_op), SCIMM}, | ||
139 | { insn_tlbp, M(cop0_op, cop_op, 0, 0, 0, tlbp_op), 0 }, | 144 | { insn_tlbp, M(cop0_op, cop_op, 0, 0, 0, tlbp_op), 0 }, |
140 | { insn_tlbr, M(cop0_op, cop_op, 0, 0, 0, tlbr_op), 0 }, | 145 | { insn_tlbr, M(cop0_op, cop_op, 0, 0, 0, tlbr_op), 0 }, |
141 | { insn_tlbwi, M(cop0_op, cop_op, 0, 0, 0, tlbwi_op), 0 }, | 146 | { insn_tlbwi, M(cop0_op, cop_op, 0, 0, 0, tlbwi_op), 0 }, |
142 | { insn_tlbwr, M(cop0_op, cop_op, 0, 0, 0, tlbwr_op), 0 }, | 147 | { insn_tlbwr, M(cop0_op, cop_op, 0, 0, 0, tlbwr_op), 0 }, |
143 | { insn_xor, M(spec_op, 0, 0, 0, 0, xor_op), RS | RT | RD }, | ||
144 | { insn_xori, M(xori_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, | 148 | { insn_xori, M(xori_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, |
145 | { insn_dins, M(spec3_op, 0, 0, 0, 0, dins_op), RS | RT | RD | RE }, | 149 | { insn_xor, M(spec_op, 0, 0, 0, 0, xor_op), RS | RT | RD }, |
146 | { insn_dinsm, M(spec3_op, 0, 0, 0, 0, dinsm_op), RS | RT | RD | RE }, | ||
147 | { insn_syscall, M(spec_op, 0, 0, 0, 0, syscall_op), SCIMM}, | ||
148 | { insn_bbit0, M(lwc2_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, | ||
149 | { insn_bbit1, M(swc2_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, | ||
150 | { insn_lwx, M(spec3_op, 0, 0, 0, lwx_op, lx_op), RS | RT | RD }, | ||
151 | { insn_ldx, M(spec3_op, 0, 0, 0, ldx_op, lx_op), RS | RT | RD }, | ||
152 | { insn_invalid, 0, 0 } | 150 | { insn_invalid, 0, 0 } |
153 | }; | 151 | }; |
154 | 152 | ||
diff --git a/arch/mips/netlogic/common/earlycons.c b/arch/mips/netlogic/common/earlycons.c index f193f7b3bd81..1902fa22d277 100644 --- a/arch/mips/netlogic/common/earlycons.c +++ b/arch/mips/netlogic/common/earlycons.c | |||
@@ -54,7 +54,7 @@ void prom_putchar(char c) | |||
54 | #elif defined(CONFIG_CPU_XLR) | 54 | #elif defined(CONFIG_CPU_XLR) |
55 | uartbase = nlm_mmio_base(NETLOGIC_IO_UART_0_OFFSET); | 55 | uartbase = nlm_mmio_base(NETLOGIC_IO_UART_0_OFFSET); |
56 | #endif | 56 | #endif |
57 | while (nlm_read_reg(uartbase, UART_LSR) == 0) | 57 | while ((nlm_read_reg(uartbase, UART_LSR) & UART_LSR_THRE) == 0) |
58 | ; | 58 | ; |
59 | nlm_write_reg(uartbase, UART_TX, c); | 59 | nlm_write_reg(uartbase, UART_TX, c); |
60 | } | 60 | } |
diff --git a/arch/mips/netlogic/common/smpboot.S b/arch/mips/netlogic/common/smpboot.S index c138b1a6dec3..a13355cc97eb 100644 --- a/arch/mips/netlogic/common/smpboot.S +++ b/arch/mips/netlogic/common/smpboot.S | |||
@@ -54,28 +54,68 @@ | |||
54 | XLP_IO_SYS_OFFSET(node) + XLP_IO_PCI_HDRSZ + \ | 54 | XLP_IO_SYS_OFFSET(node) + XLP_IO_PCI_HDRSZ + \ |
55 | SYS_CPU_NONCOHERENT_MODE * 4 | 55 | SYS_CPU_NONCOHERENT_MODE * 4 |
56 | 56 | ||
57 | .macro __config_lsu | 57 | #define XLP_AX_WORKAROUND /* enable Ax silicon workarounds */ |
58 | li t0, LSU_DEFEATURE | ||
59 | mfcr t1, t0 | ||
60 | 58 | ||
61 | lui t2, 0x4080 /* Enable Unaligned Access, L2HPE */ | 59 | /* Enable XLP features and workarounds in the LSU */ |
62 | or t1, t1, t2 | 60 | .macro xlp_config_lsu |
63 | li t2, ~0xe /* S1RCM */ | 61 | li t0, LSU_DEFEATURE |
62 | mfcr t1, t0 | ||
63 | |||
64 | lui t2, 0x4080 /* Enable Unaligned Access, L2HPE */ | ||
65 | or t1, t1, t2 | ||
66 | #ifdef XLP_AX_WORKAROUND | ||
67 | li t2, ~0xe /* S1RCM */ | ||
64 | and t1, t1, t2 | 68 | and t1, t1, t2 |
65 | mtcr t1, t0 | 69 | #endif |
70 | mtcr t1, t0 | ||
66 | 71 | ||
67 | li t0, SCHED_DEFEATURE | 72 | #ifdef XLP_AX_WORKAROUND |
68 | lui t1, 0x0100 /* Experimental: Disable BRU accepting ALU ops */ | 73 | li t0, SCHED_DEFEATURE |
69 | mtcr t1, t0 | 74 | lui t1, 0x0100 /* Disable BRU accepting ALU ops */ |
75 | mtcr t1, t0 | ||
76 | #endif | ||
77 | .endm | ||
78 | |||
79 | /* | ||
80 | * This is the code that will be copied to the reset entry point for | ||
81 | * XLR and XLP. The XLP cores start here when they are woken up. This | ||
82 | * is also the NMI entry point. | ||
83 | */ | ||
84 | .macro xlp_flush_l1_dcache | ||
85 | li t0, LSU_DEBUG_DATA0 | ||
86 | li t1, LSU_DEBUG_ADDR | ||
87 | li t2, 0 /* index */ | ||
88 | li t3, 0x1000 /* loop count */ | ||
89 | 1: | ||
90 | sll v0, t2, 5 | ||
91 | mtcr zero, t0 | ||
92 | ori v1, v0, 0x3 /* way0 | write_enable | write_active */ | ||
93 | mtcr v1, t1 | ||
94 | 2: | ||
95 | mfcr v1, t1 | ||
96 | andi v1, 0x1 /* wait for write_active == 0 */ | ||
97 | bnez v1, 2b | ||
98 | nop | ||
99 | mtcr zero, t0 | ||
100 | ori v1, v0, 0x7 /* way1 | write_enable | write_active */ | ||
101 | mtcr v1, t1 | ||
102 | 3: | ||
103 | mfcr v1, t1 | ||
104 | andi v1, 0x1 /* wait for write_active == 0 */ | ||
105 | bnez v1, 3b | ||
106 | nop | ||
107 | addi t2, 1 | ||
108 | bne t3, t2, 1b | ||
109 | nop | ||
70 | .endm | 110 | .endm |
71 | 111 | ||
72 | /* | 112 | /* |
73 | * The cores can come start when they are woken up. This is also the NMI | 113 | * The cores can come start when they are woken up. This is also the NMI |
74 | * entry, so check that first. | 114 | * entry, so check that first. |
75 | * | 115 | * |
76 | * The data corresponding to reset is stored at RESET_DATA_PHYS location, | 116 | * The data corresponding to reset/NMI is stored at RESET_DATA_PHYS |
77 | * this will have the thread mask (used when core is woken up) and the | 117 | * location, this will have the thread mask (used when core is woken up) |
78 | * current NMI handler in case we reached here for an NMI. | 118 | * and the current NMI handler in case we reached here for an NMI. |
79 | * | 119 | * |
80 | * When a core or thread is newly woken up, it loops in a 'wait'. When | 120 | * When a core or thread is newly woken up, it loops in a 'wait'. When |
81 | * the CPU really needs waking up, we send an NMI to it, with the NMI | 121 | * the CPU really needs waking up, we send an NMI to it, with the NMI |
@@ -89,12 +129,12 @@ | |||
89 | FEXPORT(nlm_reset_entry) | 129 | FEXPORT(nlm_reset_entry) |
90 | dmtc0 k0, $22, 6 | 130 | dmtc0 k0, $22, 6 |
91 | dmtc0 k1, $22, 7 | 131 | dmtc0 k1, $22, 7 |
92 | mfc0 k0, CP0_STATUS | 132 | mfc0 k0, CP0_STATUS |
93 | li k1, 0x80000 | 133 | li k1, 0x80000 |
94 | and k1, k0, k1 | 134 | and k1, k0, k1 |
95 | beqz k1, 1f /* go to real reset entry */ | 135 | beqz k1, 1f /* go to real reset entry */ |
96 | nop | 136 | nop |
97 | li k1, CKSEG1ADDR(RESET_DATA_PHYS) /* NMI */ | 137 | li k1, CKSEG1ADDR(RESET_DATA_PHYS) /* NMI */ |
98 | ld k0, BOOT_NMI_HANDLER(k1) | 138 | ld k0, BOOT_NMI_HANDLER(k1) |
99 | jr k0 | 139 | jr k0 |
100 | nop | 140 | nop |
@@ -114,21 +154,25 @@ FEXPORT(nlm_reset_entry) | |||
114 | li t2, SYS_CPU_COHERENT_BASE(0) | 154 | li t2, SYS_CPU_COHERENT_BASE(0) |
115 | add t2, t2, t3 /* t2 <- SYS offset for node */ | 155 | add t2, t2, t3 /* t2 <- SYS offset for node */ |
116 | lw t1, 0(t2) | 156 | lw t1, 0(t2) |
117 | and t1, t1, t0 | 157 | and t1, t1, t0 |
118 | sw t1, 0(t2) | 158 | sw t1, 0(t2) |
119 | 159 | ||
120 | /* read back to ensure complete */ | 160 | /* read back to ensure complete */ |
121 | lw t1, 0(t2) | 161 | lw t1, 0(t2) |
122 | sync | 162 | sync |
123 | 163 | ||
124 | /* Configure LSU on Non-0 Cores. */ | 164 | /* Configure LSU on Non-0 Cores. */ |
125 | __config_lsu | 165 | xlp_config_lsu |
166 | /* FALL THROUGH */ | ||
126 | 167 | ||
127 | /* | 168 | /* |
128 | * Wake up sibling threads from the initial thread in | 169 | * Wake up sibling threads from the initial thread in |
129 | * a core. | 170 | * a core. |
130 | */ | 171 | */ |
131 | EXPORT(nlm_boot_siblings) | 172 | EXPORT(nlm_boot_siblings) |
173 | /* core L1D flush before enable threads */ | ||
174 | xlp_flush_l1_dcache | ||
175 | /* Enable hw threads by writing to MAP_THREADMODE of the core */ | ||
132 | li t0, CKSEG1ADDR(RESET_DATA_PHYS) | 176 | li t0, CKSEG1ADDR(RESET_DATA_PHYS) |
133 | lw t1, BOOT_THREAD_MODE(t0) /* t1 <- thread mode */ | 177 | lw t1, BOOT_THREAD_MODE(t0) /* t1 <- thread mode */ |
134 | li t0, ((CPU_BLOCKID_MAP << 8) | MAP_THREADMODE) | 178 | li t0, ((CPU_BLOCKID_MAP << 8) | MAP_THREADMODE) |
@@ -139,31 +183,28 @@ EXPORT(nlm_boot_siblings) | |||
139 | /* | 183 | /* |
140 | * The new hardware thread starts at the next instruction | 184 | * The new hardware thread starts at the next instruction |
141 | * For all the cases other than core 0 thread 0, we will | 185 | * For all the cases other than core 0 thread 0, we will |
142 | * jump to the secondary wait function. | 186 | * jump to the secondary wait function. |
143 | */ | 187 | */ |
144 | mfc0 v0, CP0_EBASE, 1 | 188 | mfc0 v0, CP0_EBASE, 1 |
145 | andi v0, 0x7f /* v0 <- node/core */ | 189 | andi v0, 0x7f /* v0 <- node/core */ |
146 | 190 | ||
147 | #if 1 | 191 | /* Init MMU in the first thread after changing THREAD_MODE |
148 | /* A0 errata - Write MMU_SETUP after changing thread mode register. */ | 192 | * register (Ax Errata?) |
193 | */ | ||
149 | andi v1, v0, 0x3 /* v1 <- thread id */ | 194 | andi v1, v0, 0x3 /* v1 <- thread id */ |
150 | bnez v1, 2f | 195 | bnez v1, 2f |
151 | nop | 196 | nop |
152 | 197 | ||
153 | li t0, MMU_SETUP | 198 | li t0, MMU_SETUP |
154 | li t1, 0 | 199 | li t1, 0 |
155 | mtcr t1, t0 | 200 | mtcr t1, t0 |
156 | ehb | 201 | _ehb |
157 | #endif | ||
158 | 202 | ||
159 | 2: beqz v0, 4f | 203 | 2: beqz v0, 4f /* boot cpu (cpuid == 0)? */ |
160 | nop | 204 | nop |
161 | 205 | ||
162 | /* setup status reg */ | 206 | /* setup status reg */ |
163 | mfc0 t1, CP0_STATUS | 207 | move t1, zero |
164 | li t0, ST0_BEV | ||
165 | or t1, t0 | ||
166 | xor t1, t0 | ||
167 | #ifdef CONFIG_64BIT | 208 | #ifdef CONFIG_64BIT |
168 | ori t1, ST0_KX | 209 | ori t1, ST0_KX |
169 | #endif | 210 | #endif |
@@ -183,9 +224,9 @@ EXPORT(nlm_boot_siblings) | |||
183 | * For the boot CPU, we have to restore registers and | 224 | * For the boot CPU, we have to restore registers and |
184 | * return | 225 | * return |
185 | */ | 226 | */ |
186 | 4: dmfc0 t0, $4, 2 /* restore SP from UserLocal */ | 227 | 4: dmfc0 t0, $4, 2 /* restore SP from UserLocal */ |
187 | li t1, 0xfadebeef | 228 | li t1, 0xfadebeef |
188 | dmtc0 t1, $4, 2 /* restore SP from UserLocal */ | 229 | dmtc0 t1, $4, 2 /* restore SP from UserLocal */ |
189 | PTR_SUBU sp, t0, PT_SIZE | 230 | PTR_SUBU sp, t0, PT_SIZE |
190 | RESTORE_ALL | 231 | RESTORE_ALL |
191 | jr ra | 232 | jr ra |
@@ -193,7 +234,7 @@ EXPORT(nlm_boot_siblings) | |||
193 | EXPORT(nlm_reset_entry_end) | 234 | EXPORT(nlm_reset_entry_end) |
194 | 235 | ||
195 | FEXPORT(xlp_boot_core0_siblings) /* "Master" cpu starts from here */ | 236 | FEXPORT(xlp_boot_core0_siblings) /* "Master" cpu starts from here */ |
196 | __config_lsu | 237 | xlp_config_lsu |
197 | dmtc0 sp, $4, 2 /* SP saved in UserLocal */ | 238 | dmtc0 sp, $4, 2 /* SP saved in UserLocal */ |
198 | SAVE_ALL | 239 | SAVE_ALL |
199 | sync | 240 | sync |
@@ -210,6 +251,12 @@ FEXPORT(xlp_boot_core0_siblings) /* "Master" cpu starts from here */ | |||
210 | 251 | ||
211 | __CPUINIT | 252 | __CPUINIT |
212 | NESTED(nlm_boot_secondary_cpus, 16, sp) | 253 | NESTED(nlm_boot_secondary_cpus, 16, sp) |
254 | /* Initialize CP0 Status */ | ||
255 | move t1, zero | ||
256 | #ifdef CONFIG_64BIT | ||
257 | ori t1, ST0_KX | ||
258 | #endif | ||
259 | mtc0 t1, CP0_STATUS | ||
213 | PTR_LA t1, nlm_next_sp | 260 | PTR_LA t1, nlm_next_sp |
214 | PTR_L sp, 0(t1) | 261 | PTR_L sp, 0(t1) |
215 | PTR_LA t1, nlm_next_gp | 262 | PTR_LA t1, nlm_next_gp |
@@ -234,36 +281,36 @@ END(nlm_boot_secondary_cpus) | |||
234 | */ | 281 | */ |
235 | __CPUINIT | 282 | __CPUINIT |
236 | NESTED(nlm_rmiboot_preboot, 16, sp) | 283 | NESTED(nlm_rmiboot_preboot, 16, sp) |
237 | mfc0 t0, $15, 1 # read ebase | 284 | mfc0 t0, $15, 1 /* read ebase */ |
238 | andi t0, 0x1f # t0 has the processor_id() | 285 | andi t0, 0x1f /* t0 has the processor_id() */ |
239 | andi t2, t0, 0x3 # thread no | 286 | andi t2, t0, 0x3 /* thread num */ |
240 | sll t0, 2 # offset in cpu array | 287 | sll t0, 2 /* offset in cpu array */ |
241 | 288 | ||
242 | PTR_LA t1, nlm_cpu_ready # mark CPU ready | 289 | PTR_LA t1, nlm_cpu_ready /* mark CPU ready */ |
243 | PTR_ADDU t1, t0 | 290 | PTR_ADDU t1, t0 |
244 | li t3, 1 | 291 | li t3, 1 |
245 | sw t3, 0(t1) | 292 | sw t3, 0(t1) |
246 | 293 | ||
247 | bnez t2, 1f # skip thread programming | 294 | bnez t2, 1f /* skip thread programming */ |
248 | nop # for non zero hw threads | 295 | nop /* for thread id != 0 */ |
249 | 296 | ||
250 | /* | 297 | /* |
251 | * MMU setup only for first thread in core | 298 | * XLR MMU setup only for first thread in core |
252 | */ | 299 | */ |
253 | li t0, 0x400 | 300 | li t0, 0x400 |
254 | mfcr t1, t0 | 301 | mfcr t1, t0 |
255 | li t2, 6 # XLR thread mode mask | 302 | li t2, 6 /* XLR thread mode mask */ |
256 | nor t3, t2, zero | 303 | nor t3, t2, zero |
257 | and t2, t1, t2 # t2 - current thread mode | 304 | and t2, t1, t2 /* t2 - current thread mode */ |
258 | li v0, CKSEG1ADDR(RESET_DATA_PHYS) | 305 | li v0, CKSEG1ADDR(RESET_DATA_PHYS) |
259 | lw v1, BOOT_THREAD_MODE(v0) # v1 - new thread mode | 306 | lw v1, BOOT_THREAD_MODE(v0) /* v1 - new thread mode */ |
260 | sll v1, 1 | 307 | sll v1, 1 |
261 | beq v1, t2, 1f # same as request value | 308 | beq v1, t2, 1f /* same as request value */ |
262 | nop # nothing to do */ | 309 | nop /* nothing to do */ |
263 | 310 | ||
264 | and t2, t1, t3 # mask out old thread mode | 311 | and t2, t1, t3 /* mask out old thread mode */ |
265 | or t1, t2, v1 # put in new value | 312 | or t1, t2, v1 /* put in new value */ |
266 | mtcr t1, t0 # update core control | 313 | mtcr t1, t0 /* update core control */ |
267 | 314 | ||
268 | 1: wait | 315 | 1: wait |
269 | j 1b | 316 | j 1b |
diff --git a/arch/mips/netlogic/xlp/Makefile b/arch/mips/netlogic/xlp/Makefile index b93ed83474ec..6b4b972218f0 100644 --- a/arch/mips/netlogic/xlp/Makefile +++ b/arch/mips/netlogic/xlp/Makefile | |||
@@ -1,2 +1,4 @@ | |||
1 | obj-y += setup.o platform.o nlm_hal.o | 1 | obj-y += setup.o platform.o nlm_hal.o |
2 | obj-$(CONFIG_OF) += of.o | ||
2 | obj-$(CONFIG_SMP) += wakeup.o | 3 | obj-$(CONFIG_SMP) += wakeup.o |
4 | obj-$(CONFIG_USB) += usb-init.o | ||
diff --git a/arch/mips/netlogic/xlp/nlm_hal.c b/arch/mips/netlogic/xlp/nlm_hal.c index 9428e7125fed..6c65ac701912 100644 --- a/arch/mips/netlogic/xlp/nlm_hal.c +++ b/arch/mips/netlogic/xlp/nlm_hal.c | |||
@@ -69,6 +69,32 @@ int nlm_irq_to_irt(int irq) | |||
69 | return PIC_IRT_UART_0_INDEX; | 69 | return PIC_IRT_UART_0_INDEX; |
70 | case PIC_UART_1_IRQ: | 70 | case PIC_UART_1_IRQ: |
71 | return PIC_IRT_UART_1_INDEX; | 71 | return PIC_IRT_UART_1_INDEX; |
72 | case PIC_PCIE_LINK_0_IRQ: | ||
73 | return PIC_IRT_PCIE_LINK_0_INDEX; | ||
74 | case PIC_PCIE_LINK_1_IRQ: | ||
75 | return PIC_IRT_PCIE_LINK_1_INDEX; | ||
76 | case PIC_PCIE_LINK_2_IRQ: | ||
77 | return PIC_IRT_PCIE_LINK_2_INDEX; | ||
78 | case PIC_PCIE_LINK_3_IRQ: | ||
79 | return PIC_IRT_PCIE_LINK_3_INDEX; | ||
80 | case PIC_EHCI_0_IRQ: | ||
81 | return PIC_IRT_EHCI_0_INDEX; | ||
82 | case PIC_EHCI_1_IRQ: | ||
83 | return PIC_IRT_EHCI_1_INDEX; | ||
84 | case PIC_OHCI_0_IRQ: | ||
85 | return PIC_IRT_OHCI_0_INDEX; | ||
86 | case PIC_OHCI_1_IRQ: | ||
87 | return PIC_IRT_OHCI_1_INDEX; | ||
88 | case PIC_OHCI_2_IRQ: | ||
89 | return PIC_IRT_OHCI_2_INDEX; | ||
90 | case PIC_OHCI_3_IRQ: | ||
91 | return PIC_IRT_OHCI_3_INDEX; | ||
92 | case PIC_MMC_IRQ: | ||
93 | return PIC_IRT_MMC_INDEX; | ||
94 | case PIC_I2C_0_IRQ: | ||
95 | return PIC_IRT_I2C_0_INDEX; | ||
96 | case PIC_I2C_1_IRQ: | ||
97 | return PIC_IRT_I2C_1_INDEX; | ||
72 | default: | 98 | default: |
73 | return -1; | 99 | return -1; |
74 | } | 100 | } |
@@ -81,6 +107,32 @@ int nlm_irt_to_irq(int irt) | |||
81 | return PIC_UART_0_IRQ; | 107 | return PIC_UART_0_IRQ; |
82 | case PIC_IRT_UART_1_INDEX: | 108 | case PIC_IRT_UART_1_INDEX: |
83 | return PIC_UART_1_IRQ; | 109 | return PIC_UART_1_IRQ; |
110 | case PIC_IRT_PCIE_LINK_0_INDEX: | ||
111 | return PIC_PCIE_LINK_0_IRQ; | ||
112 | case PIC_IRT_PCIE_LINK_1_INDEX: | ||
113 | return PIC_PCIE_LINK_1_IRQ; | ||
114 | case PIC_IRT_PCIE_LINK_2_INDEX: | ||
115 | return PIC_PCIE_LINK_2_IRQ; | ||
116 | case PIC_IRT_PCIE_LINK_3_INDEX: | ||
117 | return PIC_PCIE_LINK_3_IRQ; | ||
118 | case PIC_IRT_EHCI_0_INDEX: | ||
119 | return PIC_EHCI_0_IRQ; | ||
120 | case PIC_IRT_EHCI_1_INDEX: | ||
121 | return PIC_EHCI_1_IRQ; | ||
122 | case PIC_IRT_OHCI_0_INDEX: | ||
123 | return PIC_OHCI_0_IRQ; | ||
124 | case PIC_IRT_OHCI_1_INDEX: | ||
125 | return PIC_OHCI_1_IRQ; | ||
126 | case PIC_IRT_OHCI_2_INDEX: | ||
127 | return PIC_OHCI_2_IRQ; | ||
128 | case PIC_IRT_OHCI_3_INDEX: | ||
129 | return PIC_OHCI_3_IRQ; | ||
130 | case PIC_IRT_MMC_INDEX: | ||
131 | return PIC_MMC_IRQ; | ||
132 | case PIC_IRT_I2C_0_INDEX: | ||
133 | return PIC_I2C_0_IRQ; | ||
134 | case PIC_IRT_I2C_1_INDEX: | ||
135 | return PIC_I2C_1_IRQ; | ||
84 | default: | 136 | default: |
85 | return -1; | 137 | return -1; |
86 | } | 138 | } |
diff --git a/arch/mips/netlogic/xlp/of.c b/arch/mips/netlogic/xlp/of.c new file mode 100644 index 000000000000..8e3921c0c201 --- /dev/null +++ b/arch/mips/netlogic/xlp/of.c | |||
@@ -0,0 +1,34 @@ | |||
1 | #include <linux/bootmem.h> | ||
2 | #include <linux/init.h> | ||
3 | #include <linux/io.h> | ||
4 | #include <linux/of_fdt.h> | ||
5 | #include <asm/byteorder.h> | ||
6 | |||
7 | static int __init reserve_mem_mach(unsigned long addr, unsigned long size) | ||
8 | { | ||
9 | return reserve_bootmem(addr, size, BOOTMEM_DEFAULT); | ||
10 | } | ||
11 | |||
12 | void __init free_mem_mach(unsigned long addr, unsigned long size) | ||
13 | { | ||
14 | return free_bootmem(addr, size); | ||
15 | } | ||
16 | |||
17 | void __init device_tree_init(void) | ||
18 | { | ||
19 | unsigned long base, size; | ||
20 | |||
21 | if (!initial_boot_params) | ||
22 | return; | ||
23 | |||
24 | base = virt_to_phys((void *)initial_boot_params); | ||
25 | size = be32_to_cpu(initial_boot_params->totalsize); | ||
26 | |||
27 | /* Before we do anything, lets reserve the dt blob */ | ||
28 | reserve_mem_mach(base, size); | ||
29 | |||
30 | unflatten_device_tree(); | ||
31 | |||
32 | /* free the space reserved for the dt blob */ | ||
33 | free_mem_mach(base, size); | ||
34 | } | ||
diff --git a/arch/mips/netlogic/xlp/platform.c b/arch/mips/netlogic/xlp/platform.c index 1f5e4cba891d..2c510d585447 100644 --- a/arch/mips/netlogic/xlp/platform.c +++ b/arch/mips/netlogic/xlp/platform.c | |||
@@ -53,7 +53,7 @@ | |||
53 | 53 | ||
54 | static unsigned int nlm_xlp_uart_in(struct uart_port *p, int offset) | 54 | static unsigned int nlm_xlp_uart_in(struct uart_port *p, int offset) |
55 | { | 55 | { |
56 | return nlm_read_reg(p->iobase, offset); | 56 | return nlm_read_reg(p->iobase, offset); |
57 | } | 57 | } |
58 | 58 | ||
59 | static void nlm_xlp_uart_out(struct uart_port *p, int offset, int value) | 59 | static void nlm_xlp_uart_out(struct uart_port *p, int offset, int value) |
diff --git a/arch/mips/netlogic/xlp/setup.c b/arch/mips/netlogic/xlp/setup.c index b3df7c2aad1e..3dec9f28b65b 100644 --- a/arch/mips/netlogic/xlp/setup.c +++ b/arch/mips/netlogic/xlp/setup.c | |||
@@ -41,6 +41,8 @@ | |||
41 | #include <asm/bootinfo.h> | 41 | #include <asm/bootinfo.h> |
42 | 42 | ||
43 | #include <linux/of_fdt.h> | 43 | #include <linux/of_fdt.h> |
44 | #include <linux/of_platform.h> | ||
45 | #include <linux/of_device.h> | ||
44 | 46 | ||
45 | #include <asm/netlogic/haldefs.h> | 47 | #include <asm/netlogic/haldefs.h> |
46 | #include <asm/netlogic/common.h> | 48 | #include <asm/netlogic/common.h> |
@@ -109,3 +111,17 @@ void __init prom_init(void) | |||
109 | register_smp_ops(&nlm_smp_ops); | 111 | register_smp_ops(&nlm_smp_ops); |
110 | #endif | 112 | #endif |
111 | } | 113 | } |
114 | |||
115 | static struct of_device_id __initdata xlp_ids[] = { | ||
116 | { .compatible = "simple-bus", }, | ||
117 | {}, | ||
118 | }; | ||
119 | |||
120 | int __init xlp8xx_ds_publish_devices(void) | ||
121 | { | ||
122 | if (!of_have_populated_dt()) | ||
123 | return 0; | ||
124 | return of_platform_bus_probe(NULL, xlp_ids, NULL); | ||
125 | } | ||
126 | |||
127 | device_initcall(xlp8xx_ds_publish_devices); | ||
diff --git a/arch/mips/netlogic/xlp/usb-init.c b/arch/mips/netlogic/xlp/usb-init.c new file mode 100644 index 000000000000..dbe083a93538 --- /dev/null +++ b/arch/mips/netlogic/xlp/usb-init.c | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2003-2012 Broadcom Corporation | ||
3 | * All Rights Reserved | ||
4 | * | ||
5 | * This software is available to you under a choice of one of two | ||
6 | * licenses. You may choose to be licensed under the terms of the GNU | ||
7 | * General Public License (GPL) Version 2, available from the file | ||
8 | * COPYING in the main directory of this source tree, or the Broadcom | ||
9 | * license below: | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions and the following disclaimer. | ||
17 | * 2. Redistributions in binary form must reproduce the above copyright | ||
18 | * notice, this list of conditions and the following disclaimer in | ||
19 | * the documentation and/or other materials provided with the | ||
20 | * distribution. | ||
21 | * | ||
22 | * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR | ||
23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
24 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
25 | * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE | ||
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
29 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
30 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
31 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||
32 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | */ | ||
34 | |||
35 | #include <linux/dma-mapping.h> | ||
36 | #include <linux/kernel.h> | ||
37 | #include <linux/delay.h> | ||
38 | #include <linux/init.h> | ||
39 | #include <linux/pci.h> | ||
40 | #include <linux/platform_device.h> | ||
41 | |||
42 | #include <asm/netlogic/haldefs.h> | ||
43 | #include <asm/netlogic/xlp-hal/iomap.h> | ||
44 | #include <asm/netlogic/xlp-hal/xlp.h> | ||
45 | #include <asm/netlogic/xlp-hal/usb.h> | ||
46 | |||
47 | static void nlm_usb_intr_en(int node, int port) | ||
48 | { | ||
49 | uint32_t val; | ||
50 | uint64_t port_addr; | ||
51 | |||
52 | port_addr = nlm_get_usb_regbase(node, port); | ||
53 | val = nlm_read_usb_reg(port_addr, USB_INT_EN); | ||
54 | val = USB_CTRL_INTERRUPT_EN | USB_OHCI_INTERRUPT_EN | | ||
55 | USB_OHCI_INTERRUPT1_EN | USB_CTRL_INTERRUPT_EN | | ||
56 | USB_OHCI_INTERRUPT_EN | USB_OHCI_INTERRUPT2_EN; | ||
57 | nlm_write_usb_reg(port_addr, USB_INT_EN, val); | ||
58 | } | ||
59 | |||
60 | static void nlm_usb_hw_reset(int node, int port) | ||
61 | { | ||
62 | uint64_t port_addr; | ||
63 | uint32_t val; | ||
64 | |||
65 | /* reset USB phy */ | ||
66 | port_addr = nlm_get_usb_regbase(node, port); | ||
67 | val = nlm_read_usb_reg(port_addr, USB_PHY_0); | ||
68 | val &= ~(USB_PHY_RESET | USB_PHY_PORT_RESET_0 | USB_PHY_PORT_RESET_1); | ||
69 | nlm_write_usb_reg(port_addr, USB_PHY_0, val); | ||
70 | |||
71 | mdelay(100); | ||
72 | val = nlm_read_usb_reg(port_addr, USB_CTL_0); | ||
73 | val &= ~(USB_CONTROLLER_RESET); | ||
74 | val |= 0x4; | ||
75 | nlm_write_usb_reg(port_addr, USB_CTL_0, val); | ||
76 | } | ||
77 | |||
78 | static int __init nlm_platform_usb_init(void) | ||
79 | { | ||
80 | pr_info("Initializing USB Interface\n"); | ||
81 | nlm_usb_hw_reset(0, 0); | ||
82 | nlm_usb_hw_reset(0, 3); | ||
83 | |||
84 | /* Enable PHY interrupts */ | ||
85 | nlm_usb_intr_en(0, 0); | ||
86 | nlm_usb_intr_en(0, 3); | ||
87 | |||
88 | return 0; | ||
89 | } | ||
90 | |||
91 | arch_initcall(nlm_platform_usb_init); | ||
92 | |||
93 | static u64 xlp_usb_dmamask = ~(u32)0; | ||
94 | |||
95 | /* Fixup the IRQ for USB devices which is exist on XLP SOC PCIE bus */ | ||
96 | static void nlm_usb_fixup_final(struct pci_dev *dev) | ||
97 | { | ||
98 | dev->dev.dma_mask = &xlp_usb_dmamask; | ||
99 | dev->dev.coherent_dma_mask = DMA_BIT_MASK(64); | ||
100 | switch (dev->devfn) { | ||
101 | case 0x10: | ||
102 | dev->irq = PIC_EHCI_0_IRQ; | ||
103 | break; | ||
104 | case 0x11: | ||
105 | dev->irq = PIC_OHCI_0_IRQ; | ||
106 | break; | ||
107 | case 0x12: | ||
108 | dev->irq = PIC_OHCI_1_IRQ; | ||
109 | break; | ||
110 | case 0x13: | ||
111 | dev->irq = PIC_EHCI_1_IRQ; | ||
112 | break; | ||
113 | case 0x14: | ||
114 | dev->irq = PIC_OHCI_2_IRQ; | ||
115 | break; | ||
116 | case 0x15: | ||
117 | dev->irq = PIC_OHCI_3_IRQ; | ||
118 | break; | ||
119 | } | ||
120 | } | ||
121 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_NETLOGIC, PCI_DEVICE_ID_NLM_EHCI, | ||
122 | nlm_usb_fixup_final); | ||
123 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_NETLOGIC, PCI_DEVICE_ID_NLM_OHCI, | ||
124 | nlm_usb_fixup_final); | ||
diff --git a/arch/mips/netlogic/xlr/Makefile b/arch/mips/netlogic/xlr/Makefile index f01e4d7a0600..c287dea87570 100644 --- a/arch/mips/netlogic/xlr/Makefile +++ b/arch/mips/netlogic/xlr/Makefile | |||
@@ -1,2 +1,2 @@ | |||
1 | obj-y += setup.o platform.o | 1 | obj-y += setup.o platform.o platform-flash.o |
2 | obj-$(CONFIG_SMP) += wakeup.o | 2 | obj-$(CONFIG_SMP) += wakeup.o |
diff --git a/arch/mips/netlogic/xlr/platform-flash.c b/arch/mips/netlogic/xlr/platform-flash.c new file mode 100644 index 000000000000..340ab1601c42 --- /dev/null +++ b/arch/mips/netlogic/xlr/platform-flash.c | |||
@@ -0,0 +1,220 @@ | |||
1 | /* | ||
2 | * Copyright 2011, Netlogic Microsystems. | ||
3 | * Copyright 2004, Matt Porter <mporter@kernel.crashing.org> | ||
4 | * | ||
5 | * This file is licensed under the terms of the GNU General Public | ||
6 | * License version 2. This program is licensed "as is" without any | ||
7 | * warranty of any kind, whether express or implied. | ||
8 | */ | ||
9 | |||
10 | #include <linux/device.h> | ||
11 | #include <linux/platform_device.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/delay.h> | ||
16 | #include <linux/ioport.h> | ||
17 | #include <linux/resource.h> | ||
18 | #include <linux/spi/flash.h> | ||
19 | |||
20 | #include <linux/mtd/mtd.h> | ||
21 | #include <linux/mtd/physmap.h> | ||
22 | #include <linux/mtd/nand.h> | ||
23 | #include <linux/mtd/partitions.h> | ||
24 | |||
25 | #include <asm/netlogic/haldefs.h> | ||
26 | #include <asm/netlogic/xlr/iomap.h> | ||
27 | #include <asm/netlogic/xlr/flash.h> | ||
28 | #include <asm/netlogic/xlr/bridge.h> | ||
29 | #include <asm/netlogic/xlr/gpio.h> | ||
30 | #include <asm/netlogic/xlr/xlr.h> | ||
31 | |||
32 | /* | ||
33 | * Default NOR partition layout | ||
34 | */ | ||
35 | static struct mtd_partition xlr_nor_parts[] = { | ||
36 | { | ||
37 | .name = "User FS", | ||
38 | .offset = 0x800000, | ||
39 | .size = MTDPART_SIZ_FULL, | ||
40 | } | ||
41 | }; | ||
42 | |||
43 | /* | ||
44 | * Default NAND partition layout | ||
45 | */ | ||
46 | static struct mtd_partition xlr_nand_parts[] = { | ||
47 | { | ||
48 | .name = "Root Filesystem", | ||
49 | .offset = 64 * 64 * 2048, | ||
50 | .size = 432 * 64 * 2048, | ||
51 | }, | ||
52 | { | ||
53 | .name = "Home Filesystem", | ||
54 | .offset = MTDPART_OFS_APPEND, | ||
55 | .size = MTDPART_SIZ_FULL, | ||
56 | }, | ||
57 | }; | ||
58 | |||
59 | /* Use PHYSMAP flash for NOR */ | ||
60 | struct physmap_flash_data xlr_nor_data = { | ||
61 | .width = 2, | ||
62 | .parts = xlr_nor_parts, | ||
63 | .nr_parts = ARRAY_SIZE(xlr_nor_parts), | ||
64 | }; | ||
65 | |||
66 | static struct resource xlr_nor_res[] = { | ||
67 | { | ||
68 | .flags = IORESOURCE_MEM, | ||
69 | }, | ||
70 | }; | ||
71 | |||
72 | static struct platform_device xlr_nor_dev = { | ||
73 | .name = "physmap-flash", | ||
74 | .dev = { | ||
75 | .platform_data = &xlr_nor_data, | ||
76 | }, | ||
77 | .num_resources = ARRAY_SIZE(xlr_nor_res), | ||
78 | .resource = xlr_nor_res, | ||
79 | }; | ||
80 | |||
81 | const char *xlr_part_probes[] = { "cmdlinepart", NULL }; | ||
82 | |||
83 | /* | ||
84 | * Use "gen_nand" driver for NAND flash | ||
85 | * | ||
86 | * There seems to be no way to store a private pointer containing | ||
87 | * platform specific info in gen_nand drivier. We will use a global | ||
88 | * struct for now, since we currently have only one NAND chip per board. | ||
89 | */ | ||
90 | struct xlr_nand_flash_priv { | ||
91 | int cs; | ||
92 | uint64_t flash_mmio; | ||
93 | }; | ||
94 | |||
95 | static struct xlr_nand_flash_priv nand_priv; | ||
96 | |||
97 | static void xlr_nand_ctrl(struct mtd_info *mtd, int cmd, | ||
98 | unsigned int ctrl) | ||
99 | { | ||
100 | if (ctrl & NAND_CLE) | ||
101 | nlm_write_reg(nand_priv.flash_mmio, | ||
102 | FLASH_NAND_CLE(nand_priv.cs), cmd); | ||
103 | else if (ctrl & NAND_ALE) | ||
104 | nlm_write_reg(nand_priv.flash_mmio, | ||
105 | FLASH_NAND_ALE(nand_priv.cs), cmd); | ||
106 | } | ||
107 | |||
108 | struct platform_nand_data xlr_nand_data = { | ||
109 | .chip = { | ||
110 | .nr_chips = 1, | ||
111 | .nr_partitions = ARRAY_SIZE(xlr_nand_parts), | ||
112 | .chip_delay = 50, | ||
113 | .partitions = xlr_nand_parts, | ||
114 | .part_probe_types = xlr_part_probes, | ||
115 | }, | ||
116 | .ctrl = { | ||
117 | .cmd_ctrl = xlr_nand_ctrl, | ||
118 | }, | ||
119 | }; | ||
120 | |||
121 | static struct resource xlr_nand_res[] = { | ||
122 | { | ||
123 | .flags = IORESOURCE_MEM, | ||
124 | }, | ||
125 | }; | ||
126 | |||
127 | static struct platform_device xlr_nand_dev = { | ||
128 | .name = "gen_nand", | ||
129 | .id = -1, | ||
130 | .num_resources = ARRAY_SIZE(xlr_nand_res), | ||
131 | .resource = xlr_nand_res, | ||
132 | .dev = { | ||
133 | .platform_data = &xlr_nand_data, | ||
134 | } | ||
135 | }; | ||
136 | |||
137 | /* | ||
138 | * XLR/XLS supports upto 8 devices on its FLASH interface. The value in | ||
139 | * FLASH_BAR (on the MEM/IO bridge) gives the base for mapping all the | ||
140 | * flash devices. | ||
141 | * Under this, each flash device has an offset and size given by the | ||
142 | * CSBASE_ADDR and CSBASE_MASK registers for the device. | ||
143 | * | ||
144 | * The CSBASE_ registers are expected to be setup by the bootloader. | ||
145 | */ | ||
146 | static void setup_flash_resource(uint64_t flash_mmio, | ||
147 | uint64_t flash_map_base, int cs, struct resource *res) | ||
148 | { | ||
149 | u32 base, mask; | ||
150 | |||
151 | base = nlm_read_reg(flash_mmio, FLASH_CSBASE_ADDR(cs)); | ||
152 | mask = nlm_read_reg(flash_mmio, FLASH_CSADDR_MASK(cs)); | ||
153 | |||
154 | res->start = flash_map_base + ((unsigned long)base << 16); | ||
155 | res->end = res->start + (mask + 1) * 64 * 1024; | ||
156 | } | ||
157 | |||
158 | static int __init xlr_flash_init(void) | ||
159 | { | ||
160 | uint64_t gpio_mmio, flash_mmio, flash_map_base; | ||
161 | u32 gpio_resetcfg, flash_bar; | ||
162 | int cs, boot_nand, boot_nor; | ||
163 | |||
164 | /* Flash address bits 39:24 is in bridge flash BAR */ | ||
165 | flash_bar = nlm_read_reg(nlm_io_base, BRIDGE_FLASH_BAR); | ||
166 | flash_map_base = (flash_bar & 0xffff0000) << 8; | ||
167 | |||
168 | gpio_mmio = nlm_mmio_base(NETLOGIC_IO_GPIO_OFFSET); | ||
169 | flash_mmio = nlm_mmio_base(NETLOGIC_IO_FLASH_OFFSET); | ||
170 | |||
171 | /* Get the chip reset config */ | ||
172 | gpio_resetcfg = nlm_read_reg(gpio_mmio, GPIO_PWRON_RESET_CFG_REG); | ||
173 | |||
174 | /* Check for boot flash type */ | ||
175 | boot_nor = boot_nand = 0; | ||
176 | if (nlm_chip_is_xls()) { | ||
177 | /* On XLS, check boot from NAND bit (GPIO reset reg bit 16) */ | ||
178 | if (gpio_resetcfg & (1 << 16)) | ||
179 | boot_nand = 1; | ||
180 | |||
181 | /* check boot from PCMCIA, (GPIO reset reg bit 15 */ | ||
182 | if ((gpio_resetcfg & (1 << 15)) == 0) | ||
183 | boot_nor = 1; /* not set, booted from NOR */ | ||
184 | } else { /* XLR */ | ||
185 | /* check boot from PCMCIA (bit 16 in GPIO reset on XLR) */ | ||
186 | if ((gpio_resetcfg & (1 << 16)) == 0) | ||
187 | boot_nor = 1; /* not set, booted from NOR */ | ||
188 | } | ||
189 | |||
190 | /* boot flash at chip select 0 */ | ||
191 | cs = 0; | ||
192 | |||
193 | if (boot_nand) { | ||
194 | nand_priv.cs = cs; | ||
195 | nand_priv.flash_mmio = flash_mmio; | ||
196 | setup_flash_resource(flash_mmio, flash_map_base, cs, | ||
197 | xlr_nand_res); | ||
198 | |||
199 | /* Initialize NAND flash at CS 0 */ | ||
200 | nlm_write_reg(flash_mmio, FLASH_CSDEV_PARM(cs), | ||
201 | FLASH_NAND_CSDEV_PARAM); | ||
202 | nlm_write_reg(flash_mmio, FLASH_CSTIME_PARMA(cs), | ||
203 | FLASH_NAND_CSTIME_PARAMA); | ||
204 | nlm_write_reg(flash_mmio, FLASH_CSTIME_PARMB(cs), | ||
205 | FLASH_NAND_CSTIME_PARAMB); | ||
206 | |||
207 | pr_info("ChipSelect %d: NAND Flash %pR\n", cs, xlr_nand_res); | ||
208 | return platform_device_register(&xlr_nand_dev); | ||
209 | } | ||
210 | |||
211 | if (boot_nor) { | ||
212 | setup_flash_resource(flash_mmio, flash_map_base, cs, | ||
213 | xlr_nor_res); | ||
214 | pr_info("ChipSelect %d: NOR Flash %pR\n", cs, xlr_nor_res); | ||
215 | return platform_device_register(&xlr_nor_dev); | ||
216 | } | ||
217 | return 0; | ||
218 | } | ||
219 | |||
220 | arch_initcall(xlr_flash_init); | ||
diff --git a/arch/mips/netlogic/xlr/platform.c b/arch/mips/netlogic/xlr/platform.c index eab64b45dffd..71b44d82621d 100644 --- a/arch/mips/netlogic/xlr/platform.c +++ b/arch/mips/netlogic/xlr/platform.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/resource.h> | 14 | #include <linux/resource.h> |
15 | #include <linux/serial_8250.h> | 15 | #include <linux/serial_8250.h> |
16 | #include <linux/serial_reg.h> | 16 | #include <linux/serial_reg.h> |
17 | #include <linux/i2c.h> | ||
17 | 18 | ||
18 | #include <asm/netlogic/haldefs.h> | 19 | #include <asm/netlogic/haldefs.h> |
19 | #include <asm/netlogic/xlr/iomap.h> | 20 | #include <asm/netlogic/xlr/iomap.h> |
@@ -97,3 +98,142 @@ static int __init nlm_uart_init(void) | |||
97 | } | 98 | } |
98 | 99 | ||
99 | arch_initcall(nlm_uart_init); | 100 | arch_initcall(nlm_uart_init); |
101 | |||
102 | #ifdef CONFIG_USB | ||
103 | /* Platform USB devices, only on XLS chips */ | ||
104 | static u64 xls_usb_dmamask = ~(u32)0; | ||
105 | #define USB_PLATFORM_DEV(n, i, irq) \ | ||
106 | { \ | ||
107 | .name = n, \ | ||
108 | .id = i, \ | ||
109 | .num_resources = 2, \ | ||
110 | .dev = { \ | ||
111 | .dma_mask = &xls_usb_dmamask, \ | ||
112 | .coherent_dma_mask = 0xffffffff, \ | ||
113 | }, \ | ||
114 | .resource = (struct resource[]) { \ | ||
115 | { \ | ||
116 | .flags = IORESOURCE_MEM, \ | ||
117 | }, \ | ||
118 | { \ | ||
119 | .start = irq, \ | ||
120 | .end = irq, \ | ||
121 | .flags = IORESOURCE_IRQ, \ | ||
122 | }, \ | ||
123 | }, \ | ||
124 | } | ||
125 | |||
126 | static struct platform_device xls_usb_ehci_device = | ||
127 | USB_PLATFORM_DEV("ehci-xls", 0, PIC_USB_IRQ); | ||
128 | static struct platform_device xls_usb_ohci_device_0 = | ||
129 | USB_PLATFORM_DEV("ohci-xls-0", 1, PIC_USB_IRQ); | ||
130 | static struct platform_device xls_usb_ohci_device_1 = | ||
131 | USB_PLATFORM_DEV("ohci-xls-1", 2, PIC_USB_IRQ); | ||
132 | |||
133 | static struct platform_device *xls_platform_devices[] = { | ||
134 | &xls_usb_ehci_device, | ||
135 | &xls_usb_ohci_device_0, | ||
136 | &xls_usb_ohci_device_1, | ||
137 | }; | ||
138 | |||
139 | int xls_platform_usb_init(void) | ||
140 | { | ||
141 | uint64_t usb_mmio, gpio_mmio; | ||
142 | unsigned long memres; | ||
143 | uint32_t val; | ||
144 | |||
145 | if (!nlm_chip_is_xls()) | ||
146 | return 0; | ||
147 | |||
148 | gpio_mmio = nlm_mmio_base(NETLOGIC_IO_GPIO_OFFSET); | ||
149 | usb_mmio = nlm_mmio_base(NETLOGIC_IO_USB_1_OFFSET); | ||
150 | |||
151 | /* Clear Rogue Phy INTs */ | ||
152 | nlm_write_reg(usb_mmio, 49, 0x10000000); | ||
153 | /* Enable all interrupts */ | ||
154 | nlm_write_reg(usb_mmio, 50, 0x1f000000); | ||
155 | |||
156 | /* Enable ports */ | ||
157 | nlm_write_reg(usb_mmio, 1, 0x07000500); | ||
158 | |||
159 | val = nlm_read_reg(gpio_mmio, 21); | ||
160 | if (((val >> 22) & 0x01) == 0) { | ||
161 | pr_info("Detected USB Device mode - Not supported!\n"); | ||
162 | nlm_write_reg(usb_mmio, 0, 0x01000000); | ||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | pr_info("Detected USB Host mode - Adding XLS USB devices.\n"); | ||
167 | /* Clear reset, host mode */ | ||
168 | nlm_write_reg(usb_mmio, 0, 0x02000000); | ||
169 | |||
170 | /* Memory resource for various XLS usb ports */ | ||
171 | usb_mmio = nlm_mmio_base(NETLOGIC_IO_USB_0_OFFSET); | ||
172 | memres = CPHYSADDR((unsigned long)usb_mmio); | ||
173 | xls_usb_ehci_device.resource[0].start = memres; | ||
174 | xls_usb_ehci_device.resource[0].end = memres + 0x400 - 1; | ||
175 | |||
176 | memres += 0x400; | ||
177 | xls_usb_ohci_device_0.resource[0].start = memres; | ||
178 | xls_usb_ohci_device_0.resource[0].end = memres + 0x400 - 1; | ||
179 | |||
180 | memres += 0x400; | ||
181 | xls_usb_ohci_device_1.resource[0].start = memres; | ||
182 | xls_usb_ohci_device_1.resource[0].end = memres + 0x400 - 1; | ||
183 | |||
184 | return platform_add_devices(xls_platform_devices, | ||
185 | ARRAY_SIZE(xls_platform_devices)); | ||
186 | } | ||
187 | |||
188 | arch_initcall(xls_platform_usb_init); | ||
189 | #endif | ||
190 | |||
191 | #ifdef CONFIG_I2C | ||
192 | static struct i2c_board_info nlm_i2c_board_info1[] __initdata = { | ||
193 | /* All XLR boards have this RTC and Max6657 Temp Chip */ | ||
194 | [0] = { | ||
195 | .type = "ds1374", | ||
196 | .addr = 0x68 | ||
197 | }, | ||
198 | [1] = { | ||
199 | .type = "lm90", | ||
200 | .addr = 0x4c | ||
201 | }, | ||
202 | }; | ||
203 | |||
204 | static struct resource i2c_resources[] = { | ||
205 | [0] = { | ||
206 | .start = 0, /* filled at init */ | ||
207 | .end = 0, | ||
208 | .flags = IORESOURCE_MEM, | ||
209 | }, | ||
210 | }; | ||
211 | |||
212 | static struct platform_device nlm_xlr_i2c_1 = { | ||
213 | .name = "xlr-i2cbus", | ||
214 | .id = 1, | ||
215 | .num_resources = 1, | ||
216 | .resource = i2c_resources, | ||
217 | }; | ||
218 | |||
219 | static int __init nlm_i2c_init(void) | ||
220 | { | ||
221 | int err = 0; | ||
222 | unsigned int offset; | ||
223 | |||
224 | /* I2C bus 0 does not have any useful devices, configure only bus 1 */ | ||
225 | offset = NETLOGIC_IO_I2C_1_OFFSET; | ||
226 | nlm_xlr_i2c_1.resource[0].start = CPHYSADDR(nlm_mmio_base(offset)); | ||
227 | nlm_xlr_i2c_1.resource[0].end = nlm_xlr_i2c_1.resource[0].start + 0xfff; | ||
228 | |||
229 | platform_device_register(&nlm_xlr_i2c_1); | ||
230 | |||
231 | err = i2c_register_board_info(1, nlm_i2c_board_info1, | ||
232 | ARRAY_SIZE(nlm_i2c_board_info1)); | ||
233 | if (err < 0) | ||
234 | pr_err("nlm-i2c: cannot register board I2C devices\n"); | ||
235 | return err; | ||
236 | } | ||
237 | |||
238 | arch_initcall(nlm_i2c_init); | ||
239 | #endif | ||
diff --git a/arch/mips/netlogic/xlr/setup.c b/arch/mips/netlogic/xlr/setup.c index c9d066dedc4e..81b1d311834f 100644 --- a/arch/mips/netlogic/xlr/setup.c +++ b/arch/mips/netlogic/xlr/setup.c | |||
@@ -85,7 +85,7 @@ static void nlm_linux_exit(void) | |||
85 | 85 | ||
86 | gpiobase = nlm_mmio_base(NETLOGIC_IO_GPIO_OFFSET); | 86 | gpiobase = nlm_mmio_base(NETLOGIC_IO_GPIO_OFFSET); |
87 | /* trigger a chip reset by writing 1 to GPIO_SWRESET_REG */ | 87 | /* trigger a chip reset by writing 1 to GPIO_SWRESET_REG */ |
88 | nlm_write_reg(gpiobase, NETLOGIC_GPIO_SWRESET_REG, 1); | 88 | nlm_write_reg(gpiobase, GPIO_SWRESET_REG, 1); |
89 | for ( ; ; ) | 89 | for ( ; ; ) |
90 | cpu_wait(); | 90 | cpu_wait(); |
91 | } | 91 | } |
diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c index b6e378211a2c..f80480a5a032 100644 --- a/arch/mips/oprofile/common.c +++ b/arch/mips/oprofile/common.c | |||
@@ -85,6 +85,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) | |||
85 | case CPU_34K: | 85 | case CPU_34K: |
86 | case CPU_1004K: | 86 | case CPU_1004K: |
87 | case CPU_74K: | 87 | case CPU_74K: |
88 | case CPU_LOONGSON1: | ||
88 | case CPU_SB1: | 89 | case CPU_SB1: |
89 | case CPU_SB1A: | 90 | case CPU_SB1A: |
90 | case CPU_R10000: | 91 | case CPU_R10000: |
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c index 4d80a856048d..28ea1a4cc576 100644 --- a/arch/mips/oprofile/op_model_mipsxx.c +++ b/arch/mips/oprofile/op_model_mipsxx.c | |||
@@ -339,12 +339,6 @@ static int __init mipsxx_init(void) | |||
339 | break; | 339 | break; |
340 | 340 | ||
341 | case CPU_1004K: | 341 | case CPU_1004K: |
342 | #if 0 | ||
343 | /* FIXME: report as 34K for now */ | ||
344 | op_model_mipsxx_ops.cpu_type = "mips/1004K"; | ||
345 | break; | ||
346 | #endif | ||
347 | |||
348 | case CPU_34K: | 342 | case CPU_34K: |
349 | op_model_mipsxx_ops.cpu_type = "mips/34K"; | 343 | op_model_mipsxx_ops.cpu_type = "mips/34K"; |
350 | break; | 344 | break; |
@@ -374,6 +368,10 @@ static int __init mipsxx_init(void) | |||
374 | op_model_mipsxx_ops.cpu_type = "mips/sb1"; | 368 | op_model_mipsxx_ops.cpu_type = "mips/sb1"; |
375 | break; | 369 | break; |
376 | 370 | ||
371 | case CPU_LOONGSON1: | ||
372 | op_model_mipsxx_ops.cpu_type = "mips/loongson1"; | ||
373 | break; | ||
374 | |||
377 | default: | 375 | default: |
378 | printk(KERN_ERR "Profiling unsupported for this CPU\n"); | 376 | printk(KERN_ERR "Profiling unsupported for this CPU\n"); |
379 | 377 | ||
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile index c703f43a9914..e13a71cbc3c7 100644 --- a/arch/mips/pci/Makefile +++ b/arch/mips/pci/Makefile | |||
@@ -59,6 +59,7 @@ obj-$(CONFIG_WR_PPMC) += fixup-wrppmc.o | |||
59 | obj-$(CONFIG_MIKROTIK_RB532) += pci-rc32434.o ops-rc32434.o fixup-rc32434.o | 59 | obj-$(CONFIG_MIKROTIK_RB532) += pci-rc32434.o ops-rc32434.o fixup-rc32434.o |
60 | obj-$(CONFIG_CPU_CAVIUM_OCTEON) += pci-octeon.o pcie-octeon.o | 60 | obj-$(CONFIG_CPU_CAVIUM_OCTEON) += pci-octeon.o pcie-octeon.o |
61 | obj-$(CONFIG_CPU_XLR) += pci-xlr.o | 61 | obj-$(CONFIG_CPU_XLR) += pci-xlr.o |
62 | obj-$(CONFIG_CPU_XLP) += pci-xlp.o | ||
62 | 63 | ||
63 | ifdef CONFIG_PCI_MSI | 64 | ifdef CONFIG_PCI_MSI |
64 | obj-$(CONFIG_CPU_CAVIUM_OCTEON) += msi-octeon.o | 65 | obj-$(CONFIG_CPU_CAVIUM_OCTEON) += msi-octeon.o |
diff --git a/arch/mips/pci/fixup-cobalt.c b/arch/mips/pci/fixup-cobalt.c index 9553b14002dd..3e7ce65d776c 100644 --- a/arch/mips/pci/fixup-cobalt.c +++ b/arch/mips/pci/fixup-cobalt.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #define VIA_COBALT_BRD_ID_REG 0x94 | 37 | #define VIA_COBALT_BRD_ID_REG 0x94 |
38 | #define VIA_COBALT_BRD_REG_to_ID(reg) ((unsigned char)(reg) >> 4) | 38 | #define VIA_COBALT_BRD_REG_to_ID(reg) ((unsigned char)(reg) >> 4) |
39 | 39 | ||
40 | static void qube_raq_galileo_early_fixup(struct pci_dev *dev) | 40 | static void __devinit qube_raq_galileo_early_fixup(struct pci_dev *dev) |
41 | { | 41 | { |
42 | if (dev->devfn == PCI_DEVFN(0, 0) && | 42 | if (dev->devfn == PCI_DEVFN(0, 0) && |
43 | (dev->class >> 8) == PCI_CLASS_MEMORY_OTHER) { | 43 | (dev->class >> 8) == PCI_CLASS_MEMORY_OTHER) { |
@@ -51,7 +51,7 @@ static void qube_raq_galileo_early_fixup(struct pci_dev *dev) | |||
51 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_GT64111, | 51 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_GT64111, |
52 | qube_raq_galileo_early_fixup); | 52 | qube_raq_galileo_early_fixup); |
53 | 53 | ||
54 | static void qube_raq_via_bmIDE_fixup(struct pci_dev *dev) | 54 | static void __devinit qube_raq_via_bmIDE_fixup(struct pci_dev *dev) |
55 | { | 55 | { |
56 | unsigned short cfgword; | 56 | unsigned short cfgword; |
57 | unsigned char lt; | 57 | unsigned char lt; |
@@ -74,7 +74,7 @@ static void qube_raq_via_bmIDE_fixup(struct pci_dev *dev) | |||
74 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, | 74 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, |
75 | qube_raq_via_bmIDE_fixup); | 75 | qube_raq_via_bmIDE_fixup); |
76 | 76 | ||
77 | static void qube_raq_galileo_fixup(struct pci_dev *dev) | 77 | static void __devinit qube_raq_galileo_fixup(struct pci_dev *dev) |
78 | { | 78 | { |
79 | if (dev->devfn != PCI_DEVFN(0, 0)) | 79 | if (dev->devfn != PCI_DEVFN(0, 0)) |
80 | return; | 80 | return; |
@@ -129,7 +129,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_GT64111, | |||
129 | 129 | ||
130 | int cobalt_board_id; | 130 | int cobalt_board_id; |
131 | 131 | ||
132 | static void qube_raq_via_board_id_fixup(struct pci_dev *dev) | 132 | static void __devinit qube_raq_via_board_id_fixup(struct pci_dev *dev) |
133 | { | 133 | { |
134 | u8 id; | 134 | u8 id; |
135 | int retval; | 135 | int retval; |
diff --git a/arch/mips/pci/fixup-malta.c b/arch/mips/pci/fixup-malta.c index 70073c98ed32..819622f93e9c 100644 --- a/arch/mips/pci/fixup-malta.c +++ b/arch/mips/pci/fixup-malta.c | |||
@@ -101,3 +101,17 @@ static void __devinit malta_piix_func1_fixup(struct pci_dev *pdev) | |||
101 | 101 | ||
102 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB, | 102 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB, |
103 | malta_piix_func1_fixup); | 103 | malta_piix_func1_fixup); |
104 | |||
105 | /* Enable PCI 2.1 compatibility in PIIX4 */ | ||
106 | static void __devinit quirk_dlcsetup(struct pci_dev *dev) | ||
107 | { | ||
108 | u8 odlc, ndlc; | ||
109 | |||
110 | (void) pci_read_config_byte(dev, 0x82, &odlc); | ||
111 | /* Enable passive releases and delayed transaction */ | ||
112 | ndlc = odlc | 7; | ||
113 | (void) pci_write_config_byte(dev, 0x82, ndlc); | ||
114 | } | ||
115 | |||
116 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0, | ||
117 | quirk_dlcsetup); | ||
diff --git a/arch/mips/pci/fixup-rc32434.c b/arch/mips/pci/fixup-rc32434.c index 3d86823d03a0..76bb1be99d43 100644 --- a/arch/mips/pci/fixup-rc32434.c +++ b/arch/mips/pci/fixup-rc32434.c | |||
@@ -47,7 +47,7 @@ int __devinit pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
47 | return irq + GROUP4_IRQ_BASE + 4; | 47 | return irq + GROUP4_IRQ_BASE + 4; |
48 | } | 48 | } |
49 | 49 | ||
50 | static void rc32434_pci_early_fixup(struct pci_dev *dev) | 50 | static void __devinit rc32434_pci_early_fixup(struct pci_dev *dev) |
51 | { | 51 | { |
52 | if (PCI_SLOT(dev->devfn) == 6 && dev->bus->number == 0) { | 52 | if (PCI_SLOT(dev->devfn) == 6 && dev->bus->number == 0) { |
53 | /* disable prefetched memory range */ | 53 | /* disable prefetched memory range */ |
diff --git a/arch/mips/pci/ops-bcm63xx.c b/arch/mips/pci/ops-bcm63xx.c index 822ae179bc56..65c7bd100486 100644 --- a/arch/mips/pci/ops-bcm63xx.c +++ b/arch/mips/pci/ops-bcm63xx.c | |||
@@ -411,7 +411,7 @@ struct pci_ops bcm63xx_cb_ops = { | |||
411 | * only one IO window, so it cannot be shared by PCI and cardbus, use | 411 | * only one IO window, so it cannot be shared by PCI and cardbus, use |
412 | * fixup to choose and detect unhandled configuration | 412 | * fixup to choose and detect unhandled configuration |
413 | */ | 413 | */ |
414 | static void bcm63xx_fixup(struct pci_dev *dev) | 414 | static void __devinit bcm63xx_fixup(struct pci_dev *dev) |
415 | { | 415 | { |
416 | static int io_window = -1; | 416 | static int io_window = -1; |
417 | int i, found, new_io_window; | 417 | int i, found, new_io_window; |
@@ -465,3 +465,64 @@ static void bcm63xx_fixup(struct pci_dev *dev) | |||
465 | 465 | ||
466 | DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, bcm63xx_fixup); | 466 | DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, bcm63xx_fixup); |
467 | #endif | 467 | #endif |
468 | |||
469 | static int bcm63xx_pcie_can_access(struct pci_bus *bus, int devfn) | ||
470 | { | ||
471 | switch (bus->number) { | ||
472 | case PCIE_BUS_BRIDGE: | ||
473 | return (PCI_SLOT(devfn) == 0); | ||
474 | case PCIE_BUS_DEVICE: | ||
475 | if (PCI_SLOT(devfn) == 0) | ||
476 | return bcm_pcie_readl(PCIE_DLSTATUS_REG) | ||
477 | & DLSTATUS_PHYLINKUP; | ||
478 | default: | ||
479 | return false; | ||
480 | } | ||
481 | } | ||
482 | |||
483 | static int bcm63xx_pcie_read(struct pci_bus *bus, unsigned int devfn, | ||
484 | int where, int size, u32 *val) | ||
485 | { | ||
486 | u32 data; | ||
487 | u32 reg = where & ~3; | ||
488 | |||
489 | if (!bcm63xx_pcie_can_access(bus, devfn)) | ||
490 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
491 | |||
492 | if (bus->number == PCIE_BUS_DEVICE) | ||
493 | reg += PCIE_DEVICE_OFFSET; | ||
494 | |||
495 | data = bcm_pcie_readl(reg); | ||
496 | |||
497 | *val = postprocess_read(data, where, size); | ||
498 | |||
499 | return PCIBIOS_SUCCESSFUL; | ||
500 | |||
501 | } | ||
502 | |||
503 | static int bcm63xx_pcie_write(struct pci_bus *bus, unsigned int devfn, | ||
504 | int where, int size, u32 val) | ||
505 | { | ||
506 | u32 data; | ||
507 | u32 reg = where & ~3; | ||
508 | |||
509 | if (!bcm63xx_pcie_can_access(bus, devfn)) | ||
510 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
511 | |||
512 | if (bus->number == PCIE_BUS_DEVICE) | ||
513 | reg += PCIE_DEVICE_OFFSET; | ||
514 | |||
515 | |||
516 | data = bcm_pcie_readl(reg); | ||
517 | |||
518 | data = preprocess_write(data, val, where, size); | ||
519 | bcm_pcie_writel(data, reg); | ||
520 | |||
521 | return PCIBIOS_SUCCESSFUL; | ||
522 | } | ||
523 | |||
524 | |||
525 | struct pci_ops bcm63xx_pcie_ops = { | ||
526 | .read = bcm63xx_pcie_read, | ||
527 | .write = bcm63xx_pcie_write | ||
528 | }; | ||
diff --git a/arch/mips/pci/pci-bcm63xx.c b/arch/mips/pci/pci-bcm63xx.c index 39eb7c417e2f..8a48139d219c 100644 --- a/arch/mips/pci/pci-bcm63xx.c +++ b/arch/mips/pci/pci-bcm63xx.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/pci.h> | 10 | #include <linux/pci.h> |
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/delay.h> | ||
13 | #include <asm/bootinfo.h> | 14 | #include <asm/bootinfo.h> |
14 | 15 | ||
15 | #include "pci-bcm63xx.h" | 16 | #include "pci-bcm63xx.h" |
@@ -71,6 +72,26 @@ struct pci_controller bcm63xx_cb_controller = { | |||
71 | }; | 72 | }; |
72 | #endif | 73 | #endif |
73 | 74 | ||
75 | static struct resource bcm_pcie_mem_resource = { | ||
76 | .name = "bcm63xx PCIe memory space", | ||
77 | .start = BCM_PCIE_MEM_BASE_PA, | ||
78 | .end = BCM_PCIE_MEM_END_PA, | ||
79 | .flags = IORESOURCE_MEM, | ||
80 | }; | ||
81 | |||
82 | static struct resource bcm_pcie_io_resource = { | ||
83 | .name = "bcm63xx PCIe IO space", | ||
84 | .start = 0, | ||
85 | .end = 0, | ||
86 | .flags = 0, | ||
87 | }; | ||
88 | |||
89 | struct pci_controller bcm63xx_pcie_controller = { | ||
90 | .pci_ops = &bcm63xx_pcie_ops, | ||
91 | .io_resource = &bcm_pcie_io_resource, | ||
92 | .mem_resource = &bcm_pcie_mem_resource, | ||
93 | }; | ||
94 | |||
74 | static u32 bcm63xx_int_cfg_readl(u32 reg) | 95 | static u32 bcm63xx_int_cfg_readl(u32 reg) |
75 | { | 96 | { |
76 | u32 tmp; | 97 | u32 tmp; |
@@ -94,17 +115,99 @@ static void bcm63xx_int_cfg_writel(u32 val, u32 reg) | |||
94 | 115 | ||
95 | void __iomem *pci_iospace_start; | 116 | void __iomem *pci_iospace_start; |
96 | 117 | ||
97 | static int __init bcm63xx_pci_init(void) | 118 | static void __init bcm63xx_reset_pcie(void) |
98 | { | 119 | { |
99 | unsigned int mem_size; | ||
100 | u32 val; | 120 | u32 val; |
101 | 121 | ||
102 | if (!BCMCPU_IS_6348() && !BCMCPU_IS_6358() && !BCMCPU_IS_6368()) | 122 | /* enable clock */ |
103 | return -ENODEV; | 123 | val = bcm_perf_readl(PERF_CKCTL_REG); |
124 | val |= CKCTL_6328_PCIE_EN; | ||
125 | bcm_perf_writel(val, PERF_CKCTL_REG); | ||
126 | |||
127 | /* enable SERDES */ | ||
128 | val = bcm_misc_readl(MISC_SERDES_CTRL_REG); | ||
129 | val |= SERDES_PCIE_EN | SERDES_PCIE_EXD_EN; | ||
130 | bcm_misc_writel(val, MISC_SERDES_CTRL_REG); | ||
131 | |||
132 | /* reset the PCIe core */ | ||
133 | val = bcm_perf_readl(PERF_SOFTRESET_6328_REG); | ||
134 | |||
135 | val &= ~SOFTRESET_6328_PCIE_MASK; | ||
136 | val &= ~SOFTRESET_6328_PCIE_CORE_MASK; | ||
137 | val &= ~SOFTRESET_6328_PCIE_HARD_MASK; | ||
138 | val &= ~SOFTRESET_6328_PCIE_EXT_MASK; | ||
139 | bcm_perf_writel(val, PERF_SOFTRESET_6328_REG); | ||
140 | mdelay(10); | ||
141 | |||
142 | val |= SOFTRESET_6328_PCIE_MASK; | ||
143 | val |= SOFTRESET_6328_PCIE_CORE_MASK; | ||
144 | val |= SOFTRESET_6328_PCIE_HARD_MASK; | ||
145 | bcm_perf_writel(val, PERF_SOFTRESET_6328_REG); | ||
146 | mdelay(10); | ||
147 | |||
148 | val |= SOFTRESET_6328_PCIE_EXT_MASK; | ||
149 | bcm_perf_writel(val, PERF_SOFTRESET_6328_REG); | ||
150 | mdelay(200); | ||
151 | } | ||
104 | 152 | ||
105 | if (!bcm63xx_pci_enabled) | 153 | static int __init bcm63xx_register_pcie(void) |
106 | return -ENODEV; | 154 | { |
155 | u32 val; | ||
107 | 156 | ||
157 | bcm63xx_reset_pcie(); | ||
158 | |||
159 | /* configure the PCIe bridge */ | ||
160 | val = bcm_pcie_readl(PCIE_BRIDGE_OPT1_REG); | ||
161 | val |= OPT1_RD_BE_OPT_EN; | ||
162 | val |= OPT1_RD_REPLY_BE_FIX_EN; | ||
163 | val |= OPT1_PCIE_BRIDGE_HOLE_DET_EN; | ||
164 | val |= OPT1_L1_INT_STATUS_MASK_POL; | ||
165 | bcm_pcie_writel(val, PCIE_BRIDGE_OPT1_REG); | ||
166 | |||
167 | /* setup the interrupts */ | ||
168 | val = bcm_pcie_readl(PCIE_BRIDGE_RC_INT_MASK_REG); | ||
169 | val |= PCIE_RC_INT_A | PCIE_RC_INT_B | PCIE_RC_INT_C | PCIE_RC_INT_D; | ||
170 | bcm_pcie_writel(val, PCIE_BRIDGE_RC_INT_MASK_REG); | ||
171 | |||
172 | val = bcm_pcie_readl(PCIE_BRIDGE_OPT2_REG); | ||
173 | /* enable credit checking and error checking */ | ||
174 | val |= OPT2_TX_CREDIT_CHK_EN; | ||
175 | val |= OPT2_UBUS_UR_DECODE_DIS; | ||
176 | |||
177 | /* set device bus/func for the pcie device */ | ||
178 | val |= (PCIE_BUS_DEVICE << OPT2_CFG_TYPE1_BUS_NO_SHIFT); | ||
179 | val |= OPT2_CFG_TYPE1_BD_SEL; | ||
180 | bcm_pcie_writel(val, PCIE_BRIDGE_OPT2_REG); | ||
181 | |||
182 | /* setup class code as bridge */ | ||
183 | val = bcm_pcie_readl(PCIE_IDVAL3_REG); | ||
184 | val &= ~IDVAL3_CLASS_CODE_MASK; | ||
185 | val |= (PCI_CLASS_BRIDGE_PCI << IDVAL3_SUBCLASS_SHIFT); | ||
186 | bcm_pcie_writel(val, PCIE_IDVAL3_REG); | ||
187 | |||
188 | /* disable bar1 size */ | ||
189 | val = bcm_pcie_readl(PCIE_CONFIG2_REG); | ||
190 | val &= ~CONFIG2_BAR1_SIZE_MASK; | ||
191 | bcm_pcie_writel(val, PCIE_CONFIG2_REG); | ||
192 | |||
193 | /* set bar0 to little endian */ | ||
194 | val = (BCM_PCIE_MEM_BASE_PA >> 20) << BASEMASK_BASE_SHIFT; | ||
195 | val |= (BCM_PCIE_MEM_BASE_PA >> 20) << BASEMASK_MASK_SHIFT; | ||
196 | val |= BASEMASK_REMAP_EN; | ||
197 | bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_BASEMASK_REG); | ||
198 | |||
199 | val = (BCM_PCIE_MEM_BASE_PA >> 20) << REBASE_ADDR_BASE_SHIFT; | ||
200 | bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_REBASE_ADDR_REG); | ||
201 | |||
202 | register_pci_controller(&bcm63xx_pcie_controller); | ||
203 | |||
204 | return 0; | ||
205 | } | ||
206 | |||
207 | static int __init bcm63xx_register_pci(void) | ||
208 | { | ||
209 | unsigned int mem_size; | ||
210 | u32 val; | ||
108 | /* | 211 | /* |
109 | * configuration access are done through IO space, remap 4 | 212 | * configuration access are done through IO space, remap 4 |
110 | * first bytes to access it from CPU. | 213 | * first bytes to access it from CPU. |
@@ -221,4 +324,22 @@ static int __init bcm63xx_pci_init(void) | |||
221 | return 0; | 324 | return 0; |
222 | } | 325 | } |
223 | 326 | ||
327 | |||
328 | static int __init bcm63xx_pci_init(void) | ||
329 | { | ||
330 | if (!bcm63xx_pci_enabled) | ||
331 | return -ENODEV; | ||
332 | |||
333 | switch (bcm63xx_get_cpu_id()) { | ||
334 | case BCM6328_CPU_ID: | ||
335 | return bcm63xx_register_pcie(); | ||
336 | case BCM6348_CPU_ID: | ||
337 | case BCM6358_CPU_ID: | ||
338 | case BCM6368_CPU_ID: | ||
339 | return bcm63xx_register_pci(); | ||
340 | default: | ||
341 | return -ENODEV; | ||
342 | } | ||
343 | } | ||
344 | |||
224 | arch_initcall(bcm63xx_pci_init); | 345 | arch_initcall(bcm63xx_pci_init); |
diff --git a/arch/mips/pci/pci-bcm63xx.h b/arch/mips/pci/pci-bcm63xx.h index a6e594ef3d6a..e6736d558ac7 100644 --- a/arch/mips/pci/pci-bcm63xx.h +++ b/arch/mips/pci/pci-bcm63xx.h | |||
@@ -13,11 +13,16 @@ | |||
13 | */ | 13 | */ |
14 | #define CARDBUS_PCI_IDSEL 0x8 | 14 | #define CARDBUS_PCI_IDSEL 0x8 |
15 | 15 | ||
16 | |||
17 | #define PCIE_BUS_BRIDGE 0 | ||
18 | #define PCIE_BUS_DEVICE 1 | ||
19 | |||
16 | /* | 20 | /* |
17 | * defined in ops-bcm63xx.c | 21 | * defined in ops-bcm63xx.c |
18 | */ | 22 | */ |
19 | extern struct pci_ops bcm63xx_pci_ops; | 23 | extern struct pci_ops bcm63xx_pci_ops; |
20 | extern struct pci_ops bcm63xx_cb_ops; | 24 | extern struct pci_ops bcm63xx_cb_ops; |
25 | extern struct pci_ops bcm63xx_pcie_ops; | ||
21 | 26 | ||
22 | /* | 27 | /* |
23 | * defined in pci-bcm63xx.c | 28 | * defined in pci-bcm63xx.c |
diff --git a/arch/mips/pci/pci-xlp.c b/arch/mips/pci/pci-xlp.c new file mode 100644 index 000000000000..140557a20488 --- /dev/null +++ b/arch/mips/pci/pci-xlp.c | |||
@@ -0,0 +1,248 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2003-2012 Broadcom Corporation | ||
3 | * All Rights Reserved | ||
4 | * | ||
5 | * This software is available to you under a choice of one of two | ||
6 | * licenses. You may choose to be licensed under the terms of the GNU | ||
7 | * General Public License (GPL) Version 2, available from the file | ||
8 | * COPYING in the main directory of this source tree, or the Broadcom | ||
9 | * license below: | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions and the following disclaimer. | ||
17 | * 2. Redistributions in binary form must reproduce the above copyright | ||
18 | * notice, this list of conditions and the following disclaimer in | ||
19 | * the documentation and/or other materials provided with the | ||
20 | * distribution. | ||
21 | * | ||
22 | * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR | ||
23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
24 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
25 | * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE | ||
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
29 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
30 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
31 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||
32 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | */ | ||
34 | |||
35 | #include <linux/types.h> | ||
36 | #include <linux/pci.h> | ||
37 | #include <linux/kernel.h> | ||
38 | #include <linux/init.h> | ||
39 | #include <linux/msi.h> | ||
40 | #include <linux/mm.h> | ||
41 | #include <linux/irq.h> | ||
42 | #include <linux/irqdesc.h> | ||
43 | #include <linux/console.h> | ||
44 | |||
45 | #include <asm/io.h> | ||
46 | |||
47 | #include <asm/netlogic/interrupt.h> | ||
48 | #include <asm/netlogic/haldefs.h> | ||
49 | |||
50 | #include <asm/netlogic/xlp-hal/iomap.h> | ||
51 | #include <asm/netlogic/xlp-hal/pic.h> | ||
52 | #include <asm/netlogic/xlp-hal/xlp.h> | ||
53 | #include <asm/netlogic/xlp-hal/pcibus.h> | ||
54 | #include <asm/netlogic/xlp-hal/bridge.h> | ||
55 | |||
56 | static void *pci_config_base; | ||
57 | |||
58 | #define pci_cfg_addr(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off)) | ||
59 | |||
60 | /* PCI ops */ | ||
61 | static inline u32 pci_cfg_read_32bit(struct pci_bus *bus, unsigned int devfn, | ||
62 | int where) | ||
63 | { | ||
64 | u32 data; | ||
65 | u32 *cfgaddr; | ||
66 | |||
67 | cfgaddr = (u32 *)(pci_config_base + | ||
68 | pci_cfg_addr(bus->number, devfn, where & ~3)); | ||
69 | data = *cfgaddr; | ||
70 | return data; | ||
71 | } | ||
72 | |||
73 | static inline void pci_cfg_write_32bit(struct pci_bus *bus, unsigned int devfn, | ||
74 | int where, u32 data) | ||
75 | { | ||
76 | u32 *cfgaddr; | ||
77 | |||
78 | cfgaddr = (u32 *)(pci_config_base + | ||
79 | pci_cfg_addr(bus->number, devfn, where & ~3)); | ||
80 | *cfgaddr = data; | ||
81 | } | ||
82 | |||
83 | static int nlm_pcibios_read(struct pci_bus *bus, unsigned int devfn, | ||
84 | int where, int size, u32 *val) | ||
85 | { | ||
86 | u32 data; | ||
87 | |||
88 | if ((size == 2) && (where & 1)) | ||
89 | return PCIBIOS_BAD_REGISTER_NUMBER; | ||
90 | else if ((size == 4) && (where & 3)) | ||
91 | return PCIBIOS_BAD_REGISTER_NUMBER; | ||
92 | |||
93 | data = pci_cfg_read_32bit(bus, devfn, where); | ||
94 | |||
95 | if (size == 1) | ||
96 | *val = (data >> ((where & 3) << 3)) & 0xff; | ||
97 | else if (size == 2) | ||
98 | *val = (data >> ((where & 3) << 3)) & 0xffff; | ||
99 | else | ||
100 | *val = data; | ||
101 | |||
102 | return PCIBIOS_SUCCESSFUL; | ||
103 | } | ||
104 | |||
105 | |||
106 | static int nlm_pcibios_write(struct pci_bus *bus, unsigned int devfn, | ||
107 | int where, int size, u32 val) | ||
108 | { | ||
109 | u32 data; | ||
110 | |||
111 | if ((size == 2) && (where & 1)) | ||
112 | return PCIBIOS_BAD_REGISTER_NUMBER; | ||
113 | else if ((size == 4) && (where & 3)) | ||
114 | return PCIBIOS_BAD_REGISTER_NUMBER; | ||
115 | |||
116 | data = pci_cfg_read_32bit(bus, devfn, where); | ||
117 | |||
118 | if (size == 1) | ||
119 | data = (data & ~(0xff << ((where & 3) << 3))) | | ||
120 | (val << ((where & 3) << 3)); | ||
121 | else if (size == 2) | ||
122 | data = (data & ~(0xffff << ((where & 3) << 3))) | | ||
123 | (val << ((where & 3) << 3)); | ||
124 | else | ||
125 | data = val; | ||
126 | |||
127 | pci_cfg_write_32bit(bus, devfn, where, data); | ||
128 | |||
129 | return PCIBIOS_SUCCESSFUL; | ||
130 | } | ||
131 | |||
132 | struct pci_ops nlm_pci_ops = { | ||
133 | .read = nlm_pcibios_read, | ||
134 | .write = nlm_pcibios_write | ||
135 | }; | ||
136 | |||
137 | static struct resource nlm_pci_mem_resource = { | ||
138 | .name = "XLP PCI MEM", | ||
139 | .start = 0xd0000000UL, /* 256MB PCI mem @ 0xd000_0000 */ | ||
140 | .end = 0xdfffffffUL, | ||
141 | .flags = IORESOURCE_MEM, | ||
142 | }; | ||
143 | |||
144 | static struct resource nlm_pci_io_resource = { | ||
145 | .name = "XLP IO MEM", | ||
146 | .start = 0x14000000UL, /* 64MB PCI IO @ 0x1000_0000 */ | ||
147 | .end = 0x17ffffffUL, | ||
148 | .flags = IORESOURCE_IO, | ||
149 | }; | ||
150 | |||
151 | struct pci_controller nlm_pci_controller = { | ||
152 | .index = 0, | ||
153 | .pci_ops = &nlm_pci_ops, | ||
154 | .mem_resource = &nlm_pci_mem_resource, | ||
155 | .mem_offset = 0x00000000UL, | ||
156 | .io_resource = &nlm_pci_io_resource, | ||
157 | .io_offset = 0x00000000UL, | ||
158 | }; | ||
159 | |||
160 | static int get_irq_vector(const struct pci_dev *dev) | ||
161 | { | ||
162 | /* | ||
163 | * For XLP PCIe, there is an IRQ per Link, find out which | ||
164 | * link the device is on to assign interrupts | ||
165 | */ | ||
166 | if (dev->bus->self == NULL) | ||
167 | return 0; | ||
168 | |||
169 | switch (dev->bus->self->devfn) { | ||
170 | case 0x8: | ||
171 | return PIC_PCIE_LINK_0_IRQ; | ||
172 | case 0x9: | ||
173 | return PIC_PCIE_LINK_1_IRQ; | ||
174 | case 0xa: | ||
175 | return PIC_PCIE_LINK_2_IRQ; | ||
176 | case 0xb: | ||
177 | return PIC_PCIE_LINK_3_IRQ; | ||
178 | } | ||
179 | WARN(1, "Unexpected devfn %d\n", dev->bus->self->devfn); | ||
180 | return 0; | ||
181 | } | ||
182 | |||
183 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
184 | { | ||
185 | return get_irq_vector(dev); | ||
186 | } | ||
187 | |||
188 | /* Do platform specific device initialization at pci_enable_device() time */ | ||
189 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
190 | { | ||
191 | return 0; | ||
192 | } | ||
193 | |||
194 | static int xlp_enable_pci_bswap(void) | ||
195 | { | ||
196 | uint64_t pciebase, sysbase; | ||
197 | int node, i; | ||
198 | u32 reg; | ||
199 | |||
200 | /* Chip-0 so node set to 0 */ | ||
201 | node = 0; | ||
202 | sysbase = nlm_get_bridge_regbase(node); | ||
203 | /* | ||
204 | * Enable byte swap in hardware. Program each link's PCIe SWAP regions | ||
205 | * from the link's address ranges. | ||
206 | */ | ||
207 | for (i = 0; i < 4; i++) { | ||
208 | pciebase = nlm_pcicfg_base(XLP_IO_PCIE_OFFSET(node, i)); | ||
209 | if (nlm_read_pci_reg(pciebase, 0) == 0xffffffff) | ||
210 | continue; | ||
211 | |||
212 | reg = nlm_read_bridge_reg(sysbase, BRIDGE_PCIEMEM_BASE0 + i); | ||
213 | nlm_write_pci_reg(pciebase, PCIE_BYTE_SWAP_MEM_BASE, reg); | ||
214 | |||
215 | reg = nlm_read_bridge_reg(sysbase, BRIDGE_PCIEMEM_LIMIT0 + i); | ||
216 | nlm_write_pci_reg(pciebase, PCIE_BYTE_SWAP_MEM_LIM, | ||
217 | reg | 0xfff); | ||
218 | |||
219 | reg = nlm_read_bridge_reg(sysbase, BRIDGE_PCIEIO_BASE0 + i); | ||
220 | nlm_write_pci_reg(pciebase, PCIE_BYTE_SWAP_IO_BASE, reg); | ||
221 | |||
222 | reg = nlm_read_bridge_reg(sysbase, BRIDGE_PCIEIO_LIMIT0 + i); | ||
223 | nlm_write_pci_reg(pciebase, PCIE_BYTE_SWAP_IO_LIM, reg | 0xfff); | ||
224 | } | ||
225 | return 0; | ||
226 | } | ||
227 | |||
228 | static int __init pcibios_init(void) | ||
229 | { | ||
230 | /* Firmware assigns PCI resources */ | ||
231 | pci_set_flags(PCI_PROBE_ONLY); | ||
232 | pci_config_base = ioremap(XLP_DEFAULT_PCI_ECFG_BASE, 64 << 20); | ||
233 | |||
234 | /* Extend IO port for memory mapped io */ | ||
235 | ioport_resource.start = 0; | ||
236 | ioport_resource.end = ~0; | ||
237 | |||
238 | xlp_enable_pci_bswap(); | ||
239 | set_io_port_base(CKSEG1); | ||
240 | nlm_pci_controller.io_map_base = CKSEG1; | ||
241 | |||
242 | register_pci_controller(&nlm_pci_controller); | ||
243 | pr_info("XLP PCIe Controller %pR%pR.\n", &nlm_pci_io_resource, | ||
244 | &nlm_pci_mem_resource); | ||
245 | |||
246 | return 0; | ||
247 | } | ||
248 | arch_initcall(pcibios_init); | ||
diff --git a/arch/mips/pci/pci-xlr.c b/arch/mips/pci/pci-xlr.c index 172af1cd5867..18af021d289a 100644 --- a/arch/mips/pci/pci-xlr.c +++ b/arch/mips/pci/pci-xlr.c | |||
@@ -375,7 +375,3 @@ static int __init pcibios_init(void) | |||
375 | } | 375 | } |
376 | 376 | ||
377 | arch_initcall(pcibios_init); | 377 | arch_initcall(pcibios_init); |
378 | |||
379 | struct pci_fixup pcibios_fixups[] = { | ||
380 | {0} | ||
381 | }; | ||
diff --git a/arch/mips/pnx833x/stb22x/board.c b/arch/mips/pnx833x/stb22x/board.c index 644eb7c3210f..4b328ac43050 100644 --- a/arch/mips/pnx833x/stb22x/board.c +++ b/arch/mips/pnx833x/stb22x/board.c | |||
@@ -91,7 +91,7 @@ void __init pnx833x_board_setup(void) | |||
91 | pnx833x_gpio_select_function_alt(32); | 91 | pnx833x_gpio_select_function_alt(32); |
92 | pnx833x_gpio_select_function_alt(33); | 92 | pnx833x_gpio_select_function_alt(33); |
93 | 93 | ||
94 | #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE) | 94 | #if IS_ENABLED(CONFIG_MTD_NAND_PLATFORM) |
95 | /* Setup MIU for NAND access on CS0... | 95 | /* Setup MIU for NAND access on CS0... |
96 | * | 96 | * |
97 | * (it seems that we must also configure CS1 for reliable operation, | 97 | * (it seems that we must also configure CS1 for reliable operation, |
@@ -117,7 +117,7 @@ void __init pnx833x_board_setup(void) | |||
117 | pnx833x_gpio_select_output(5); | 117 | pnx833x_gpio_select_output(5); |
118 | pnx833x_gpio_write(1, 5); | 118 | pnx833x_gpio_write(1, 5); |
119 | 119 | ||
120 | #elif defined(CONFIG_MTD_CFI) || defined(CONFIG_MTD_CFI_MODULE) | 120 | #elif IS_ENABLED(CONFIG_MTD_CFI) |
121 | 121 | ||
122 | /* Set up MIU for 16-bit NOR access on CS0 and CS1... */ | 122 | /* Set up MIU for 16-bit NOR access on CS0 and CS1... */ |
123 | 123 | ||
diff --git a/arch/mips/txx9/generic/pci.c b/arch/mips/txx9/generic/pci.c index 125db323ab1e..4efd9185f294 100644 --- a/arch/mips/txx9/generic/pci.c +++ b/arch/mips/txx9/generic/pci.c | |||
@@ -304,7 +304,7 @@ static void __devinit quirk_slc90e66_bridge(struct pci_dev *dev) | |||
304 | smsc_fdc37m81x_config_end(); | 304 | smsc_fdc37m81x_config_end(); |
305 | } | 305 | } |
306 | 306 | ||
307 | static void quirk_slc90e66_ide(struct pci_dev *dev) | 307 | static void __devinit quirk_slc90e66_ide(struct pci_dev *dev) |
308 | { | 308 | { |
309 | unsigned char dat; | 309 | unsigned char dat; |
310 | int regs[2] = {0x41, 0x43}; | 310 | int regs[2] = {0x41, 0x43}; |
@@ -339,7 +339,7 @@ static void quirk_slc90e66_ide(struct pci_dev *dev) | |||
339 | } | 339 | } |
340 | #endif /* CONFIG_TOSHIBA_FPCIB0 */ | 340 | #endif /* CONFIG_TOSHIBA_FPCIB0 */ |
341 | 341 | ||
342 | static void tc35815_fixup(struct pci_dev *dev) | 342 | static void __devinit tc35815_fixup(struct pci_dev *dev) |
343 | { | 343 | { |
344 | /* This device may have PM registers but not they are not suported. */ | 344 | /* This device may have PM registers but not they are not suported. */ |
345 | if (dev->pm_cap) { | 345 | if (dev->pm_cap) { |
@@ -348,7 +348,7 @@ static void tc35815_fixup(struct pci_dev *dev) | |||
348 | } | 348 | } |
349 | } | 349 | } |
350 | 350 | ||
351 | static void final_fixup(struct pci_dev *dev) | 351 | static void __devinit final_fixup(struct pci_dev *dev) |
352 | { | 352 | { |
353 | unsigned char bist; | 353 | unsigned char bist; |
354 | 354 | ||
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c index ae77a7916c03..560fe8991753 100644 --- a/arch/mips/txx9/generic/setup.c +++ b/arch/mips/txx9/generic/setup.c | |||
@@ -632,7 +632,7 @@ void __init txx9_physmap_flash_init(int no, unsigned long addr, | |||
632 | unsigned long size, | 632 | unsigned long size, |
633 | const struct physmap_flash_data *pdata) | 633 | const struct physmap_flash_data *pdata) |
634 | { | 634 | { |
635 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | 635 | #if IS_ENABLED(CONFIG_MTD_PHYSMAP) |
636 | struct resource res = { | 636 | struct resource res = { |
637 | .start = addr, | 637 | .start = addr, |
638 | .end = addr + size - 1, | 638 | .end = addr + size - 1, |
@@ -670,8 +670,7 @@ void __init txx9_physmap_flash_init(int no, unsigned long addr, | |||
670 | void __init txx9_ndfmc_init(unsigned long baseaddr, | 670 | void __init txx9_ndfmc_init(unsigned long baseaddr, |
671 | const struct txx9ndfmc_platform_data *pdata) | 671 | const struct txx9ndfmc_platform_data *pdata) |
672 | { | 672 | { |
673 | #if defined(CONFIG_MTD_NAND_TXX9NDFMC) || \ | 673 | #if IS_ENABLED(CONFIG_MTD_NAND_TXX9NDFMC) |
674 | defined(CONFIG_MTD_NAND_TXX9NDFMC_MODULE) | ||
675 | struct resource res = { | 674 | struct resource res = { |
676 | .start = baseaddr, | 675 | .start = baseaddr, |
677 | .end = baseaddr + 0x1000 - 1, | 676 | .end = baseaddr + 0x1000 - 1, |
@@ -687,7 +686,7 @@ void __init txx9_ndfmc_init(unsigned long baseaddr, | |||
687 | #endif | 686 | #endif |
688 | } | 687 | } |
689 | 688 | ||
690 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | 689 | #if IS_ENABLED(CONFIG_LEDS_GPIO) |
691 | static DEFINE_SPINLOCK(txx9_iocled_lock); | 690 | static DEFINE_SPINLOCK(txx9_iocled_lock); |
692 | 691 | ||
693 | #define TXX9_IOCLED_MAXLEDS 8 | 692 | #define TXX9_IOCLED_MAXLEDS 8 |
@@ -810,7 +809,7 @@ void __init txx9_iocled_init(unsigned long baseaddr, | |||
810 | void __init txx9_dmac_init(int id, unsigned long baseaddr, int irq, | 809 | void __init txx9_dmac_init(int id, unsigned long baseaddr, int irq, |
811 | const struct txx9dmac_platform_data *pdata) | 810 | const struct txx9dmac_platform_data *pdata) |
812 | { | 811 | { |
813 | #if defined(CONFIG_TXX9_DMAC) || defined(CONFIG_TXX9_DMAC_MODULE) | 812 | #if IS_ENABLED(CONFIG_TXX9_DMAC) |
814 | struct resource res[] = { | 813 | struct resource res[] = { |
815 | { | 814 | { |
816 | .start = baseaddr, | 815 | .start = baseaddr, |
@@ -866,8 +865,7 @@ void __init txx9_aclc_init(unsigned long baseaddr, int irq, | |||
866 | unsigned int dma_chan_out, | 865 | unsigned int dma_chan_out, |
867 | unsigned int dma_chan_in) | 866 | unsigned int dma_chan_in) |
868 | { | 867 | { |
869 | #if defined(CONFIG_SND_SOC_TXX9ACLC) || \ | 868 | #if IS_ENABLED(CONFIG_SND_SOC_TXX9ACLC) |
870 | defined(CONFIG_SND_SOC_TXX9ACLC_MODULE) | ||
871 | unsigned int dma_base = dmac_id * TXX9_DMA_MAX_NR_CHANNELS; | 869 | unsigned int dma_base = dmac_id * TXX9_DMA_MAX_NR_CHANNELS; |
872 | struct resource res[] = { | 870 | struct resource res[] = { |
873 | { | 871 | { |
diff --git a/arch/mips/txx9/generic/setup_tx4939.c b/arch/mips/txx9/generic/setup_tx4939.c index 6567895d1f59..5ff7a9584daf 100644 --- a/arch/mips/txx9/generic/setup_tx4939.c +++ b/arch/mips/txx9/generic/setup_tx4939.c | |||
@@ -317,7 +317,7 @@ void __init tx4939_sio_init(unsigned int sclk, unsigned int cts_mask) | |||
317 | } | 317 | } |
318 | } | 318 | } |
319 | 319 | ||
320 | #if defined(CONFIG_TC35815) || defined(CONFIG_TC35815_MODULE) | 320 | #if IS_ENABLED(CONFIG_TC35815) |
321 | static u32 tx4939_get_eth_speed(struct net_device *dev) | 321 | static u32 tx4939_get_eth_speed(struct net_device *dev) |
322 | { | 322 | { |
323 | struct ethtool_cmd cmd; | 323 | struct ethtool_cmd cmd; |
diff --git a/arch/mips/txx9/rbtx4939/setup.c b/arch/mips/txx9/rbtx4939/setup.c index 2ad8973ba13d..e15641d93092 100644 --- a/arch/mips/txx9/rbtx4939/setup.c +++ b/arch/mips/txx9/rbtx4939/setup.c | |||
@@ -40,8 +40,7 @@ static void __init rbtx4939_time_init(void) | |||
40 | tx4939_time_init(0); | 40 | tx4939_time_init(0); |
41 | } | 41 | } |
42 | 42 | ||
43 | #if defined(__BIG_ENDIAN) && \ | 43 | #if defined(__BIG_ENDIAN) && IS_ENABLED(CONFIG_SMC91X) |
44 | (defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)) | ||
45 | #define HAVE_RBTX4939_IOSWAB | 44 | #define HAVE_RBTX4939_IOSWAB |
46 | #define IS_CE1_ADDR(addr) \ | 45 | #define IS_CE1_ADDR(addr) \ |
47 | ((((unsigned long)(addr) - IO_BASE) & 0xfff00000) == TXX9_CE(1)) | 46 | ((((unsigned long)(addr) - IO_BASE) & 0xfff00000) == TXX9_CE(1)) |
@@ -187,7 +186,7 @@ static void __init rbtx4939_update_ioc_pen(void) | |||
187 | 186 | ||
188 | #define RBTX4939_MAX_7SEGLEDS 8 | 187 | #define RBTX4939_MAX_7SEGLEDS 8 |
189 | 188 | ||
190 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) | 189 | #if IS_ENABLED(CONFIG_LEDS_CLASS) |
191 | static u8 led_val[RBTX4939_MAX_7SEGLEDS]; | 190 | static u8 led_val[RBTX4939_MAX_7SEGLEDS]; |
192 | struct rbtx4939_led_data { | 191 | struct rbtx4939_led_data { |
193 | struct led_classdev cdev; | 192 | struct led_classdev cdev; |
@@ -263,7 +262,7 @@ static inline void rbtx4939_led_setup(void) | |||
263 | 262 | ||
264 | static void __rbtx4939_7segled_putc(unsigned int pos, unsigned char val) | 263 | static void __rbtx4939_7segled_putc(unsigned int pos, unsigned char val) |
265 | { | 264 | { |
266 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) | 265 | #if IS_ENABLED(CONFIG_LEDS_CLASS) |
267 | unsigned long flags; | 266 | unsigned long flags; |
268 | local_irq_save(flags); | 267 | local_irq_save(flags); |
269 | /* bit7: reserved for LED class */ | 268 | /* bit7: reserved for LED class */ |
@@ -287,7 +286,7 @@ static void rbtx4939_7segled_putc(unsigned int pos, unsigned char val) | |||
287 | __rbtx4939_7segled_putc(pos, val); | 286 | __rbtx4939_7segled_putc(pos, val); |
288 | } | 287 | } |
289 | 288 | ||
290 | #if defined(CONFIG_MTD_RBTX4939) || defined(CONFIG_MTD_RBTX4939_MODULE) | 289 | #if IS_ENABLED(CONFIG_MTD_RBTX4939) |
291 | /* special mapping for boot rom */ | 290 | /* special mapping for boot rom */ |
292 | static unsigned long rbtx4939_flash_fixup_ofs(unsigned long ofs) | 291 | static unsigned long rbtx4939_flash_fixup_ofs(unsigned long ofs) |
293 | { | 292 | { |
@@ -463,7 +462,7 @@ static void __init rbtx4939_device_init(void) | |||
463 | .flags = SMC91X_USE_16BIT, | 462 | .flags = SMC91X_USE_16BIT, |
464 | }; | 463 | }; |
465 | struct platform_device *pdev; | 464 | struct platform_device *pdev; |
466 | #if defined(CONFIG_TC35815) || defined(CONFIG_TC35815_MODULE) | 465 | #if IS_ENABLED(CONFIG_TC35815) |
467 | int i, j; | 466 | int i, j; |
468 | unsigned char ethaddr[2][6]; | 467 | unsigned char ethaddr[2][6]; |
469 | u8 bdipsw = readb(rbtx4939_bdipsw_addr) & 0x0f; | 468 | u8 bdipsw = readb(rbtx4939_bdipsw_addr) & 0x0f; |
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index b01d67328243..7c0d391996b5 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig | |||
@@ -73,6 +73,20 @@ config HW_RANDOM_ATMEL | |||
73 | 73 | ||
74 | If unsure, say Y. | 74 | If unsure, say Y. |
75 | 75 | ||
76 | config HW_RANDOM_BCM63XX | ||
77 | tristate "Broadcom BCM63xx Random Number Generator support" | ||
78 | depends on HW_RANDOM && BCM63XX | ||
79 | default HW_RANDOM | ||
80 | ---help--- | ||
81 | This driver provides kernel-side support for the Random Number | ||
82 | Generator hardware found on the Broadcom BCM63xx SoCs. | ||
83 | |||
84 | To compile this driver as a module, choose M here: the | ||
85 | module will be called bcm63xx-rng | ||
86 | |||
87 | If unusure, say Y. | ||
88 | |||
89 | |||
76 | config HW_RANDOM_GEODE | 90 | config HW_RANDOM_GEODE |
77 | tristate "AMD Geode HW Random Number Generator support" | 91 | tristate "AMD Geode HW Random Number Generator support" |
78 | depends on HW_RANDOM && X86_32 && PCI | 92 | depends on HW_RANDOM && X86_32 && PCI |
diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile index 8d6d173b65e6..39a757ca15b6 100644 --- a/drivers/char/hw_random/Makefile +++ b/drivers/char/hw_random/Makefile | |||
@@ -8,6 +8,7 @@ obj-$(CONFIG_HW_RANDOM_TIMERIOMEM) += timeriomem-rng.o | |||
8 | obj-$(CONFIG_HW_RANDOM_INTEL) += intel-rng.o | 8 | obj-$(CONFIG_HW_RANDOM_INTEL) += intel-rng.o |
9 | obj-$(CONFIG_HW_RANDOM_AMD) += amd-rng.o | 9 | obj-$(CONFIG_HW_RANDOM_AMD) += amd-rng.o |
10 | obj-$(CONFIG_HW_RANDOM_ATMEL) += atmel-rng.o | 10 | obj-$(CONFIG_HW_RANDOM_ATMEL) += atmel-rng.o |
11 | obj-$(CONFIG_HW_RANDOM_BCM63XX) += bcm63xx-rng.o | ||
11 | obj-$(CONFIG_HW_RANDOM_GEODE) += geode-rng.o | 12 | obj-$(CONFIG_HW_RANDOM_GEODE) += geode-rng.o |
12 | obj-$(CONFIG_HW_RANDOM_N2RNG) += n2-rng.o | 13 | obj-$(CONFIG_HW_RANDOM_N2RNG) += n2-rng.o |
13 | n2-rng-y := n2-drv.o n2-asm.o | 14 | n2-rng-y := n2-drv.o n2-asm.o |
diff --git a/drivers/char/hw_random/bcm63xx-rng.c b/drivers/char/hw_random/bcm63xx-rng.c new file mode 100644 index 000000000000..aec6a4277caa --- /dev/null +++ b/drivers/char/hw_random/bcm63xx-rng.c | |||
@@ -0,0 +1,175 @@ | |||
1 | /* | ||
2 | * Broadcom BCM63xx Random Number Generator support | ||
3 | * | ||
4 | * Copyright (C) 2011, Florian Fainelli <florian@openwrt.org> | ||
5 | * Copyright (C) 2009, Broadcom Corporation | ||
6 | * | ||
7 | */ | ||
8 | #include <linux/module.h> | ||
9 | #include <linux/slab.h> | ||
10 | #include <linux/io.h> | ||
11 | #include <linux/err.h> | ||
12 | #include <linux/clk.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/hw_random.h> | ||
15 | |||
16 | #include <bcm63xx_io.h> | ||
17 | #include <bcm63xx_regs.h> | ||
18 | |||
19 | struct bcm63xx_rng_priv { | ||
20 | struct clk *clk; | ||
21 | void __iomem *regs; | ||
22 | }; | ||
23 | |||
24 | #define to_rng_priv(rng) ((struct bcm63xx_rng_priv *)rng->priv) | ||
25 | |||
26 | static int bcm63xx_rng_init(struct hwrng *rng) | ||
27 | { | ||
28 | struct bcm63xx_rng_priv *priv = to_rng_priv(rng); | ||
29 | u32 val; | ||
30 | |||
31 | val = bcm_readl(priv->regs + RNG_CTRL); | ||
32 | val |= RNG_EN; | ||
33 | bcm_writel(val, priv->regs + RNG_CTRL); | ||
34 | |||
35 | return 0; | ||
36 | } | ||
37 | |||
38 | static void bcm63xx_rng_cleanup(struct hwrng *rng) | ||
39 | { | ||
40 | struct bcm63xx_rng_priv *priv = to_rng_priv(rng); | ||
41 | u32 val; | ||
42 | |||
43 | val = bcm_readl(priv->regs + RNG_CTRL); | ||
44 | val &= ~RNG_EN; | ||
45 | bcm_writel(val, priv->regs + RNG_CTRL); | ||
46 | } | ||
47 | |||
48 | static int bcm63xx_rng_data_present(struct hwrng *rng, int wait) | ||
49 | { | ||
50 | struct bcm63xx_rng_priv *priv = to_rng_priv(rng); | ||
51 | |||
52 | return bcm_readl(priv->regs + RNG_STAT) & RNG_AVAIL_MASK; | ||
53 | } | ||
54 | |||
55 | static int bcm63xx_rng_data_read(struct hwrng *rng, u32 *data) | ||
56 | { | ||
57 | struct bcm63xx_rng_priv *priv = to_rng_priv(rng); | ||
58 | |||
59 | *data = bcm_readl(priv->regs + RNG_DATA); | ||
60 | |||
61 | return 4; | ||
62 | } | ||
63 | |||
64 | static int __devinit bcm63xx_rng_probe(struct platform_device *pdev) | ||
65 | { | ||
66 | struct resource *r; | ||
67 | struct clk *clk; | ||
68 | int ret; | ||
69 | struct bcm63xx_rng_priv *priv; | ||
70 | struct hwrng *rng; | ||
71 | |||
72 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
73 | if (!r) { | ||
74 | dev_err(&pdev->dev, "no iomem resource\n"); | ||
75 | ret = -ENXIO; | ||
76 | goto out; | ||
77 | } | ||
78 | |||
79 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | ||
80 | if (!priv) { | ||
81 | dev_err(&pdev->dev, "no memory for private structure\n"); | ||
82 | ret = -ENOMEM; | ||
83 | goto out; | ||
84 | } | ||
85 | |||
86 | rng = kzalloc(sizeof(*rng), GFP_KERNEL); | ||
87 | if (!rng) { | ||
88 | dev_err(&pdev->dev, "no memory for rng structure\n"); | ||
89 | ret = -ENOMEM; | ||
90 | goto out_free_priv; | ||
91 | } | ||
92 | |||
93 | platform_set_drvdata(pdev, rng); | ||
94 | rng->priv = (unsigned long)priv; | ||
95 | rng->name = pdev->name; | ||
96 | rng->init = bcm63xx_rng_init; | ||
97 | rng->cleanup = bcm63xx_rng_cleanup; | ||
98 | rng->data_present = bcm63xx_rng_data_present; | ||
99 | rng->data_read = bcm63xx_rng_data_read; | ||
100 | |||
101 | clk = clk_get(&pdev->dev, "ipsec"); | ||
102 | if (IS_ERR(clk)) { | ||
103 | dev_err(&pdev->dev, "no clock for device\n"); | ||
104 | ret = PTR_ERR(clk); | ||
105 | goto out_free_rng; | ||
106 | } | ||
107 | |||
108 | priv->clk = clk; | ||
109 | |||
110 | if (!devm_request_mem_region(&pdev->dev, r->start, | ||
111 | resource_size(r), pdev->name)) { | ||
112 | dev_err(&pdev->dev, "request mem failed"); | ||
113 | ret = -ENOMEM; | ||
114 | goto out_free_rng; | ||
115 | } | ||
116 | |||
117 | priv->regs = devm_ioremap_nocache(&pdev->dev, r->start, | ||
118 | resource_size(r)); | ||
119 | if (!priv->regs) { | ||
120 | dev_err(&pdev->dev, "ioremap failed"); | ||
121 | ret = -ENOMEM; | ||
122 | goto out_free_rng; | ||
123 | } | ||
124 | |||
125 | clk_enable(clk); | ||
126 | |||
127 | ret = hwrng_register(rng); | ||
128 | if (ret) { | ||
129 | dev_err(&pdev->dev, "failed to register rng device\n"); | ||
130 | goto out_clk_disable; | ||
131 | } | ||
132 | |||
133 | dev_info(&pdev->dev, "registered RNG driver\n"); | ||
134 | |||
135 | return 0; | ||
136 | |||
137 | out_clk_disable: | ||
138 | clk_disable(clk); | ||
139 | out_free_rng: | ||
140 | platform_set_drvdata(pdev, NULL); | ||
141 | kfree(rng); | ||
142 | out_free_priv: | ||
143 | kfree(priv); | ||
144 | out: | ||
145 | return ret; | ||
146 | } | ||
147 | |||
148 | static int __devexit bcm63xx_rng_remove(struct platform_device *pdev) | ||
149 | { | ||
150 | struct hwrng *rng = platform_get_drvdata(pdev); | ||
151 | struct bcm63xx_rng_priv *priv = to_rng_priv(rng); | ||
152 | |||
153 | hwrng_unregister(rng); | ||
154 | clk_disable(priv->clk); | ||
155 | kfree(priv); | ||
156 | kfree(rng); | ||
157 | platform_set_drvdata(pdev, NULL); | ||
158 | |||
159 | return 0; | ||
160 | } | ||
161 | |||
162 | static struct platform_driver bcm63xx_rng_driver = { | ||
163 | .probe = bcm63xx_rng_probe, | ||
164 | .remove = __devexit_p(bcm63xx_rng_remove), | ||
165 | .driver = { | ||
166 | .name = "bcm63xx-rng", | ||
167 | .owner = THIS_MODULE, | ||
168 | }, | ||
169 | }; | ||
170 | |||
171 | module_platform_driver(bcm63xx_rng_driver); | ||
172 | |||
173 | MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>"); | ||
174 | MODULE_DESCRIPTION("Broadcom BCM63xx RNG driver"); | ||
175 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c index ee139a598814..f44c83549fe5 100644 --- a/drivers/i2c/busses/i2c-octeon.c +++ b/drivers/i2c/busses/i2c-octeon.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * (C) Copyright 2009-2010 | 2 | * (C) Copyright 2009-2010 |
3 | * Nokia Siemens Networks, michael.lawnick.ext@nsn.com | 3 | * Nokia Siemens Networks, michael.lawnick.ext@nsn.com |
4 | * | 4 | * |
5 | * Portions Copyright (C) 2010 Cavium Networks, Inc. | 5 | * Portions Copyright (C) 2010, 2011 Cavium Networks, Inc. |
6 | * | 6 | * |
7 | * This is a driver for the i2c adapter in Cavium Networks' OCTEON processors. | 7 | * This is a driver for the i2c adapter in Cavium Networks' OCTEON processors. |
8 | * | 8 | * |
@@ -11,17 +11,18 @@ | |||
11 | * warranty of any kind, whether express or implied. | 11 | * warranty of any kind, whether express or implied. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/interrupt.h> | ||
14 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
15 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/of_i2c.h> | ||
19 | #include <linux/delay.h> | ||
16 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
17 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
18 | #include <linux/init.h> | 22 | #include <linux/init.h> |
19 | |||
20 | #include <linux/io.h> | ||
21 | #include <linux/i2c.h> | 23 | #include <linux/i2c.h> |
22 | #include <linux/interrupt.h> | 24 | #include <linux/io.h> |
23 | #include <linux/delay.h> | 25 | #include <linux/of.h> |
24 | #include <linux/platform_device.h> | ||
25 | 26 | ||
26 | #include <asm/octeon/octeon.h> | 27 | #include <asm/octeon/octeon.h> |
27 | 28 | ||
@@ -65,7 +66,7 @@ struct octeon_i2c { | |||
65 | wait_queue_head_t queue; | 66 | wait_queue_head_t queue; |
66 | struct i2c_adapter adap; | 67 | struct i2c_adapter adap; |
67 | int irq; | 68 | int irq; |
68 | int twsi_freq; | 69 | u32 twsi_freq; |
69 | int sys_freq; | 70 | int sys_freq; |
70 | resource_size_t twsi_phys; | 71 | resource_size_t twsi_phys; |
71 | void __iomem *twsi_base; | 72 | void __iomem *twsi_base; |
@@ -121,10 +122,8 @@ static u8 octeon_i2c_read_sw(struct octeon_i2c *i2c, u64 eop_reg) | |||
121 | */ | 122 | */ |
122 | static void octeon_i2c_write_int(struct octeon_i2c *i2c, u64 data) | 123 | static void octeon_i2c_write_int(struct octeon_i2c *i2c, u64 data) |
123 | { | 124 | { |
124 | u64 tmp; | ||
125 | |||
126 | __raw_writeq(data, i2c->twsi_base + TWSI_INT); | 125 | __raw_writeq(data, i2c->twsi_base + TWSI_INT); |
127 | tmp = __raw_readq(i2c->twsi_base + TWSI_INT); | 126 | __raw_readq(i2c->twsi_base + TWSI_INT); |
128 | } | 127 | } |
129 | 128 | ||
130 | /** | 129 | /** |
@@ -515,7 +514,6 @@ static int __devinit octeon_i2c_probe(struct platform_device *pdev) | |||
515 | { | 514 | { |
516 | int irq, result = 0; | 515 | int irq, result = 0; |
517 | struct octeon_i2c *i2c; | 516 | struct octeon_i2c *i2c; |
518 | struct octeon_i2c_data *i2c_data; | ||
519 | struct resource *res_mem; | 517 | struct resource *res_mem; |
520 | 518 | ||
521 | /* All adaptors have an irq. */ | 519 | /* All adaptors have an irq. */ |
@@ -523,86 +521,90 @@ static int __devinit octeon_i2c_probe(struct platform_device *pdev) | |||
523 | if (irq < 0) | 521 | if (irq < 0) |
524 | return irq; | 522 | return irq; |
525 | 523 | ||
526 | i2c = kzalloc(sizeof(*i2c), GFP_KERNEL); | 524 | i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); |
527 | if (!i2c) { | 525 | if (!i2c) { |
528 | dev_err(&pdev->dev, "kzalloc failed\n"); | 526 | dev_err(&pdev->dev, "kzalloc failed\n"); |
529 | result = -ENOMEM; | 527 | result = -ENOMEM; |
530 | goto out; | 528 | goto out; |
531 | } | 529 | } |
532 | i2c->dev = &pdev->dev; | 530 | i2c->dev = &pdev->dev; |
533 | i2c_data = pdev->dev.platform_data; | ||
534 | 531 | ||
535 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 532 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
536 | 533 | ||
537 | if (res_mem == NULL) { | 534 | if (res_mem == NULL) { |
538 | dev_err(i2c->dev, "found no memory resource\n"); | 535 | dev_err(i2c->dev, "found no memory resource\n"); |
539 | result = -ENXIO; | 536 | result = -ENXIO; |
540 | goto fail_region; | 537 | goto out; |
541 | } | 538 | } |
539 | i2c->twsi_phys = res_mem->start; | ||
540 | i2c->regsize = resource_size(res_mem); | ||
542 | 541 | ||
543 | if (i2c_data == NULL) { | 542 | /* |
544 | dev_err(i2c->dev, "no I2C frequency data\n"); | 543 | * "clock-rate" is a legacy binding, the official binding is |
544 | * "clock-frequency". Try the official one first and then | ||
545 | * fall back if it doesn't exist. | ||
546 | */ | ||
547 | if (of_property_read_u32(pdev->dev.of_node, | ||
548 | "clock-frequency", &i2c->twsi_freq) && | ||
549 | of_property_read_u32(pdev->dev.of_node, | ||
550 | "clock-rate", &i2c->twsi_freq)) { | ||
551 | dev_err(i2c->dev, | ||
552 | "no I2C 'clock-rate' or 'clock-frequency' property\n"); | ||
545 | result = -ENXIO; | 553 | result = -ENXIO; |
546 | goto fail_region; | 554 | goto out; |
547 | } | 555 | } |
548 | 556 | ||
549 | i2c->twsi_phys = res_mem->start; | 557 | i2c->sys_freq = octeon_get_io_clock_rate(); |
550 | i2c->regsize = resource_size(res_mem); | ||
551 | i2c->twsi_freq = i2c_data->i2c_freq; | ||
552 | i2c->sys_freq = i2c_data->sys_freq; | ||
553 | 558 | ||
554 | if (!request_mem_region(i2c->twsi_phys, i2c->regsize, res_mem->name)) { | 559 | if (!devm_request_mem_region(&pdev->dev, i2c->twsi_phys, i2c->regsize, |
560 | res_mem->name)) { | ||
555 | dev_err(i2c->dev, "request_mem_region failed\n"); | 561 | dev_err(i2c->dev, "request_mem_region failed\n"); |
556 | goto fail_region; | 562 | goto out; |
557 | } | 563 | } |
558 | i2c->twsi_base = ioremap(i2c->twsi_phys, i2c->regsize); | 564 | i2c->twsi_base = devm_ioremap(&pdev->dev, i2c->twsi_phys, i2c->regsize); |
559 | 565 | ||
560 | init_waitqueue_head(&i2c->queue); | 566 | init_waitqueue_head(&i2c->queue); |
561 | 567 | ||
562 | i2c->irq = irq; | 568 | i2c->irq = irq; |
563 | 569 | ||
564 | result = request_irq(i2c->irq, octeon_i2c_isr, 0, DRV_NAME, i2c); | 570 | result = devm_request_irq(&pdev->dev, i2c->irq, |
571 | octeon_i2c_isr, 0, DRV_NAME, i2c); | ||
565 | if (result < 0) { | 572 | if (result < 0) { |
566 | dev_err(i2c->dev, "failed to attach interrupt\n"); | 573 | dev_err(i2c->dev, "failed to attach interrupt\n"); |
567 | goto fail_irq; | 574 | goto out; |
568 | } | 575 | } |
569 | 576 | ||
570 | result = octeon_i2c_initlowlevel(i2c); | 577 | result = octeon_i2c_initlowlevel(i2c); |
571 | if (result) { | 578 | if (result) { |
572 | dev_err(i2c->dev, "init low level failed\n"); | 579 | dev_err(i2c->dev, "init low level failed\n"); |
573 | goto fail_add; | 580 | goto out; |
574 | } | 581 | } |
575 | 582 | ||
576 | result = octeon_i2c_setclock(i2c); | 583 | result = octeon_i2c_setclock(i2c); |
577 | if (result) { | 584 | if (result) { |
578 | dev_err(i2c->dev, "clock init failed\n"); | 585 | dev_err(i2c->dev, "clock init failed\n"); |
579 | goto fail_add; | 586 | goto out; |
580 | } | 587 | } |
581 | 588 | ||
582 | i2c->adap = octeon_i2c_ops; | 589 | i2c->adap = octeon_i2c_ops; |
583 | i2c->adap.dev.parent = &pdev->dev; | 590 | i2c->adap.dev.parent = &pdev->dev; |
584 | i2c->adap.nr = pdev->id >= 0 ? pdev->id : 0; | 591 | i2c->adap.dev.of_node = pdev->dev.of_node; |
585 | i2c_set_adapdata(&i2c->adap, i2c); | 592 | i2c_set_adapdata(&i2c->adap, i2c); |
586 | platform_set_drvdata(pdev, i2c); | 593 | platform_set_drvdata(pdev, i2c); |
587 | 594 | ||
588 | result = i2c_add_numbered_adapter(&i2c->adap); | 595 | result = i2c_add_adapter(&i2c->adap); |
589 | if (result < 0) { | 596 | if (result < 0) { |
590 | dev_err(i2c->dev, "failed to add adapter\n"); | 597 | dev_err(i2c->dev, "failed to add adapter\n"); |
591 | goto fail_add; | 598 | goto fail_add; |
592 | } | 599 | } |
593 | |||
594 | dev_info(i2c->dev, "version %s\n", DRV_VERSION); | 600 | dev_info(i2c->dev, "version %s\n", DRV_VERSION); |
595 | 601 | ||
596 | return result; | 602 | of_i2c_register_devices(&i2c->adap); |
603 | |||
604 | return 0; | ||
597 | 605 | ||
598 | fail_add: | 606 | fail_add: |
599 | platform_set_drvdata(pdev, NULL); | 607 | platform_set_drvdata(pdev, NULL); |
600 | free_irq(i2c->irq, i2c); | ||
601 | fail_irq: | ||
602 | iounmap(i2c->twsi_base); | ||
603 | release_mem_region(i2c->twsi_phys, i2c->regsize); | ||
604 | fail_region: | ||
605 | kfree(i2c); | ||
606 | out: | 608 | out: |
607 | return result; | 609 | return result; |
608 | }; | 610 | }; |
@@ -613,19 +615,24 @@ static int __devexit octeon_i2c_remove(struct platform_device *pdev) | |||
613 | 615 | ||
614 | i2c_del_adapter(&i2c->adap); | 616 | i2c_del_adapter(&i2c->adap); |
615 | platform_set_drvdata(pdev, NULL); | 617 | platform_set_drvdata(pdev, NULL); |
616 | free_irq(i2c->irq, i2c); | ||
617 | iounmap(i2c->twsi_base); | ||
618 | release_mem_region(i2c->twsi_phys, i2c->regsize); | ||
619 | kfree(i2c); | ||
620 | return 0; | 618 | return 0; |
621 | }; | 619 | }; |
622 | 620 | ||
621 | static struct of_device_id octeon_i2c_match[] = { | ||
622 | { | ||
623 | .compatible = "cavium,octeon-3860-twsi", | ||
624 | }, | ||
625 | {}, | ||
626 | }; | ||
627 | MODULE_DEVICE_TABLE(of, octeon_i2c_match); | ||
628 | |||
623 | static struct platform_driver octeon_i2c_driver = { | 629 | static struct platform_driver octeon_i2c_driver = { |
624 | .probe = octeon_i2c_probe, | 630 | .probe = octeon_i2c_probe, |
625 | .remove = __devexit_p(octeon_i2c_remove), | 631 | .remove = __devexit_p(octeon_i2c_remove), |
626 | .driver = { | 632 | .driver = { |
627 | .owner = THIS_MODULE, | 633 | .owner = THIS_MODULE, |
628 | .name = DRV_NAME, | 634 | .name = DRV_NAME, |
635 | .of_match_table = octeon_i2c_match, | ||
629 | }, | 636 | }, |
630 | }; | 637 | }; |
631 | 638 | ||
@@ -635,4 +642,3 @@ MODULE_AUTHOR("Michael Lawnick <michael.lawnick.ext@nsn.com>"); | |||
635 | MODULE_DESCRIPTION("I2C-Bus adapter for Cavium OCTEON processors"); | 642 | MODULE_DESCRIPTION("I2C-Bus adapter for Cavium OCTEON processors"); |
636 | MODULE_LICENSE("GPL"); | 643 | MODULE_LICENSE("GPL"); |
637 | MODULE_VERSION(DRV_VERSION); | 644 | MODULE_VERSION(DRV_VERSION); |
638 | MODULE_ALIAS("platform:" DRV_NAME); | ||
diff --git a/drivers/mtd/nand/jz4740_nand.c b/drivers/mtd/nand/jz4740_nand.c index a6fa884ae49b..100b6775e175 100644 --- a/drivers/mtd/nand/jz4740_nand.c +++ b/drivers/mtd/nand/jz4740_nand.c | |||
@@ -52,9 +52,10 @@ | |||
52 | 52 | ||
53 | #define JZ_NAND_CTRL_ENABLE_CHIP(x) BIT((x) << 1) | 53 | #define JZ_NAND_CTRL_ENABLE_CHIP(x) BIT((x) << 1) |
54 | #define JZ_NAND_CTRL_ASSERT_CHIP(x) BIT(((x) << 1) + 1) | 54 | #define JZ_NAND_CTRL_ASSERT_CHIP(x) BIT(((x) << 1) + 1) |
55 | #define JZ_NAND_CTRL_ASSERT_CHIP_MASK 0xaa | ||
55 | 56 | ||
56 | #define JZ_NAND_MEM_ADDR_OFFSET 0x10000 | ||
57 | #define JZ_NAND_MEM_CMD_OFFSET 0x08000 | 57 | #define JZ_NAND_MEM_CMD_OFFSET 0x08000 |
58 | #define JZ_NAND_MEM_ADDR_OFFSET 0x10000 | ||
58 | 59 | ||
59 | struct jz_nand { | 60 | struct jz_nand { |
60 | struct mtd_info mtd; | 61 | struct mtd_info mtd; |
@@ -62,8 +63,11 @@ struct jz_nand { | |||
62 | void __iomem *base; | 63 | void __iomem *base; |
63 | struct resource *mem; | 64 | struct resource *mem; |
64 | 65 | ||
65 | void __iomem *bank_base; | 66 | unsigned char banks[JZ_NAND_NUM_BANKS]; |
66 | struct resource *bank_mem; | 67 | void __iomem *bank_base[JZ_NAND_NUM_BANKS]; |
68 | struct resource *bank_mem[JZ_NAND_NUM_BANKS]; | ||
69 | |||
70 | int selected_bank; | ||
67 | 71 | ||
68 | struct jz_nand_platform_data *pdata; | 72 | struct jz_nand_platform_data *pdata; |
69 | bool is_reading; | 73 | bool is_reading; |
@@ -74,26 +78,50 @@ static inline struct jz_nand *mtd_to_jz_nand(struct mtd_info *mtd) | |||
74 | return container_of(mtd, struct jz_nand, mtd); | 78 | return container_of(mtd, struct jz_nand, mtd); |
75 | } | 79 | } |
76 | 80 | ||
81 | static void jz_nand_select_chip(struct mtd_info *mtd, int chipnr) | ||
82 | { | ||
83 | struct jz_nand *nand = mtd_to_jz_nand(mtd); | ||
84 | struct nand_chip *chip = mtd->priv; | ||
85 | uint32_t ctrl; | ||
86 | int banknr; | ||
87 | |||
88 | ctrl = readl(nand->base + JZ_REG_NAND_CTRL); | ||
89 | ctrl &= ~JZ_NAND_CTRL_ASSERT_CHIP_MASK; | ||
90 | |||
91 | if (chipnr == -1) { | ||
92 | banknr = -1; | ||
93 | } else { | ||
94 | banknr = nand->banks[chipnr] - 1; | ||
95 | chip->IO_ADDR_R = nand->bank_base[banknr]; | ||
96 | chip->IO_ADDR_W = nand->bank_base[banknr]; | ||
97 | } | ||
98 | writel(ctrl, nand->base + JZ_REG_NAND_CTRL); | ||
99 | |||
100 | nand->selected_bank = banknr; | ||
101 | } | ||
102 | |||
77 | static void jz_nand_cmd_ctrl(struct mtd_info *mtd, int dat, unsigned int ctrl) | 103 | static void jz_nand_cmd_ctrl(struct mtd_info *mtd, int dat, unsigned int ctrl) |
78 | { | 104 | { |
79 | struct jz_nand *nand = mtd_to_jz_nand(mtd); | 105 | struct jz_nand *nand = mtd_to_jz_nand(mtd); |
80 | struct nand_chip *chip = mtd->priv; | 106 | struct nand_chip *chip = mtd->priv; |
81 | uint32_t reg; | 107 | uint32_t reg; |
108 | void __iomem *bank_base = nand->bank_base[nand->selected_bank]; | ||
109 | |||
110 | BUG_ON(nand->selected_bank < 0); | ||
82 | 111 | ||
83 | if (ctrl & NAND_CTRL_CHANGE) { | 112 | if (ctrl & NAND_CTRL_CHANGE) { |
84 | BUG_ON((ctrl & NAND_ALE) && (ctrl & NAND_CLE)); | 113 | BUG_ON((ctrl & NAND_ALE) && (ctrl & NAND_CLE)); |
85 | if (ctrl & NAND_ALE) | 114 | if (ctrl & NAND_ALE) |
86 | chip->IO_ADDR_W = nand->bank_base + JZ_NAND_MEM_ADDR_OFFSET; | 115 | bank_base += JZ_NAND_MEM_ADDR_OFFSET; |
87 | else if (ctrl & NAND_CLE) | 116 | else if (ctrl & NAND_CLE) |
88 | chip->IO_ADDR_W = nand->bank_base + JZ_NAND_MEM_CMD_OFFSET; | 117 | bank_base += JZ_NAND_MEM_CMD_OFFSET; |
89 | else | 118 | chip->IO_ADDR_W = bank_base; |
90 | chip->IO_ADDR_W = nand->bank_base; | ||
91 | 119 | ||
92 | reg = readl(nand->base + JZ_REG_NAND_CTRL); | 120 | reg = readl(nand->base + JZ_REG_NAND_CTRL); |
93 | if (ctrl & NAND_NCE) | 121 | if (ctrl & NAND_NCE) |
94 | reg |= JZ_NAND_CTRL_ASSERT_CHIP(0); | 122 | reg |= JZ_NAND_CTRL_ASSERT_CHIP(nand->selected_bank); |
95 | else | 123 | else |
96 | reg &= ~JZ_NAND_CTRL_ASSERT_CHIP(0); | 124 | reg &= ~JZ_NAND_CTRL_ASSERT_CHIP(nand->selected_bank); |
97 | writel(reg, nand->base + JZ_REG_NAND_CTRL); | 125 | writel(reg, nand->base + JZ_REG_NAND_CTRL); |
98 | } | 126 | } |
99 | if (dat != NAND_CMD_NONE) | 127 | if (dat != NAND_CMD_NONE) |
@@ -252,7 +280,7 @@ static int jz_nand_correct_ecc_rs(struct mtd_info *mtd, uint8_t *dat, | |||
252 | } | 280 | } |
253 | 281 | ||
254 | static int jz_nand_ioremap_resource(struct platform_device *pdev, | 282 | static int jz_nand_ioremap_resource(struct platform_device *pdev, |
255 | const char *name, struct resource **res, void __iomem **base) | 283 | const char *name, struct resource **res, void *__iomem *base) |
256 | { | 284 | { |
257 | int ret; | 285 | int ret; |
258 | 286 | ||
@@ -288,6 +316,90 @@ err: | |||
288 | return ret; | 316 | return ret; |
289 | } | 317 | } |
290 | 318 | ||
319 | static inline void jz_nand_iounmap_resource(struct resource *res, void __iomem *base) | ||
320 | { | ||
321 | iounmap(base); | ||
322 | release_mem_region(res->start, resource_size(res)); | ||
323 | } | ||
324 | |||
325 | static int __devinit jz_nand_detect_bank(struct platform_device *pdev, struct jz_nand *nand, unsigned char bank, size_t chipnr, uint8_t *nand_maf_id, uint8_t *nand_dev_id) { | ||
326 | int ret; | ||
327 | int gpio; | ||
328 | char gpio_name[9]; | ||
329 | char res_name[6]; | ||
330 | uint32_t ctrl; | ||
331 | struct mtd_info *mtd = &nand->mtd; | ||
332 | struct nand_chip *chip = &nand->chip; | ||
333 | |||
334 | /* Request GPIO port. */ | ||
335 | gpio = JZ_GPIO_MEM_CS0 + bank - 1; | ||
336 | sprintf(gpio_name, "NAND CS%d", bank); | ||
337 | ret = gpio_request(gpio, gpio_name); | ||
338 | if (ret) { | ||
339 | dev_warn(&pdev->dev, | ||
340 | "Failed to request %s gpio %d: %d\n", | ||
341 | gpio_name, gpio, ret); | ||
342 | goto notfound_gpio; | ||
343 | } | ||
344 | |||
345 | /* Request I/O resource. */ | ||
346 | sprintf(res_name, "bank%d", bank); | ||
347 | ret = jz_nand_ioremap_resource(pdev, res_name, | ||
348 | &nand->bank_mem[bank - 1], | ||
349 | &nand->bank_base[bank - 1]); | ||
350 | if (ret) | ||
351 | goto notfound_resource; | ||
352 | |||
353 | /* Enable chip in bank. */ | ||
354 | jz_gpio_set_function(gpio, JZ_GPIO_FUNC_MEM_CS0); | ||
355 | ctrl = readl(nand->base + JZ_REG_NAND_CTRL); | ||
356 | ctrl |= JZ_NAND_CTRL_ENABLE_CHIP(bank - 1); | ||
357 | writel(ctrl, nand->base + JZ_REG_NAND_CTRL); | ||
358 | |||
359 | if (chipnr == 0) { | ||
360 | /* Detect first chip. */ | ||
361 | ret = nand_scan_ident(mtd, 1, NULL); | ||
362 | if (ret) | ||
363 | goto notfound_id; | ||
364 | |||
365 | /* Retrieve the IDs from the first chip. */ | ||
366 | chip->select_chip(mtd, 0); | ||
367 | chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1); | ||
368 | chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1); | ||
369 | *nand_maf_id = chip->read_byte(mtd); | ||
370 | *nand_dev_id = chip->read_byte(mtd); | ||
371 | } else { | ||
372 | /* Detect additional chip. */ | ||
373 | chip->select_chip(mtd, chipnr); | ||
374 | chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1); | ||
375 | chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1); | ||
376 | if (*nand_maf_id != chip->read_byte(mtd) | ||
377 | || *nand_dev_id != chip->read_byte(mtd)) { | ||
378 | ret = -ENODEV; | ||
379 | goto notfound_id; | ||
380 | } | ||
381 | |||
382 | /* Update size of the MTD. */ | ||
383 | chip->numchips++; | ||
384 | mtd->size += chip->chipsize; | ||
385 | } | ||
386 | |||
387 | dev_info(&pdev->dev, "Found chip %i on bank %i\n", chipnr, bank); | ||
388 | return 0; | ||
389 | |||
390 | notfound_id: | ||
391 | dev_info(&pdev->dev, "No chip found on bank %i\n", bank); | ||
392 | ctrl &= ~(JZ_NAND_CTRL_ENABLE_CHIP(bank - 1)); | ||
393 | writel(ctrl, nand->base + JZ_REG_NAND_CTRL); | ||
394 | jz_gpio_set_function(gpio, JZ_GPIO_FUNC_NONE); | ||
395 | jz_nand_iounmap_resource(nand->bank_mem[bank - 1], | ||
396 | nand->bank_base[bank - 1]); | ||
397 | notfound_resource: | ||
398 | gpio_free(gpio); | ||
399 | notfound_gpio: | ||
400 | return ret; | ||
401 | } | ||
402 | |||
291 | static int __devinit jz_nand_probe(struct platform_device *pdev) | 403 | static int __devinit jz_nand_probe(struct platform_device *pdev) |
292 | { | 404 | { |
293 | int ret; | 405 | int ret; |
@@ -295,6 +407,8 @@ static int __devinit jz_nand_probe(struct platform_device *pdev) | |||
295 | struct nand_chip *chip; | 407 | struct nand_chip *chip; |
296 | struct mtd_info *mtd; | 408 | struct mtd_info *mtd; |
297 | struct jz_nand_platform_data *pdata = pdev->dev.platform_data; | 409 | struct jz_nand_platform_data *pdata = pdev->dev.platform_data; |
410 | size_t chipnr, bank_idx; | ||
411 | uint8_t nand_maf_id = 0, nand_dev_id = 0; | ||
298 | 412 | ||
299 | nand = kzalloc(sizeof(*nand), GFP_KERNEL); | 413 | nand = kzalloc(sizeof(*nand), GFP_KERNEL); |
300 | if (!nand) { | 414 | if (!nand) { |
@@ -305,10 +419,6 @@ static int __devinit jz_nand_probe(struct platform_device *pdev) | |||
305 | ret = jz_nand_ioremap_resource(pdev, "mmio", &nand->mem, &nand->base); | 419 | ret = jz_nand_ioremap_resource(pdev, "mmio", &nand->mem, &nand->base); |
306 | if (ret) | 420 | if (ret) |
307 | goto err_free; | 421 | goto err_free; |
308 | ret = jz_nand_ioremap_resource(pdev, "bank", &nand->bank_mem, | ||
309 | &nand->bank_base); | ||
310 | if (ret) | ||
311 | goto err_iounmap_mmio; | ||
312 | 422 | ||
313 | if (pdata && gpio_is_valid(pdata->busy_gpio)) { | 423 | if (pdata && gpio_is_valid(pdata->busy_gpio)) { |
314 | ret = gpio_request(pdata->busy_gpio, "NAND busy pin"); | 424 | ret = gpio_request(pdata->busy_gpio, "NAND busy pin"); |
@@ -316,7 +426,7 @@ static int __devinit jz_nand_probe(struct platform_device *pdev) | |||
316 | dev_err(&pdev->dev, | 426 | dev_err(&pdev->dev, |
317 | "Failed to request busy gpio %d: %d\n", | 427 | "Failed to request busy gpio %d: %d\n", |
318 | pdata->busy_gpio, ret); | 428 | pdata->busy_gpio, ret); |
319 | goto err_iounmap_mem; | 429 | goto err_iounmap_mmio; |
320 | } | 430 | } |
321 | } | 431 | } |
322 | 432 | ||
@@ -339,22 +449,51 @@ static int __devinit jz_nand_probe(struct platform_device *pdev) | |||
339 | 449 | ||
340 | chip->chip_delay = 50; | 450 | chip->chip_delay = 50; |
341 | chip->cmd_ctrl = jz_nand_cmd_ctrl; | 451 | chip->cmd_ctrl = jz_nand_cmd_ctrl; |
452 | chip->select_chip = jz_nand_select_chip; | ||
342 | 453 | ||
343 | if (pdata && gpio_is_valid(pdata->busy_gpio)) | 454 | if (pdata && gpio_is_valid(pdata->busy_gpio)) |
344 | chip->dev_ready = jz_nand_dev_ready; | 455 | chip->dev_ready = jz_nand_dev_ready; |
345 | 456 | ||
346 | chip->IO_ADDR_R = nand->bank_base; | ||
347 | chip->IO_ADDR_W = nand->bank_base; | ||
348 | |||
349 | nand->pdata = pdata; | 457 | nand->pdata = pdata; |
350 | platform_set_drvdata(pdev, nand); | 458 | platform_set_drvdata(pdev, nand); |
351 | 459 | ||
352 | writel(JZ_NAND_CTRL_ENABLE_CHIP(0), nand->base + JZ_REG_NAND_CTRL); | 460 | /* We are going to autodetect NAND chips in the banks specified in the |
353 | 461 | * platform data. Although nand_scan_ident() can detect multiple chips, | |
354 | ret = nand_scan_ident(mtd, 1, NULL); | 462 | * it requires those chips to be numbered consecuitively, which is not |
355 | if (ret) { | 463 | * always the case for external memory banks. And a fixed chip-to-bank |
356 | dev_err(&pdev->dev, "Failed to scan nand\n"); | 464 | * mapping is not practical either, since for example Dingoo units |
357 | goto err_gpio_free; | 465 | * produced at different times have NAND chips in different banks. |
466 | */ | ||
467 | chipnr = 0; | ||
468 | for (bank_idx = 0; bank_idx < JZ_NAND_NUM_BANKS; bank_idx++) { | ||
469 | unsigned char bank; | ||
470 | |||
471 | /* If there is no platform data, look for NAND in bank 1, | ||
472 | * which is the most likely bank since it is the only one | ||
473 | * that can be booted from. | ||
474 | */ | ||
475 | bank = pdata ? pdata->banks[bank_idx] : bank_idx ^ 1; | ||
476 | if (bank == 0) | ||
477 | break; | ||
478 | if (bank > JZ_NAND_NUM_BANKS) { | ||
479 | dev_warn(&pdev->dev, | ||
480 | "Skipping non-existing bank: %d\n", bank); | ||
481 | continue; | ||
482 | } | ||
483 | /* The detection routine will directly or indirectly call | ||
484 | * jz_nand_select_chip(), so nand->banks has to contain the | ||
485 | * bank we're checking. | ||
486 | */ | ||
487 | nand->banks[chipnr] = bank; | ||
488 | if (jz_nand_detect_bank(pdev, nand, bank, chipnr, | ||
489 | &nand_maf_id, &nand_dev_id) == 0) | ||
490 | chipnr++; | ||
491 | else | ||
492 | nand->banks[chipnr] = 0; | ||
493 | } | ||
494 | if (chipnr == 0) { | ||
495 | dev_err(&pdev->dev, "No NAND chips found\n"); | ||
496 | goto err_gpio_busy; | ||
358 | } | 497 | } |
359 | 498 | ||
360 | if (pdata && pdata->ident_callback) { | 499 | if (pdata && pdata->ident_callback) { |
@@ -364,8 +503,8 @@ static int __devinit jz_nand_probe(struct platform_device *pdev) | |||
364 | 503 | ||
365 | ret = nand_scan_tail(mtd); | 504 | ret = nand_scan_tail(mtd); |
366 | if (ret) { | 505 | if (ret) { |
367 | dev_err(&pdev->dev, "Failed to scan nand\n"); | 506 | dev_err(&pdev->dev, "Failed to scan NAND\n"); |
368 | goto err_gpio_free; | 507 | goto err_unclaim_banks; |
369 | } | 508 | } |
370 | 509 | ||
371 | ret = mtd_device_parse_register(mtd, NULL, NULL, | 510 | ret = mtd_device_parse_register(mtd, NULL, NULL, |
@@ -382,14 +521,21 @@ static int __devinit jz_nand_probe(struct platform_device *pdev) | |||
382 | return 0; | 521 | return 0; |
383 | 522 | ||
384 | err_nand_release: | 523 | err_nand_release: |
385 | nand_release(&nand->mtd); | 524 | nand_release(mtd); |
386 | err_gpio_free: | 525 | err_unclaim_banks: |
526 | while (chipnr--) { | ||
527 | unsigned char bank = nand->banks[chipnr]; | ||
528 | gpio_free(JZ_GPIO_MEM_CS0 + bank - 1); | ||
529 | jz_nand_iounmap_resource(nand->bank_mem[bank - 1], | ||
530 | nand->bank_base[bank - 1]); | ||
531 | } | ||
532 | writel(0, nand->base + JZ_REG_NAND_CTRL); | ||
533 | err_gpio_busy: | ||
534 | if (pdata && gpio_is_valid(pdata->busy_gpio)) | ||
535 | gpio_free(pdata->busy_gpio); | ||
387 | platform_set_drvdata(pdev, NULL); | 536 | platform_set_drvdata(pdev, NULL); |
388 | gpio_free(pdata->busy_gpio); | ||
389 | err_iounmap_mem: | ||
390 | iounmap(nand->bank_base); | ||
391 | err_iounmap_mmio: | 537 | err_iounmap_mmio: |
392 | iounmap(nand->base); | 538 | jz_nand_iounmap_resource(nand->mem, nand->base); |
393 | err_free: | 539 | err_free: |
394 | kfree(nand); | 540 | kfree(nand); |
395 | return ret; | 541 | return ret; |
@@ -398,16 +544,26 @@ err_free: | |||
398 | static int __devexit jz_nand_remove(struct platform_device *pdev) | 544 | static int __devexit jz_nand_remove(struct platform_device *pdev) |
399 | { | 545 | { |
400 | struct jz_nand *nand = platform_get_drvdata(pdev); | 546 | struct jz_nand *nand = platform_get_drvdata(pdev); |
547 | struct jz_nand_platform_data *pdata = pdev->dev.platform_data; | ||
548 | size_t i; | ||
401 | 549 | ||
402 | nand_release(&nand->mtd); | 550 | nand_release(&nand->mtd); |
403 | 551 | ||
404 | /* Deassert and disable all chips */ | 552 | /* Deassert and disable all chips */ |
405 | writel(0, nand->base + JZ_REG_NAND_CTRL); | 553 | writel(0, nand->base + JZ_REG_NAND_CTRL); |
406 | 554 | ||
407 | iounmap(nand->bank_base); | 555 | for (i = 0; i < JZ_NAND_NUM_BANKS; ++i) { |
408 | release_mem_region(nand->bank_mem->start, resource_size(nand->bank_mem)); | 556 | unsigned char bank = nand->banks[i]; |
409 | iounmap(nand->base); | 557 | if (bank != 0) { |
410 | release_mem_region(nand->mem->start, resource_size(nand->mem)); | 558 | jz_nand_iounmap_resource(nand->bank_mem[bank - 1], |
559 | nand->bank_base[bank - 1]); | ||
560 | gpio_free(JZ_GPIO_MEM_CS0 + bank - 1); | ||
561 | } | ||
562 | } | ||
563 | if (pdata && gpio_is_valid(pdata->busy_gpio)) | ||
564 | gpio_free(pdata->busy_gpio); | ||
565 | |||
566 | jz_nand_iounmap_resource(nand->mem, nand->base); | ||
411 | 567 | ||
412 | platform_set_drvdata(pdev, NULL); | 568 | platform_set_drvdata(pdev, NULL); |
413 | kfree(nand); | 569 | kfree(nand); |
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c index cd827ff4a021..c42bbb16cdae 100644 --- a/drivers/net/ethernet/octeon/octeon_mgmt.c +++ b/drivers/net/ethernet/octeon/octeon_mgmt.c | |||
@@ -6,19 +6,21 @@ | |||
6 | * Copyright (C) 2009 Cavium Networks | 6 | * Copyright (C) 2009 Cavium Networks |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/capability.h> | 9 | #include <linux/platform_device.h> |
10 | #include <linux/dma-mapping.h> | 10 | #include <linux/dma-mapping.h> |
11 | #include <linux/init.h> | 11 | #include <linux/etherdevice.h> |
12 | #include <linux/module.h> | 12 | #include <linux/capability.h> |
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/netdevice.h> | 14 | #include <linux/netdevice.h> |
16 | #include <linux/etherdevice.h> | 15 | #include <linux/spinlock.h> |
17 | #include <linux/if.h> | ||
18 | #include <linux/if_vlan.h> | 16 | #include <linux/if_vlan.h> |
17 | #include <linux/of_mdio.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/of_net.h> | ||
20 | #include <linux/init.h> | ||
19 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
20 | #include <linux/phy.h> | 22 | #include <linux/phy.h> |
21 | #include <linux/spinlock.h> | 23 | #include <linux/io.h> |
22 | 24 | ||
23 | #include <asm/octeon/octeon.h> | 25 | #include <asm/octeon/octeon.h> |
24 | #include <asm/octeon/cvmx-mixx-defs.h> | 26 | #include <asm/octeon/cvmx-mixx-defs.h> |
@@ -58,8 +60,56 @@ union mgmt_port_ring_entry { | |||
58 | } s; | 60 | } s; |
59 | }; | 61 | }; |
60 | 62 | ||
63 | #define MIX_ORING1 0x0 | ||
64 | #define MIX_ORING2 0x8 | ||
65 | #define MIX_IRING1 0x10 | ||
66 | #define MIX_IRING2 0x18 | ||
67 | #define MIX_CTL 0x20 | ||
68 | #define MIX_IRHWM 0x28 | ||
69 | #define MIX_IRCNT 0x30 | ||
70 | #define MIX_ORHWM 0x38 | ||
71 | #define MIX_ORCNT 0x40 | ||
72 | #define MIX_ISR 0x48 | ||
73 | #define MIX_INTENA 0x50 | ||
74 | #define MIX_REMCNT 0x58 | ||
75 | #define MIX_BIST 0x78 | ||
76 | |||
77 | #define AGL_GMX_PRT_CFG 0x10 | ||
78 | #define AGL_GMX_RX_FRM_CTL 0x18 | ||
79 | #define AGL_GMX_RX_FRM_MAX 0x30 | ||
80 | #define AGL_GMX_RX_JABBER 0x38 | ||
81 | #define AGL_GMX_RX_STATS_CTL 0x50 | ||
82 | |||
83 | #define AGL_GMX_RX_STATS_PKTS_DRP 0xb0 | ||
84 | #define AGL_GMX_RX_STATS_OCTS_DRP 0xb8 | ||
85 | #define AGL_GMX_RX_STATS_PKTS_BAD 0xc0 | ||
86 | |||
87 | #define AGL_GMX_RX_ADR_CTL 0x100 | ||
88 | #define AGL_GMX_RX_ADR_CAM_EN 0x108 | ||
89 | #define AGL_GMX_RX_ADR_CAM0 0x180 | ||
90 | #define AGL_GMX_RX_ADR_CAM1 0x188 | ||
91 | #define AGL_GMX_RX_ADR_CAM2 0x190 | ||
92 | #define AGL_GMX_RX_ADR_CAM3 0x198 | ||
93 | #define AGL_GMX_RX_ADR_CAM4 0x1a0 | ||
94 | #define AGL_GMX_RX_ADR_CAM5 0x1a8 | ||
95 | |||
96 | #define AGL_GMX_TX_STATS_CTL 0x268 | ||
97 | #define AGL_GMX_TX_CTL 0x270 | ||
98 | #define AGL_GMX_TX_STAT0 0x280 | ||
99 | #define AGL_GMX_TX_STAT1 0x288 | ||
100 | #define AGL_GMX_TX_STAT2 0x290 | ||
101 | #define AGL_GMX_TX_STAT3 0x298 | ||
102 | #define AGL_GMX_TX_STAT4 0x2a0 | ||
103 | #define AGL_GMX_TX_STAT5 0x2a8 | ||
104 | #define AGL_GMX_TX_STAT6 0x2b0 | ||
105 | #define AGL_GMX_TX_STAT7 0x2b8 | ||
106 | #define AGL_GMX_TX_STAT8 0x2c0 | ||
107 | #define AGL_GMX_TX_STAT9 0x2c8 | ||
108 | |||
61 | struct octeon_mgmt { | 109 | struct octeon_mgmt { |
62 | struct net_device *netdev; | 110 | struct net_device *netdev; |
111 | u64 mix; | ||
112 | u64 agl; | ||
63 | int port; | 113 | int port; |
64 | int irq; | 114 | int irq; |
65 | u64 *tx_ring; | 115 | u64 *tx_ring; |
@@ -85,31 +135,34 @@ struct octeon_mgmt { | |||
85 | struct napi_struct napi; | 135 | struct napi_struct napi; |
86 | struct tasklet_struct tx_clean_tasklet; | 136 | struct tasklet_struct tx_clean_tasklet; |
87 | struct phy_device *phydev; | 137 | struct phy_device *phydev; |
138 | struct device_node *phy_np; | ||
139 | resource_size_t mix_phys; | ||
140 | resource_size_t mix_size; | ||
141 | resource_size_t agl_phys; | ||
142 | resource_size_t agl_size; | ||
88 | }; | 143 | }; |
89 | 144 | ||
90 | static void octeon_mgmt_set_rx_irq(struct octeon_mgmt *p, int enable) | 145 | static void octeon_mgmt_set_rx_irq(struct octeon_mgmt *p, int enable) |
91 | { | 146 | { |
92 | int port = p->port; | ||
93 | union cvmx_mixx_intena mix_intena; | 147 | union cvmx_mixx_intena mix_intena; |
94 | unsigned long flags; | 148 | unsigned long flags; |
95 | 149 | ||
96 | spin_lock_irqsave(&p->lock, flags); | 150 | spin_lock_irqsave(&p->lock, flags); |
97 | mix_intena.u64 = cvmx_read_csr(CVMX_MIXX_INTENA(port)); | 151 | mix_intena.u64 = cvmx_read_csr(p->mix + MIX_INTENA); |
98 | mix_intena.s.ithena = enable ? 1 : 0; | 152 | mix_intena.s.ithena = enable ? 1 : 0; |
99 | cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64); | 153 | cvmx_write_csr(p->mix + MIX_INTENA, mix_intena.u64); |
100 | spin_unlock_irqrestore(&p->lock, flags); | 154 | spin_unlock_irqrestore(&p->lock, flags); |
101 | } | 155 | } |
102 | 156 | ||
103 | static void octeon_mgmt_set_tx_irq(struct octeon_mgmt *p, int enable) | 157 | static void octeon_mgmt_set_tx_irq(struct octeon_mgmt *p, int enable) |
104 | { | 158 | { |
105 | int port = p->port; | ||
106 | union cvmx_mixx_intena mix_intena; | 159 | union cvmx_mixx_intena mix_intena; |
107 | unsigned long flags; | 160 | unsigned long flags; |
108 | 161 | ||
109 | spin_lock_irqsave(&p->lock, flags); | 162 | spin_lock_irqsave(&p->lock, flags); |
110 | mix_intena.u64 = cvmx_read_csr(CVMX_MIXX_INTENA(port)); | 163 | mix_intena.u64 = cvmx_read_csr(p->mix + MIX_INTENA); |
111 | mix_intena.s.othena = enable ? 1 : 0; | 164 | mix_intena.s.othena = enable ? 1 : 0; |
112 | cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64); | 165 | cvmx_write_csr(p->mix + MIX_INTENA, mix_intena.u64); |
113 | spin_unlock_irqrestore(&p->lock, flags); | 166 | spin_unlock_irqrestore(&p->lock, flags); |
114 | } | 167 | } |
115 | 168 | ||
@@ -146,7 +199,6 @@ static unsigned int ring_size_to_bytes(unsigned int ring_size) | |||
146 | static void octeon_mgmt_rx_fill_ring(struct net_device *netdev) | 199 | static void octeon_mgmt_rx_fill_ring(struct net_device *netdev) |
147 | { | 200 | { |
148 | struct octeon_mgmt *p = netdev_priv(netdev); | 201 | struct octeon_mgmt *p = netdev_priv(netdev); |
149 | int port = p->port; | ||
150 | 202 | ||
151 | while (p->rx_current_fill < ring_max_fill(OCTEON_MGMT_RX_RING_SIZE)) { | 203 | while (p->rx_current_fill < ring_max_fill(OCTEON_MGMT_RX_RING_SIZE)) { |
152 | unsigned int size; | 204 | unsigned int size; |
@@ -177,24 +229,23 @@ static void octeon_mgmt_rx_fill_ring(struct net_device *netdev) | |||
177 | (p->rx_next_fill + 1) % OCTEON_MGMT_RX_RING_SIZE; | 229 | (p->rx_next_fill + 1) % OCTEON_MGMT_RX_RING_SIZE; |
178 | p->rx_current_fill++; | 230 | p->rx_current_fill++; |
179 | /* Ring the bell. */ | 231 | /* Ring the bell. */ |
180 | cvmx_write_csr(CVMX_MIXX_IRING2(port), 1); | 232 | cvmx_write_csr(p->mix + MIX_IRING2, 1); |
181 | } | 233 | } |
182 | } | 234 | } |
183 | 235 | ||
184 | static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p) | 236 | static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p) |
185 | { | 237 | { |
186 | int port = p->port; | ||
187 | union cvmx_mixx_orcnt mix_orcnt; | 238 | union cvmx_mixx_orcnt mix_orcnt; |
188 | union mgmt_port_ring_entry re; | 239 | union mgmt_port_ring_entry re; |
189 | struct sk_buff *skb; | 240 | struct sk_buff *skb; |
190 | int cleaned = 0; | 241 | int cleaned = 0; |
191 | unsigned long flags; | 242 | unsigned long flags; |
192 | 243 | ||
193 | mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port)); | 244 | mix_orcnt.u64 = cvmx_read_csr(p->mix + MIX_ORCNT); |
194 | while (mix_orcnt.s.orcnt) { | 245 | while (mix_orcnt.s.orcnt) { |
195 | spin_lock_irqsave(&p->tx_list.lock, flags); | 246 | spin_lock_irqsave(&p->tx_list.lock, flags); |
196 | 247 | ||
197 | mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port)); | 248 | mix_orcnt.u64 = cvmx_read_csr(p->mix + MIX_ORCNT); |
198 | 249 | ||
199 | if (mix_orcnt.s.orcnt == 0) { | 250 | if (mix_orcnt.s.orcnt == 0) { |
200 | spin_unlock_irqrestore(&p->tx_list.lock, flags); | 251 | spin_unlock_irqrestore(&p->tx_list.lock, flags); |
@@ -214,7 +265,7 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p) | |||
214 | mix_orcnt.s.orcnt = 1; | 265 | mix_orcnt.s.orcnt = 1; |
215 | 266 | ||
216 | /* Acknowledge to hardware that we have the buffer. */ | 267 | /* Acknowledge to hardware that we have the buffer. */ |
217 | cvmx_write_csr(CVMX_MIXX_ORCNT(port), mix_orcnt.u64); | 268 | cvmx_write_csr(p->mix + MIX_ORCNT, mix_orcnt.u64); |
218 | p->tx_current_fill--; | 269 | p->tx_current_fill--; |
219 | 270 | ||
220 | spin_unlock_irqrestore(&p->tx_list.lock, flags); | 271 | spin_unlock_irqrestore(&p->tx_list.lock, flags); |
@@ -224,7 +275,7 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p) | |||
224 | dev_kfree_skb_any(skb); | 275 | dev_kfree_skb_any(skb); |
225 | cleaned++; | 276 | cleaned++; |
226 | 277 | ||
227 | mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port)); | 278 | mix_orcnt.u64 = cvmx_read_csr(p->mix + MIX_ORCNT); |
228 | } | 279 | } |
229 | 280 | ||
230 | if (cleaned && netif_queue_stopped(p->netdev)) | 281 | if (cleaned && netif_queue_stopped(p->netdev)) |
@@ -241,13 +292,12 @@ static void octeon_mgmt_clean_tx_tasklet(unsigned long arg) | |||
241 | static void octeon_mgmt_update_rx_stats(struct net_device *netdev) | 292 | static void octeon_mgmt_update_rx_stats(struct net_device *netdev) |
242 | { | 293 | { |
243 | struct octeon_mgmt *p = netdev_priv(netdev); | 294 | struct octeon_mgmt *p = netdev_priv(netdev); |
244 | int port = p->port; | ||
245 | unsigned long flags; | 295 | unsigned long flags; |
246 | u64 drop, bad; | 296 | u64 drop, bad; |
247 | 297 | ||
248 | /* These reads also clear the count registers. */ | 298 | /* These reads also clear the count registers. */ |
249 | drop = cvmx_read_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(port)); | 299 | drop = cvmx_read_csr(p->agl + AGL_GMX_RX_STATS_PKTS_DRP); |
250 | bad = cvmx_read_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(port)); | 300 | bad = cvmx_read_csr(p->agl + AGL_GMX_RX_STATS_PKTS_BAD); |
251 | 301 | ||
252 | if (drop || bad) { | 302 | if (drop || bad) { |
253 | /* Do an atomic update. */ | 303 | /* Do an atomic update. */ |
@@ -261,15 +311,14 @@ static void octeon_mgmt_update_rx_stats(struct net_device *netdev) | |||
261 | static void octeon_mgmt_update_tx_stats(struct net_device *netdev) | 311 | static void octeon_mgmt_update_tx_stats(struct net_device *netdev) |
262 | { | 312 | { |
263 | struct octeon_mgmt *p = netdev_priv(netdev); | 313 | struct octeon_mgmt *p = netdev_priv(netdev); |
264 | int port = p->port; | ||
265 | unsigned long flags; | 314 | unsigned long flags; |
266 | 315 | ||
267 | union cvmx_agl_gmx_txx_stat0 s0; | 316 | union cvmx_agl_gmx_txx_stat0 s0; |
268 | union cvmx_agl_gmx_txx_stat1 s1; | 317 | union cvmx_agl_gmx_txx_stat1 s1; |
269 | 318 | ||
270 | /* These reads also clear the count registers. */ | 319 | /* These reads also clear the count registers. */ |
271 | s0.u64 = cvmx_read_csr(CVMX_AGL_GMX_TXX_STAT0(port)); | 320 | s0.u64 = cvmx_read_csr(p->agl + AGL_GMX_TX_STAT0); |
272 | s1.u64 = cvmx_read_csr(CVMX_AGL_GMX_TXX_STAT1(port)); | 321 | s1.u64 = cvmx_read_csr(p->agl + AGL_GMX_TX_STAT1); |
273 | 322 | ||
274 | if (s0.s.xsdef || s0.s.xscol || s1.s.scol || s1.s.mcol) { | 323 | if (s0.s.xsdef || s0.s.xscol || s1.s.scol || s1.s.mcol) { |
275 | /* Do an atomic update. */ | 324 | /* Do an atomic update. */ |
@@ -308,7 +357,6 @@ static u64 octeon_mgmt_dequeue_rx_buffer(struct octeon_mgmt *p, | |||
308 | 357 | ||
309 | static int octeon_mgmt_receive_one(struct octeon_mgmt *p) | 358 | static int octeon_mgmt_receive_one(struct octeon_mgmt *p) |
310 | { | 359 | { |
311 | int port = p->port; | ||
312 | struct net_device *netdev = p->netdev; | 360 | struct net_device *netdev = p->netdev; |
313 | union cvmx_mixx_ircnt mix_ircnt; | 361 | union cvmx_mixx_ircnt mix_ircnt; |
314 | union mgmt_port_ring_entry re; | 362 | union mgmt_port_ring_entry re; |
@@ -381,18 +429,17 @@ done: | |||
381 | /* Tell the hardware we processed a packet. */ | 429 | /* Tell the hardware we processed a packet. */ |
382 | mix_ircnt.u64 = 0; | 430 | mix_ircnt.u64 = 0; |
383 | mix_ircnt.s.ircnt = 1; | 431 | mix_ircnt.s.ircnt = 1; |
384 | cvmx_write_csr(CVMX_MIXX_IRCNT(port), mix_ircnt.u64); | 432 | cvmx_write_csr(p->mix + MIX_IRCNT, mix_ircnt.u64); |
385 | return rc; | 433 | return rc; |
386 | } | 434 | } |
387 | 435 | ||
388 | static int octeon_mgmt_receive_packets(struct octeon_mgmt *p, int budget) | 436 | static int octeon_mgmt_receive_packets(struct octeon_mgmt *p, int budget) |
389 | { | 437 | { |
390 | int port = p->port; | ||
391 | unsigned int work_done = 0; | 438 | unsigned int work_done = 0; |
392 | union cvmx_mixx_ircnt mix_ircnt; | 439 | union cvmx_mixx_ircnt mix_ircnt; |
393 | int rc; | 440 | int rc; |
394 | 441 | ||
395 | mix_ircnt.u64 = cvmx_read_csr(CVMX_MIXX_IRCNT(port)); | 442 | mix_ircnt.u64 = cvmx_read_csr(p->mix + MIX_IRCNT); |
396 | while (work_done < budget && mix_ircnt.s.ircnt) { | 443 | while (work_done < budget && mix_ircnt.s.ircnt) { |
397 | 444 | ||
398 | rc = octeon_mgmt_receive_one(p); | 445 | rc = octeon_mgmt_receive_one(p); |
@@ -400,7 +447,7 @@ static int octeon_mgmt_receive_packets(struct octeon_mgmt *p, int budget) | |||
400 | work_done++; | 447 | work_done++; |
401 | 448 | ||
402 | /* Check for more packets. */ | 449 | /* Check for more packets. */ |
403 | mix_ircnt.u64 = cvmx_read_csr(CVMX_MIXX_IRCNT(port)); | 450 | mix_ircnt.u64 = cvmx_read_csr(p->mix + MIX_IRCNT); |
404 | } | 451 | } |
405 | 452 | ||
406 | octeon_mgmt_rx_fill_ring(p->netdev); | 453 | octeon_mgmt_rx_fill_ring(p->netdev); |
@@ -434,16 +481,16 @@ static void octeon_mgmt_reset_hw(struct octeon_mgmt *p) | |||
434 | union cvmx_agl_gmx_bist agl_gmx_bist; | 481 | union cvmx_agl_gmx_bist agl_gmx_bist; |
435 | 482 | ||
436 | mix_ctl.u64 = 0; | 483 | mix_ctl.u64 = 0; |
437 | cvmx_write_csr(CVMX_MIXX_CTL(p->port), mix_ctl.u64); | 484 | cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64); |
438 | do { | 485 | do { |
439 | mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(p->port)); | 486 | mix_ctl.u64 = cvmx_read_csr(p->mix + MIX_CTL); |
440 | } while (mix_ctl.s.busy); | 487 | } while (mix_ctl.s.busy); |
441 | mix_ctl.s.reset = 1; | 488 | mix_ctl.s.reset = 1; |
442 | cvmx_write_csr(CVMX_MIXX_CTL(p->port), mix_ctl.u64); | 489 | cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64); |
443 | cvmx_read_csr(CVMX_MIXX_CTL(p->port)); | 490 | cvmx_read_csr(p->mix + MIX_CTL); |
444 | cvmx_wait(64); | 491 | cvmx_wait(64); |
445 | 492 | ||
446 | mix_bist.u64 = cvmx_read_csr(CVMX_MIXX_BIST(p->port)); | 493 | mix_bist.u64 = cvmx_read_csr(p->mix + MIX_BIST); |
447 | if (mix_bist.u64) | 494 | if (mix_bist.u64) |
448 | dev_warn(p->dev, "MIX failed BIST (0x%016llx)\n", | 495 | dev_warn(p->dev, "MIX failed BIST (0x%016llx)\n", |
449 | (unsigned long long)mix_bist.u64); | 496 | (unsigned long long)mix_bist.u64); |
@@ -474,7 +521,6 @@ static void octeon_mgmt_cam_state_add(struct octeon_mgmt_cam_state *cs, | |||
474 | static void octeon_mgmt_set_rx_filtering(struct net_device *netdev) | 521 | static void octeon_mgmt_set_rx_filtering(struct net_device *netdev) |
475 | { | 522 | { |
476 | struct octeon_mgmt *p = netdev_priv(netdev); | 523 | struct octeon_mgmt *p = netdev_priv(netdev); |
477 | int port = p->port; | ||
478 | union cvmx_agl_gmx_rxx_adr_ctl adr_ctl; | 524 | union cvmx_agl_gmx_rxx_adr_ctl adr_ctl; |
479 | union cvmx_agl_gmx_prtx_cfg agl_gmx_prtx; | 525 | union cvmx_agl_gmx_prtx_cfg agl_gmx_prtx; |
480 | unsigned long flags; | 526 | unsigned long flags; |
@@ -520,29 +566,29 @@ static void octeon_mgmt_set_rx_filtering(struct net_device *netdev) | |||
520 | spin_lock_irqsave(&p->lock, flags); | 566 | spin_lock_irqsave(&p->lock, flags); |
521 | 567 | ||
522 | /* Disable packet I/O. */ | 568 | /* Disable packet I/O. */ |
523 | agl_gmx_prtx.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port)); | 569 | agl_gmx_prtx.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG); |
524 | prev_packet_enable = agl_gmx_prtx.s.en; | 570 | prev_packet_enable = agl_gmx_prtx.s.en; |
525 | agl_gmx_prtx.s.en = 0; | 571 | agl_gmx_prtx.s.en = 0; |
526 | cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), agl_gmx_prtx.u64); | 572 | cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, agl_gmx_prtx.u64); |
527 | 573 | ||
528 | adr_ctl.u64 = 0; | 574 | adr_ctl.u64 = 0; |
529 | adr_ctl.s.cam_mode = cam_mode; | 575 | adr_ctl.s.cam_mode = cam_mode; |
530 | adr_ctl.s.mcst = multicast_mode; | 576 | adr_ctl.s.mcst = multicast_mode; |
531 | adr_ctl.s.bcst = 1; /* Allow broadcast */ | 577 | adr_ctl.s.bcst = 1; /* Allow broadcast */ |
532 | 578 | ||
533 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CTL(port), adr_ctl.u64); | 579 | cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CTL, adr_ctl.u64); |
534 | 580 | ||
535 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM0(port), cam_state.cam[0]); | 581 | cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM0, cam_state.cam[0]); |
536 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM1(port), cam_state.cam[1]); | 582 | cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM1, cam_state.cam[1]); |
537 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM2(port), cam_state.cam[2]); | 583 | cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM2, cam_state.cam[2]); |
538 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM3(port), cam_state.cam[3]); | 584 | cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM3, cam_state.cam[3]); |
539 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM4(port), cam_state.cam[4]); | 585 | cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM4, cam_state.cam[4]); |
540 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM5(port), cam_state.cam[5]); | 586 | cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM5, cam_state.cam[5]); |
541 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM_EN(port), cam_state.cam_mask); | 587 | cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM_EN, cam_state.cam_mask); |
542 | 588 | ||
543 | /* Restore packet I/O. */ | 589 | /* Restore packet I/O. */ |
544 | agl_gmx_prtx.s.en = prev_packet_enable; | 590 | agl_gmx_prtx.s.en = prev_packet_enable; |
545 | cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), agl_gmx_prtx.u64); | 591 | cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, agl_gmx_prtx.u64); |
546 | 592 | ||
547 | spin_unlock_irqrestore(&p->lock, flags); | 593 | spin_unlock_irqrestore(&p->lock, flags); |
548 | } | 594 | } |
@@ -564,7 +610,6 @@ static int octeon_mgmt_set_mac_address(struct net_device *netdev, void *addr) | |||
564 | static int octeon_mgmt_change_mtu(struct net_device *netdev, int new_mtu) | 610 | static int octeon_mgmt_change_mtu(struct net_device *netdev, int new_mtu) |
565 | { | 611 | { |
566 | struct octeon_mgmt *p = netdev_priv(netdev); | 612 | struct octeon_mgmt *p = netdev_priv(netdev); |
567 | int port = p->port; | ||
568 | int size_without_fcs = new_mtu + OCTEON_MGMT_RX_HEADROOM; | 613 | int size_without_fcs = new_mtu + OCTEON_MGMT_RX_HEADROOM; |
569 | 614 | ||
570 | /* | 615 | /* |
@@ -580,8 +625,8 @@ static int octeon_mgmt_change_mtu(struct net_device *netdev, int new_mtu) | |||
580 | 625 | ||
581 | netdev->mtu = new_mtu; | 626 | netdev->mtu = new_mtu; |
582 | 627 | ||
583 | cvmx_write_csr(CVMX_AGL_GMX_RXX_FRM_MAX(port), size_without_fcs); | 628 | cvmx_write_csr(p->agl + AGL_GMX_RX_FRM_MAX, size_without_fcs); |
584 | cvmx_write_csr(CVMX_AGL_GMX_RXX_JABBER(port), | 629 | cvmx_write_csr(p->agl + AGL_GMX_RX_JABBER, |
585 | (size_without_fcs + 7) & 0xfff8); | 630 | (size_without_fcs + 7) & 0xfff8); |
586 | 631 | ||
587 | return 0; | 632 | return 0; |
@@ -591,14 +636,13 @@ static irqreturn_t octeon_mgmt_interrupt(int cpl, void *dev_id) | |||
591 | { | 636 | { |
592 | struct net_device *netdev = dev_id; | 637 | struct net_device *netdev = dev_id; |
593 | struct octeon_mgmt *p = netdev_priv(netdev); | 638 | struct octeon_mgmt *p = netdev_priv(netdev); |
594 | int port = p->port; | ||
595 | union cvmx_mixx_isr mixx_isr; | 639 | union cvmx_mixx_isr mixx_isr; |
596 | 640 | ||
597 | mixx_isr.u64 = cvmx_read_csr(CVMX_MIXX_ISR(port)); | 641 | mixx_isr.u64 = cvmx_read_csr(p->mix + MIX_ISR); |
598 | 642 | ||
599 | /* Clear any pending interrupts */ | 643 | /* Clear any pending interrupts */ |
600 | cvmx_write_csr(CVMX_MIXX_ISR(port), mixx_isr.u64); | 644 | cvmx_write_csr(p->mix + MIX_ISR, mixx_isr.u64); |
601 | cvmx_read_csr(CVMX_MIXX_ISR(port)); | 645 | cvmx_read_csr(p->mix + MIX_ISR); |
602 | 646 | ||
603 | if (mixx_isr.s.irthresh) { | 647 | if (mixx_isr.s.irthresh) { |
604 | octeon_mgmt_disable_rx_irq(p); | 648 | octeon_mgmt_disable_rx_irq(p); |
@@ -629,7 +673,6 @@ static int octeon_mgmt_ioctl(struct net_device *netdev, | |||
629 | static void octeon_mgmt_adjust_link(struct net_device *netdev) | 673 | static void octeon_mgmt_adjust_link(struct net_device *netdev) |
630 | { | 674 | { |
631 | struct octeon_mgmt *p = netdev_priv(netdev); | 675 | struct octeon_mgmt *p = netdev_priv(netdev); |
632 | int port = p->port; | ||
633 | union cvmx_agl_gmx_prtx_cfg prtx_cfg; | 676 | union cvmx_agl_gmx_prtx_cfg prtx_cfg; |
634 | unsigned long flags; | 677 | unsigned long flags; |
635 | int link_changed = 0; | 678 | int link_changed = 0; |
@@ -640,11 +683,9 @@ static void octeon_mgmt_adjust_link(struct net_device *netdev) | |||
640 | link_changed = 1; | 683 | link_changed = 1; |
641 | if (p->last_duplex != p->phydev->duplex) { | 684 | if (p->last_duplex != p->phydev->duplex) { |
642 | p->last_duplex = p->phydev->duplex; | 685 | p->last_duplex = p->phydev->duplex; |
643 | prtx_cfg.u64 = | 686 | prtx_cfg.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG); |
644 | cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port)); | ||
645 | prtx_cfg.s.duplex = p->phydev->duplex; | 687 | prtx_cfg.s.duplex = p->phydev->duplex; |
646 | cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), | 688 | cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, prtx_cfg.u64); |
647 | prtx_cfg.u64); | ||
648 | } | 689 | } |
649 | } else { | 690 | } else { |
650 | if (p->last_link) | 691 | if (p->last_link) |
@@ -670,18 +711,16 @@ static void octeon_mgmt_adjust_link(struct net_device *netdev) | |||
670 | static int octeon_mgmt_init_phy(struct net_device *netdev) | 711 | static int octeon_mgmt_init_phy(struct net_device *netdev) |
671 | { | 712 | { |
672 | struct octeon_mgmt *p = netdev_priv(netdev); | 713 | struct octeon_mgmt *p = netdev_priv(netdev); |
673 | char phy_id[MII_BUS_ID_SIZE + 3]; | ||
674 | 714 | ||
675 | if (octeon_is_simulation()) { | 715 | if (octeon_is_simulation() || p->phy_np == NULL) { |
676 | /* No PHYs in the simulator. */ | 716 | /* No PHYs in the simulator. */ |
677 | netif_carrier_on(netdev); | 717 | netif_carrier_on(netdev); |
678 | return 0; | 718 | return 0; |
679 | } | 719 | } |
680 | 720 | ||
681 | snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "mdio-octeon-0", p->port); | 721 | p->phydev = of_phy_connect(netdev, p->phy_np, |
682 | 722 | octeon_mgmt_adjust_link, 0, | |
683 | p->phydev = phy_connect(netdev, phy_id, octeon_mgmt_adjust_link, 0, | 723 | PHY_INTERFACE_MODE_MII); |
684 | PHY_INTERFACE_MODE_MII); | ||
685 | 724 | ||
686 | if (IS_ERR(p->phydev)) { | 725 | if (IS_ERR(p->phydev)) { |
687 | p->phydev = NULL; | 726 | p->phydev = NULL; |
@@ -737,14 +776,14 @@ static int octeon_mgmt_open(struct net_device *netdev) | |||
737 | 776 | ||
738 | octeon_mgmt_reset_hw(p); | 777 | octeon_mgmt_reset_hw(p); |
739 | 778 | ||
740 | mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(port)); | 779 | mix_ctl.u64 = cvmx_read_csr(p->mix + MIX_CTL); |
741 | 780 | ||
742 | /* Bring it out of reset if needed. */ | 781 | /* Bring it out of reset if needed. */ |
743 | if (mix_ctl.s.reset) { | 782 | if (mix_ctl.s.reset) { |
744 | mix_ctl.s.reset = 0; | 783 | mix_ctl.s.reset = 0; |
745 | cvmx_write_csr(CVMX_MIXX_CTL(port), mix_ctl.u64); | 784 | cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64); |
746 | do { | 785 | do { |
747 | mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(port)); | 786 | mix_ctl.u64 = cvmx_read_csr(p->mix + MIX_CTL); |
748 | } while (mix_ctl.s.reset); | 787 | } while (mix_ctl.s.reset); |
749 | } | 788 | } |
750 | 789 | ||
@@ -755,17 +794,17 @@ static int octeon_mgmt_open(struct net_device *netdev) | |||
755 | oring1.u64 = 0; | 794 | oring1.u64 = 0; |
756 | oring1.s.obase = p->tx_ring_handle >> 3; | 795 | oring1.s.obase = p->tx_ring_handle >> 3; |
757 | oring1.s.osize = OCTEON_MGMT_TX_RING_SIZE; | 796 | oring1.s.osize = OCTEON_MGMT_TX_RING_SIZE; |
758 | cvmx_write_csr(CVMX_MIXX_ORING1(port), oring1.u64); | 797 | cvmx_write_csr(p->mix + MIX_ORING1, oring1.u64); |
759 | 798 | ||
760 | iring1.u64 = 0; | 799 | iring1.u64 = 0; |
761 | iring1.s.ibase = p->rx_ring_handle >> 3; | 800 | iring1.s.ibase = p->rx_ring_handle >> 3; |
762 | iring1.s.isize = OCTEON_MGMT_RX_RING_SIZE; | 801 | iring1.s.isize = OCTEON_MGMT_RX_RING_SIZE; |
763 | cvmx_write_csr(CVMX_MIXX_IRING1(port), iring1.u64); | 802 | cvmx_write_csr(p->mix + MIX_IRING1, iring1.u64); |
764 | 803 | ||
765 | /* Disable packet I/O. */ | 804 | /* Disable packet I/O. */ |
766 | prtx_cfg.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port)); | 805 | prtx_cfg.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG); |
767 | prtx_cfg.s.en = 0; | 806 | prtx_cfg.s.en = 0; |
768 | cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), prtx_cfg.u64); | 807 | cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, prtx_cfg.u64); |
769 | 808 | ||
770 | memcpy(sa.sa_data, netdev->dev_addr, ETH_ALEN); | 809 | memcpy(sa.sa_data, netdev->dev_addr, ETH_ALEN); |
771 | octeon_mgmt_set_mac_address(netdev, &sa); | 810 | octeon_mgmt_set_mac_address(netdev, &sa); |
@@ -782,7 +821,7 @@ static int octeon_mgmt_open(struct net_device *netdev) | |||
782 | mix_ctl.s.nbtarb = 0; /* Arbitration mode */ | 821 | mix_ctl.s.nbtarb = 0; /* Arbitration mode */ |
783 | /* MII CB-request FIFO programmable high watermark */ | 822 | /* MII CB-request FIFO programmable high watermark */ |
784 | mix_ctl.s.mrq_hwm = 1; | 823 | mix_ctl.s.mrq_hwm = 1; |
785 | cvmx_write_csr(CVMX_MIXX_CTL(port), mix_ctl.u64); | 824 | cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64); |
786 | 825 | ||
787 | if (OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X) | 826 | if (OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X) |
788 | || OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_X)) { | 827 | || OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_X)) { |
@@ -809,16 +848,16 @@ static int octeon_mgmt_open(struct net_device *netdev) | |||
809 | 848 | ||
810 | /* Clear statistics. */ | 849 | /* Clear statistics. */ |
811 | /* Clear on read. */ | 850 | /* Clear on read. */ |
812 | cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_CTL(port), 1); | 851 | cvmx_write_csr(p->agl + AGL_GMX_RX_STATS_CTL, 1); |
813 | cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(port), 0); | 852 | cvmx_write_csr(p->agl + AGL_GMX_RX_STATS_PKTS_DRP, 0); |
814 | cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(port), 0); | 853 | cvmx_write_csr(p->agl + AGL_GMX_RX_STATS_PKTS_BAD, 0); |
815 | 854 | ||
816 | cvmx_write_csr(CVMX_AGL_GMX_TXX_STATS_CTL(port), 1); | 855 | cvmx_write_csr(p->agl + AGL_GMX_TX_STATS_CTL, 1); |
817 | cvmx_write_csr(CVMX_AGL_GMX_TXX_STAT0(port), 0); | 856 | cvmx_write_csr(p->agl + AGL_GMX_TX_STAT0, 0); |
818 | cvmx_write_csr(CVMX_AGL_GMX_TXX_STAT1(port), 0); | 857 | cvmx_write_csr(p->agl + AGL_GMX_TX_STAT1, 0); |
819 | 858 | ||
820 | /* Clear any pending interrupts */ | 859 | /* Clear any pending interrupts */ |
821 | cvmx_write_csr(CVMX_MIXX_ISR(port), cvmx_read_csr(CVMX_MIXX_ISR(port))); | 860 | cvmx_write_csr(p->mix + MIX_ISR, cvmx_read_csr(p->mix + MIX_ISR)); |
822 | 861 | ||
823 | if (request_irq(p->irq, octeon_mgmt_interrupt, 0, netdev->name, | 862 | if (request_irq(p->irq, octeon_mgmt_interrupt, 0, netdev->name, |
824 | netdev)) { | 863 | netdev)) { |
@@ -829,18 +868,18 @@ static int octeon_mgmt_open(struct net_device *netdev) | |||
829 | /* Interrupt every single RX packet */ | 868 | /* Interrupt every single RX packet */ |
830 | mix_irhwm.u64 = 0; | 869 | mix_irhwm.u64 = 0; |
831 | mix_irhwm.s.irhwm = 0; | 870 | mix_irhwm.s.irhwm = 0; |
832 | cvmx_write_csr(CVMX_MIXX_IRHWM(port), mix_irhwm.u64); | 871 | cvmx_write_csr(p->mix + MIX_IRHWM, mix_irhwm.u64); |
833 | 872 | ||
834 | /* Interrupt when we have 1 or more packets to clean. */ | 873 | /* Interrupt when we have 1 or more packets to clean. */ |
835 | mix_orhwm.u64 = 0; | 874 | mix_orhwm.u64 = 0; |
836 | mix_orhwm.s.orhwm = 1; | 875 | mix_orhwm.s.orhwm = 1; |
837 | cvmx_write_csr(CVMX_MIXX_ORHWM(port), mix_orhwm.u64); | 876 | cvmx_write_csr(p->mix + MIX_ORHWM, mix_orhwm.u64); |
838 | 877 | ||
839 | /* Enable receive and transmit interrupts */ | 878 | /* Enable receive and transmit interrupts */ |
840 | mix_intena.u64 = 0; | 879 | mix_intena.u64 = 0; |
841 | mix_intena.s.ithena = 1; | 880 | mix_intena.s.ithena = 1; |
842 | mix_intena.s.othena = 1; | 881 | mix_intena.s.othena = 1; |
843 | cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64); | 882 | cvmx_write_csr(p->mix + MIX_INTENA, mix_intena.u64); |
844 | 883 | ||
845 | 884 | ||
846 | /* Enable packet I/O. */ | 885 | /* Enable packet I/O. */ |
@@ -871,7 +910,7 @@ static int octeon_mgmt_open(struct net_device *netdev) | |||
871 | * frame. GMX checks that the PREAMBLE is sent correctly. | 910 | * frame. GMX checks that the PREAMBLE is sent correctly. |
872 | */ | 911 | */ |
873 | rxx_frm_ctl.s.pre_chk = 1; | 912 | rxx_frm_ctl.s.pre_chk = 1; |
874 | cvmx_write_csr(CVMX_AGL_GMX_RXX_FRM_CTL(port), rxx_frm_ctl.u64); | 913 | cvmx_write_csr(p->agl + AGL_GMX_RX_FRM_CTL, rxx_frm_ctl.u64); |
875 | 914 | ||
876 | /* Enable the AGL block */ | 915 | /* Enable the AGL block */ |
877 | agl_gmx_inf_mode.u64 = 0; | 916 | agl_gmx_inf_mode.u64 = 0; |
@@ -879,13 +918,13 @@ static int octeon_mgmt_open(struct net_device *netdev) | |||
879 | cvmx_write_csr(CVMX_AGL_GMX_INF_MODE, agl_gmx_inf_mode.u64); | 918 | cvmx_write_csr(CVMX_AGL_GMX_INF_MODE, agl_gmx_inf_mode.u64); |
880 | 919 | ||
881 | /* Configure the port duplex and enables */ | 920 | /* Configure the port duplex and enables */ |
882 | prtx_cfg.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port)); | 921 | prtx_cfg.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG); |
883 | prtx_cfg.s.tx_en = 1; | 922 | prtx_cfg.s.tx_en = 1; |
884 | prtx_cfg.s.rx_en = 1; | 923 | prtx_cfg.s.rx_en = 1; |
885 | prtx_cfg.s.en = 1; | 924 | prtx_cfg.s.en = 1; |
886 | p->last_duplex = 1; | 925 | p->last_duplex = 1; |
887 | prtx_cfg.s.duplex = p->last_duplex; | 926 | prtx_cfg.s.duplex = p->last_duplex; |
888 | cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), prtx_cfg.u64); | 927 | cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, prtx_cfg.u64); |
889 | 928 | ||
890 | p->last_link = 0; | 929 | p->last_link = 0; |
891 | netif_carrier_off(netdev); | 930 | netif_carrier_off(netdev); |
@@ -949,7 +988,6 @@ static int octeon_mgmt_stop(struct net_device *netdev) | |||
949 | static int octeon_mgmt_xmit(struct sk_buff *skb, struct net_device *netdev) | 988 | static int octeon_mgmt_xmit(struct sk_buff *skb, struct net_device *netdev) |
950 | { | 989 | { |
951 | struct octeon_mgmt *p = netdev_priv(netdev); | 990 | struct octeon_mgmt *p = netdev_priv(netdev); |
952 | int port = p->port; | ||
953 | union mgmt_port_ring_entry re; | 991 | union mgmt_port_ring_entry re; |
954 | unsigned long flags; | 992 | unsigned long flags; |
955 | int rv = NETDEV_TX_BUSY; | 993 | int rv = NETDEV_TX_BUSY; |
@@ -993,7 +1031,7 @@ static int octeon_mgmt_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
993 | netdev->stats.tx_bytes += skb->len; | 1031 | netdev->stats.tx_bytes += skb->len; |
994 | 1032 | ||
995 | /* Ring the bell. */ | 1033 | /* Ring the bell. */ |
996 | cvmx_write_csr(CVMX_MIXX_ORING2(port), 1); | 1034 | cvmx_write_csr(p->mix + MIX_ORING2, 1); |
997 | 1035 | ||
998 | rv = NETDEV_TX_OK; | 1036 | rv = NETDEV_TX_OK; |
999 | out: | 1037 | out: |
@@ -1071,10 +1109,14 @@ static const struct net_device_ops octeon_mgmt_ops = { | |||
1071 | 1109 | ||
1072 | static int __devinit octeon_mgmt_probe(struct platform_device *pdev) | 1110 | static int __devinit octeon_mgmt_probe(struct platform_device *pdev) |
1073 | { | 1111 | { |
1074 | struct resource *res_irq; | ||
1075 | struct net_device *netdev; | 1112 | struct net_device *netdev; |
1076 | struct octeon_mgmt *p; | 1113 | struct octeon_mgmt *p; |
1077 | int i; | 1114 | const __be32 *data; |
1115 | const u8 *mac; | ||
1116 | struct resource *res_mix; | ||
1117 | struct resource *res_agl; | ||
1118 | int len; | ||
1119 | int result; | ||
1078 | 1120 | ||
1079 | netdev = alloc_etherdev(sizeof(struct octeon_mgmt)); | 1121 | netdev = alloc_etherdev(sizeof(struct octeon_mgmt)); |
1080 | if (netdev == NULL) | 1122 | if (netdev == NULL) |
@@ -1088,14 +1130,63 @@ static int __devinit octeon_mgmt_probe(struct platform_device *pdev) | |||
1088 | p->netdev = netdev; | 1130 | p->netdev = netdev; |
1089 | p->dev = &pdev->dev; | 1131 | p->dev = &pdev->dev; |
1090 | 1132 | ||
1091 | p->port = pdev->id; | 1133 | data = of_get_property(pdev->dev.of_node, "cell-index", &len); |
1134 | if (data && len == sizeof(*data)) { | ||
1135 | p->port = be32_to_cpup(data); | ||
1136 | } else { | ||
1137 | dev_err(&pdev->dev, "no 'cell-index' property\n"); | ||
1138 | result = -ENXIO; | ||
1139 | goto err; | ||
1140 | } | ||
1141 | |||
1092 | snprintf(netdev->name, IFNAMSIZ, "mgmt%d", p->port); | 1142 | snprintf(netdev->name, IFNAMSIZ, "mgmt%d", p->port); |
1093 | 1143 | ||
1094 | res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 1144 | result = platform_get_irq(pdev, 0); |
1095 | if (!res_irq) | 1145 | if (result < 0) |
1146 | goto err; | ||
1147 | |||
1148 | p->irq = result; | ||
1149 | |||
1150 | res_mix = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1151 | if (res_mix == NULL) { | ||
1152 | dev_err(&pdev->dev, "no 'reg' resource\n"); | ||
1153 | result = -ENXIO; | ||
1154 | goto err; | ||
1155 | } | ||
1156 | |||
1157 | res_agl = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
1158 | if (res_agl == NULL) { | ||
1159 | dev_err(&pdev->dev, "no 'reg' resource\n"); | ||
1160 | result = -ENXIO; | ||
1161 | goto err; | ||
1162 | } | ||
1163 | |||
1164 | p->mix_phys = res_mix->start; | ||
1165 | p->mix_size = resource_size(res_mix); | ||
1166 | p->agl_phys = res_agl->start; | ||
1167 | p->agl_size = resource_size(res_agl); | ||
1168 | |||
1169 | |||
1170 | if (!devm_request_mem_region(&pdev->dev, p->mix_phys, p->mix_size, | ||
1171 | res_mix->name)) { | ||
1172 | dev_err(&pdev->dev, "request_mem_region (%s) failed\n", | ||
1173 | res_mix->name); | ||
1174 | result = -ENXIO; | ||
1175 | goto err; | ||
1176 | } | ||
1177 | |||
1178 | if (!devm_request_mem_region(&pdev->dev, p->agl_phys, p->agl_size, | ||
1179 | res_agl->name)) { | ||
1180 | result = -ENXIO; | ||
1181 | dev_err(&pdev->dev, "request_mem_region (%s) failed\n", | ||
1182 | res_agl->name); | ||
1096 | goto err; | 1183 | goto err; |
1184 | } | ||
1185 | |||
1186 | |||
1187 | p->mix = (u64)devm_ioremap(&pdev->dev, p->mix_phys, p->mix_size); | ||
1188 | p->agl = (u64)devm_ioremap(&pdev->dev, p->agl_phys, p->agl_size); | ||
1097 | 1189 | ||
1098 | p->irq = res_irq->start; | ||
1099 | spin_lock_init(&p->lock); | 1190 | spin_lock_init(&p->lock); |
1100 | 1191 | ||
1101 | skb_queue_head_init(&p->tx_list); | 1192 | skb_queue_head_init(&p->tx_list); |
@@ -1108,24 +1199,26 @@ static int __devinit octeon_mgmt_probe(struct platform_device *pdev) | |||
1108 | netdev->netdev_ops = &octeon_mgmt_ops; | 1199 | netdev->netdev_ops = &octeon_mgmt_ops; |
1109 | netdev->ethtool_ops = &octeon_mgmt_ethtool_ops; | 1200 | netdev->ethtool_ops = &octeon_mgmt_ethtool_ops; |
1110 | 1201 | ||
1111 | /* The mgmt ports get the first N MACs. */ | 1202 | mac = of_get_mac_address(pdev->dev.of_node); |
1112 | for (i = 0; i < 6; i++) | 1203 | |
1113 | netdev->dev_addr[i] = octeon_bootinfo->mac_addr_base[i]; | 1204 | if (mac) |
1114 | netdev->dev_addr[5] += p->port; | 1205 | memcpy(netdev->dev_addr, mac, 6); |
1115 | 1206 | ||
1116 | if (p->port >= octeon_bootinfo->mac_addr_count) | 1207 | p->phy_np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); |
1117 | dev_err(&pdev->dev, | ||
1118 | "Error %s: Using MAC outside of the assigned range: %pM\n", | ||
1119 | netdev->name, netdev->dev_addr); | ||
1120 | 1208 | ||
1121 | if (register_netdev(netdev)) | 1209 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(64); |
1210 | pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; | ||
1211 | |||
1212 | result = register_netdev(netdev); | ||
1213 | if (result) | ||
1122 | goto err; | 1214 | goto err; |
1123 | 1215 | ||
1124 | dev_info(&pdev->dev, "Version " DRV_VERSION "\n"); | 1216 | dev_info(&pdev->dev, "Version " DRV_VERSION "\n"); |
1125 | return 0; | 1217 | return 0; |
1218 | |||
1126 | err: | 1219 | err: |
1127 | free_netdev(netdev); | 1220 | free_netdev(netdev); |
1128 | return -ENOENT; | 1221 | return result; |
1129 | } | 1222 | } |
1130 | 1223 | ||
1131 | static int __devexit octeon_mgmt_remove(struct platform_device *pdev) | 1224 | static int __devexit octeon_mgmt_remove(struct platform_device *pdev) |
@@ -1137,10 +1230,19 @@ static int __devexit octeon_mgmt_remove(struct platform_device *pdev) | |||
1137 | return 0; | 1230 | return 0; |
1138 | } | 1231 | } |
1139 | 1232 | ||
1233 | static struct of_device_id octeon_mgmt_match[] = { | ||
1234 | { | ||
1235 | .compatible = "cavium,octeon-5750-mix", | ||
1236 | }, | ||
1237 | {}, | ||
1238 | }; | ||
1239 | MODULE_DEVICE_TABLE(of, octeon_mgmt_match); | ||
1240 | |||
1140 | static struct platform_driver octeon_mgmt_driver = { | 1241 | static struct platform_driver octeon_mgmt_driver = { |
1141 | .driver = { | 1242 | .driver = { |
1142 | .name = "octeon_mgmt", | 1243 | .name = "octeon_mgmt", |
1143 | .owner = THIS_MODULE, | 1244 | .owner = THIS_MODULE, |
1245 | .of_match_table = octeon_mgmt_match, | ||
1144 | }, | 1246 | }, |
1145 | .probe = octeon_mgmt_probe, | 1247 | .probe = octeon_mgmt_probe, |
1146 | .remove = __devexit_p(octeon_mgmt_remove), | 1248 | .remove = __devexit_p(octeon_mgmt_remove), |
diff --git a/drivers/net/phy/mdio-octeon.c b/drivers/net/phy/mdio-octeon.c index 826d961f39f7..d4015aa663e6 100644 --- a/drivers/net/phy/mdio-octeon.c +++ b/drivers/net/phy/mdio-octeon.c | |||
@@ -3,14 +3,17 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (C) 2009 Cavium Networks | 6 | * Copyright (C) 2009,2011 Cavium, Inc. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/gfp.h> | ||
10 | #include <linux/init.h> | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/platform_device.h> | 9 | #include <linux/platform_device.h> |
10 | #include <linux/of_mdio.h> | ||
11 | #include <linux/delay.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/gfp.h> | ||
13 | #include <linux/phy.h> | 15 | #include <linux/phy.h> |
16 | #include <linux/io.h> | ||
14 | 17 | ||
15 | #include <asm/octeon/octeon.h> | 18 | #include <asm/octeon/octeon.h> |
16 | #include <asm/octeon/cvmx-smix-defs.h> | 19 | #include <asm/octeon/cvmx-smix-defs.h> |
@@ -18,9 +21,17 @@ | |||
18 | #define DRV_VERSION "1.0" | 21 | #define DRV_VERSION "1.0" |
19 | #define DRV_DESCRIPTION "Cavium Networks Octeon SMI/MDIO driver" | 22 | #define DRV_DESCRIPTION "Cavium Networks Octeon SMI/MDIO driver" |
20 | 23 | ||
24 | #define SMI_CMD 0x0 | ||
25 | #define SMI_WR_DAT 0x8 | ||
26 | #define SMI_RD_DAT 0x10 | ||
27 | #define SMI_CLK 0x18 | ||
28 | #define SMI_EN 0x20 | ||
29 | |||
21 | struct octeon_mdiobus { | 30 | struct octeon_mdiobus { |
22 | struct mii_bus *mii_bus; | 31 | struct mii_bus *mii_bus; |
23 | int unit; | 32 | u64 register_base; |
33 | resource_size_t mdio_phys; | ||
34 | resource_size_t regsize; | ||
24 | int phy_irq[PHY_MAX_ADDR]; | 35 | int phy_irq[PHY_MAX_ADDR]; |
25 | }; | 36 | }; |
26 | 37 | ||
@@ -35,15 +46,15 @@ static int octeon_mdiobus_read(struct mii_bus *bus, int phy_id, int regnum) | |||
35 | smi_cmd.s.phy_op = 1; /* MDIO_CLAUSE_22_READ */ | 46 | smi_cmd.s.phy_op = 1; /* MDIO_CLAUSE_22_READ */ |
36 | smi_cmd.s.phy_adr = phy_id; | 47 | smi_cmd.s.phy_adr = phy_id; |
37 | smi_cmd.s.reg_adr = regnum; | 48 | smi_cmd.s.reg_adr = regnum; |
38 | cvmx_write_csr(CVMX_SMIX_CMD(p->unit), smi_cmd.u64); | 49 | cvmx_write_csr(p->register_base + SMI_CMD, smi_cmd.u64); |
39 | 50 | ||
40 | do { | 51 | do { |
41 | /* | 52 | /* |
42 | * Wait 1000 clocks so we don't saturate the RSL bus | 53 | * Wait 1000 clocks so we don't saturate the RSL bus |
43 | * doing reads. | 54 | * doing reads. |
44 | */ | 55 | */ |
45 | cvmx_wait(1000); | 56 | __delay(1000); |
46 | smi_rd.u64 = cvmx_read_csr(CVMX_SMIX_RD_DAT(p->unit)); | 57 | smi_rd.u64 = cvmx_read_csr(p->register_base + SMI_RD_DAT); |
47 | } while (smi_rd.s.pending && --timeout); | 58 | } while (smi_rd.s.pending && --timeout); |
48 | 59 | ||
49 | if (smi_rd.s.val) | 60 | if (smi_rd.s.val) |
@@ -62,21 +73,21 @@ static int octeon_mdiobus_write(struct mii_bus *bus, int phy_id, | |||
62 | 73 | ||
63 | smi_wr.u64 = 0; | 74 | smi_wr.u64 = 0; |
64 | smi_wr.s.dat = val; | 75 | smi_wr.s.dat = val; |
65 | cvmx_write_csr(CVMX_SMIX_WR_DAT(p->unit), smi_wr.u64); | 76 | cvmx_write_csr(p->register_base + SMI_WR_DAT, smi_wr.u64); |
66 | 77 | ||
67 | smi_cmd.u64 = 0; | 78 | smi_cmd.u64 = 0; |
68 | smi_cmd.s.phy_op = 0; /* MDIO_CLAUSE_22_WRITE */ | 79 | smi_cmd.s.phy_op = 0; /* MDIO_CLAUSE_22_WRITE */ |
69 | smi_cmd.s.phy_adr = phy_id; | 80 | smi_cmd.s.phy_adr = phy_id; |
70 | smi_cmd.s.reg_adr = regnum; | 81 | smi_cmd.s.reg_adr = regnum; |
71 | cvmx_write_csr(CVMX_SMIX_CMD(p->unit), smi_cmd.u64); | 82 | cvmx_write_csr(p->register_base + SMI_CMD, smi_cmd.u64); |
72 | 83 | ||
73 | do { | 84 | do { |
74 | /* | 85 | /* |
75 | * Wait 1000 clocks so we don't saturate the RSL bus | 86 | * Wait 1000 clocks so we don't saturate the RSL bus |
76 | * doing reads. | 87 | * doing reads. |
77 | */ | 88 | */ |
78 | cvmx_wait(1000); | 89 | __delay(1000); |
79 | smi_wr.u64 = cvmx_read_csr(CVMX_SMIX_WR_DAT(p->unit)); | 90 | smi_wr.u64 = cvmx_read_csr(p->register_base + SMI_WR_DAT); |
80 | } while (smi_wr.s.pending && --timeout); | 91 | } while (smi_wr.s.pending && --timeout); |
81 | 92 | ||
82 | if (timeout <= 0) | 93 | if (timeout <= 0) |
@@ -88,38 +99,44 @@ static int octeon_mdiobus_write(struct mii_bus *bus, int phy_id, | |||
88 | static int __devinit octeon_mdiobus_probe(struct platform_device *pdev) | 99 | static int __devinit octeon_mdiobus_probe(struct platform_device *pdev) |
89 | { | 100 | { |
90 | struct octeon_mdiobus *bus; | 101 | struct octeon_mdiobus *bus; |
102 | struct resource *res_mem; | ||
91 | union cvmx_smix_en smi_en; | 103 | union cvmx_smix_en smi_en; |
92 | int i; | ||
93 | int err = -ENOENT; | 104 | int err = -ENOENT; |
94 | 105 | ||
95 | bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); | 106 | bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); |
96 | if (!bus) | 107 | if (!bus) |
97 | return -ENOMEM; | 108 | return -ENOMEM; |
98 | 109 | ||
99 | /* The platform_device id is our unit number. */ | 110 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
100 | bus->unit = pdev->id; | 111 | |
112 | if (res_mem == NULL) { | ||
113 | dev_err(&pdev->dev, "found no memory resource\n"); | ||
114 | err = -ENXIO; | ||
115 | goto fail; | ||
116 | } | ||
117 | bus->mdio_phys = res_mem->start; | ||
118 | bus->regsize = resource_size(res_mem); | ||
119 | if (!devm_request_mem_region(&pdev->dev, bus->mdio_phys, bus->regsize, | ||
120 | res_mem->name)) { | ||
121 | dev_err(&pdev->dev, "request_mem_region failed\n"); | ||
122 | goto fail; | ||
123 | } | ||
124 | bus->register_base = | ||
125 | (u64)devm_ioremap(&pdev->dev, bus->mdio_phys, bus->regsize); | ||
101 | 126 | ||
102 | bus->mii_bus = mdiobus_alloc(); | 127 | bus->mii_bus = mdiobus_alloc(); |
103 | 128 | ||
104 | if (!bus->mii_bus) | 129 | if (!bus->mii_bus) |
105 | goto err; | 130 | goto fail; |
106 | 131 | ||
107 | smi_en.u64 = 0; | 132 | smi_en.u64 = 0; |
108 | smi_en.s.en = 1; | 133 | smi_en.s.en = 1; |
109 | cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64); | 134 | cvmx_write_csr(bus->register_base + SMI_EN, smi_en.u64); |
110 | |||
111 | /* | ||
112 | * Standard Octeon evaluation boards don't support phy | ||
113 | * interrupts, we need to poll. | ||
114 | */ | ||
115 | for (i = 0; i < PHY_MAX_ADDR; i++) | ||
116 | bus->phy_irq[i] = PHY_POLL; | ||
117 | 135 | ||
118 | bus->mii_bus->priv = bus; | 136 | bus->mii_bus->priv = bus; |
119 | bus->mii_bus->irq = bus->phy_irq; | 137 | bus->mii_bus->irq = bus->phy_irq; |
120 | bus->mii_bus->name = "mdio-octeon"; | 138 | bus->mii_bus->name = "mdio-octeon"; |
121 | snprintf(bus->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", | 139 | snprintf(bus->mii_bus->id, MII_BUS_ID_SIZE, "%llx", bus->register_base); |
122 | bus->mii_bus->name, bus->unit); | ||
123 | bus->mii_bus->parent = &pdev->dev; | 140 | bus->mii_bus->parent = &pdev->dev; |
124 | 141 | ||
125 | bus->mii_bus->read = octeon_mdiobus_read; | 142 | bus->mii_bus->read = octeon_mdiobus_read; |
@@ -127,20 +144,18 @@ static int __devinit octeon_mdiobus_probe(struct platform_device *pdev) | |||
127 | 144 | ||
128 | dev_set_drvdata(&pdev->dev, bus); | 145 | dev_set_drvdata(&pdev->dev, bus); |
129 | 146 | ||
130 | err = mdiobus_register(bus->mii_bus); | 147 | err = of_mdiobus_register(bus->mii_bus, pdev->dev.of_node); |
131 | if (err) | 148 | if (err) |
132 | goto err_register; | 149 | goto fail_register; |
133 | 150 | ||
134 | dev_info(&pdev->dev, "Version " DRV_VERSION "\n"); | 151 | dev_info(&pdev->dev, "Version " DRV_VERSION "\n"); |
135 | 152 | ||
136 | return 0; | 153 | return 0; |
137 | err_register: | 154 | fail_register: |
138 | mdiobus_free(bus->mii_bus); | 155 | mdiobus_free(bus->mii_bus); |
139 | 156 | fail: | |
140 | err: | ||
141 | devm_kfree(&pdev->dev, bus); | ||
142 | smi_en.u64 = 0; | 157 | smi_en.u64 = 0; |
143 | cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64); | 158 | cvmx_write_csr(bus->register_base + SMI_EN, smi_en.u64); |
144 | return err; | 159 | return err; |
145 | } | 160 | } |
146 | 161 | ||
@@ -154,14 +169,23 @@ static int __devexit octeon_mdiobus_remove(struct platform_device *pdev) | |||
154 | mdiobus_unregister(bus->mii_bus); | 169 | mdiobus_unregister(bus->mii_bus); |
155 | mdiobus_free(bus->mii_bus); | 170 | mdiobus_free(bus->mii_bus); |
156 | smi_en.u64 = 0; | 171 | smi_en.u64 = 0; |
157 | cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64); | 172 | cvmx_write_csr(bus->register_base + SMI_EN, smi_en.u64); |
158 | return 0; | 173 | return 0; |
159 | } | 174 | } |
160 | 175 | ||
176 | static struct of_device_id octeon_mdiobus_match[] = { | ||
177 | { | ||
178 | .compatible = "cavium,octeon-3860-mdio", | ||
179 | }, | ||
180 | {}, | ||
181 | }; | ||
182 | MODULE_DEVICE_TABLE(of, octeon_mdiobus_match); | ||
183 | |||
161 | static struct platform_driver octeon_mdiobus_driver = { | 184 | static struct platform_driver octeon_mdiobus_driver = { |
162 | .driver = { | 185 | .driver = { |
163 | .name = "mdio-octeon", | 186 | .name = "mdio-octeon", |
164 | .owner = THIS_MODULE, | 187 | .owner = THIS_MODULE, |
188 | .of_match_table = octeon_mdiobus_match, | ||
165 | }, | 189 | }, |
166 | .probe = octeon_mdiobus_probe, | 190 | .probe = octeon_mdiobus_probe, |
167 | .remove = __devexit_p(octeon_mdiobus_remove), | 191 | .remove = __devexit_p(octeon_mdiobus_remove), |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 4cde4fb0cd6c..5f84b5563c2d 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -144,6 +144,15 @@ config SPI_EP93XX | |||
144 | This enables using the Cirrus EP93xx SPI controller in master | 144 | This enables using the Cirrus EP93xx SPI controller in master |
145 | mode. | 145 | mode. |
146 | 146 | ||
147 | config SPI_FALCON | ||
148 | tristate "Falcon SPI controller support" | ||
149 | depends on SOC_FALCON | ||
150 | help | ||
151 | The external bus unit (EBU) found on the FALC-ON SoC has SPI | ||
152 | emulation that is designed for serial flash access. This driver | ||
153 | has only been tested with m25p80 type chips. The hardware has no | ||
154 | support for other types of SPI peripherals. | ||
155 | |||
147 | config SPI_GPIO | 156 | config SPI_GPIO |
148 | tristate "GPIO-based bitbanging SPI Master" | 157 | tristate "GPIO-based bitbanging SPI Master" |
149 | depends on GENERIC_GPIO | 158 | depends on GENERIC_GPIO |
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 273f50d1127a..3920dcf4c740 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile | |||
@@ -26,6 +26,7 @@ obj-$(CONFIG_SPI_DW_MMIO) += spi-dw-mmio.o | |||
26 | obj-$(CONFIG_SPI_DW_PCI) += spi-dw-midpci.o | 26 | obj-$(CONFIG_SPI_DW_PCI) += spi-dw-midpci.o |
27 | spi-dw-midpci-objs := spi-dw-pci.o spi-dw-mid.o | 27 | spi-dw-midpci-objs := spi-dw-pci.o spi-dw-mid.o |
28 | obj-$(CONFIG_SPI_EP93XX) += spi-ep93xx.o | 28 | obj-$(CONFIG_SPI_EP93XX) += spi-ep93xx.o |
29 | obj-$(CONFIG_SPI_FALCON) += spi-falcon.o | ||
29 | obj-$(CONFIG_SPI_FSL_LIB) += spi-fsl-lib.o | 30 | obj-$(CONFIG_SPI_FSL_LIB) += spi-fsl-lib.o |
30 | obj-$(CONFIG_SPI_FSL_ESPI) += spi-fsl-espi.o | 31 | obj-$(CONFIG_SPI_FSL_ESPI) += spi-fsl-espi.o |
31 | obj-$(CONFIG_SPI_FSL_SPI) += spi-fsl-spi.o | 32 | obj-$(CONFIG_SPI_FSL_SPI) += spi-fsl-spi.o |
diff --git a/drivers/spi/spi-falcon.c b/drivers/spi/spi-falcon.c new file mode 100644 index 000000000000..8f6aa735a24c --- /dev/null +++ b/drivers/spi/spi-falcon.c | |||
@@ -0,0 +1,469 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify it | ||
3 | * under the terms of the GNU General Public License version 2 as published | ||
4 | * by the Free Software Foundation. | ||
5 | * | ||
6 | * Copyright (C) 2012 Thomas Langer <thomas.langer@lantiq.com> | ||
7 | */ | ||
8 | |||
9 | #include <linux/module.h> | ||
10 | #include <linux/device.h> | ||
11 | #include <linux/platform_device.h> | ||
12 | #include <linux/spi/spi.h> | ||
13 | #include <linux/delay.h> | ||
14 | #include <linux/workqueue.h> | ||
15 | #include <linux/of.h> | ||
16 | #include <linux/of_platform.h> | ||
17 | |||
18 | #include <lantiq_soc.h> | ||
19 | |||
20 | #define DRV_NAME "sflash-falcon" | ||
21 | |||
22 | #define FALCON_SPI_XFER_BEGIN (1 << 0) | ||
23 | #define FALCON_SPI_XFER_END (1 << 1) | ||
24 | |||
25 | /* Bus Read Configuration Register0 */ | ||
26 | #define BUSRCON0 0x00000010 | ||
27 | /* Bus Write Configuration Register0 */ | ||
28 | #define BUSWCON0 0x00000018 | ||
29 | /* Serial Flash Configuration Register */ | ||
30 | #define SFCON 0x00000080 | ||
31 | /* Serial Flash Time Register */ | ||
32 | #define SFTIME 0x00000084 | ||
33 | /* Serial Flash Status Register */ | ||
34 | #define SFSTAT 0x00000088 | ||
35 | /* Serial Flash Command Register */ | ||
36 | #define SFCMD 0x0000008C | ||
37 | /* Serial Flash Address Register */ | ||
38 | #define SFADDR 0x00000090 | ||
39 | /* Serial Flash Data Register */ | ||
40 | #define SFDATA 0x00000094 | ||
41 | /* Serial Flash I/O Control Register */ | ||
42 | #define SFIO 0x00000098 | ||
43 | /* EBU Clock Control Register */ | ||
44 | #define EBUCC 0x000000C4 | ||
45 | |||
46 | /* Dummy Phase Length */ | ||
47 | #define SFCMD_DUMLEN_OFFSET 16 | ||
48 | #define SFCMD_DUMLEN_MASK 0x000F0000 | ||
49 | /* Chip Select */ | ||
50 | #define SFCMD_CS_OFFSET 24 | ||
51 | #define SFCMD_CS_MASK 0x07000000 | ||
52 | /* field offset */ | ||
53 | #define SFCMD_ALEN_OFFSET 20 | ||
54 | #define SFCMD_ALEN_MASK 0x00700000 | ||
55 | /* SCK Rise-edge Position */ | ||
56 | #define SFTIME_SCKR_POS_OFFSET 8 | ||
57 | #define SFTIME_SCKR_POS_MASK 0x00000F00 | ||
58 | /* SCK Period */ | ||
59 | #define SFTIME_SCK_PER_OFFSET 0 | ||
60 | #define SFTIME_SCK_PER_MASK 0x0000000F | ||
61 | /* SCK Fall-edge Position */ | ||
62 | #define SFTIME_SCKF_POS_OFFSET 12 | ||
63 | #define SFTIME_SCKF_POS_MASK 0x0000F000 | ||
64 | /* Device Size */ | ||
65 | #define SFCON_DEV_SIZE_A23_0 0x03000000 | ||
66 | #define SFCON_DEV_SIZE_MASK 0x0F000000 | ||
67 | /* Read Data Position */ | ||
68 | #define SFTIME_RD_POS_MASK 0x000F0000 | ||
69 | /* Data Output */ | ||
70 | #define SFIO_UNUSED_WD_MASK 0x0000000F | ||
71 | /* Command Opcode mask */ | ||
72 | #define SFCMD_OPC_MASK 0x000000FF | ||
73 | /* dlen bytes of data to write */ | ||
74 | #define SFCMD_DIR_WRITE 0x00000100 | ||
75 | /* Data Length offset */ | ||
76 | #define SFCMD_DLEN_OFFSET 9 | ||
77 | /* Command Error */ | ||
78 | #define SFSTAT_CMD_ERR 0x20000000 | ||
79 | /* Access Command Pending */ | ||
80 | #define SFSTAT_CMD_PEND 0x00400000 | ||
81 | /* Frequency set to 100MHz. */ | ||
82 | #define EBUCC_EBUDIV_SELF100 0x00000001 | ||
83 | /* Serial Flash */ | ||
84 | #define BUSRCON0_AGEN_SERIAL_FLASH 0xF0000000 | ||
85 | /* 8-bit multiplexed */ | ||
86 | #define BUSRCON0_PORTW_8_BIT_MUX 0x00000000 | ||
87 | /* Serial Flash */ | ||
88 | #define BUSWCON0_AGEN_SERIAL_FLASH 0xF0000000 | ||
89 | /* Chip Select after opcode */ | ||
90 | #define SFCMD_KEEP_CS_KEEP_SELECTED 0x00008000 | ||
91 | |||
92 | #define CLOCK_100M 100000000 | ||
93 | #define CLOCK_50M 50000000 | ||
94 | |||
95 | struct falcon_sflash { | ||
96 | u32 sfcmd; /* for caching of opcode, direction, ... */ | ||
97 | struct spi_master *master; | ||
98 | }; | ||
99 | |||
100 | int falcon_sflash_xfer(struct spi_device *spi, struct spi_transfer *t, | ||
101 | unsigned long flags) | ||
102 | { | ||
103 | struct device *dev = &spi->dev; | ||
104 | struct falcon_sflash *priv = spi_master_get_devdata(spi->master); | ||
105 | const u8 *txp = t->tx_buf; | ||
106 | u8 *rxp = t->rx_buf; | ||
107 | unsigned int bytelen = ((8 * t->len + 7) / 8); | ||
108 | unsigned int len, alen, dumlen; | ||
109 | u32 val; | ||
110 | enum { | ||
111 | state_init, | ||
112 | state_command_prepare, | ||
113 | state_write, | ||
114 | state_read, | ||
115 | state_disable_cs, | ||
116 | state_end | ||
117 | } state = state_init; | ||
118 | |||
119 | do { | ||
120 | switch (state) { | ||
121 | case state_init: /* detect phase of upper layer sequence */ | ||
122 | { | ||
123 | /* initial write ? */ | ||
124 | if (flags & FALCON_SPI_XFER_BEGIN) { | ||
125 | if (!txp) { | ||
126 | dev_err(dev, | ||
127 | "BEGIN without tx data!\n"); | ||
128 | return -ENODATA; | ||
129 | } | ||
130 | /* | ||
131 | * Prepare the parts of the sfcmd register, | ||
132 | * which should not change during a sequence! | ||
133 | * Only exception are the length fields, | ||
134 | * especially alen and dumlen. | ||
135 | */ | ||
136 | |||
137 | priv->sfcmd = ((spi->chip_select | ||
138 | << SFCMD_CS_OFFSET) | ||
139 | & SFCMD_CS_MASK); | ||
140 | priv->sfcmd |= SFCMD_KEEP_CS_KEEP_SELECTED; | ||
141 | priv->sfcmd |= *txp; | ||
142 | txp++; | ||
143 | bytelen--; | ||
144 | if (bytelen) { | ||
145 | /* | ||
146 | * more data: | ||
147 | * maybe address and/or dummy | ||
148 | */ | ||
149 | state = state_command_prepare; | ||
150 | break; | ||
151 | } else { | ||
152 | dev_dbg(dev, "write cmd %02X\n", | ||
153 | priv->sfcmd & SFCMD_OPC_MASK); | ||
154 | } | ||
155 | } | ||
156 | /* continued write ? */ | ||
157 | if (txp && bytelen) { | ||
158 | state = state_write; | ||
159 | break; | ||
160 | } | ||
161 | /* read data? */ | ||
162 | if (rxp && bytelen) { | ||
163 | state = state_read; | ||
164 | break; | ||
165 | } | ||
166 | /* end of sequence? */ | ||
167 | if (flags & FALCON_SPI_XFER_END) | ||
168 | state = state_disable_cs; | ||
169 | else | ||
170 | state = state_end; | ||
171 | break; | ||
172 | } | ||
173 | /* collect tx data for address and dummy phase */ | ||
174 | case state_command_prepare: | ||
175 | { | ||
176 | /* txp is valid, already checked */ | ||
177 | val = 0; | ||
178 | alen = 0; | ||
179 | dumlen = 0; | ||
180 | while (bytelen > 0) { | ||
181 | if (alen < 3) { | ||
182 | val = (val << 8) | (*txp++); | ||
183 | alen++; | ||
184 | } else if ((dumlen < 15) && (*txp == 0)) { | ||
185 | /* | ||
186 | * assume dummy bytes are set to 0 | ||
187 | * from upper layer | ||
188 | */ | ||
189 | dumlen++; | ||
190 | txp++; | ||
191 | } else { | ||
192 | break; | ||
193 | } | ||
194 | bytelen--; | ||
195 | } | ||
196 | priv->sfcmd &= ~(SFCMD_ALEN_MASK | SFCMD_DUMLEN_MASK); | ||
197 | priv->sfcmd |= (alen << SFCMD_ALEN_OFFSET) | | ||
198 | (dumlen << SFCMD_DUMLEN_OFFSET); | ||
199 | if (alen > 0) | ||
200 | ltq_ebu_w32(val, SFADDR); | ||
201 | |||
202 | dev_dbg(dev, "wr %02X, alen=%d (addr=%06X) dlen=%d\n", | ||
203 | priv->sfcmd & SFCMD_OPC_MASK, | ||
204 | alen, val, dumlen); | ||
205 | |||
206 | if (bytelen > 0) { | ||
207 | /* continue with write */ | ||
208 | state = state_write; | ||
209 | } else if (flags & FALCON_SPI_XFER_END) { | ||
210 | /* end of sequence? */ | ||
211 | state = state_disable_cs; | ||
212 | } else { | ||
213 | /* | ||
214 | * go to end and expect another | ||
215 | * call (read or write) | ||
216 | */ | ||
217 | state = state_end; | ||
218 | } | ||
219 | break; | ||
220 | } | ||
221 | case state_write: | ||
222 | { | ||
223 | /* txp still valid */ | ||
224 | priv->sfcmd |= SFCMD_DIR_WRITE; | ||
225 | len = 0; | ||
226 | val = 0; | ||
227 | do { | ||
228 | if (bytelen--) | ||
229 | val |= (*txp++) << (8 * len++); | ||
230 | if ((flags & FALCON_SPI_XFER_END) | ||
231 | && (bytelen == 0)) { | ||
232 | priv->sfcmd &= | ||
233 | ~SFCMD_KEEP_CS_KEEP_SELECTED; | ||
234 | } | ||
235 | if ((len == 4) || (bytelen == 0)) { | ||
236 | ltq_ebu_w32(val, SFDATA); | ||
237 | ltq_ebu_w32(priv->sfcmd | ||
238 | | (len<<SFCMD_DLEN_OFFSET), | ||
239 | SFCMD); | ||
240 | len = 0; | ||
241 | val = 0; | ||
242 | priv->sfcmd &= ~(SFCMD_ALEN_MASK | ||
243 | | SFCMD_DUMLEN_MASK); | ||
244 | } | ||
245 | } while (bytelen); | ||
246 | state = state_end; | ||
247 | break; | ||
248 | } | ||
249 | case state_read: | ||
250 | { | ||
251 | /* read data */ | ||
252 | priv->sfcmd &= ~SFCMD_DIR_WRITE; | ||
253 | do { | ||
254 | if ((flags & FALCON_SPI_XFER_END) | ||
255 | && (bytelen <= 4)) { | ||
256 | priv->sfcmd &= | ||
257 | ~SFCMD_KEEP_CS_KEEP_SELECTED; | ||
258 | } | ||
259 | len = (bytelen > 4) ? 4 : bytelen; | ||
260 | bytelen -= len; | ||
261 | ltq_ebu_w32(priv->sfcmd | ||
262 | | (len << SFCMD_DLEN_OFFSET), SFCMD); | ||
263 | priv->sfcmd &= ~(SFCMD_ALEN_MASK | ||
264 | | SFCMD_DUMLEN_MASK); | ||
265 | do { | ||
266 | val = ltq_ebu_r32(SFSTAT); | ||
267 | if (val & SFSTAT_CMD_ERR) { | ||
268 | /* reset error status */ | ||
269 | dev_err(dev, "SFSTAT: CMD_ERR"); | ||
270 | dev_err(dev, " (%x)\n", val); | ||
271 | ltq_ebu_w32(SFSTAT_CMD_ERR, | ||
272 | SFSTAT); | ||
273 | return -EBADE; | ||
274 | } | ||
275 | } while (val & SFSTAT_CMD_PEND); | ||
276 | val = ltq_ebu_r32(SFDATA); | ||
277 | do { | ||
278 | *rxp = (val & 0xFF); | ||
279 | rxp++; | ||
280 | val >>= 8; | ||
281 | len--; | ||
282 | } while (len); | ||
283 | } while (bytelen); | ||
284 | state = state_end; | ||
285 | break; | ||
286 | } | ||
287 | case state_disable_cs: | ||
288 | { | ||
289 | priv->sfcmd &= ~SFCMD_KEEP_CS_KEEP_SELECTED; | ||
290 | ltq_ebu_w32(priv->sfcmd | (0 << SFCMD_DLEN_OFFSET), | ||
291 | SFCMD); | ||
292 | val = ltq_ebu_r32(SFSTAT); | ||
293 | if (val & SFSTAT_CMD_ERR) { | ||
294 | /* reset error status */ | ||
295 | dev_err(dev, "SFSTAT: CMD_ERR (%x)\n", val); | ||
296 | ltq_ebu_w32(SFSTAT_CMD_ERR, SFSTAT); | ||
297 | return -EBADE; | ||
298 | } | ||
299 | state = state_end; | ||
300 | break; | ||
301 | } | ||
302 | case state_end: | ||
303 | break; | ||
304 | } | ||
305 | } while (state != state_end); | ||
306 | |||
307 | return 0; | ||
308 | } | ||
309 | |||
310 | static int falcon_sflash_setup(struct spi_device *spi) | ||
311 | { | ||
312 | unsigned int i; | ||
313 | unsigned long flags; | ||
314 | |||
315 | if (spi->chip_select > 0) | ||
316 | return -ENODEV; | ||
317 | |||
318 | spin_lock_irqsave(&ebu_lock, flags); | ||
319 | |||
320 | if (spi->max_speed_hz >= CLOCK_100M) { | ||
321 | /* set EBU clock to 100 MHz */ | ||
322 | ltq_sys1_w32_mask(0, EBUCC_EBUDIV_SELF100, EBUCC); | ||
323 | i = 1; /* divider */ | ||
324 | } else { | ||
325 | /* set EBU clock to 50 MHz */ | ||
326 | ltq_sys1_w32_mask(EBUCC_EBUDIV_SELF100, 0, EBUCC); | ||
327 | |||
328 | /* search for suitable divider */ | ||
329 | for (i = 1; i < 7; i++) { | ||
330 | if (CLOCK_50M / i <= spi->max_speed_hz) | ||
331 | break; | ||
332 | } | ||
333 | } | ||
334 | |||
335 | /* setup period of serial clock */ | ||
336 | ltq_ebu_w32_mask(SFTIME_SCKF_POS_MASK | ||
337 | | SFTIME_SCKR_POS_MASK | ||
338 | | SFTIME_SCK_PER_MASK, | ||
339 | (i << SFTIME_SCKR_POS_OFFSET) | ||
340 | | (i << (SFTIME_SCK_PER_OFFSET + 1)), | ||
341 | SFTIME); | ||
342 | |||
343 | /* | ||
344 | * set some bits of unused_wd, to not trigger HOLD/WP | ||
345 | * signals on non QUAD flashes | ||
346 | */ | ||
347 | ltq_ebu_w32((SFIO_UNUSED_WD_MASK & (0x8 | 0x4)), SFIO); | ||
348 | |||
349 | ltq_ebu_w32(BUSRCON0_AGEN_SERIAL_FLASH | BUSRCON0_PORTW_8_BIT_MUX, | ||
350 | BUSRCON0); | ||
351 | ltq_ebu_w32(BUSWCON0_AGEN_SERIAL_FLASH, BUSWCON0); | ||
352 | /* set address wrap around to maximum for 24-bit addresses */ | ||
353 | ltq_ebu_w32_mask(SFCON_DEV_SIZE_MASK, SFCON_DEV_SIZE_A23_0, SFCON); | ||
354 | |||
355 | spin_unlock_irqrestore(&ebu_lock, flags); | ||
356 | |||
357 | return 0; | ||
358 | } | ||
359 | |||
360 | static int falcon_sflash_prepare_xfer(struct spi_master *master) | ||
361 | { | ||
362 | return 0; | ||
363 | } | ||
364 | |||
365 | static int falcon_sflash_unprepare_xfer(struct spi_master *master) | ||
366 | { | ||
367 | return 0; | ||
368 | } | ||
369 | |||
370 | static int falcon_sflash_xfer_one(struct spi_master *master, | ||
371 | struct spi_message *m) | ||
372 | { | ||
373 | struct falcon_sflash *priv = spi_master_get_devdata(master); | ||
374 | struct spi_transfer *t; | ||
375 | unsigned long spi_flags; | ||
376 | unsigned long flags; | ||
377 | int ret = 0; | ||
378 | |||
379 | priv->sfcmd = 0; | ||
380 | m->actual_length = 0; | ||
381 | |||
382 | spi_flags = FALCON_SPI_XFER_BEGIN; | ||
383 | list_for_each_entry(t, &m->transfers, transfer_list) { | ||
384 | if (list_is_last(&t->transfer_list, &m->transfers)) | ||
385 | spi_flags |= FALCON_SPI_XFER_END; | ||
386 | |||
387 | spin_lock_irqsave(&ebu_lock, flags); | ||
388 | ret = falcon_sflash_xfer(m->spi, t, spi_flags); | ||
389 | spin_unlock_irqrestore(&ebu_lock, flags); | ||
390 | |||
391 | if (ret) | ||
392 | break; | ||
393 | |||
394 | m->actual_length += t->len; | ||
395 | |||
396 | WARN_ON(t->delay_usecs || t->cs_change); | ||
397 | spi_flags = 0; | ||
398 | } | ||
399 | |||
400 | m->status = ret; | ||
401 | m->complete(m->context); | ||
402 | |||
403 | return 0; | ||
404 | } | ||
405 | |||
406 | static int __devinit falcon_sflash_probe(struct platform_device *pdev) | ||
407 | { | ||
408 | struct falcon_sflash *priv; | ||
409 | struct spi_master *master; | ||
410 | int ret; | ||
411 | |||
412 | if (ltq_boot_select() != BS_SPI) { | ||
413 | dev_err(&pdev->dev, "invalid bootstrap options\n"); | ||
414 | return -ENODEV; | ||
415 | } | ||
416 | |||
417 | master = spi_alloc_master(&pdev->dev, sizeof(*priv)); | ||
418 | if (!master) | ||
419 | return -ENOMEM; | ||
420 | |||
421 | priv = spi_master_get_devdata(master); | ||
422 | priv->master = master; | ||
423 | |||
424 | master->mode_bits = SPI_MODE_3; | ||
425 | master->num_chipselect = 1; | ||
426 | master->bus_num = -1; | ||
427 | master->setup = falcon_sflash_setup; | ||
428 | master->prepare_transfer_hardware = falcon_sflash_prepare_xfer; | ||
429 | master->transfer_one_message = falcon_sflash_xfer_one; | ||
430 | master->unprepare_transfer_hardware = falcon_sflash_unprepare_xfer; | ||
431 | master->dev.of_node = pdev->dev.of_node; | ||
432 | |||
433 | platform_set_drvdata(pdev, priv); | ||
434 | |||
435 | ret = spi_register_master(master); | ||
436 | if (ret) | ||
437 | spi_master_put(master); | ||
438 | return ret; | ||
439 | } | ||
440 | |||
441 | static int __devexit falcon_sflash_remove(struct platform_device *pdev) | ||
442 | { | ||
443 | struct falcon_sflash *priv = platform_get_drvdata(pdev); | ||
444 | |||
445 | spi_unregister_master(priv->master); | ||
446 | |||
447 | return 0; | ||
448 | } | ||
449 | |||
450 | static const struct of_device_id falcon_sflash_match[] = { | ||
451 | { .compatible = "lantiq,sflash-falcon" }, | ||
452 | {}, | ||
453 | }; | ||
454 | MODULE_DEVICE_TABLE(of, falcon_sflash_match); | ||
455 | |||
456 | static struct platform_driver falcon_sflash_driver = { | ||
457 | .probe = falcon_sflash_probe, | ||
458 | .remove = __devexit_p(falcon_sflash_remove), | ||
459 | .driver = { | ||
460 | .name = DRV_NAME, | ||
461 | .owner = THIS_MODULE, | ||
462 | .of_match_table = falcon_sflash_match, | ||
463 | } | ||
464 | }; | ||
465 | |||
466 | module_platform_driver(falcon_sflash_driver); | ||
467 | |||
468 | MODULE_LICENSE("GPL"); | ||
469 | MODULE_DESCRIPTION("Lantiq Falcon SPI/SFLASH controller driver"); | ||
diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c index e31949c9c87e..f15b31b37ca5 100644 --- a/drivers/staging/octeon/ethernet-mdio.c +++ b/drivers/staging/octeon/ethernet-mdio.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/ethtool.h> | 28 | #include <linux/ethtool.h> |
29 | #include <linux/phy.h> | 29 | #include <linux/phy.h> |
30 | #include <linux/ratelimit.h> | 30 | #include <linux/ratelimit.h> |
31 | #include <linux/of_mdio.h> | ||
31 | 32 | ||
32 | #include <net/dst.h> | 33 | #include <net/dst.h> |
33 | 34 | ||
@@ -161,22 +162,23 @@ static void cvm_oct_adjust_link(struct net_device *dev) | |||
161 | int cvm_oct_phy_setup_device(struct net_device *dev) | 162 | int cvm_oct_phy_setup_device(struct net_device *dev) |
162 | { | 163 | { |
163 | struct octeon_ethernet *priv = netdev_priv(dev); | 164 | struct octeon_ethernet *priv = netdev_priv(dev); |
165 | struct device_node *phy_node; | ||
164 | 166 | ||
165 | int phy_addr = cvmx_helper_board_get_mii_address(priv->port); | 167 | if (!priv->of_node) |
166 | if (phy_addr != -1) { | 168 | return 0; |
167 | char phy_id[MII_BUS_ID_SIZE + 3]; | ||
168 | 169 | ||
169 | snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "mdio-octeon-0", phy_addr); | 170 | phy_node = of_parse_phandle(priv->of_node, "phy-handle", 0); |
171 | if (!phy_node) | ||
172 | return 0; | ||
170 | 173 | ||
171 | priv->phydev = phy_connect(dev, phy_id, cvm_oct_adjust_link, 0, | 174 | priv->phydev = of_phy_connect(dev, phy_node, cvm_oct_adjust_link, 0, |
172 | PHY_INTERFACE_MODE_GMII); | 175 | PHY_INTERFACE_MODE_GMII); |
176 | |||
177 | if (priv->phydev == NULL) | ||
178 | return -ENODEV; | ||
179 | |||
180 | priv->last_link = 0; | ||
181 | phy_start_aneg(priv->phydev); | ||
173 | 182 | ||
174 | if (IS_ERR(priv->phydev)) { | ||
175 | priv->phydev = NULL; | ||
176 | return -1; | ||
177 | } | ||
178 | priv->last_link = 0; | ||
179 | phy_start_aneg(priv->phydev); | ||
180 | } | ||
181 | return 0; | 183 | return 0; |
182 | } | 184 | } |
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 18f7a790f73d..683bedc74dde 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c | |||
@@ -24,6 +24,7 @@ | |||
24 | * This file may also be available under a different license from Cavium. | 24 | * This file may also be available under a different license from Cavium. |
25 | * Contact Cavium Networks for more information | 25 | * Contact Cavium Networks for more information |
26 | **********************************************************************/ | 26 | **********************************************************************/ |
27 | #include <linux/platform_device.h> | ||
27 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
28 | #include <linux/init.h> | 29 | #include <linux/init.h> |
29 | #include <linux/module.h> | 30 | #include <linux/module.h> |
@@ -32,6 +33,7 @@ | |||
32 | #include <linux/phy.h> | 33 | #include <linux/phy.h> |
33 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
34 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
36 | #include <linux/of_net.h> | ||
35 | 37 | ||
36 | #include <net/dst.h> | 38 | #include <net/dst.h> |
37 | 39 | ||
@@ -113,15 +115,6 @@ int rx_napi_weight = 32; | |||
113 | module_param(rx_napi_weight, int, 0444); | 115 | module_param(rx_napi_weight, int, 0444); |
114 | MODULE_PARM_DESC(rx_napi_weight, "The NAPI WEIGHT parameter."); | 116 | MODULE_PARM_DESC(rx_napi_weight, "The NAPI WEIGHT parameter."); |
115 | 117 | ||
116 | /* | ||
117 | * The offset from mac_addr_base that should be used for the next port | ||
118 | * that is configured. By convention, if any mgmt ports exist on the | ||
119 | * chip, they get the first mac addresses, The ports controlled by | ||
120 | * this driver are numbered sequencially following any mgmt addresses | ||
121 | * that may exist. | ||
122 | */ | ||
123 | static unsigned int cvm_oct_mac_addr_offset; | ||
124 | |||
125 | /** | 118 | /** |
126 | * cvm_oct_poll_queue - Workqueue for polling operations. | 119 | * cvm_oct_poll_queue - Workqueue for polling operations. |
127 | */ | 120 | */ |
@@ -176,7 +169,7 @@ static void cvm_oct_periodic_worker(struct work_struct *work) | |||
176 | queue_delayed_work(cvm_oct_poll_queue, &priv->port_periodic_work, HZ); | 169 | queue_delayed_work(cvm_oct_poll_queue, &priv->port_periodic_work, HZ); |
177 | } | 170 | } |
178 | 171 | ||
179 | static __init void cvm_oct_configure_common_hw(void) | 172 | static __devinit void cvm_oct_configure_common_hw(void) |
180 | { | 173 | { |
181 | /* Setup the FPA */ | 174 | /* Setup the FPA */ |
182 | cvmx_fpa_enable(); | 175 | cvmx_fpa_enable(); |
@@ -396,23 +389,21 @@ static void cvm_oct_common_set_multicast_list(struct net_device *dev) | |||
396 | 389 | ||
397 | * Returns Zero on success | 390 | * Returns Zero on success |
398 | */ | 391 | */ |
399 | static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr) | 392 | static int cvm_oct_set_mac_filter(struct net_device *dev) |
400 | { | 393 | { |
401 | struct octeon_ethernet *priv = netdev_priv(dev); | 394 | struct octeon_ethernet *priv = netdev_priv(dev); |
402 | union cvmx_gmxx_prtx_cfg gmx_cfg; | 395 | union cvmx_gmxx_prtx_cfg gmx_cfg; |
403 | int interface = INTERFACE(priv->port); | 396 | int interface = INTERFACE(priv->port); |
404 | int index = INDEX(priv->port); | 397 | int index = INDEX(priv->port); |
405 | 398 | ||
406 | memcpy(dev->dev_addr, addr + 2, 6); | ||
407 | |||
408 | if ((interface < 2) | 399 | if ((interface < 2) |
409 | && (cvmx_helper_interface_get_mode(interface) != | 400 | && (cvmx_helper_interface_get_mode(interface) != |
410 | CVMX_HELPER_INTERFACE_MODE_SPI)) { | 401 | CVMX_HELPER_INTERFACE_MODE_SPI)) { |
411 | int i; | 402 | int i; |
412 | uint8_t *ptr = addr; | 403 | uint8_t *ptr = dev->dev_addr; |
413 | uint64_t mac = 0; | 404 | uint64_t mac = 0; |
414 | for (i = 0; i < 6; i++) | 405 | for (i = 0; i < 6; i++) |
415 | mac = (mac << 8) | (uint64_t) (ptr[i + 2]); | 406 | mac = (mac << 8) | (uint64_t)ptr[i]; |
416 | 407 | ||
417 | gmx_cfg.u64 = | 408 | gmx_cfg.u64 = |
418 | cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface)); | 409 | cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface)); |
@@ -421,17 +412,17 @@ static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr) | |||
421 | 412 | ||
422 | cvmx_write_csr(CVMX_GMXX_SMACX(index, interface), mac); | 413 | cvmx_write_csr(CVMX_GMXX_SMACX(index, interface), mac); |
423 | cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM0(index, interface), | 414 | cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM0(index, interface), |
424 | ptr[2]); | 415 | ptr[0]); |
425 | cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM1(index, interface), | 416 | cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM1(index, interface), |
426 | ptr[3]); | 417 | ptr[1]); |
427 | cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM2(index, interface), | 418 | cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM2(index, interface), |
428 | ptr[4]); | 419 | ptr[2]); |
429 | cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM3(index, interface), | 420 | cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM3(index, interface), |
430 | ptr[5]); | 421 | ptr[3]); |
431 | cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM4(index, interface), | 422 | cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM4(index, interface), |
432 | ptr[6]); | 423 | ptr[4]); |
433 | cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM5(index, interface), | 424 | cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM5(index, interface), |
434 | ptr[7]); | 425 | ptr[5]); |
435 | cvm_oct_common_set_multicast_list(dev); | 426 | cvm_oct_common_set_multicast_list(dev); |
436 | cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), | 427 | cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), |
437 | gmx_cfg.u64); | 428 | gmx_cfg.u64); |
@@ -439,6 +430,15 @@ static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr) | |||
439 | return 0; | 430 | return 0; |
440 | } | 431 | } |
441 | 432 | ||
433 | static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr) | ||
434 | { | ||
435 | int r = eth_mac_addr(dev, addr); | ||
436 | |||
437 | if (r) | ||
438 | return r; | ||
439 | return cvm_oct_set_mac_filter(dev); | ||
440 | } | ||
441 | |||
442 | /** | 442 | /** |
443 | * cvm_oct_common_init - per network device initialization | 443 | * cvm_oct_common_init - per network device initialization |
444 | * @dev: Device to initialize | 444 | * @dev: Device to initialize |
@@ -448,26 +448,17 @@ static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr) | |||
448 | int cvm_oct_common_init(struct net_device *dev) | 448 | int cvm_oct_common_init(struct net_device *dev) |
449 | { | 449 | { |
450 | struct octeon_ethernet *priv = netdev_priv(dev); | 450 | struct octeon_ethernet *priv = netdev_priv(dev); |
451 | struct sockaddr sa; | 451 | const u8 *mac = NULL; |
452 | u64 mac = ((u64)(octeon_bootinfo->mac_addr_base[0] & 0xff) << 40) | | 452 | |
453 | ((u64)(octeon_bootinfo->mac_addr_base[1] & 0xff) << 32) | | 453 | if (priv->of_node) |
454 | ((u64)(octeon_bootinfo->mac_addr_base[2] & 0xff) << 24) | | 454 | mac = of_get_mac_address(priv->of_node); |
455 | ((u64)(octeon_bootinfo->mac_addr_base[3] & 0xff) << 16) | | 455 | |
456 | ((u64)(octeon_bootinfo->mac_addr_base[4] & 0xff) << 8) | | 456 | if (mac && is_valid_ether_addr(mac)) { |
457 | (u64)(octeon_bootinfo->mac_addr_base[5] & 0xff); | 457 | memcpy(dev->dev_addr, mac, ETH_ALEN); |
458 | 458 | dev->addr_assign_type &= ~NET_ADDR_RANDOM; | |
459 | mac += cvm_oct_mac_addr_offset; | 459 | } else { |
460 | sa.sa_data[0] = (mac >> 40) & 0xff; | 460 | eth_hw_addr_random(dev); |
461 | sa.sa_data[1] = (mac >> 32) & 0xff; | 461 | } |
462 | sa.sa_data[2] = (mac >> 24) & 0xff; | ||
463 | sa.sa_data[3] = (mac >> 16) & 0xff; | ||
464 | sa.sa_data[4] = (mac >> 8) & 0xff; | ||
465 | sa.sa_data[5] = mac & 0xff; | ||
466 | |||
467 | if (cvm_oct_mac_addr_offset >= octeon_bootinfo->mac_addr_count) | ||
468 | printk(KERN_DEBUG "%s: Using MAC outside of the assigned range:" | ||
469 | " %pM\n", dev->name, sa.sa_data); | ||
470 | cvm_oct_mac_addr_offset++; | ||
471 | 462 | ||
472 | /* | 463 | /* |
473 | * Force the interface to use the POW send if always_use_pow | 464 | * Force the interface to use the POW send if always_use_pow |
@@ -488,7 +479,7 @@ int cvm_oct_common_init(struct net_device *dev) | |||
488 | SET_ETHTOOL_OPS(dev, &cvm_oct_ethtool_ops); | 479 | SET_ETHTOOL_OPS(dev, &cvm_oct_ethtool_ops); |
489 | 480 | ||
490 | cvm_oct_phy_setup_device(dev); | 481 | cvm_oct_phy_setup_device(dev); |
491 | dev->netdev_ops->ndo_set_mac_address(dev, &sa); | 482 | cvm_oct_set_mac_filter(dev); |
492 | dev->netdev_ops->ndo_change_mtu(dev, dev->mtu); | 483 | dev->netdev_ops->ndo_change_mtu(dev, dev->mtu); |
493 | 484 | ||
494 | /* | 485 | /* |
@@ -595,22 +586,55 @@ static const struct net_device_ops cvm_oct_pow_netdev_ops = { | |||
595 | 586 | ||
596 | extern void octeon_mdiobus_force_mod_depencency(void); | 587 | extern void octeon_mdiobus_force_mod_depencency(void); |
597 | 588 | ||
598 | static int __init cvm_oct_init_module(void) | 589 | static struct device_node * __devinit cvm_oct_of_get_child(const struct device_node *parent, |
590 | int reg_val) | ||
591 | { | ||
592 | struct device_node *node = NULL; | ||
593 | int size; | ||
594 | const __be32 *addr; | ||
595 | |||
596 | for (;;) { | ||
597 | node = of_get_next_child(parent, node); | ||
598 | if (!node) | ||
599 | break; | ||
600 | addr = of_get_property(node, "reg", &size); | ||
601 | if (addr && (be32_to_cpu(*addr) == reg_val)) | ||
602 | break; | ||
603 | } | ||
604 | return node; | ||
605 | } | ||
606 | |||
607 | static struct device_node * __devinit cvm_oct_node_for_port(struct device_node *pip, | ||
608 | int interface, int port) | ||
609 | { | ||
610 | struct device_node *ni, *np; | ||
611 | |||
612 | ni = cvm_oct_of_get_child(pip, interface); | ||
613 | if (!ni) | ||
614 | return NULL; | ||
615 | |||
616 | np = cvm_oct_of_get_child(ni, port); | ||
617 | of_node_put(ni); | ||
618 | |||
619 | return np; | ||
620 | } | ||
621 | |||
622 | static int __devinit cvm_oct_probe(struct platform_device *pdev) | ||
599 | { | 623 | { |
600 | int num_interfaces; | 624 | int num_interfaces; |
601 | int interface; | 625 | int interface; |
602 | int fau = FAU_NUM_PACKET_BUFFERS_TO_FREE; | 626 | int fau = FAU_NUM_PACKET_BUFFERS_TO_FREE; |
603 | int qos; | 627 | int qos; |
628 | struct device_node *pip; | ||
604 | 629 | ||
605 | octeon_mdiobus_force_mod_depencency(); | 630 | octeon_mdiobus_force_mod_depencency(); |
606 | pr_notice("cavium-ethernet %s\n", OCTEON_ETHERNET_VERSION); | 631 | pr_notice("cavium-ethernet %s\n", OCTEON_ETHERNET_VERSION); |
607 | 632 | ||
608 | if (OCTEON_IS_MODEL(OCTEON_CN52XX)) | 633 | pip = pdev->dev.of_node; |
609 | cvm_oct_mac_addr_offset = 2; /* First two are the mgmt ports. */ | 634 | if (!pip) { |
610 | else if (OCTEON_IS_MODEL(OCTEON_CN56XX)) | 635 | pr_err("Error: No 'pip' in /aliases\n"); |
611 | cvm_oct_mac_addr_offset = 1; /* First one is the mgmt port. */ | 636 | return -EINVAL; |
612 | else | 637 | } |
613 | cvm_oct_mac_addr_offset = 0; | ||
614 | 638 | ||
615 | cvm_oct_poll_queue = create_singlethread_workqueue("octeon-ethernet"); | 639 | cvm_oct_poll_queue = create_singlethread_workqueue("octeon-ethernet"); |
616 | if (cvm_oct_poll_queue == NULL) { | 640 | if (cvm_oct_poll_queue == NULL) { |
@@ -689,10 +713,11 @@ static int __init cvm_oct_init_module(void) | |||
689 | cvmx_helper_interface_get_mode(interface); | 713 | cvmx_helper_interface_get_mode(interface); |
690 | int num_ports = cvmx_helper_ports_on_interface(interface); | 714 | int num_ports = cvmx_helper_ports_on_interface(interface); |
691 | int port; | 715 | int port; |
716 | int port_index; | ||
692 | 717 | ||
693 | for (port = cvmx_helper_get_ipd_port(interface, 0); | 718 | for (port_index = 0, port = cvmx_helper_get_ipd_port(interface, 0); |
694 | port < cvmx_helper_get_ipd_port(interface, num_ports); | 719 | port < cvmx_helper_get_ipd_port(interface, num_ports); |
695 | port++) { | 720 | port_index++, port++) { |
696 | struct octeon_ethernet *priv; | 721 | struct octeon_ethernet *priv; |
697 | struct net_device *dev = | 722 | struct net_device *dev = |
698 | alloc_etherdev(sizeof(struct octeon_ethernet)); | 723 | alloc_etherdev(sizeof(struct octeon_ethernet)); |
@@ -703,6 +728,7 @@ static int __init cvm_oct_init_module(void) | |||
703 | 728 | ||
704 | /* Initialize the device private structure. */ | 729 | /* Initialize the device private structure. */ |
705 | priv = netdev_priv(dev); | 730 | priv = netdev_priv(dev); |
731 | priv->of_node = cvm_oct_node_for_port(pip, interface, port_index); | ||
706 | 732 | ||
707 | INIT_DELAYED_WORK(&priv->port_periodic_work, | 733 | INIT_DELAYED_WORK(&priv->port_periodic_work, |
708 | cvm_oct_periodic_worker); | 734 | cvm_oct_periodic_worker); |
@@ -787,7 +813,7 @@ static int __init cvm_oct_init_module(void) | |||
787 | return 0; | 813 | return 0; |
788 | } | 814 | } |
789 | 815 | ||
790 | static void __exit cvm_oct_cleanup_module(void) | 816 | static int __devexit cvm_oct_remove(struct platform_device *pdev) |
791 | { | 817 | { |
792 | int port; | 818 | int port; |
793 | 819 | ||
@@ -835,10 +861,29 @@ static void __exit cvm_oct_cleanup_module(void) | |||
835 | if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL) | 861 | if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL) |
836 | cvm_oct_mem_empty_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL, | 862 | cvm_oct_mem_empty_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL, |
837 | CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128); | 863 | CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128); |
864 | return 0; | ||
838 | } | 865 | } |
839 | 866 | ||
867 | static struct of_device_id cvm_oct_match[] = { | ||
868 | { | ||
869 | .compatible = "cavium,octeon-3860-pip", | ||
870 | }, | ||
871 | {}, | ||
872 | }; | ||
873 | MODULE_DEVICE_TABLE(of, cvm_oct_match); | ||
874 | |||
875 | static struct platform_driver cvm_oct_driver = { | ||
876 | .probe = cvm_oct_probe, | ||
877 | .remove = __devexit_p(cvm_oct_remove), | ||
878 | .driver = { | ||
879 | .owner = THIS_MODULE, | ||
880 | .name = KBUILD_MODNAME, | ||
881 | .of_match_table = cvm_oct_match, | ||
882 | }, | ||
883 | }; | ||
884 | |||
885 | module_platform_driver(cvm_oct_driver); | ||
886 | |||
840 | MODULE_LICENSE("GPL"); | 887 | MODULE_LICENSE("GPL"); |
841 | MODULE_AUTHOR("Cavium Networks <support@caviumnetworks.com>"); | 888 | MODULE_AUTHOR("Cavium Networks <support@caviumnetworks.com>"); |
842 | MODULE_DESCRIPTION("Cavium Networks Octeon ethernet driver."); | 889 | MODULE_DESCRIPTION("Cavium Networks Octeon ethernet driver."); |
843 | module_init(cvm_oct_init_module); | ||
844 | module_exit(cvm_oct_cleanup_module); | ||
diff --git a/drivers/staging/octeon/octeon-ethernet.h b/drivers/staging/octeon/octeon-ethernet.h index d58192563552..9360e22e0739 100644 --- a/drivers/staging/octeon/octeon-ethernet.h +++ b/drivers/staging/octeon/octeon-ethernet.h | |||
@@ -31,6 +31,8 @@ | |||
31 | #ifndef OCTEON_ETHERNET_H | 31 | #ifndef OCTEON_ETHERNET_H |
32 | #define OCTEON_ETHERNET_H | 32 | #define OCTEON_ETHERNET_H |
33 | 33 | ||
34 | #include <linux/of.h> | ||
35 | |||
34 | /** | 36 | /** |
35 | * This is the definition of the Ethernet driver's private | 37 | * This is the definition of the Ethernet driver's private |
36 | * driver state stored in netdev_priv(dev). | 38 | * driver state stored in netdev_priv(dev). |
@@ -59,6 +61,7 @@ struct octeon_ethernet { | |||
59 | void (*poll) (struct net_device *dev); | 61 | void (*poll) (struct net_device *dev); |
60 | struct delayed_work port_periodic_work; | 62 | struct delayed_work port_periodic_work; |
61 | struct work_struct port_work; /* may be unused. */ | 63 | struct work_struct port_work; /* may be unused. */ |
64 | struct device_node *of_node; | ||
62 | }; | 65 | }; |
63 | 66 | ||
64 | int cvm_oct_free_work(void *work_queue_entry); | 67 | int cvm_oct_free_work(void *work_queue_entry); |
diff --git a/include/linux/libfdt.h b/include/linux/libfdt.h new file mode 100644 index 000000000000..4c0306c69b4e --- /dev/null +++ b/include/linux/libfdt.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _INCLUDE_LIBFDT_H_ | ||
2 | #define _INCLUDE_LIBFDT_H_ | ||
3 | |||
4 | #include <linux/libfdt_env.h> | ||
5 | #include "../../scripts/dtc/libfdt/fdt.h" | ||
6 | #include "../../scripts/dtc/libfdt/libfdt.h" | ||
7 | |||
8 | #endif /* _INCLUDE_LIBFDT_H_ */ | ||
diff --git a/include/linux/libfdt_env.h b/include/linux/libfdt_env.h new file mode 100644 index 000000000000..01508c7b8c81 --- /dev/null +++ b/include/linux/libfdt_env.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _LIBFDT_ENV_H | ||
2 | #define _LIBFDT_ENV_H | ||
3 | |||
4 | #include <linux/string.h> | ||
5 | |||
6 | #include <asm/byteorder.h> | ||
7 | |||
8 | #define fdt32_to_cpu(x) be32_to_cpu(x) | ||
9 | #define cpu_to_fdt32(x) cpu_to_be32(x) | ||
10 | #define fdt64_to_cpu(x) be64_to_cpu(x) | ||
11 | #define cpu_to_fdt64(x) cpu_to_be64(x) | ||
12 | |||
13 | #endif /* _LIBFDT_ENV_H */ | ||
diff --git a/lib/Kconfig b/lib/Kconfig index 8269d56dcdaa..bfdbb1ff0aa3 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
@@ -387,4 +387,10 @@ config SIGNATURE | |||
387 | Digital signature verification. Currently only RSA is supported. | 387 | Digital signature verification. Currently only RSA is supported. |
388 | Implementation is done using GnuPG MPI library | 388 | Implementation is done using GnuPG MPI library |
389 | 389 | ||
390 | # | ||
391 | # libfdt files, only selected if needed. | ||
392 | # | ||
393 | config LIBFDT | ||
394 | bool | ||
395 | |||
390 | endmenu | 396 | endmenu |
diff --git a/lib/Makefile b/lib/Makefile index 8c31a0cb75e9..2f2be5a8734c 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -130,6 +130,11 @@ obj-$(CONFIG_GENERIC_STRNLEN_USER) += strnlen_user.o | |||
130 | 130 | ||
131 | obj-$(CONFIG_STMP_DEVICE) += stmp_device.o | 131 | obj-$(CONFIG_STMP_DEVICE) += stmp_device.o |
132 | 132 | ||
133 | libfdt_files = fdt.o fdt_ro.o fdt_wip.o fdt_rw.o fdt_sw.o fdt_strerror.o | ||
134 | $(foreach file, $(libfdt_files), \ | ||
135 | $(eval CFLAGS_$(file) = -I$(src)/../scripts/dtc/libfdt)) | ||
136 | lib-$(CONFIG_LIBFDT) += $(libfdt_files) | ||
137 | |||
133 | hostprogs-y := gen_crc32table | 138 | hostprogs-y := gen_crc32table |
134 | clean-files := crc32table.h | 139 | clean-files := crc32table.h |
135 | 140 | ||
diff --git a/lib/fdt.c b/lib/fdt.c new file mode 100644 index 000000000000..97f20069fc37 --- /dev/null +++ b/lib/fdt.c | |||
@@ -0,0 +1,2 @@ | |||
1 | #include <linux/libfdt_env.h> | ||
2 | #include "../scripts/dtc/libfdt/fdt.c" | ||
diff --git a/lib/fdt_ro.c b/lib/fdt_ro.c new file mode 100644 index 000000000000..f73c04ea7be4 --- /dev/null +++ b/lib/fdt_ro.c | |||
@@ -0,0 +1,2 @@ | |||
1 | #include <linux/libfdt_env.h> | ||
2 | #include "../scripts/dtc/libfdt/fdt_ro.c" | ||
diff --git a/lib/fdt_rw.c b/lib/fdt_rw.c new file mode 100644 index 000000000000..0c1f0f4a4b13 --- /dev/null +++ b/lib/fdt_rw.c | |||
@@ -0,0 +1,2 @@ | |||
1 | #include <linux/libfdt_env.h> | ||
2 | #include "../scripts/dtc/libfdt/fdt_rw.c" | ||
diff --git a/lib/fdt_strerror.c b/lib/fdt_strerror.c new file mode 100644 index 000000000000..8713e3ff4707 --- /dev/null +++ b/lib/fdt_strerror.c | |||
@@ -0,0 +1,2 @@ | |||
1 | #include <linux/libfdt_env.h> | ||
2 | #include "../scripts/dtc/libfdt/fdt_strerror.c" | ||
diff --git a/lib/fdt_sw.c b/lib/fdt_sw.c new file mode 100644 index 000000000000..9ac7e50c76ce --- /dev/null +++ b/lib/fdt_sw.c | |||
@@ -0,0 +1,2 @@ | |||
1 | #include <linux/libfdt_env.h> | ||
2 | #include "../scripts/dtc/libfdt/fdt_sw.c" | ||
diff --git a/lib/fdt_wip.c b/lib/fdt_wip.c new file mode 100644 index 000000000000..45b3fc3d3ba1 --- /dev/null +++ b/lib/fdt_wip.c | |||
@@ -0,0 +1,2 @@ | |||
1 | #include <linux/libfdt_env.h> | ||
2 | #include "../scripts/dtc/libfdt/fdt_wip.c" | ||