Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus

Pull MIPS updates from Ralf Baechle:
"More hardware support across the field including a bunch of device
drivers. The highlight however really are further steps towards
device tree.

This has been sitting in -next for ages. All MIPS _defconfigs have
been tested to boot or where I don't have hardware available, to at
least build fine."

* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (77 commits)
MIPS: Loongson 1B: Add defconfig
MIPS: Loongson 1B: Add board support
MIPS: Netlogic: early console fix
MIPS: Netlogic: Fix indentation of smpboot.S
MIPS: Netlogic: remove cpu_has_dc_aliases define for XLP
MIPS: Netlogic: Remove unused pcibios_fixups
MIPS: Netlogic: Add XLP SoC devices in FDT
MIPS: Netlogic: Add IRQ mappings for more devices
MIPS: Netlogic: USB support for XLP
MIPS: Netlogic: XLP PCIe controller support.
MIPS: Netlogic: Platform changes for XLR/XLS I2C
MIPS: Netlogic: Platform NAND/NOR flash support
MIPS: Netlogic: Platform changes for XLS USB
MIPS: Netlogic: Remove NETLOGIC_ prefix
MIPS: Netlogic: SMP wakeup code update
MIPS: Netlogic: Update comments in smpboot.S
MIPS: BCM63XX: Add 96328avng reference board
MIPS: Expose PCIe drivers for MIPS
MIPS: BCM63XX: Add PCIe Support for BCM6328
MIPS: BCM63XX: Move the PCI initialization into its own function
...

+8110 -2225
+30
Documentation/devicetree/bindings/ata/cavium-compact-flash.txt
··· 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 + };
+49
Documentation/devicetree/bindings/gpio/cavium-octeon-gpio.txt
··· 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 + };
+34
Documentation/devicetree/bindings/i2c/cavium-i2c.txt
··· 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 + };
+126
Documentation/devicetree/bindings/mips/cavium/bootbus.txt
··· 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 + };
+26
Documentation/devicetree/bindings/mips/cavium/ciu.txt
··· 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 + };
+27
Documentation/devicetree/bindings/mips/cavium/ciu2.txt
··· 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 + };
+21
Documentation/devicetree/bindings/mips/cavium/dma-engine.txt
··· 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 + };
+46
Documentation/devicetree/bindings/mips/cavium/uctl.txt
··· 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 + };
+27
Documentation/devicetree/bindings/net/cavium-mdio.txt
··· 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 + };
+39
Documentation/devicetree/bindings/net/cavium-mix.txt
··· 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 + };
+98
Documentation/devicetree/bindings/net/cavium-pip.txt
··· 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 + };
+19
Documentation/devicetree/bindings/serial/cavium-uart.txt
··· 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 + };
+1
arch/mips/Kbuild.platforms
··· 14 14 platforms += lantiq 15 15 platforms += lasat 16 16 platforms += loongson 17 + platforms += loongson1 17 18 platforms += mipssim 18 19 platforms += mti-malta 19 20 platforms += netlogic
+37 -1
arch/mips/Kconfig
··· 209 209 select SYS_HAS_CPU_MIPS32_R1 210 210 select SYS_SUPPORTS_32BIT_KERNEL 211 211 select SYS_SUPPORTS_LITTLE_ENDIAN 212 + select SYS_SUPPORTS_ZBOOT_UART16550 212 213 select DMA_NONCOHERENT 213 214 select IRQ_CPU 214 215 select GENERIC_GPIO ··· 264 263 developed at Institute of Computing Technology (ICT), 265 264 Chinese Academy of Sciences (CAS) in the People's Republic 266 265 of China. The chief architect is Professor Weiwu Hu. 266 + 267 + config MACH_LOONGSON1 268 + bool "Loongson 1 family of machines" 269 + select SYS_SUPPORTS_ZBOOT 270 + help 271 + This enables support for the Loongson 1 based machines. 272 + 273 + Loongson 1 is a family of 32-bit MIPS-compatible SoCs developed by 274 + the ICT (Institute of Computing Technology) and the Chinese Academy 275 + of Sciences. 267 276 268 277 config MIPS_MALTA 269 278 bool "MIPS Malta board" ··· 798 787 select ZONE_DMA if 64BIT 799 788 select SYNC_R4K 800 789 select SYS_HAS_EARLY_PRINTK 790 + select USB_ARCH_HAS_OHCI if USB_SUPPORT 791 + select USB_ARCH_HAS_EHCI if USB_SUPPORT 801 792 help 802 793 Support for systems based on Netlogic XLR and XLS processors. 803 794 Say Y here if you have a XLR or XLS based board. ··· 812 799 select SYS_HAS_CPU_XLP 813 800 select SYS_SUPPORTS_SMP 814 801 select HW_HAS_PCI 815 - select SWAP_IO_SPACE 816 802 select SYS_SUPPORTS_32BIT_KERNEL 817 803 select SYS_SUPPORTS_64BIT_KERNEL 818 804 select 64BIT_PHYS_ADDR ··· 848 836 source "arch/mips/vr41xx/Kconfig" 849 837 source "arch/mips/cavium-octeon/Kconfig" 850 838 source "arch/mips/loongson/Kconfig" 839 + source "arch/mips/loongson1/Kconfig" 851 840 source "arch/mips/netlogic/Kconfig" 852 841 853 842 endmenu ··· 1230 1217 have a similar programming interface with FPGA northbridge used in 1231 1218 Loongson2E. 1232 1219 1220 + config CPU_LOONGSON1B 1221 + bool "Loongson 1B" 1222 + depends on SYS_HAS_CPU_LOONGSON1B 1223 + select CPU_LOONGSON1 1224 + help 1225 + The Loongson 1B is a 32-bit SoC, which implements the MIPS32 1226 + release 2 instruction set. 1227 + 1233 1228 config CPU_MIPS32_R1 1234 1229 bool "MIPS32 Release 1" 1235 1230 depends on SYS_HAS_CPU_MIPS32_R1 ··· 1453 1432 select WEAK_ORDERING 1454 1433 select CPU_SUPPORTS_HIGHMEM 1455 1434 select CPU_SUPPORTS_HUGEPAGES 1435 + select LIBFDT 1436 + select USE_OF 1456 1437 help 1457 1438 The Cavium Octeon processor is a highly integrated chip containing 1458 1439 many ethernet hardware widgets for networking tasks. The processor ··· 1567 1544 select CPU_SUPPORTS_64BIT_KERNEL 1568 1545 select CPU_SUPPORTS_HIGHMEM 1569 1546 1547 + config CPU_LOONGSON1 1548 + bool 1549 + select CPU_MIPS32 1550 + select CPU_MIPSR2 1551 + select CPU_HAS_PREFETCH 1552 + select CPU_SUPPORTS_32BIT_KERNEL 1553 + select CPU_SUPPORTS_HIGHMEM 1554 + 1570 1555 config CPU_BMIPS 1571 1556 bool 1572 1557 select CPU_MIPS32 ··· 1592 1561 select CPU_SUPPORTS_CPUFREQ 1593 1562 select CPU_SUPPORTS_ADDRWINCFG if 64BIT 1594 1563 select CPU_SUPPORTS_UNCACHED_ACCELERATED 1564 + 1565 + config SYS_HAS_CPU_LOONGSON1B 1566 + bool 1595 1567 1596 1568 config SYS_HAS_CPU_MIPS32_R1 1597 1569 bool ··· 2399 2365 bool 2400 2366 2401 2367 source "drivers/pci/Kconfig" 2368 + 2369 + source "drivers/pci/pcie/Kconfig" 2402 2370 2403 2371 # 2404 2372 # ISA support is now enabled via select. Too many systems still have the one
+2 -2
arch/mips/alchemy/board-mtx1.c
··· 81 81 82 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 85 /* Enable USB power switch */ 86 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 89 /* Initialize sys_pinfunc */ 90 90 au_writel(SYS_PF_NI2, SYS_PINFUNC);
+4 -6
arch/mips/alchemy/common/platform.c
··· 334 334 if (alchemy_get_macs(ctype) < 1) 335 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 339 if (!macres) { 339 340 printk(KERN_INFO "Alchemy: no memory for MAC0 resources\n"); 340 341 return; 341 342 } 342 - memcpy(macres, au1xxx_eth0_resources[ctype], 343 - sizeof(struct resource) * MAC_RES_COUNT); 344 343 au1xxx_eth0_device.resource = macres; 345 344 346 345 i = prom_get_ethernet_addr(ethaddr); ··· 355 356 if (alchemy_get_macs(ctype) < 2) 356 357 return; 357 358 358 - macres = kmalloc(sizeof(struct resource) * MAC_RES_COUNT, GFP_KERNEL); 359 + macres = kmemdup(au1xxx_eth1_resources[ctype], 360 + sizeof(struct resource) * MAC_RES_COUNT, GFP_KERNEL); 359 361 if (!macres) { 360 362 printk(KERN_INFO "Alchemy: no memory for MAC1 resources\n"); 361 363 return; 362 364 } 363 - memcpy(macres, au1xxx_eth1_resources[ctype], 364 - sizeof(struct resource) * MAC_RES_COUNT); 365 365 au1xxx_eth1_device.resource = macres; 366 366 367 367 ethaddr[5] += 1; /* next addr for 2nd MAC */
+1 -1
arch/mips/alchemy/devboards/Makefile
··· 2 2 # Alchemy Develboards 3 3 # 4 4 5 - obj-y += prom.o bcsr.o platform.o 5 + obj-y += bcsr.o platform.o 6 6 obj-$(CONFIG_PM) += pm.o 7 7 obj-$(CONFIG_MIPS_PB1100) += pb1100.o 8 8 obj-$(CONFIG_MIPS_PB1500) += pb1500.o
+1 -4
arch/mips/alchemy/devboards/bcsr.c
··· 90 90 unsigned short bisr = __raw_readw(bcsr_virt + BCSR_REG_INTSTAT); 91 91 92 92 disable_irq_nosync(irq); 93 - 94 - for ( ; bisr; bisr &= bisr - 1) 95 - generic_handle_irq(bcsr_csc_base + __ffs(bisr)); 96 - 93 + generic_handle_irq(bcsr_csc_base + __ffs(bisr)); 97 94 enable_irq(irq); 98 95 } 99 96
+2 -2
arch/mips/alchemy/devboards/pb1100.c
··· 46 46 alchemy_gpio1_input_enable(); 47 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 51 u32 pin_func, sys_freqctrl, sys_clksrc; 52 52 ··· 93 93 pin_func |= SYS_PF_USB; 94 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 98 /* Enable sys bus clock divider when IDLE state or no bus activity. */ 99 99 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL);
+2 -2
arch/mips/alchemy/devboards/pb1500.c
··· 53 53 alchemy_gpio_direction_input(201); 54 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 58 /* Zero and disable FREQ2 */ 59 59 sys_freqctrl = au_readl(SYS_FREQCTRL0); ··· 87 87 /* 2nd USB port is USB host */ 88 88 pin_func |= SYS_PF_USB; 89 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 92 #ifdef CONFIG_PCI 93 93 {
+30
arch/mips/alchemy/devboards/platform.c
··· 10 10 #include <linux/platform_device.h> 11 11 #include <linux/pm.h> 12 12 13 + #include <asm/bootinfo.h> 13 14 #include <asm/reboot.h> 15 + #include <asm/mach-au1x00/au1000.h> 14 16 #include <asm/mach-db1x00/bcsr.h> 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 + } 15 45 16 46 17 47 static struct platform_device db1x00_rtc_dev = {
-69
arch/mips/alchemy/devboards/prom.c
··· 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 - }
+4
arch/mips/bcm63xx/Kconfig
··· 1 1 menu "CPU support" 2 2 depends on BCM63XX 3 3 4 + config BCM63XX_CPU_6328 5 + bool "support 6328 CPU" 6 + select HW_HAS_PCI 7 + 4 8 config BCM63XX_CPU_6338 5 9 bool "support 6338 CPU" 6 10 select HW_HAS_PCI
+2 -1
arch/mips/bcm63xx/Makefile
··· 1 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 4 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 4 5 5 6 obj-y += boards/
+58 -49
arch/mips/bcm63xx/boards/board_bcm963xx.c
··· 11 11 #include <linux/kernel.h> 12 12 #include <linux/string.h> 13 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 14 #include <linux/ssb/ssb.h> 18 15 #include <asm/addrspace.h> 19 16 #include <bcm63xx_board.h> ··· 21 24 #include <bcm63xx_dev_pci.h> 22 25 #include <bcm63xx_dev_enet.h> 23 26 #include <bcm63xx_dev_dsp.h> 27 + #include <bcm63xx_dev_flash.h> 24 28 #include <bcm63xx_dev_pcmcia.h> 29 + #include <bcm63xx_dev_spi.h> 25 30 #include <board_bcm963xx.h> 26 31 27 32 #define PFX "board_bcm963xx: " ··· 31 32 static struct bcm963xx_nvram nvram; 32 33 static unsigned int mac_addr_used; 33 34 static struct board_info board; 35 + 36 + /* 37 + * known 6328 boards 38 + */ 39 + #ifdef CONFIG_BCM63XX_CPU_6328 40 + static struct board_info __initdata board_96328avng = { 41 + .name = "96328avng", 42 + .expected_cpu_id = 0x6328, 43 + 44 + .has_uart0 = 1, 45 + .has_pci = 1, 46 + 47 + .leds = { 48 + { 49 + .name = "96328avng::ppp-fail", 50 + .gpio = 2, 51 + .active_low = 1, 52 + }, 53 + { 54 + .name = "96328avng::power", 55 + .gpio = 4, 56 + .active_low = 1, 57 + .default_trigger = "default-on", 58 + }, 59 + { 60 + .name = "96328avng::power-fail", 61 + .gpio = 8, 62 + .active_low = 1, 63 + }, 64 + { 65 + .name = "96328avng::wps", 66 + .gpio = 9, 67 + .active_low = 1, 68 + }, 69 + { 70 + .name = "96328avng::ppp", 71 + .gpio = 11, 72 + .active_low = 1, 73 + }, 74 + }, 75 + }; 76 + #endif 34 77 35 78 /* 36 79 * known 6338 boards ··· 633 592 * all boards 634 593 */ 635 594 static const struct board_info __initdata *bcm963xx_boards[] = { 595 + #ifdef CONFIG_BCM63XX_CPU_6328 596 + &board_96328avng, 597 + #endif 636 598 #ifdef CONFIG_BCM63XX_CPU_6338 637 599 &board_96338gw, 638 600 &board_96338w, ··· 753 709 char cfe_version[32]; 754 710 u32 val; 755 711 756 - /* read base address of boot chip select (0) */ 757 - val = bcm_mpi_readl(MPI_CSBASE_REG(0)); 758 - val &= MPI_CSBASE_BASE_MASK; 712 + /* read base address of boot chip select (0) 713 + * 6328 does not have MPI but boots from a fixed address 714 + */ 715 + if (BCMCPU_IS_6328()) 716 + val = 0x18000000; 717 + else { 718 + val = bcm_mpi_readl(MPI_CSBASE_REG(0)); 719 + val &= MPI_CSBASE_BASE_MASK; 720 + } 759 721 boot_addr = (u8 *)KSEG1ADDR(val); 760 722 761 723 /* dump cfe version */ ··· 858 808 panic("unexpected CPU for bcm963xx board"); 859 809 } 860 810 861 - static struct mtd_partition mtd_partitions[] = { 862 - { 863 - .name = "cfe", 864 - .offset = 0x0, 865 - .size = 0x40000, 866 - } 867 - }; 868 - 869 - static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL }; 870 - 871 - static struct physmap_flash_data flash_data = { 872 - .width = 2, 873 - .nr_parts = ARRAY_SIZE(mtd_partitions), 874 - .parts = mtd_partitions, 875 - .part_probe_types = bcm63xx_part_types, 876 - }; 877 - 878 - static struct resource mtd_resources[] = { 879 - { 880 - .start = 0, /* filled at runtime */ 881 - .end = 0, /* filled at runtime */ 882 - .flags = IORESOURCE_MEM, 883 - } 884 - }; 885 - 886 - static struct platform_device mtd_dev = { 887 - .name = "physmap-flash", 888 - .resource = mtd_resources, 889 - .num_resources = ARRAY_SIZE(mtd_resources), 890 - .dev = { 891 - .platform_data = &flash_data, 892 - }, 893 - }; 894 - 895 811 static struct gpio_led_platform_data bcm63xx_led_data; 896 812 897 813 static struct platform_device bcm63xx_gpio_leds = { ··· 871 855 */ 872 856 int __init board_register_devices(void) 873 857 { 874 - u32 val; 875 - 876 858 if (board.has_uart0) 877 859 bcm63xx_uart_register(0); 878 860 ··· 904 890 } 905 891 #endif 906 892 907 - /* read base address of boot chip select (0) */ 908 - val = bcm_mpi_readl(MPI_CSBASE_REG(0)); 909 - val &= MPI_CSBASE_BASE_MASK; 893 + bcm63xx_spi_register(); 910 894 911 - mtd_resources[0].start = val; 912 - mtd_resources[0].end = 0x1FFFFFFF; 913 - 914 - platform_device_register(&mtd_dev); 895 + bcm63xx_flash_register(); 915 896 916 897 bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); 917 898 bcm63xx_led_data.leds = board.leds;
+21 -5
arch/mips/bcm63xx/clk.c
··· 120 120 { 121 121 if (!BCMCPU_IS_6368()) 122 122 return; 123 - bcm_hwclock_set(CKCTL_6368_ROBOSW_CLK_EN | 123 + bcm_hwclock_set(CKCTL_6368_ROBOSW_EN | 124 124 CKCTL_6368_SWPKT_USB_EN | 125 125 CKCTL_6368_SWPKT_SAR_EN, enable); 126 126 if (enable) { ··· 163 163 if (BCMCPU_IS_6348()) 164 164 bcm_hwclock_set(CKCTL_6348_USBH_EN, enable); 165 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 169 static struct clk clk_usbh = { ··· 181 181 mask = CKCTL_6338_SPI_EN; 182 182 else if (BCMCPU_IS_6348()) 183 183 mask = CKCTL_6348_SPI_EN; 184 - else 185 - /* BCMCPU_IS_6358 */ 184 + else if (BCMCPU_IS_6358()) 186 185 mask = CKCTL_6358_SPI_EN; 186 + else 187 + /* BCMCPU_IS_6368 */ 188 + mask = CKCTL_6368_SPI_EN; 187 189 bcm_hwclock_set(mask, enable); 188 190 } 189 191 ··· 201 199 if (!BCMCPU_IS_6368()) 202 200 return; 203 201 204 - bcm_hwclock_set(CKCTL_6368_SAR_CLK_EN | 202 + bcm_hwclock_set(CKCTL_6368_SAR_EN | 205 203 CKCTL_6368_SWPKT_SAR_EN, enable); 206 204 207 205 if (enable) { ··· 221 219 222 220 static struct clk clk_xtm = { 223 221 .set = xtm_set, 222 + }; 223 + 224 + /* 225 + * IPsec clock 226 + */ 227 + static void ipsec_set(struct clk *clk, int enable) 228 + { 229 + bcm_hwclock_set(CKCTL_6368_IPSEC_EN, enable); 230 + } 231 + 232 + static struct clk clk_ipsec = { 233 + .set = ipsec_set, 224 234 }; 225 235 226 236 /* ··· 292 278 return &clk_periph; 293 279 if (BCMCPU_IS_6358() && !strcmp(id, "pcm")) 294 280 return &clk_pcm; 281 + if (BCMCPU_IS_6368() && !strcmp(id, "ipsec")) 282 + return &clk_ipsec; 295 283 return ERR_PTR(-ENOENT); 296 284 } 297 285
+55 -8
arch/mips/bcm63xx/cpu.c
··· 29 29 static unsigned int bcm63xx_cpu_freq; 30 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 40 static const unsigned long bcm6338_regs_base[] = { 33 41 __GEN_CPU_REGS_TABLE(6338) 34 42 }; ··· 107 99 static unsigned int detect_cpu_clock(void) 108 100 { 109 101 switch (bcm63xx_get_cpu_id()) { 102 + case BCM6328_CPU_ID: 103 + { 104 + unsigned int tmp, mips_pll_fcvo; 105 + 106 + tmp = bcm_misc_readl(MISC_STRAPBUS_6328_REG); 107 + mips_pll_fcvo = (tmp & STRAPBUS_6328_FCVO_MASK) 108 + >> STRAPBUS_6328_FCVO_SHIFT; 109 + 110 + switch (mips_pll_fcvo) { 111 + case 0x12: 112 + case 0x14: 113 + case 0x19: 114 + return 160000000; 115 + case 0x1c: 116 + return 192000000; 117 + case 0x13: 118 + case 0x15: 119 + return 200000000; 120 + case 0x1a: 121 + return 384000000; 122 + case 0x16: 123 + return 400000000; 124 + default: 125 + return 320000000; 126 + } 127 + 128 + } 110 129 case BCM6338_CPU_ID: 111 130 /* BCM6338 has a fixed 240 Mhz frequency */ 112 131 return 240000000; ··· 205 170 unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0; 206 171 u32 val; 207 172 173 + if (BCMCPU_IS_6328()) 174 + return bcm_ddr_readl(DDR_CSEND_REG) << 24; 175 + 208 176 if (BCMCPU_IS_6345()) { 209 177 val = bcm_sdram_readl(SDRAM_MBASE_REG); 210 178 return (val * 8 * 1024 * 1024); ··· 266 228 bcm63xx_irqs = bcm6345_irqs; 267 229 break; 268 230 case CPU_BMIPS4350: 269 - switch (read_c0_prid() & 0xf0) { 270 - case 0x10: 231 + if ((read_c0_prid() & 0xf0) == 0x10) { 271 232 expected_cpu_id = BCM6358_CPU_ID; 272 233 bcm63xx_regs_base = bcm6358_regs_base; 273 234 bcm63xx_irqs = bcm6358_irqs; 274 - break; 275 - case 0x30: 276 - expected_cpu_id = BCM6368_CPU_ID; 277 - bcm63xx_regs_base = bcm6368_regs_base; 278 - bcm63xx_irqs = bcm6368_irqs; 279 - break; 235 + } else { 236 + /* all newer chips have the same chip id location */ 237 + u16 chip_id = bcm_readw(BCM_6368_PERF_BASE); 238 + 239 + switch (chip_id) { 240 + case BCM6328_CPU_ID: 241 + expected_cpu_id = BCM6328_CPU_ID; 242 + bcm63xx_regs_base = bcm6328_regs_base; 243 + bcm63xx_irqs = bcm6328_irqs; 244 + break; 245 + case BCM6368_CPU_ID: 246 + expected_cpu_id = BCM6368_CPU_ID; 247 + bcm63xx_regs_base = bcm6368_regs_base; 248 + bcm63xx_irqs = bcm6368_irqs; 249 + break; 250 + } 280 251 } 281 252 break; 282 253 }
+1 -1
arch/mips/bcm63xx/dev-dsp.c
··· 31 31 32 32 static struct platform_device bcm63xx_voip_dsp_device = { 33 33 .name = "bcm63xx-voip-dsp", 34 - .id = 0, 34 + .id = -1, 35 35 .num_resources = ARRAY_SIZE(voip_dsp_resources), 36 36 .resource = voip_dsp_resources, 37 37 };
+123
arch/mips/bcm63xx/dev-flash.c
··· 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 + }
+40
arch/mips/bcm63xx/dev-rng.c
··· 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);
+119
arch/mips/bcm63xx/dev-spi.c
··· 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 + }
+1 -1
arch/mips/bcm63xx/dev-wdt.c
··· 21 21 22 22 static struct platform_device bcm63xx_wdt_device = { 23 23 .name = "bcm63xx-wdt", 24 - .id = 0, 24 + .id = -1, 25 25 .num_resources = ARRAY_SIZE(wdt_resources), 26 26 .resource = wdt_resources, 27 27 };
+21
arch/mips/bcm63xx/irq.c
··· 27 27 static void __internal_irq_unmask_64(unsigned int irq) __maybe_unused; 28 28 29 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 41 #ifdef CONFIG_BCM63XX_CPU_6338 31 42 #define irq_stat_reg PERF_IRQSTAT_6338_REG 32 43 #define irq_mask_reg PERF_IRQMASK_6338_REG ··· 129 118 irq_mask_addr = bcm63xx_regset_address(RSET_PERF); 130 119 131 120 switch (bcm63xx_get_cpu_id()) { 121 + case BCM6328_CPU_ID: 122 + irq_stat_addr += PERF_IRQSTAT_6328_REG; 123 + irq_mask_addr += PERF_IRQMASK_6328_REG; 124 + irq_bits = 64; 125 + ext_irq_count = 4; 126 + is_ext_irq_cascaded = 1; 127 + ext_irq_start = BCM_6328_EXT_IRQ0 - IRQ_INTERNAL_BASE; 128 + ext_irq_end = BCM_6328_EXT_IRQ3 - IRQ_INTERNAL_BASE; 129 + ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6328; 130 + break; 132 131 case BCM6338_CPU_ID: 133 132 irq_stat_addr += PERF_IRQSTAT_6338_REG; 134 133 irq_mask_addr += PERF_IRQMASK_6338_REG;
+3 -1
arch/mips/bcm63xx/prom.c
··· 26 26 bcm_wdt_writel(WDT_STOP_2, WDT_CTL_REG); 27 27 28 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 32 mask = CKCTL_6338_ALL_SAFE_EN; 31 33 else if (BCMCPU_IS_6345()) 32 34 mask = CKCTL_6345_ALL_SAFE_EN;
+10 -3
arch/mips/bcm63xx/setup.c
··· 68 68 69 69 /* mask and clear all external irq */ 70 70 switch (bcm63xx_get_cpu_id()) { 71 + case BCM6328_CPU_ID: 72 + perf_regs[0] = PERF_EXTIRQ_CFG_REG_6328; 73 + break; 71 74 case BCM6338_CPU_ID: 72 75 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6338; 73 76 break; ··· 98 95 bcm6348_a1_reboot(); 99 96 100 97 printk(KERN_INFO "triggering watchdog soft-reset...\n"); 101 - reg = bcm_perf_readl(PERF_SYS_PLL_CTL_REG); 102 - reg |= SYS_PLL_SOFT_RESET; 103 - bcm_perf_writel(reg, PERF_SYS_PLL_CTL_REG); 98 + if (BCMCPU_IS_6328()) { 99 + bcm_wdt_writel(1, WDT_SOFTRESET_REG); 100 + } else { 101 + reg = bcm_perf_readl(PERF_SYS_PLL_CTL_REG); 102 + reg |= SYS_PLL_SOFT_RESET; 103 + bcm_perf_writel(reg, PERF_SYS_PLL_CTL_REG); 104 + } 104 105 while (1) 105 106 ; 106 107 }
+4
arch/mips/boot/compressed/Makefile
··· 58 58 # Calculate the load address of the compressed kernel image 59 59 hostprogs-y := calc_vmlinuz_load_addr 60 60 61 + ifeq ($(CONFIG_MACH_JZ4740),y) 62 + VMLINUZ_LOAD_ADDRESS := 0x80600000 63 + else 61 64 VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \ 62 65 $(obj)/vmlinux.bin $(VMLINUX_LOAD_ADDRESS)) 66 + endif 63 67 64 68 vmlinuzobjs-y += $(obj)/piggy.o 65 69
+5
arch/mips/boot/compressed/uart-16550.c
··· 18 18 #define PORT(offset) (CKSEG1ADDR(AR7_REGS_UART0) + (4 * offset)) 19 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 26 #ifndef PORT 22 27 #error please define the serial port address for your own machine 23 28 #endif
+2
arch/mips/cavium-octeon/.gitignore
··· 1 + *.dtb.S 2 + *.dtb
+16
arch/mips/cavium-octeon/Makefile
··· 9 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 15 obj-y := cpu.o setup.o serial.o octeon-platform.o octeon-irq.o csrc-octeon.o 13 16 obj-y += dma-octeon.o flash_setup.o 14 17 obj-y += octeon-memcpy.o 15 18 obj-y += executive/ 16 19 17 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))
-183
arch/mips/cavium-octeon/executive/cvmx-fpa.c
··· 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 - }
-243
arch/mips/cavium-octeon/executive/cvmx-helper-fpa.c
··· 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 - }
+311 -82
arch/mips/cavium-octeon/octeon-irq.c
··· 3 3 * License. See the file "COPYING" in the main directory of this archive 4 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 9 #include <linux/interrupt.h> 10 + #include <linux/irqdomain.h> 10 11 #include <linux/bitops.h> 11 12 #include <linux/percpu.h> 13 + #include <linux/slab.h> 12 14 #include <linux/irq.h> 13 15 #include <linux/smp.h> 16 + #include <linux/of.h> 14 17 15 18 #include <asm/octeon/octeon.h> 16 19 ··· 45 42 46 43 static struct octeon_core_chip_data octeon_irq_core_chip_data[MIPS_CORE_IRQ_LINES]; 47 44 48 - static void __init octeon_irq_set_ciu_mapping(int irq, int line, int bit, 49 - struct irq_chip *chip, 50 - irq_flow_handler_t handler) 45 + static void octeon_irq_set_ciu_mapping(int irq, int line, int bit, 46 + struct irq_chip *chip, 47 + irq_flow_handler_t handler) 51 48 { 52 49 union octeon_ciu_chip_data cd; 53 50 ··· 508 505 } 509 506 } 510 507 508 + static void octeon_irq_gpio_setup(struct irq_data *data) 509 + { 510 + union cvmx_gpio_bit_cfgx cfg; 511 + union octeon_ciu_chip_data cd; 512 + u32 t = irqd_get_trigger_type(data); 513 + 514 + cd.p = irq_data_get_irq_chip_data(data); 515 + 516 + cfg.u64 = 0; 517 + cfg.s.int_en = 1; 518 + cfg.s.int_type = (t & IRQ_TYPE_EDGE_BOTH) != 0; 519 + cfg.s.rx_xor = (t & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_EDGE_FALLING)) != 0; 520 + 521 + /* 140 nS glitch filter*/ 522 + cfg.s.fil_cnt = 7; 523 + cfg.s.fil_sel = 3; 524 + 525 + cvmx_write_csr(CVMX_GPIO_BIT_CFGX(cd.s.bit - 16), cfg.u64); 526 + } 527 + 528 + static void octeon_irq_ciu_enable_gpio_v2(struct irq_data *data) 529 + { 530 + octeon_irq_gpio_setup(data); 531 + octeon_irq_ciu_enable_v2(data); 532 + } 533 + 534 + static void octeon_irq_ciu_enable_gpio(struct irq_data *data) 535 + { 536 + octeon_irq_gpio_setup(data); 537 + octeon_irq_ciu_enable(data); 538 + } 539 + 540 + static int octeon_irq_ciu_gpio_set_type(struct irq_data *data, unsigned int t) 541 + { 542 + irqd_set_trigger_type(data, t); 543 + octeon_irq_gpio_setup(data); 544 + 545 + return IRQ_SET_MASK_OK; 546 + } 547 + 548 + static void octeon_irq_ciu_disable_gpio_v2(struct irq_data *data) 549 + { 550 + union octeon_ciu_chip_data cd; 551 + 552 + cd.p = irq_data_get_irq_chip_data(data); 553 + cvmx_write_csr(CVMX_GPIO_BIT_CFGX(cd.s.bit - 16), 0); 554 + 555 + octeon_irq_ciu_disable_all_v2(data); 556 + } 557 + 558 + static void octeon_irq_ciu_disable_gpio(struct irq_data *data) 559 + { 560 + union octeon_ciu_chip_data cd; 561 + 562 + cd.p = irq_data_get_irq_chip_data(data); 563 + cvmx_write_csr(CVMX_GPIO_BIT_CFGX(cd.s.bit - 16), 0); 564 + 565 + octeon_irq_ciu_disable_all(data); 566 + } 567 + 568 + static void octeon_irq_ciu_gpio_ack(struct irq_data *data) 569 + { 570 + union octeon_ciu_chip_data cd; 571 + u64 mask; 572 + 573 + cd.p = irq_data_get_irq_chip_data(data); 574 + mask = 1ull << (cd.s.bit - 16); 575 + 576 + cvmx_write_csr(CVMX_GPIO_INT_CLR, mask); 577 + } 578 + 579 + static void octeon_irq_handle_gpio(unsigned int irq, struct irq_desc *desc) 580 + { 581 + if (irqd_get_trigger_type(irq_desc_get_irq_data(desc)) & IRQ_TYPE_EDGE_BOTH) 582 + handle_edge_irq(irq, desc); 583 + else 584 + handle_level_irq(irq, desc); 585 + } 586 + 511 587 #ifdef CONFIG_SMP 512 588 513 589 static void octeon_irq_cpu_offline_ciu(struct irq_data *data) ··· 732 650 .name = "CIU", 733 651 .irq_enable = octeon_irq_ciu_enable_v2, 734 652 .irq_disable = octeon_irq_ciu_disable_all_v2, 735 - .irq_mask = octeon_irq_ciu_disable_local_v2, 736 - .irq_unmask = octeon_irq_ciu_enable_v2, 737 - #ifdef CONFIG_SMP 738 - .irq_set_affinity = octeon_irq_ciu_set_affinity_v2, 739 - .irq_cpu_offline = octeon_irq_cpu_offline_ciu, 740 - #endif 741 - }; 742 - 743 - static struct irq_chip octeon_irq_chip_ciu_edge_v2 = { 744 - .name = "CIU-E", 745 - .irq_enable = octeon_irq_ciu_enable_v2, 746 - .irq_disable = octeon_irq_ciu_disable_all_v2, 747 653 .irq_ack = octeon_irq_ciu_ack, 748 654 .irq_mask = octeon_irq_ciu_disable_local_v2, 749 655 .irq_unmask = octeon_irq_ciu_enable_v2, ··· 745 675 .name = "CIU", 746 676 .irq_enable = octeon_irq_ciu_enable, 747 677 .irq_disable = octeon_irq_ciu_disable_all, 748 - .irq_mask = octeon_irq_dummy_mask, 749 - #ifdef CONFIG_SMP 750 - .irq_set_affinity = octeon_irq_ciu_set_affinity, 751 - .irq_cpu_offline = octeon_irq_cpu_offline_ciu, 752 - #endif 753 - }; 754 - 755 - static struct irq_chip octeon_irq_chip_ciu_edge = { 756 - .name = "CIU-E", 757 - .irq_enable = octeon_irq_ciu_enable, 758 - .irq_disable = octeon_irq_ciu_disable_all, 759 - .irq_mask = octeon_irq_dummy_mask, 760 678 .irq_ack = octeon_irq_ciu_ack, 679 + .irq_mask = octeon_irq_dummy_mask, 761 680 #ifdef CONFIG_SMP 762 681 .irq_set_affinity = octeon_irq_ciu_set_affinity, 763 682 .irq_cpu_offline = octeon_irq_cpu_offline_ciu, ··· 774 715 .irq_cpu_online = octeon_irq_ciu_enable_local, 775 716 .irq_cpu_offline = octeon_irq_ciu_disable_local, 776 717 .flags = IRQCHIP_ONOFFLINE_ENABLED, 718 + }; 719 + 720 + static struct irq_chip octeon_irq_chip_ciu_gpio_v2 = { 721 + .name = "CIU-GPIO", 722 + .irq_enable = octeon_irq_ciu_enable_gpio_v2, 723 + .irq_disable = octeon_irq_ciu_disable_gpio_v2, 724 + .irq_ack = octeon_irq_ciu_gpio_ack, 725 + .irq_mask = octeon_irq_ciu_disable_local_v2, 726 + .irq_unmask = octeon_irq_ciu_enable_v2, 727 + .irq_set_type = octeon_irq_ciu_gpio_set_type, 728 + #ifdef CONFIG_SMP 729 + .irq_set_affinity = octeon_irq_ciu_set_affinity_v2, 730 + #endif 731 + .flags = IRQCHIP_SET_TYPE_MASKED, 732 + }; 733 + 734 + static struct irq_chip octeon_irq_chip_ciu_gpio = { 735 + .name = "CIU-GPIO", 736 + .irq_enable = octeon_irq_ciu_enable_gpio, 737 + .irq_disable = octeon_irq_ciu_disable_gpio, 738 + .irq_mask = octeon_irq_dummy_mask, 739 + .irq_ack = octeon_irq_ciu_gpio_ack, 740 + .irq_set_type = octeon_irq_ciu_gpio_set_type, 741 + #ifdef CONFIG_SMP 742 + .irq_set_affinity = octeon_irq_ciu_set_affinity, 743 + #endif 744 + .flags = IRQCHIP_SET_TYPE_MASKED, 777 745 }; 778 746 779 747 /* ··· 848 762 .irq_enable = octeon_irq_ciu_wd_enable, 849 763 .irq_disable = octeon_irq_ciu_disable_all, 850 764 .irq_mask = octeon_irq_dummy_mask, 765 + }; 766 + 767 + static bool octeon_irq_ciu_is_edge(unsigned int line, unsigned int bit) 768 + { 769 + bool edge = false; 770 + 771 + if (line == 0) 772 + switch (bit) { 773 + case 48 ... 49: /* GMX DRP */ 774 + case 50: /* IPD_DRP */ 775 + case 52 ... 55: /* Timers */ 776 + case 58: /* MPI */ 777 + edge = true; 778 + break; 779 + default: 780 + break; 781 + } 782 + else /* line == 1 */ 783 + switch (bit) { 784 + case 47: /* PTP */ 785 + edge = true; 786 + break; 787 + default: 788 + break; 789 + } 790 + return edge; 791 + } 792 + 793 + struct octeon_irq_gpio_domain_data { 794 + unsigned int base_hwirq; 795 + }; 796 + 797 + static int octeon_irq_gpio_xlat(struct irq_domain *d, 798 + struct device_node *node, 799 + const u32 *intspec, 800 + unsigned int intsize, 801 + unsigned long *out_hwirq, 802 + unsigned int *out_type) 803 + { 804 + unsigned int type; 805 + unsigned int pin; 806 + unsigned int trigger; 807 + struct octeon_irq_gpio_domain_data *gpiod; 808 + 809 + if (d->of_node != node) 810 + return -EINVAL; 811 + 812 + if (intsize < 2) 813 + return -EINVAL; 814 + 815 + pin = intspec[0]; 816 + if (pin >= 16) 817 + return -EINVAL; 818 + 819 + trigger = intspec[1]; 820 + 821 + switch (trigger) { 822 + case 1: 823 + type = IRQ_TYPE_EDGE_RISING; 824 + break; 825 + case 2: 826 + type = IRQ_TYPE_EDGE_FALLING; 827 + break; 828 + case 4: 829 + type = IRQ_TYPE_LEVEL_HIGH; 830 + break; 831 + case 8: 832 + type = IRQ_TYPE_LEVEL_LOW; 833 + break; 834 + default: 835 + pr_err("Error: (%s) Invalid irq trigger specification: %x\n", 836 + node->name, 837 + trigger); 838 + type = IRQ_TYPE_LEVEL_LOW; 839 + break; 840 + } 841 + *out_type = type; 842 + gpiod = d->host_data; 843 + *out_hwirq = gpiod->base_hwirq + pin; 844 + 845 + return 0; 846 + } 847 + 848 + static int octeon_irq_ciu_xlat(struct irq_domain *d, 849 + struct device_node *node, 850 + const u32 *intspec, 851 + unsigned int intsize, 852 + unsigned long *out_hwirq, 853 + unsigned int *out_type) 854 + { 855 + unsigned int ciu, bit; 856 + 857 + ciu = intspec[0]; 858 + bit = intspec[1]; 859 + 860 + if (ciu > 1 || bit > 63) 861 + return -EINVAL; 862 + 863 + /* These are the GPIO lines */ 864 + if (ciu == 0 && bit >= 16 && bit < 32) 865 + return -EINVAL; 866 + 867 + *out_hwirq = (ciu << 6) | bit; 868 + *out_type = 0; 869 + 870 + return 0; 871 + } 872 + 873 + static struct irq_chip *octeon_irq_ciu_chip; 874 + static struct irq_chip *octeon_irq_gpio_chip; 875 + 876 + static bool octeon_irq_virq_in_range(unsigned int virq) 877 + { 878 + /* We cannot let it overflow the mapping array. */ 879 + if (virq < (1ul << 8 * sizeof(octeon_irq_ciu_to_irq[0][0]))) 880 + return true; 881 + 882 + WARN_ONCE(true, "virq out of range %u.\n", virq); 883 + return false; 884 + } 885 + 886 + static int octeon_irq_ciu_map(struct irq_domain *d, 887 + unsigned int virq, irq_hw_number_t hw) 888 + { 889 + unsigned int line = hw >> 6; 890 + unsigned int bit = hw & 63; 891 + 892 + if (!octeon_irq_virq_in_range(virq)) 893 + return -EINVAL; 894 + 895 + if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0) 896 + return -EINVAL; 897 + 898 + if (octeon_irq_ciu_is_edge(line, bit)) 899 + octeon_irq_set_ciu_mapping(virq, line, bit, 900 + octeon_irq_ciu_chip, 901 + handle_edge_irq); 902 + else 903 + octeon_irq_set_ciu_mapping(virq, line, bit, 904 + octeon_irq_ciu_chip, 905 + handle_level_irq); 906 + 907 + return 0; 908 + } 909 + 910 + static int octeon_irq_gpio_map(struct irq_domain *d, 911 + unsigned int virq, irq_hw_number_t hw) 912 + { 913 + unsigned int line = hw >> 6; 914 + unsigned int bit = hw & 63; 915 + 916 + if (!octeon_irq_virq_in_range(virq)) 917 + return -EINVAL; 918 + 919 + if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0) 920 + return -EINVAL; 921 + 922 + octeon_irq_set_ciu_mapping(virq, line, bit, 923 + octeon_irq_gpio_chip, 924 + octeon_irq_handle_gpio); 925 + 926 + return 0; 927 + } 928 + 929 + static struct irq_domain_ops octeon_irq_domain_ciu_ops = { 930 + .map = octeon_irq_ciu_map, 931 + .xlate = octeon_irq_ciu_xlat, 932 + }; 933 + 934 + static struct irq_domain_ops octeon_irq_domain_gpio_ops = { 935 + .map = octeon_irq_gpio_map, 936 + .xlate = octeon_irq_gpio_xlat, 851 937 }; 852 938 853 939 static void octeon_irq_ip2_v1(void) ··· 1145 887 { 1146 888 unsigned int i; 1147 889 struct irq_chip *chip; 1148 - struct irq_chip *chip_edge; 1149 890 struct irq_chip *chip_mbox; 1150 891 struct irq_chip *chip_wd; 892 + struct device_node *gpio_node; 893 + struct device_node *ciu_node; 1151 894 1152 895 octeon_irq_init_ciu_percpu(); 1153 896 octeon_irq_setup_secondary = octeon_irq_setup_secondary_ciu; ··· 1160 901 octeon_irq_ip2 = octeon_irq_ip2_v2; 1161 902 octeon_irq_ip3 = octeon_irq_ip3_v2; 1162 903 chip = &octeon_irq_chip_ciu_v2; 1163 - chip_edge = &octeon_irq_chip_ciu_edge_v2; 1164 904 chip_mbox = &octeon_irq_chip_ciu_mbox_v2; 1165 905 chip_wd = &octeon_irq_chip_ciu_wd_v2; 906 + octeon_irq_gpio_chip = &octeon_irq_chip_ciu_gpio_v2; 1166 907 } else { 1167 908 octeon_irq_ip2 = octeon_irq_ip2_v1; 1168 909 octeon_irq_ip3 = octeon_irq_ip3_v1; 1169 910 chip = &octeon_irq_chip_ciu; 1170 - chip_edge = &octeon_irq_chip_ciu_edge; 1171 911 chip_mbox = &octeon_irq_chip_ciu_mbox; 1172 912 chip_wd = &octeon_irq_chip_ciu_wd; 913 + octeon_irq_gpio_chip = &octeon_irq_chip_ciu_gpio; 1173 914 } 915 + octeon_irq_ciu_chip = chip; 1174 916 octeon_irq_ip4 = octeon_irq_ip4_mask; 1175 917 1176 918 /* Mips internal */ ··· 1180 920 /* CIU_0 */ 1181 921 for (i = 0; i < 16; i++) 1182 922 octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_WORKQ0, 0, i + 0, chip, handle_level_irq); 1183 - for (i = 0; i < 16; i++) 1184 - octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_GPIO0, 0, i + 16, chip, handle_level_irq); 1185 923 1186 924 octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX0, 0, 32, chip_mbox, handle_percpu_irq); 1187 925 octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX1, 0, 33, chip_mbox, handle_percpu_irq); 1188 - 1189 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_UART0, 0, 34, chip, handle_level_irq); 1190 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_UART1, 0, 35, chip, handle_level_irq); 1191 926 1192 927 for (i = 0; i < 4; i++) 1193 928 octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_PCI_INT0, 0, i + 36, chip, handle_level_irq); 1194 929 for (i = 0; i < 4; i++) 1195 930 octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_PCI_MSI0, 0, i + 40, chip, handle_level_irq); 1196 931 1197 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_TWSI, 0, 45, chip, handle_level_irq); 1198 932 octeon_irq_set_ciu_mapping(OCTEON_IRQ_RML, 0, 46, chip, handle_level_irq); 1199 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_TRACE0, 0, 47, chip, handle_level_irq); 1200 - 1201 - for (i = 0; i < 2; i++) 1202 - octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_GMX_DRP0, 0, i + 48, chip_edge, handle_edge_irq); 1203 - 1204 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_IPD_DRP, 0, 50, chip_edge, handle_edge_irq); 1205 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_KEY_ZERO, 0, 51, chip_edge, handle_edge_irq); 1206 - 1207 933 for (i = 0; i < 4; i++) 1208 - octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_TIMER0, 0, i + 52, chip_edge, handle_edge_irq); 934 + octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_TIMER0, 0, i + 52, chip, handle_edge_irq); 1209 935 1210 936 octeon_irq_set_ciu_mapping(OCTEON_IRQ_USB0, 0, 56, chip, handle_level_irq); 1211 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_PCM, 0, 57, chip, handle_level_irq); 1212 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_MPI, 0, 58, chip, handle_level_irq); 1213 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_TWSI2, 0, 59, chip, handle_level_irq); 1214 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_POWIQ, 0, 60, chip, handle_level_irq); 1215 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_IPDPPTHR, 0, 61, chip, handle_level_irq); 1216 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_MII0, 0, 62, chip, handle_level_irq); 1217 937 octeon_irq_set_ciu_mapping(OCTEON_IRQ_BOOTDMA, 0, 63, chip, handle_level_irq); 1218 938 1219 939 /* CIU_1 */ 1220 940 for (i = 0; i < 16; i++) 1221 941 octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_WDOG0, 1, i + 0, chip_wd, handle_level_irq); 1222 942 1223 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_UART2, 1, 16, chip, handle_level_irq); 1224 943 octeon_irq_set_ciu_mapping(OCTEON_IRQ_USB1, 1, 17, chip, handle_level_irq); 1225 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_MII1, 1, 18, chip, handle_level_irq); 1226 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_NAND, 1, 19, chip, handle_level_irq); 1227 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_MIO, 1, 20, chip, handle_level_irq); 1228 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_IOB, 1, 21, chip, handle_level_irq); 1229 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_FPA, 1, 22, chip, handle_level_irq); 1230 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_POW, 1, 23, chip, handle_level_irq); 1231 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_L2C, 1, 24, chip, handle_level_irq); 1232 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_IPD, 1, 25, chip, handle_level_irq); 1233 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_PIP, 1, 26, chip, handle_level_irq); 1234 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_PKO, 1, 27, chip, handle_level_irq); 1235 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_ZIP, 1, 28, chip, handle_level_irq); 1236 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_TIM, 1, 29, chip, handle_level_irq); 1237 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_RAD, 1, 30, chip, handle_level_irq); 1238 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_KEY, 1, 31, chip, handle_level_irq); 1239 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_DFA, 1, 32, chip, handle_level_irq); 1240 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_USBCTL, 1, 33, chip, handle_level_irq); 1241 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_SLI, 1, 34, chip, handle_level_irq); 1242 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_DPI, 1, 35, chip, handle_level_irq); 1243 944 1244 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_AGX0, 1, 36, chip, handle_level_irq); 945 + gpio_node = of_find_compatible_node(NULL, NULL, "cavium,octeon-3860-gpio"); 946 + if (gpio_node) { 947 + struct octeon_irq_gpio_domain_data *gpiod; 1245 948 1246 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_AGL, 1, 46, chip, handle_level_irq); 949 + gpiod = kzalloc(sizeof(*gpiod), GFP_KERNEL); 950 + if (gpiod) { 951 + /* gpio domain host_data is the base hwirq number. */ 952 + gpiod->base_hwirq = 16; 953 + irq_domain_add_linear(gpio_node, 16, &octeon_irq_domain_gpio_ops, gpiod); 954 + of_node_put(gpio_node); 955 + } else 956 + pr_warn("Cannot allocate memory for GPIO irq_domain.\n"); 957 + } else 958 + pr_warn("Cannot find device node for cavium,octeon-3860-gpio.\n"); 1247 959 1248 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_PTP, 1, 47, chip_edge, handle_edge_irq); 1249 - 1250 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_PEM0, 1, 48, chip, handle_level_irq); 1251 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_PEM1, 1, 49, chip, handle_level_irq); 1252 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_SRIO0, 1, 50, chip, handle_level_irq); 1253 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_SRIO1, 1, 51, chip, handle_level_irq); 1254 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_LMC0, 1, 52, chip, handle_level_irq); 1255 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_DFM, 1, 56, chip, handle_level_irq); 1256 - octeon_irq_set_ciu_mapping(OCTEON_IRQ_RST, 1, 63, chip, handle_level_irq); 960 + ciu_node = of_find_compatible_node(NULL, NULL, "cavium,octeon-3860-ciu"); 961 + if (ciu_node) { 962 + irq_domain_add_tree(ciu_node, &octeon_irq_domain_ciu_ops, NULL); 963 + of_node_put(ciu_node); 964 + } else 965 + pr_warn("Cannot find device node for cavium,octeon-3860-ciu.\n"); 1257 966 1258 967 /* Enable the CIU lines */ 1259 968 set_c0_status(STATUSF_IP3 | STATUSF_IP2);
+12 -4
arch/mips/cavium-octeon/octeon-memcpy.S
··· 164 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 175 * A combined memcpy/__copy_user 168 176 * __copy_user sets len to 0 for success; else to an upper bound of 169 177 * the number of uncopied bytes. ··· 182 174 move v0, dst /* return value */ 183 175 __memcpy: 184 176 FEXPORT(__copy_user) 177 + li t7, 0 /* not inatomic */ 178 + __copy_user_common: 185 179 /* 186 180 * Note: dst & src may be unaligned, len may be 0 187 181 * Temps ··· 422 412 * Assumes src < THREAD_BUADDR($28) 423 413 */ 424 414 LOAD t0, TI_TASK($28) 425 - nop 426 415 LOAD t0, THREAD_BUADDR(t0) 427 416 1: 428 417 EXC( lb t1, 0(src), l_exc) ··· 431 422 ADD dst, dst, 1 432 423 l_exc: 433 424 LOAD t0, TI_TASK($28) 434 - nop 435 425 LOAD t0, THREAD_BUADDR(t0) # t0 is just past last good address 436 - nop 437 426 SUB len, AT, t0 # len number of uncopied bytes 427 + bnez t7, 2f /* Skip the zeroing out part if inatomic */ 438 428 /* 439 429 * Here's where we rely on src and dst being incremented in tandem, 440 430 * See (3) above. ··· 451 443 ADD dst, dst, 1 452 444 bnez src, 1b 453 445 SUB src, src, 1 454 - jr ra 446 + 2: jr ra 455 447 nop 456 448 457 449
+522 -177
arch/mips/cavium-octeon/octeon-platform.c
··· 3 3 * License. See the file "COPYING" in the main directory of this archive 4 4 * for more details. 5 5 * 6 - * Copyright (C) 2004-2010 Cavium Networks 6 + * Copyright (C) 2004-2011 Cavium Networks 7 7 * Copyright (C) 2008 Wind River Systems 8 8 */ 9 9 ··· 13 13 #include <linux/usb.h> 14 14 #include <linux/dma-mapping.h> 15 15 #include <linux/module.h> 16 + #include <linux/slab.h> 16 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 22 #include <asm/octeon/octeon.h> 19 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 27 static struct octeon_cf_data octeon_cf_data; 22 28 ··· 168 162 } 169 163 device_initcall(octeon_rng_device_init); 170 164 171 - static struct i2c_board_info __initdata octeon_i2c_devices[] = { 172 - { 173 - I2C_BOARD_INFO("ds1337", 0x68), 174 - }, 175 - }; 176 - 177 - static int __init octeon_i2c_devices_init(void) 178 - { 179 - return i2c_register_board_info(0, octeon_i2c_devices, 180 - ARRAY_SIZE(octeon_i2c_devices)); 181 - } 182 - arch_initcall(octeon_i2c_devices_init); 183 - 184 - #define OCTEON_I2C_IO_BASE 0x1180000001000ull 185 - #define OCTEON_I2C_IO_UNIT_OFFSET 0x200 186 - 187 - static struct octeon_i2c_data octeon_i2c_data[2]; 188 - 189 - static int __init octeon_i2c_device_init(void) 190 - { 191 - struct platform_device *pd; 192 - int ret = 0; 193 - int port, num_ports; 194 - 195 - struct resource i2c_resources[] = { 196 - { 197 - .flags = IORESOURCE_MEM, 198 - }, { 199 - .flags = IORESOURCE_IRQ, 200 - } 201 - }; 202 - 203 - if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN52XX)) 204 - num_ports = 2; 205 - else 206 - num_ports = 1; 207 - 208 - for (port = 0; port < num_ports; port++) { 209 - octeon_i2c_data[port].sys_freq = octeon_get_io_clock_rate(); 210 - /*FIXME: should be examined. At the moment is set for 100Khz */ 211 - octeon_i2c_data[port].i2c_freq = 100000; 212 - 213 - pd = platform_device_alloc("i2c-octeon", port); 214 - if (!pd) { 215 - ret = -ENOMEM; 216 - goto out; 217 - } 218 - 219 - pd->dev.platform_data = octeon_i2c_data + port; 220 - 221 - i2c_resources[0].start = 222 - OCTEON_I2C_IO_BASE + (port * OCTEON_I2C_IO_UNIT_OFFSET); 223 - i2c_resources[0].end = i2c_resources[0].start + 0x1f; 224 - switch (port) { 225 - case 0: 226 - i2c_resources[1].start = OCTEON_IRQ_TWSI; 227 - i2c_resources[1].end = OCTEON_IRQ_TWSI; 228 - break; 229 - case 1: 230 - i2c_resources[1].start = OCTEON_IRQ_TWSI2; 231 - i2c_resources[1].end = OCTEON_IRQ_TWSI2; 232 - break; 233 - default: 234 - BUG(); 235 - } 236 - 237 - ret = platform_device_add_resources(pd, 238 - i2c_resources, 239 - ARRAY_SIZE(i2c_resources)); 240 - if (ret) 241 - goto fail; 242 - 243 - ret = platform_device_add(pd); 244 - if (ret) 245 - goto fail; 246 - } 247 - return ret; 248 - fail: 249 - platform_device_put(pd); 250 - out: 251 - return ret; 252 - } 253 - device_initcall(octeon_i2c_device_init); 254 - 255 - /* Octeon SMI/MDIO interface. */ 256 - static int __init octeon_mdiobus_device_init(void) 257 - { 258 - struct platform_device *pd; 259 - int ret = 0; 260 - 261 - if (octeon_is_simulation()) 262 - return 0; /* No mdio in the simulator. */ 263 - 264 - /* The bus number is the platform_device id. */ 265 - pd = platform_device_alloc("mdio-octeon", 0); 266 - if (!pd) { 267 - ret = -ENOMEM; 268 - goto out; 269 - } 270 - 271 - ret = platform_device_add(pd); 272 - if (ret) 273 - goto fail; 274 - 275 - return ret; 276 - fail: 277 - platform_device_put(pd); 278 - 279 - out: 280 - return ret; 281 - 282 - } 283 - device_initcall(octeon_mdiobus_device_init); 284 - 285 - /* Octeon mgmt port Ethernet interface. */ 286 - static int __init octeon_mgmt_device_init(void) 287 - { 288 - struct platform_device *pd; 289 - int ret = 0; 290 - int port, num_ports; 291 - 292 - struct resource mgmt_port_resource = { 293 - .flags = IORESOURCE_IRQ, 294 - .start = -1, 295 - .end = -1 296 - }; 297 - 298 - if (!OCTEON_IS_MODEL(OCTEON_CN56XX) && !OCTEON_IS_MODEL(OCTEON_CN52XX)) 299 - return 0; 300 - 301 - if (OCTEON_IS_MODEL(OCTEON_CN56XX)) 302 - num_ports = 1; 303 - else 304 - num_ports = 2; 305 - 306 - for (port = 0; port < num_ports; port++) { 307 - pd = platform_device_alloc("octeon_mgmt", port); 308 - if (!pd) { 309 - ret = -ENOMEM; 310 - goto out; 311 - } 312 - /* No DMA restrictions */ 313 - pd->dev.coherent_dma_mask = DMA_BIT_MASK(64); 314 - pd->dev.dma_mask = &pd->dev.coherent_dma_mask; 315 - 316 - switch (port) { 317 - case 0: 318 - mgmt_port_resource.start = OCTEON_IRQ_MII0; 319 - break; 320 - case 1: 321 - mgmt_port_resource.start = OCTEON_IRQ_MII1; 322 - break; 323 - default: 324 - BUG(); 325 - } 326 - mgmt_port_resource.end = mgmt_port_resource.start; 327 - 328 - ret = platform_device_add_resources(pd, &mgmt_port_resource, 1); 329 - 330 - if (ret) 331 - goto fail; 332 - 333 - ret = platform_device_add(pd); 334 - if (ret) 335 - goto fail; 336 - } 337 - return ret; 338 - fail: 339 - platform_device_put(pd); 340 - 341 - out: 342 - return ret; 343 - 344 - } 345 - device_initcall(octeon_mgmt_device_init); 346 - 347 165 #ifdef CONFIG_USB 348 166 349 167 static int __init octeon_ehci_device_init(void) ··· 269 439 device_initcall(octeon_ohci_device_init); 270 440 271 441 #endif /* CONFIG_USB */ 442 + 443 + static struct of_device_id __initdata octeon_ids[] = { 444 + { .compatible = "simple-bus", }, 445 + { .compatible = "cavium,octeon-6335-uctl", }, 446 + { .compatible = "cavium,octeon-3860-bootbus", }, 447 + { .compatible = "cavium,mdio-mux", }, 448 + { .compatible = "gpio-leds", }, 449 + {}, 450 + }; 451 + 452 + static bool __init octeon_has_88e1145(void) 453 + { 454 + return !OCTEON_IS_MODEL(OCTEON_CN52XX) && 455 + !OCTEON_IS_MODEL(OCTEON_CN6XXX) && 456 + !OCTEON_IS_MODEL(OCTEON_CN56XX); 457 + } 458 + 459 + static void __init octeon_fdt_set_phy(int eth, int phy_addr) 460 + { 461 + const __be32 *phy_handle; 462 + const __be32 *alt_phy_handle; 463 + const __be32 *reg; 464 + u32 phandle; 465 + int phy; 466 + int alt_phy; 467 + const char *p; 468 + int current_len; 469 + char new_name[20]; 470 + 471 + phy_handle = fdt_getprop(initial_boot_params, eth, "phy-handle", NULL); 472 + if (!phy_handle) 473 + return; 474 + 475 + phandle = be32_to_cpup(phy_handle); 476 + phy = fdt_node_offset_by_phandle(initial_boot_params, phandle); 477 + 478 + alt_phy_handle = fdt_getprop(initial_boot_params, eth, "cavium,alt-phy-handle", NULL); 479 + if (alt_phy_handle) { 480 + u32 alt_phandle = be32_to_cpup(alt_phy_handle); 481 + alt_phy = fdt_node_offset_by_phandle(initial_boot_params, alt_phandle); 482 + } else { 483 + alt_phy = -1; 484 + } 485 + 486 + if (phy_addr < 0 || phy < 0) { 487 + /* Delete the PHY things */ 488 + fdt_nop_property(initial_boot_params, eth, "phy-handle"); 489 + /* This one may fail */ 490 + fdt_nop_property(initial_boot_params, eth, "cavium,alt-phy-handle"); 491 + if (phy >= 0) 492 + fdt_nop_node(initial_boot_params, phy); 493 + if (alt_phy >= 0) 494 + fdt_nop_node(initial_boot_params, alt_phy); 495 + return; 496 + } 497 + 498 + if (phy_addr >= 256 && alt_phy > 0) { 499 + const struct fdt_property *phy_prop; 500 + struct fdt_property *alt_prop; 501 + u32 phy_handle_name; 502 + 503 + /* Use the alt phy node instead.*/ 504 + phy_prop = fdt_get_property(initial_boot_params, eth, "phy-handle", NULL); 505 + phy_handle_name = phy_prop->nameoff; 506 + fdt_nop_node(initial_boot_params, phy); 507 + fdt_nop_property(initial_boot_params, eth, "phy-handle"); 508 + alt_prop = fdt_get_property_w(initial_boot_params, eth, "cavium,alt-phy-handle", NULL); 509 + alt_prop->nameoff = phy_handle_name; 510 + phy = alt_phy; 511 + } 512 + 513 + phy_addr &= 0xff; 514 + 515 + if (octeon_has_88e1145()) { 516 + fdt_nop_property(initial_boot_params, phy, "marvell,reg-init"); 517 + memset(new_name, 0, sizeof(new_name)); 518 + strcpy(new_name, "marvell,88e1145"); 519 + p = fdt_getprop(initial_boot_params, phy, "compatible", 520 + &current_len); 521 + if (p && current_len >= strlen(new_name)) 522 + fdt_setprop_inplace(initial_boot_params, phy, 523 + "compatible", new_name, current_len); 524 + } 525 + 526 + reg = fdt_getprop(initial_boot_params, phy, "reg", NULL); 527 + if (phy_addr == be32_to_cpup(reg)) 528 + return; 529 + 530 + fdt_setprop_inplace_cell(initial_boot_params, phy, "reg", phy_addr); 531 + 532 + snprintf(new_name, sizeof(new_name), "ethernet-phy@%x", phy_addr); 533 + 534 + p = fdt_get_name(initial_boot_params, phy, &current_len); 535 + if (p && current_len == strlen(new_name)) 536 + fdt_set_name(initial_boot_params, phy, new_name); 537 + else 538 + pr_err("Error: could not rename ethernet phy: <%s>", p); 539 + } 540 + 541 + static void __init octeon_fdt_set_mac_addr(int n, u64 *pmac) 542 + { 543 + u8 new_mac[6]; 544 + u64 mac = *pmac; 545 + int r; 546 + 547 + new_mac[0] = (mac >> 40) & 0xff; 548 + new_mac[1] = (mac >> 32) & 0xff; 549 + new_mac[2] = (mac >> 24) & 0xff; 550 + new_mac[3] = (mac >> 16) & 0xff; 551 + new_mac[4] = (mac >> 8) & 0xff; 552 + new_mac[5] = mac & 0xff; 553 + 554 + r = fdt_setprop_inplace(initial_boot_params, n, "local-mac-address", 555 + new_mac, sizeof(new_mac)); 556 + 557 + if (r) { 558 + pr_err("Setting \"local-mac-address\" failed %d", r); 559 + return; 560 + } 561 + *pmac = mac + 1; 562 + } 563 + 564 + static void __init octeon_fdt_rm_ethernet(int node) 565 + { 566 + const __be32 *phy_handle; 567 + 568 + phy_handle = fdt_getprop(initial_boot_params, node, "phy-handle", NULL); 569 + if (phy_handle) { 570 + u32 ph = be32_to_cpup(phy_handle); 571 + int p = fdt_node_offset_by_phandle(initial_boot_params, ph); 572 + if (p >= 0) 573 + fdt_nop_node(initial_boot_params, p); 574 + } 575 + fdt_nop_node(initial_boot_params, node); 576 + } 577 + 578 + static void __init octeon_fdt_pip_port(int iface, int i, int p, int max, u64 *pmac) 579 + { 580 + char name_buffer[20]; 581 + int eth; 582 + int phy_addr; 583 + int ipd_port; 584 + 585 + snprintf(name_buffer, sizeof(name_buffer), "ethernet@%x", p); 586 + eth = fdt_subnode_offset(initial_boot_params, iface, name_buffer); 587 + if (eth < 0) 588 + return; 589 + if (p > max) { 590 + pr_debug("Deleting port %x:%x\n", i, p); 591 + octeon_fdt_rm_ethernet(eth); 592 + return; 593 + } 594 + if (OCTEON_IS_MODEL(OCTEON_CN68XX)) 595 + ipd_port = (0x100 * i) + (0x10 * p) + 0x800; 596 + else 597 + ipd_port = 16 * i + p; 598 + 599 + phy_addr = cvmx_helper_board_get_mii_address(ipd_port); 600 + octeon_fdt_set_phy(eth, phy_addr); 601 + octeon_fdt_set_mac_addr(eth, pmac); 602 + } 603 + 604 + static void __init octeon_fdt_pip_iface(int pip, int idx, u64 *pmac) 605 + { 606 + char name_buffer[20]; 607 + int iface; 608 + int p; 609 + int count; 610 + 611 + count = cvmx_helper_interface_enumerate(idx); 612 + 613 + snprintf(name_buffer, sizeof(name_buffer), "interface@%d", idx); 614 + iface = fdt_subnode_offset(initial_boot_params, pip, name_buffer); 615 + if (iface < 0) 616 + return; 617 + 618 + for (p = 0; p < 16; p++) 619 + octeon_fdt_pip_port(iface, idx, p, count - 1, pmac); 620 + } 621 + 622 + int __init octeon_prune_device_tree(void) 623 + { 624 + int i, max_port, uart_mask; 625 + const char *pip_path; 626 + const char *alias_prop; 627 + char name_buffer[20]; 628 + int aliases; 629 + u64 mac_addr_base; 630 + 631 + if (fdt_check_header(initial_boot_params)) 632 + panic("Corrupt Device Tree."); 633 + 634 + aliases = fdt_path_offset(initial_boot_params, "/aliases"); 635 + if (aliases < 0) { 636 + pr_err("Error: No /aliases node in device tree."); 637 + return -EINVAL; 638 + } 639 + 640 + 641 + mac_addr_base = 642 + ((octeon_bootinfo->mac_addr_base[0] & 0xffull)) << 40 | 643 + ((octeon_bootinfo->mac_addr_base[1] & 0xffull)) << 32 | 644 + ((octeon_bootinfo->mac_addr_base[2] & 0xffull)) << 24 | 645 + ((octeon_bootinfo->mac_addr_base[3] & 0xffull)) << 16 | 646 + ((octeon_bootinfo->mac_addr_base[4] & 0xffull)) << 8 | 647 + (octeon_bootinfo->mac_addr_base[5] & 0xffull); 648 + 649 + if (OCTEON_IS_MODEL(OCTEON_CN52XX) || OCTEON_IS_MODEL(OCTEON_CN63XX)) 650 + max_port = 2; 651 + else if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN68XX)) 652 + max_port = 1; 653 + else 654 + max_port = 0; 655 + 656 + if (octeon_bootinfo->board_type == CVMX_BOARD_TYPE_NIC10E) 657 + max_port = 0; 658 + 659 + for (i = 0; i < 2; i++) { 660 + int mgmt; 661 + snprintf(name_buffer, sizeof(name_buffer), 662 + "mix%d", i); 663 + alias_prop = fdt_getprop(initial_boot_params, aliases, 664 + name_buffer, NULL); 665 + if (alias_prop) { 666 + mgmt = fdt_path_offset(initial_boot_params, alias_prop); 667 + if (mgmt < 0) 668 + continue; 669 + if (i >= max_port) { 670 + pr_debug("Deleting mix%d\n", i); 671 + octeon_fdt_rm_ethernet(mgmt); 672 + fdt_nop_property(initial_boot_params, aliases, 673 + name_buffer); 674 + } else { 675 + int phy_addr = cvmx_helper_board_get_mii_address(CVMX_HELPER_BOARD_MGMT_IPD_PORT + i); 676 + octeon_fdt_set_phy(mgmt, phy_addr); 677 + octeon_fdt_set_mac_addr(mgmt, &mac_addr_base); 678 + } 679 + } 680 + } 681 + 682 + pip_path = fdt_getprop(initial_boot_params, aliases, "pip", NULL); 683 + if (pip_path) { 684 + int pip = fdt_path_offset(initial_boot_params, pip_path); 685 + if (pip >= 0) 686 + for (i = 0; i <= 4; i++) 687 + octeon_fdt_pip_iface(pip, i, &mac_addr_base); 688 + } 689 + 690 + /* I2C */ 691 + if (OCTEON_IS_MODEL(OCTEON_CN52XX) || 692 + OCTEON_IS_MODEL(OCTEON_CN63XX) || 693 + OCTEON_IS_MODEL(OCTEON_CN68XX) || 694 + OCTEON_IS_MODEL(OCTEON_CN56XX)) 695 + max_port = 2; 696 + else 697 + max_port = 1; 698 + 699 + for (i = 0; i < 2; i++) { 700 + int i2c; 701 + snprintf(name_buffer, sizeof(name_buffer), 702 + "twsi%d", i); 703 + alias_prop = fdt_getprop(initial_boot_params, aliases, 704 + name_buffer, NULL); 705 + 706 + if (alias_prop) { 707 + i2c = fdt_path_offset(initial_boot_params, alias_prop); 708 + if (i2c < 0) 709 + continue; 710 + if (i >= max_port) { 711 + pr_debug("Deleting twsi%d\n", i); 712 + fdt_nop_node(initial_boot_params, i2c); 713 + fdt_nop_property(initial_boot_params, aliases, 714 + name_buffer); 715 + } 716 + } 717 + } 718 + 719 + /* SMI/MDIO */ 720 + if (OCTEON_IS_MODEL(OCTEON_CN68XX)) 721 + max_port = 4; 722 + else if (OCTEON_IS_MODEL(OCTEON_CN52XX) || 723 + OCTEON_IS_MODEL(OCTEON_CN63XX) || 724 + OCTEON_IS_MODEL(OCTEON_CN56XX)) 725 + max_port = 2; 726 + else 727 + max_port = 1; 728 + 729 + for (i = 0; i < 2; i++) { 730 + int i2c; 731 + snprintf(name_buffer, sizeof(name_buffer), 732 + "smi%d", i); 733 + alias_prop = fdt_getprop(initial_boot_params, aliases, 734 + name_buffer, NULL); 735 + 736 + if (alias_prop) { 737 + i2c = fdt_path_offset(initial_boot_params, alias_prop); 738 + if (i2c < 0) 739 + continue; 740 + if (i >= max_port) { 741 + pr_debug("Deleting smi%d\n", i); 742 + fdt_nop_node(initial_boot_params, i2c); 743 + fdt_nop_property(initial_boot_params, aliases, 744 + name_buffer); 745 + } 746 + } 747 + } 748 + 749 + /* Serial */ 750 + uart_mask = 3; 751 + 752 + /* Right now CN52XX is the only chip with a third uart */ 753 + if (OCTEON_IS_MODEL(OCTEON_CN52XX)) 754 + uart_mask |= 4; /* uart2 */ 755 + 756 + for (i = 0; i < 3; i++) { 757 + int uart; 758 + snprintf(name_buffer, sizeof(name_buffer), 759 + "uart%d", i); 760 + alias_prop = fdt_getprop(initial_boot_params, aliases, 761 + name_buffer, NULL); 762 + 763 + if (alias_prop) { 764 + uart = fdt_path_offset(initial_boot_params, alias_prop); 765 + if (uart_mask & (1 << i)) 766 + continue; 767 + pr_debug("Deleting uart%d\n", i); 768 + fdt_nop_node(initial_boot_params, uart); 769 + fdt_nop_property(initial_boot_params, aliases, 770 + name_buffer); 771 + } 772 + } 773 + 774 + /* Compact Flash */ 775 + alias_prop = fdt_getprop(initial_boot_params, aliases, 776 + "cf0", NULL); 777 + if (alias_prop) { 778 + union cvmx_mio_boot_reg_cfgx mio_boot_reg_cfg; 779 + unsigned long base_ptr, region_base, region_size; 780 + unsigned long region1_base = 0; 781 + unsigned long region1_size = 0; 782 + int cs, bootbus; 783 + bool is_16bit = false; 784 + bool is_true_ide = false; 785 + __be32 new_reg[6]; 786 + __be32 *ranges; 787 + int len; 788 + 789 + int cf = fdt_path_offset(initial_boot_params, alias_prop); 790 + base_ptr = 0; 791 + if (octeon_bootinfo->major_version == 1 792 + && octeon_bootinfo->minor_version >= 1) { 793 + if (octeon_bootinfo->compact_flash_common_base_addr) 794 + base_ptr = octeon_bootinfo->compact_flash_common_base_addr; 795 + } else { 796 + base_ptr = 0x1d000800; 797 + } 798 + 799 + if (!base_ptr) 800 + goto no_cf; 801 + 802 + /* Find CS0 region. */ 803 + for (cs = 0; cs < 8; cs++) { 804 + mio_boot_reg_cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(cs)); 805 + region_base = mio_boot_reg_cfg.s.base << 16; 806 + region_size = (mio_boot_reg_cfg.s.size + 1) << 16; 807 + if (mio_boot_reg_cfg.s.en && base_ptr >= region_base 808 + && base_ptr < region_base + region_size) { 809 + is_16bit = mio_boot_reg_cfg.s.width; 810 + break; 811 + } 812 + } 813 + if (cs >= 7) { 814 + /* cs and cs + 1 are CS0 and CS1, both must be less than 8. */ 815 + goto no_cf; 816 + } 817 + 818 + if (!(base_ptr & 0xfffful)) { 819 + /* 820 + * Boot loader signals availability of DMA (true_ide 821 + * mode) by setting low order bits of base_ptr to 822 + * zero. 823 + */ 824 + 825 + /* Asume that CS1 immediately follows. */ 826 + mio_boot_reg_cfg.u64 = 827 + cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(cs + 1)); 828 + region1_base = mio_boot_reg_cfg.s.base << 16; 829 + region1_size = (mio_boot_reg_cfg.s.size + 1) << 16; 830 + if (!mio_boot_reg_cfg.s.en) 831 + goto no_cf; 832 + is_true_ide = true; 833 + 834 + } else { 835 + fdt_nop_property(initial_boot_params, cf, "cavium,true-ide"); 836 + fdt_nop_property(initial_boot_params, cf, "cavium,dma-engine-handle"); 837 + if (!is_16bit) { 838 + __be32 width = cpu_to_be32(8); 839 + fdt_setprop_inplace(initial_boot_params, cf, 840 + "cavium,bus-width", &width, sizeof(width)); 841 + } 842 + } 843 + new_reg[0] = cpu_to_be32(cs); 844 + new_reg[1] = cpu_to_be32(0); 845 + new_reg[2] = cpu_to_be32(0x10000); 846 + new_reg[3] = cpu_to_be32(cs + 1); 847 + new_reg[4] = cpu_to_be32(0); 848 + new_reg[5] = cpu_to_be32(0x10000); 849 + fdt_setprop_inplace(initial_boot_params, cf, 850 + "reg", new_reg, sizeof(new_reg)); 851 + 852 + bootbus = fdt_parent_offset(initial_boot_params, cf); 853 + if (bootbus < 0) 854 + goto no_cf; 855 + ranges = fdt_getprop_w(initial_boot_params, bootbus, "ranges", &len); 856 + if (!ranges || len < (5 * 8 * sizeof(__be32))) 857 + goto no_cf; 858 + 859 + ranges[(cs * 5) + 2] = cpu_to_be32(region_base >> 32); 860 + ranges[(cs * 5) + 3] = cpu_to_be32(region_base & 0xffffffff); 861 + ranges[(cs * 5) + 4] = cpu_to_be32(region_size); 862 + if (is_true_ide) { 863 + cs++; 864 + ranges[(cs * 5) + 2] = cpu_to_be32(region1_base >> 32); 865 + ranges[(cs * 5) + 3] = cpu_to_be32(region1_base & 0xffffffff); 866 + ranges[(cs * 5) + 4] = cpu_to_be32(region1_size); 867 + } 868 + goto end_cf; 869 + no_cf: 870 + fdt_nop_node(initial_boot_params, cf); 871 + 872 + end_cf: 873 + ; 874 + } 875 + 876 + /* 8 char LED */ 877 + alias_prop = fdt_getprop(initial_boot_params, aliases, 878 + "led0", NULL); 879 + if (alias_prop) { 880 + union cvmx_mio_boot_reg_cfgx mio_boot_reg_cfg; 881 + unsigned long base_ptr, region_base, region_size; 882 + int cs, bootbus; 883 + __be32 new_reg[6]; 884 + __be32 *ranges; 885 + int len; 886 + int led = fdt_path_offset(initial_boot_params, alias_prop); 887 + 888 + base_ptr = octeon_bootinfo->led_display_base_addr; 889 + if (base_ptr == 0) 890 + goto no_led; 891 + /* Find CS0 region. */ 892 + for (cs = 0; cs < 8; cs++) { 893 + mio_boot_reg_cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(cs)); 894 + region_base = mio_boot_reg_cfg.s.base << 16; 895 + region_size = (mio_boot_reg_cfg.s.size + 1) << 16; 896 + if (mio_boot_reg_cfg.s.en && base_ptr >= region_base 897 + && base_ptr < region_base + region_size) 898 + break; 899 + } 900 + 901 + if (cs > 7) 902 + goto no_led; 903 + 904 + new_reg[0] = cpu_to_be32(cs); 905 + new_reg[1] = cpu_to_be32(0x20); 906 + new_reg[2] = cpu_to_be32(0x20); 907 + new_reg[3] = cpu_to_be32(cs); 908 + new_reg[4] = cpu_to_be32(0); 909 + new_reg[5] = cpu_to_be32(0x20); 910 + fdt_setprop_inplace(initial_boot_params, led, 911 + "reg", new_reg, sizeof(new_reg)); 912 + 913 + bootbus = fdt_parent_offset(initial_boot_params, led); 914 + if (bootbus < 0) 915 + goto no_led; 916 + ranges = fdt_getprop_w(initial_boot_params, bootbus, "ranges", &len); 917 + if (!ranges || len < (5 * 8 * sizeof(__be32))) 918 + goto no_led; 919 + 920 + ranges[(cs * 5) + 2] = cpu_to_be32(region_base >> 32); 921 + ranges[(cs * 5) + 3] = cpu_to_be32(region_base & 0xffffffff); 922 + ranges[(cs * 5) + 4] = cpu_to_be32(region_size); 923 + goto end_led; 924 + 925 + no_led: 926 + fdt_nop_node(initial_boot_params, led); 927 + end_led: 928 + ; 929 + } 930 + 931 + /* OHCI/UHCI USB */ 932 + alias_prop = fdt_getprop(initial_boot_params, aliases, 933 + "uctl", NULL); 934 + if (alias_prop) { 935 + int uctl = fdt_path_offset(initial_boot_params, alias_prop); 936 + 937 + if (uctl >= 0 && (!OCTEON_IS_MODEL(OCTEON_CN6XXX) || 938 + octeon_bootinfo->board_type == CVMX_BOARD_TYPE_NIC2E)) { 939 + pr_debug("Deleting uctl\n"); 940 + fdt_nop_node(initial_boot_params, uctl); 941 + fdt_nop_property(initial_boot_params, aliases, "uctl"); 942 + } else if (octeon_bootinfo->board_type == CVMX_BOARD_TYPE_NIC10E || 943 + octeon_bootinfo->board_type == CVMX_BOARD_TYPE_NIC4E) { 944 + /* Missing "refclk-type" defaults to crystal. */ 945 + fdt_nop_property(initial_boot_params, uctl, "refclk-type"); 946 + } 947 + } 948 + 949 + return 0; 950 + } 951 + 952 + static int __init octeon_publish_devices(void) 953 + { 954 + return of_platform_bus_probe(NULL, octeon_ids, NULL); 955 + } 956 + device_initcall(octeon_publish_devices); 272 957 273 958 MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>"); 274 959 MODULE_LICENSE("GPL");
+571
arch/mips/cavium-octeon/octeon_3xxx.dts
··· 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 + };
+625
arch/mips/cavium-octeon/octeon_68xx.dts
··· 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 + };
+58 -86
arch/mips/cavium-octeon/serial.c
··· 43 43 cvmx_write_csr((uint64_t)(up->membase + (offset << 3)), (u8)value); 44 44 } 45 45 46 - /* 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, 46 + static int __devinit octeon_serial_probe(struct platform_device *pdev) 47 + { 48 + int irq, res; 49 + struct resource *res_mem; 50 + struct uart_port port; 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()) 66 + /* Make simulator output fast*/ 67 + port.uartclk = 115200 * 16; 68 + else 69 + port.uartclk = octeon_get_io_clock_rate(); 70 + 71 + port.serial_in = octeon_serial_in; 72 + port.serial_out = octeon_serial_out; 73 + port.irq = irq; 74 + 75 + res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 76 + if (res_mem == NULL) { 77 + dev_err(&pdev->dev, "found no memory resource\n"); 78 + return -ENXIO; 79 + } 80 + port.mapbase = res_mem->start; 81 + port.membase = ioremap(res_mem->start, resource_size(res_mem)); 82 + 83 + res = serial8250_register_port(&port); 84 + 85 + return res >= 0 ? 0 : res; 86 + } 87 + 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, 56 102 }, 57 103 }; 58 104 59 - static void __init octeon_uart_set_common(struct plat_serial8250_port *p) 60 - { 61 - p->flags = ASYNC_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE; 62 - p->type = PORT_OCTEON; 63 - p->iotype = UPIO_MEM; 64 - p->regshift = 3; /* I/O addresses are every 8 bytes */ 65 - if (octeon_is_simulation()) 66 - /* Make simulator output fast*/ 67 - p->uartclk = 115200 * 16; 68 - else 69 - p->uartclk = octeon_get_io_clock_rate(); 70 - p->serial_in = octeon_serial_in; 71 - p->serial_out = octeon_serial_out; 72 - } 73 - 74 105 static int __init octeon_serial_init(void) 75 106 { 76 - int enable_uart0; 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 - 115 - if (enable_uart1) { 116 - /* Add a ttyS device for hardware uart 1 */ 117 - octeon_uart_set_common(p); 118 - p->membase = (void *) CVMX_MIO_UARTX_RBR(1); 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 - } 131 - 132 - BUG_ON(p > &octeon_uart8250_data[OCTEON_MAX_UARTS]); 133 - 134 - return platform_device_register(&octeon_uart8250_device); 107 + return platform_driver_register(&octeon_serial_driver); 135 108 } 136 - 137 - device_initcall(octeon_serial_init); 109 + late_initcall(octeon_serial_init);
+45
arch/mips/cavium-octeon/setup.c
··· 21 21 #include <linux/platform_device.h> 22 22 #include <linux/serial_core.h> 23 23 #include <linux/serial_8250.h> 24 + #include <linux/of_fdt.h> 25 + #include <linux/libfdt.h> 24 26 25 27 #include <asm/processor.h> 26 28 #include <asm/reboot.h> ··· 776 774 panic("Unable to request_irq(OCTEON_IRQ_RML)"); 777 775 } 778 776 #endif 777 + } 778 + 779 + int octeon_prune_device_tree(void); 780 + 781 + extern const char __dtb_octeon_3xxx_begin; 782 + extern const char __dtb_octeon_3xxx_end; 783 + extern const char __dtb_octeon_68xx_begin; 784 + extern const char __dtb_octeon_68xx_end; 785 + void __init device_tree_init(void) 786 + { 787 + int dt_size; 788 + struct boot_param_header *fdt; 789 + bool do_prune; 790 + 791 + if (octeon_bootinfo->minor_version >= 3 && octeon_bootinfo->fdt_addr) { 792 + fdt = phys_to_virt(octeon_bootinfo->fdt_addr); 793 + if (fdt_check_header(fdt)) 794 + panic("Corrupt Device Tree passed to kernel."); 795 + dt_size = be32_to_cpu(fdt->totalsize); 796 + do_prune = false; 797 + } else if (OCTEON_IS_MODEL(OCTEON_CN68XX)) { 798 + fdt = (struct boot_param_header *)&__dtb_octeon_68xx_begin; 799 + dt_size = &__dtb_octeon_68xx_end - &__dtb_octeon_68xx_begin; 800 + do_prune = true; 801 + } else { 802 + fdt = (struct boot_param_header *)&__dtb_octeon_3xxx_begin; 803 + dt_size = &__dtb_octeon_3xxx_end - &__dtb_octeon_3xxx_begin; 804 + do_prune = true; 805 + } 806 + 807 + /* Copy the default tree from init memory. */ 808 + initial_boot_params = early_init_dt_alloc_memory_arch(dt_size, 8); 809 + if (initial_boot_params == NULL) 810 + panic("Could not allocate initial_boot_params\n"); 811 + memcpy(initial_boot_params, fdt, dt_size); 812 + 813 + if (do_prune) { 814 + octeon_prune_device_tree(); 815 + pr_info("Using internal Device Tree.\n"); 816 + } else { 817 + pr_info("Using passed Device Tree.\n"); 818 + } 819 + unflatten_device_tree(); 779 820 }
+109
arch/mips/configs/ls1b_defconfig
··· 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
+4
arch/mips/configs/nlm_xlr_defconfig
··· 367 367 CONFIG_HW_RANDOM=y 368 368 CONFIG_HW_RANDOM_TIMERIOMEM=m 369 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 374 # CONFIG_HWMON is not set 371 375 # CONFIG_VGA_CONSOLE is not set 372 376 # CONFIG_HID_SUPPORT is not set
+1 -1
arch/mips/dec/prom/memory.c
··· 101 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 106 * Leave 128 KB reserved for Lance memory for 107 107 * IOASIC DECstations.
+2 -1
arch/mips/include/asm/cpu.h
··· 197 197 #define PRID_REV_VR4181A 0x0070 /* Same as VR4122 */ 198 198 #define PRID_REV_VR4130 0x0080 199 199 #define PRID_REV_34K_V1_0_2 0x0022 200 + #define PRID_REV_LOONGSON1B 0x0020 200 201 #define PRID_REV_LOONGSON2E 0x0002 201 202 #define PRID_REV_LOONGSON2F 0x0003 202 203 ··· 262 261 */ 263 262 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K, 264 263 CPU_ALCHEMY, CPU_PR4450, CPU_BMIPS32, CPU_BMIPS3300, CPU_BMIPS4350, 265 - CPU_BMIPS4380, CPU_BMIPS5000, CPU_JZRISC, CPU_M14KC, 264 + CPU_BMIPS4380, CPU_BMIPS5000, CPU_JZRISC, CPU_LOONGSON1, CPU_M14KC, 266 265 267 266 /* 268 267 * MIPS64 class processors
+140 -10
arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
··· 9 9 * compile time if only one CPU support is enabled (idea stolen from 10 10 * arm mach-types) 11 11 */ 12 + #define BCM6328_CPU_ID 0x6328 12 13 #define BCM6338_CPU_ID 0x6338 13 14 #define BCM6345_CPU_ID 0x6345 14 15 #define BCM6348_CPU_ID 0x6348 ··· 20 19 u16 __bcm63xx_get_cpu_id(void); 21 20 u16 bcm63xx_get_cpu_rev(void); 22 21 unsigned int bcm63xx_get_cpu_freq(void); 22 + 23 + #ifdef CONFIG_BCM63XX_CPU_6328 24 + # ifdef bcm63xx_get_cpu_id 25 + # undef bcm63xx_get_cpu_id 26 + # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id() 27 + # define BCMCPU_RUNTIME_DETECT 28 + # else 29 + # define bcm63xx_get_cpu_id() BCM6328_CPU_ID 30 + # endif 31 + # define BCMCPU_IS_6328() (bcm63xx_get_cpu_id() == BCM6328_CPU_ID) 32 + #else 33 + # define BCMCPU_IS_6328() (0) 34 + #endif 23 35 24 36 #ifdef CONFIG_BCM63XX_CPU_6338 25 37 # ifdef bcm63xx_get_cpu_id ··· 116 102 RSET_UART1, 117 103 RSET_GPIO, 118 104 RSET_SPI, 119 - RSET_SPI2, 120 105 RSET_UDC0, 121 106 RSET_OHCI0, 122 107 RSET_OHCI_PRIV, 123 108 RSET_USBH_PRIV, 124 109 RSET_MPI, 125 110 RSET_PCMCIA, 111 + RSET_PCIE, 126 112 RSET_DSL, 127 113 RSET_ENET0, 128 114 RSET_ENET1, ··· 144 130 RSET_PCMDMA, 145 131 RSET_PCMDMAC, 146 132 RSET_PCMDMAS, 133 + RSET_RNG, 134 + RSET_MISC 147 135 }; 148 136 149 137 #define RSET_DSL_LMEM_SIZE (64 * 1024 * 4) 150 138 #define RSET_DSL_SIZE 4096 151 139 #define RSET_WDT_SIZE 12 140 + #define BCM_6338_RSET_SPI_SIZE 64 141 + #define BCM_6348_RSET_SPI_SIZE 64 142 + #define BCM_6358_RSET_SPI_SIZE 1804 143 + #define BCM_6368_RSET_SPI_SIZE 1804 152 144 #define RSET_ENET_SIZE 2048 153 145 #define RSET_ENETDMA_SIZE 2048 154 146 #define RSET_ENETSW_SIZE 65536 ··· 169 149 #define RSET_XTMDMA_SIZE 256 170 150 #define RSET_XTMDMAC_SIZE(chans) (16 * (chans)) 171 151 #define RSET_XTMDMAS_SIZE(chans) (16 * (chans)) 152 + #define RSET_RNG_SIZE 20 172 153 154 + /* 155 + * 6328 register sets base address 156 + */ 157 + #define BCM_6328_DSL_LMEM_BASE (0xdeadbeef) 158 + #define BCM_6328_PERF_BASE (0xb0000000) 159 + #define BCM_6328_TIMER_BASE (0xb0000040) 160 + #define BCM_6328_WDT_BASE (0xb000005c) 161 + #define BCM_6328_UART0_BASE (0xb0000100) 162 + #define BCM_6328_UART1_BASE (0xb0000120) 163 + #define BCM_6328_GPIO_BASE (0xb0000080) 164 + #define BCM_6328_SPI_BASE (0xdeadbeef) 165 + #define BCM_6328_UDC0_BASE (0xdeadbeef) 166 + #define BCM_6328_USBDMA_BASE (0xdeadbeef) 167 + #define BCM_6328_OHCI0_BASE (0xdeadbeef) 168 + #define BCM_6328_OHCI_PRIV_BASE (0xdeadbeef) 169 + #define BCM_6328_USBH_PRIV_BASE (0xdeadbeef) 170 + #define BCM_6328_MPI_BASE (0xdeadbeef) 171 + #define BCM_6328_PCMCIA_BASE (0xdeadbeef) 172 + #define BCM_6328_PCIE_BASE (0xb0e40000) 173 + #define BCM_6328_SDRAM_REGS_BASE (0xdeadbeef) 174 + #define BCM_6328_DSL_BASE (0xb0001900) 175 + #define BCM_6328_UBUS_BASE (0xdeadbeef) 176 + #define BCM_6328_ENET0_BASE (0xdeadbeef) 177 + #define BCM_6328_ENET1_BASE (0xdeadbeef) 178 + #define BCM_6328_ENETDMA_BASE (0xb000d800) 179 + #define BCM_6328_ENETDMAC_BASE (0xb000da00) 180 + #define BCM_6328_ENETDMAS_BASE (0xb000dc00) 181 + #define BCM_6328_ENETSW_BASE (0xb0e00000) 182 + #define BCM_6328_EHCI0_BASE (0x10002500) 183 + #define BCM_6328_SDRAM_BASE (0xdeadbeef) 184 + #define BCM_6328_MEMC_BASE (0xdeadbeef) 185 + #define BCM_6328_DDR_BASE (0xb0003000) 186 + #define BCM_6328_M2M_BASE (0xdeadbeef) 187 + #define BCM_6328_ATM_BASE (0xdeadbeef) 188 + #define BCM_6328_XTM_BASE (0xdeadbeef) 189 + #define BCM_6328_XTMDMA_BASE (0xb000b800) 190 + #define BCM_6328_XTMDMAC_BASE (0xdeadbeef) 191 + #define BCM_6328_XTMDMAS_BASE (0xdeadbeef) 192 + #define BCM_6328_PCM_BASE (0xb000a800) 193 + #define BCM_6328_PCMDMA_BASE (0xdeadbeef) 194 + #define BCM_6328_PCMDMAC_BASE (0xdeadbeef) 195 + #define BCM_6328_PCMDMAS_BASE (0xdeadbeef) 196 + #define BCM_6328_RNG_BASE (0xdeadbeef) 197 + #define BCM_6328_MISC_BASE (0xb0001800) 173 198 /* 174 199 * 6338 register sets base address 175 200 */ ··· 227 162 #define BCM_6338_UART1_BASE (0xdeadbeef) 228 163 #define BCM_6338_GPIO_BASE (0xfffe0400) 229 164 #define BCM_6338_SPI_BASE (0xfffe0c00) 230 - #define BCM_6338_SPI2_BASE (0xdeadbeef) 231 165 #define BCM_6338_UDC0_BASE (0xdeadbeef) 232 166 #define BCM_6338_USBDMA_BASE (0xfffe2400) 233 167 #define BCM_6338_OHCI0_BASE (0xdeadbeef) ··· 234 170 #define BCM_6338_USBH_PRIV_BASE (0xdeadbeef) 235 171 #define BCM_6338_MPI_BASE (0xfffe3160) 236 172 #define BCM_6338_PCMCIA_BASE (0xdeadbeef) 173 + #define BCM_6338_PCIE_BASE (0xdeadbeef) 237 174 #define BCM_6338_SDRAM_REGS_BASE (0xfffe3100) 238 175 #define BCM_6338_DSL_BASE (0xfffe1000) 239 176 #define BCM_6338_UBUS_BASE (0xdeadbeef) ··· 258 193 #define BCM_6338_PCMDMA_BASE (0xdeadbeef) 259 194 #define BCM_6338_PCMDMAC_BASE (0xdeadbeef) 260 195 #define BCM_6338_PCMDMAS_BASE (0xdeadbeef) 196 + #define BCM_6338_RNG_BASE (0xdeadbeef) 197 + #define BCM_6338_MISC_BASE (0xdeadbeef) 261 198 262 199 /* 263 200 * 6345 register sets base address ··· 273 206 #define BCM_6345_UART1_BASE (0xdeadbeef) 274 207 #define BCM_6345_GPIO_BASE (0xfffe0400) 275 208 #define BCM_6345_SPI_BASE (0xdeadbeef) 276 - #define BCM_6345_SPI2_BASE (0xdeadbeef) 277 209 #define BCM_6345_UDC0_BASE (0xdeadbeef) 278 210 #define BCM_6345_USBDMA_BASE (0xfffe2800) 279 211 #define BCM_6345_ENET0_BASE (0xfffe1800) ··· 282 216 #define BCM_6345_ENETSW_BASE (0xdeadbeef) 283 217 #define BCM_6345_PCMCIA_BASE (0xfffe2028) 284 218 #define BCM_6345_MPI_BASE (0xfffe2000) 219 + #define BCM_6345_PCIE_BASE (0xdeadbeef) 285 220 #define BCM_6345_OHCI0_BASE (0xfffe2100) 286 221 #define BCM_6345_OHCI_PRIV_BASE (0xfffe2200) 287 222 #define BCM_6345_USBH_PRIV_BASE (0xdeadbeef) ··· 304 237 #define BCM_6345_PCMDMA_BASE (0xdeadbeef) 305 238 #define BCM_6345_PCMDMAC_BASE (0xdeadbeef) 306 239 #define BCM_6345_PCMDMAS_BASE (0xdeadbeef) 240 + #define BCM_6345_RNG_BASE (0xdeadbeef) 241 + #define BCM_6345_MISC_BASE (0xdeadbeef) 307 242 308 243 /* 309 244 * 6348 register sets base address ··· 318 249 #define BCM_6348_UART1_BASE (0xdeadbeef) 319 250 #define BCM_6348_GPIO_BASE (0xfffe0400) 320 251 #define BCM_6348_SPI_BASE (0xfffe0c00) 321 - #define BCM_6348_SPI2_BASE (0xdeadbeef) 322 252 #define BCM_6348_UDC0_BASE (0xfffe1000) 323 253 #define BCM_6348_OHCI0_BASE (0xfffe1b00) 324 254 #define BCM_6348_OHCI_PRIV_BASE (0xfffe1c00) 325 255 #define BCM_6348_USBH_PRIV_BASE (0xdeadbeef) 326 256 #define BCM_6348_MPI_BASE (0xfffe2000) 327 257 #define BCM_6348_PCMCIA_BASE (0xfffe2054) 258 + #define BCM_6348_PCIE_BASE (0xdeadbeef) 328 259 #define BCM_6348_SDRAM_REGS_BASE (0xfffe2300) 329 260 #define BCM_6348_M2M_BASE (0xfffe2800) 330 261 #define BCM_6348_DSL_BASE (0xfffe3000) ··· 347 278 #define BCM_6348_PCMDMA_BASE (0xdeadbeef) 348 279 #define BCM_6348_PCMDMAC_BASE (0xdeadbeef) 349 280 #define BCM_6348_PCMDMAS_BASE (0xdeadbeef) 281 + #define BCM_6348_RNG_BASE (0xdeadbeef) 282 + #define BCM_6348_MISC_BASE (0xdeadbeef) 350 283 351 284 /* 352 285 * 6358 register sets base address ··· 360 289 #define BCM_6358_UART0_BASE (0xfffe0100) 361 290 #define BCM_6358_UART1_BASE (0xfffe0120) 362 291 #define BCM_6358_GPIO_BASE (0xfffe0080) 363 - #define BCM_6358_SPI_BASE (0xdeadbeef) 364 - #define BCM_6358_SPI2_BASE (0xfffe0800) 292 + #define BCM_6358_SPI_BASE (0xfffe0800) 365 293 #define BCM_6358_UDC0_BASE (0xfffe0800) 366 294 #define BCM_6358_OHCI0_BASE (0xfffe1400) 367 295 #define BCM_6358_OHCI_PRIV_BASE (0xdeadbeef) 368 296 #define BCM_6358_USBH_PRIV_BASE (0xfffe1500) 369 297 #define BCM_6358_MPI_BASE (0xfffe1000) 370 298 #define BCM_6358_PCMCIA_BASE (0xfffe1054) 299 + #define BCM_6358_PCIE_BASE (0xdeadbeef) 371 300 #define BCM_6358_SDRAM_REGS_BASE (0xfffe2300) 372 301 #define BCM_6358_M2M_BASE (0xdeadbeef) 373 302 #define BCM_6358_DSL_BASE (0xfffe3000) ··· 390 319 #define BCM_6358_PCMDMA_BASE (0xfffe1800) 391 320 #define BCM_6358_PCMDMAC_BASE (0xfffe1900) 392 321 #define BCM_6358_PCMDMAS_BASE (0xfffe1a00) 322 + #define BCM_6358_RNG_BASE (0xdeadbeef) 323 + #define BCM_6358_MISC_BASE (0xdeadbeef) 393 324 394 325 395 326 /* ··· 404 331 #define BCM_6368_UART0_BASE (0xb0000100) 405 332 #define BCM_6368_UART1_BASE (0xb0000120) 406 333 #define BCM_6368_GPIO_BASE (0xb0000080) 407 - #define BCM_6368_SPI_BASE (0xdeadbeef) 408 - #define BCM_6368_SPI2_BASE (0xb0000800) 334 + #define BCM_6368_SPI_BASE (0xb0000800) 409 335 #define BCM_6368_UDC0_BASE (0xdeadbeef) 410 336 #define BCM_6368_OHCI0_BASE (0xb0001600) 411 337 #define BCM_6368_OHCI_PRIV_BASE (0xdeadbeef) 412 338 #define BCM_6368_USBH_PRIV_BASE (0xb0001700) 413 339 #define BCM_6368_MPI_BASE (0xb0001000) 414 340 #define BCM_6368_PCMCIA_BASE (0xb0001054) 341 + #define BCM_6368_PCIE_BASE (0xdeadbeef) 415 342 #define BCM_6368_SDRAM_REGS_BASE (0xdeadbeef) 416 343 #define BCM_6368_M2M_BASE (0xdeadbeef) 417 344 #define BCM_6368_DSL_BASE (0xdeadbeef) ··· 434 361 #define BCM_6368_PCMDMA_BASE (0xb0005800) 435 362 #define BCM_6368_PCMDMAC_BASE (0xb0005a00) 436 363 #define BCM_6368_PCMDMAS_BASE (0xb0005c00) 364 + #define BCM_6368_RNG_BASE (0xb0004180) 365 + #define BCM_6368_MISC_BASE (0xdeadbeef) 437 366 438 367 439 368 extern const unsigned long *bcm63xx_regs_base; ··· 454 379 __GEN_RSET_BASE(__cpu, UART1) \ 455 380 __GEN_RSET_BASE(__cpu, GPIO) \ 456 381 __GEN_RSET_BASE(__cpu, SPI) \ 457 - __GEN_RSET_BASE(__cpu, SPI2) \ 458 382 __GEN_RSET_BASE(__cpu, UDC0) \ 459 383 __GEN_RSET_BASE(__cpu, OHCI0) \ 460 384 __GEN_RSET_BASE(__cpu, OHCI_PRIV) \ 461 385 __GEN_RSET_BASE(__cpu, USBH_PRIV) \ 462 386 __GEN_RSET_BASE(__cpu, MPI) \ 463 387 __GEN_RSET_BASE(__cpu, PCMCIA) \ 388 + __GEN_RSET_BASE(__cpu, PCIE) \ 464 389 __GEN_RSET_BASE(__cpu, DSL) \ 465 390 __GEN_RSET_BASE(__cpu, ENET0) \ 466 391 __GEN_RSET_BASE(__cpu, ENET1) \ ··· 482 407 __GEN_RSET_BASE(__cpu, PCMDMA) \ 483 408 __GEN_RSET_BASE(__cpu, PCMDMAC) \ 484 409 __GEN_RSET_BASE(__cpu, PCMDMAS) \ 410 + __GEN_RSET_BASE(__cpu, RNG) \ 411 + __GEN_RSET_BASE(__cpu, MISC) \ 485 412 } 486 413 487 414 #define __GEN_CPU_REGS_TABLE(__cpu) \ ··· 495 418 [RSET_UART1] = BCM_## __cpu ##_UART1_BASE, \ 496 419 [RSET_GPIO] = BCM_## __cpu ##_GPIO_BASE, \ 497 420 [RSET_SPI] = BCM_## __cpu ##_SPI_BASE, \ 498 - [RSET_SPI2] = BCM_## __cpu ##_SPI2_BASE, \ 499 421 [RSET_UDC0] = BCM_## __cpu ##_UDC0_BASE, \ 500 422 [RSET_OHCI0] = BCM_## __cpu ##_OHCI0_BASE, \ 501 423 [RSET_OHCI_PRIV] = BCM_## __cpu ##_OHCI_PRIV_BASE, \ 502 424 [RSET_USBH_PRIV] = BCM_## __cpu ##_USBH_PRIV_BASE, \ 503 425 [RSET_MPI] = BCM_## __cpu ##_MPI_BASE, \ 504 426 [RSET_PCMCIA] = BCM_## __cpu ##_PCMCIA_BASE, \ 427 + [RSET_PCIE] = BCM_## __cpu ##_PCIE_BASE, \ 505 428 [RSET_DSL] = BCM_## __cpu ##_DSL_BASE, \ 506 429 [RSET_ENET0] = BCM_## __cpu ##_ENET0_BASE, \ 507 430 [RSET_ENET1] = BCM_## __cpu ##_ENET1_BASE, \ ··· 523 446 [RSET_PCMDMA] = BCM_## __cpu ##_PCMDMA_BASE, \ 524 447 [RSET_PCMDMAC] = BCM_## __cpu ##_PCMDMAC_BASE, \ 525 448 [RSET_PCMDMAS] = BCM_## __cpu ##_PCMDMAS_BASE, \ 449 + [RSET_RNG] = BCM_## __cpu ##_RNG_BASE, \ 450 + [RSET_MISC] = BCM_## __cpu ##_MISC_BASE, \ 526 451 527 452 528 453 static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set) ··· 532 453 #ifdef BCMCPU_RUNTIME_DETECT 533 454 return bcm63xx_regs_base[set]; 534 455 #else 456 + #ifdef CONFIG_BCM63XX_CPU_6328 457 + __GEN_RSET(6328) 458 + #endif 535 459 #ifdef CONFIG_BCM63XX_CPU_6338 536 460 __GEN_RSET(6338) 537 461 #endif ··· 560 478 */ 561 479 enum bcm63xx_irq { 562 480 IRQ_TIMER = 0, 481 + IRQ_SPI, 563 482 IRQ_UART0, 564 483 IRQ_UART1, 565 484 IRQ_DSL, ··· 589 506 }; 590 507 591 508 /* 509 + * 6328 irqs 510 + */ 511 + #define BCM_6328_HIGH_IRQ_BASE (IRQ_INTERNAL_BASE + 32) 512 + 513 + #define BCM_6328_TIMER_IRQ (IRQ_INTERNAL_BASE + 31) 514 + #define BCM_6328_SPI_IRQ 0 515 + #define BCM_6328_UART0_IRQ (IRQ_INTERNAL_BASE + 28) 516 + #define BCM_6328_UART1_IRQ (BCM_6328_HIGH_IRQ_BASE + 7) 517 + #define BCM_6328_DSL_IRQ (IRQ_INTERNAL_BASE + 4) 518 + #define BCM_6328_UDC0_IRQ 0 519 + #define BCM_6328_ENET0_IRQ 0 520 + #define BCM_6328_ENET1_IRQ 0 521 + #define BCM_6328_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12) 522 + #define BCM_6328_OHCI0_IRQ (IRQ_INTERNAL_BASE + 9) 523 + #define BCM_6328_EHCI0_IRQ (IRQ_INTERNAL_BASE + 10) 524 + #define BCM_6328_PCMCIA_IRQ 0 525 + #define BCM_6328_ENET0_RXDMA_IRQ 0 526 + #define BCM_6328_ENET0_TXDMA_IRQ 0 527 + #define BCM_6328_ENET1_RXDMA_IRQ 0 528 + #define BCM_6328_ENET1_TXDMA_IRQ 0 529 + #define BCM_6328_PCI_IRQ (IRQ_INTERNAL_BASE + 23) 530 + #define BCM_6328_ATM_IRQ 0 531 + #define BCM_6328_ENETSW_RXDMA0_IRQ (BCM_6328_HIGH_IRQ_BASE + 0) 532 + #define BCM_6328_ENETSW_RXDMA1_IRQ (BCM_6328_HIGH_IRQ_BASE + 1) 533 + #define BCM_6328_ENETSW_RXDMA2_IRQ (BCM_6328_HIGH_IRQ_BASE + 2) 534 + #define BCM_6328_ENETSW_RXDMA3_IRQ (BCM_6328_HIGH_IRQ_BASE + 3) 535 + #define BCM_6328_ENETSW_TXDMA0_IRQ (BCM_6328_HIGH_IRQ_BASE + 4) 536 + #define BCM_6328_ENETSW_TXDMA1_IRQ (BCM_6328_HIGH_IRQ_BASE + 5) 537 + #define BCM_6328_ENETSW_TXDMA2_IRQ (BCM_6328_HIGH_IRQ_BASE + 6) 538 + #define BCM_6328_ENETSW_TXDMA3_IRQ (BCM_6328_HIGH_IRQ_BASE + 7) 539 + #define BCM_6328_XTM_IRQ (BCM_6328_HIGH_IRQ_BASE + 31) 540 + #define BCM_6328_XTM_DMA0_IRQ (BCM_6328_HIGH_IRQ_BASE + 11) 541 + 542 + #define BCM_6328_PCM_DMA0_IRQ (IRQ_INTERNAL_BASE + 2) 543 + #define BCM_6328_PCM_DMA1_IRQ (IRQ_INTERNAL_BASE + 3) 544 + #define BCM_6328_EXT_IRQ0 (IRQ_INTERNAL_BASE + 24) 545 + #define BCM_6328_EXT_IRQ1 (IRQ_INTERNAL_BASE + 25) 546 + #define BCM_6328_EXT_IRQ2 (IRQ_INTERNAL_BASE + 26) 547 + #define BCM_6328_EXT_IRQ3 (IRQ_INTERNAL_BASE + 27) 548 + 549 + /* 592 550 * 6338 irqs 593 551 */ 594 552 #define BCM_6338_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) 553 + #define BCM_6338_SPI_IRQ (IRQ_INTERNAL_BASE + 1) 595 554 #define BCM_6338_UART0_IRQ (IRQ_INTERNAL_BASE + 2) 596 555 #define BCM_6338_UART1_IRQ 0 597 556 #define BCM_6338_DSL_IRQ (IRQ_INTERNAL_BASE + 5) ··· 664 539 * 6345 irqs 665 540 */ 666 541 #define BCM_6345_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) 542 + #define BCM_6345_SPI_IRQ 0 667 543 #define BCM_6345_UART0_IRQ (IRQ_INTERNAL_BASE + 2) 668 544 #define BCM_6345_UART1_IRQ 0 669 545 #define BCM_6345_DSL_IRQ (IRQ_INTERNAL_BASE + 3) ··· 695 569 * 6348 irqs 696 570 */ 697 571 #define BCM_6348_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) 572 + #define BCM_6348_SPI_IRQ (IRQ_INTERNAL_BASE + 1) 698 573 #define BCM_6348_UART0_IRQ (IRQ_INTERNAL_BASE + 2) 699 574 #define BCM_6348_UART1_IRQ 0 700 575 #define BCM_6348_DSL_IRQ (IRQ_INTERNAL_BASE + 4) ··· 726 599 * 6358 irqs 727 600 */ 728 601 #define BCM_6358_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) 602 + #define BCM_6358_SPI_IRQ (IRQ_INTERNAL_BASE + 1) 729 603 #define BCM_6358_UART0_IRQ (IRQ_INTERNAL_BASE + 2) 730 604 #define BCM_6358_UART1_IRQ (IRQ_INTERNAL_BASE + 3) 731 605 #define BCM_6358_DSL_IRQ (IRQ_INTERNAL_BASE + 29) ··· 766 638 #define BCM_6368_HIGH_IRQ_BASE (IRQ_INTERNAL_BASE + 32) 767 639 768 640 #define BCM_6368_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) 641 + #define BCM_6368_SPI_IRQ (IRQ_INTERNAL_BASE + 1) 769 642 #define BCM_6368_UART0_IRQ (IRQ_INTERNAL_BASE + 2) 770 643 #define BCM_6368_UART1_IRQ (IRQ_INTERNAL_BASE + 3) 771 644 #define BCM_6368_DSL_IRQ (IRQ_INTERNAL_BASE + 4) ··· 806 677 807 678 #define __GEN_CPU_IRQ_TABLE(__cpu) \ 808 679 [IRQ_TIMER] = BCM_## __cpu ##_TIMER_IRQ, \ 680 + [IRQ_SPI] = BCM_## __cpu ##_SPI_IRQ, \ 809 681 [IRQ_UART0] = BCM_## __cpu ##_UART0_IRQ, \ 810 682 [IRQ_UART1] = BCM_## __cpu ##_UART1_IRQ, \ 811 683 [IRQ_DSL] = BCM_## __cpu ##_DSL_IRQ, \
+12
arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
··· 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 */
+89
arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
··· 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 */
+2
arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
··· 9 9 static inline unsigned long bcm63xx_gpio_count(void) 10 10 { 11 11 switch (bcm63xx_get_cpu_id()) { 12 + case BCM6328_CPU_ID: 13 + return 32; 12 14 case BCM6358_CPU_ID: 13 15 return 40; 14 16 case BCM6338_CPU_ID:
+8
arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h
··· 40 40 #define BCM_CB_MEM_END_PA (BCM_CB_MEM_BASE_PA + \ 41 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 49 * Internal registers are accessed through KSEG3 ··· 89 85 #define bcm_mpi_writel(v, o) bcm_rset_writel(RSET_MPI, (v), (o)) 90 86 #define bcm_pcmcia_readl(o) bcm_rset_readl(RSET_PCMCIA, (o)) 91 87 #define bcm_pcmcia_writel(v, o) bcm_rset_writel(RSET_PCMCIA, (v), (o)) 88 + #define bcm_pcie_readl(o) bcm_rset_readl(RSET_PCIE, (o)) 89 + #define bcm_pcie_writel(v, o) bcm_rset_writel(RSET_PCIE, (v), (o)) 92 90 #define bcm_sdram_readl(o) bcm_rset_readl(RSET_SDRAM, (o)) 93 91 #define bcm_sdram_writel(v, o) bcm_rset_writel(RSET_SDRAM, (v), (o)) 94 92 #define bcm_memc_readl(o) bcm_rset_readl(RSET_MEMC, (o)) 95 93 #define bcm_memc_writel(v, o) bcm_rset_writel(RSET_MEMC, (v), (o)) 96 94 #define bcm_ddr_readl(o) bcm_rset_readl(RSET_DDR, (o)) 97 95 #define bcm_ddr_writel(v, o) bcm_rset_writel(RSET_DDR, (v), (o)) 96 + #define bcm_misc_readl(o) bcm_rset_readl(RSET_MISC, (o)) 97 + #define bcm_misc_writel(v, o) bcm_rset_writel(RSET_MISC, (v), (o)) 98 98 99 99 #endif /* ! BCM63XX_IO_H_ */
+268 -18
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
··· 15 15 /* Clock Control register */ 16 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 42 #define CKCTL_6338_ADSLPHY_EN (1 << 0) 19 43 #define CKCTL_6338_MPI_EN (1 << 1) 20 44 #define CKCTL_6338_DRAM_EN (1 << 2) ··· 114 90 #define CKCTL_6368_PHYMIPS_EN (1 << 6) 115 91 #define CKCTL_6368_SWPKT_USB_EN (1 << 7) 116 92 #define CKCTL_6368_SWPKT_SAR_EN (1 << 8) 117 - #define CKCTL_6368_SPI_CLK_EN (1 << 9) 118 - #define CKCTL_6368_USBD_CLK_EN (1 << 10) 119 - #define CKCTL_6368_SAR_CLK_EN (1 << 11) 120 - #define CKCTL_6368_ROBOSW_CLK_EN (1 << 12) 121 - #define CKCTL_6368_UTOPIA_CLK_EN (1 << 13) 122 - #define CKCTL_6368_PCM_CLK_EN (1 << 14) 123 - #define CKCTL_6368_USBH_CLK_EN (1 << 15) 93 + #define CKCTL_6368_SPI_EN (1 << 9) 94 + #define CKCTL_6368_USBD_EN (1 << 10) 95 + #define CKCTL_6368_SAR_EN (1 << 11) 96 + #define CKCTL_6368_ROBOSW_EN (1 << 12) 97 + #define CKCTL_6368_UTOPIA_EN (1 << 13) 98 + #define CKCTL_6368_PCM_EN (1 << 14) 99 + #define CKCTL_6368_USBH_EN (1 << 15) 124 100 #define CKCTL_6368_DISABLE_GLESS_EN (1 << 16) 125 - #define CKCTL_6368_NAND_CLK_EN (1 << 17) 126 - #define CKCTL_6368_IPSEC_CLK_EN (1 << 18) 101 + #define CKCTL_6368_NAND_EN (1 << 17) 102 + #define CKCTL_6368_IPSEC_EN (1 << 18) 127 103 128 104 #define CKCTL_6368_ALL_SAFE_EN (CKCTL_6368_SWPKT_USB_EN | \ 129 105 CKCTL_6368_SWPKT_SAR_EN | \ 130 - CKCTL_6368_SPI_CLK_EN | \ 131 - CKCTL_6368_USBD_CLK_EN | \ 132 - CKCTL_6368_SAR_CLK_EN | \ 133 - CKCTL_6368_ROBOSW_CLK_EN | \ 134 - CKCTL_6368_UTOPIA_CLK_EN | \ 135 - CKCTL_6368_PCM_CLK_EN | \ 136 - CKCTL_6368_USBH_CLK_EN | \ 106 + CKCTL_6368_SPI_EN | \ 107 + CKCTL_6368_USBD_EN | \ 108 + CKCTL_6368_SAR_EN | \ 109 + CKCTL_6368_ROBOSW_EN | \ 110 + CKCTL_6368_UTOPIA_EN | \ 111 + CKCTL_6368_PCM_EN | \ 112 + CKCTL_6368_USBH_EN | \ 137 113 CKCTL_6368_DISABLE_GLESS_EN | \ 138 - CKCTL_6368_NAND_CLK_EN | \ 139 - CKCTL_6368_IPSEC_CLK_EN) 114 + CKCTL_6368_NAND_EN | \ 115 + CKCTL_6368_IPSEC_EN) 140 116 141 117 /* System PLL Control register */ 142 118 #define PERF_SYS_PLL_CTL_REG 0x8 143 119 #define SYS_PLL_SOFT_RESET 0x1 144 120 145 121 /* Interrupt Mask register */ 122 + #define PERF_IRQMASK_6328_REG 0x20 146 123 #define PERF_IRQMASK_6338_REG 0xc 147 124 #define PERF_IRQMASK_6345_REG 0xc 148 125 #define PERF_IRQMASK_6348_REG 0xc ··· 151 126 #define PERF_IRQMASK_6368_REG 0x20 152 127 153 128 /* Interrupt Status register */ 129 + #define PERF_IRQSTAT_6328_REG 0x28 154 130 #define PERF_IRQSTAT_6338_REG 0x10 155 131 #define PERF_IRQSTAT_6345_REG 0x10 156 132 #define PERF_IRQSTAT_6348_REG 0x10 ··· 159 133 #define PERF_IRQSTAT_6368_REG 0x28 160 134 161 135 /* External Interrupt Configuration register */ 136 + #define PERF_EXTIRQ_CFG_REG_6328 0x18 162 137 #define PERF_EXTIRQ_CFG_REG_6338 0x14 163 138 #define PERF_EXTIRQ_CFG_REG_6348 0x14 164 139 #define PERF_EXTIRQ_CFG_REG_6358 0x14 ··· 189 162 190 163 /* Soft Reset register */ 191 164 #define PERF_SOFTRESET_REG 0x28 165 + #define PERF_SOFTRESET_6328_REG 0x10 192 166 #define PERF_SOFTRESET_6368_REG 0x10 167 + 168 + #define SOFTRESET_6328_SPI_MASK (1 << 0) 169 + #define SOFTRESET_6328_EPHY_MASK (1 << 1) 170 + #define SOFTRESET_6328_SAR_MASK (1 << 2) 171 + #define SOFTRESET_6328_ENETSW_MASK (1 << 3) 172 + #define SOFTRESET_6328_USBS_MASK (1 << 4) 173 + #define SOFTRESET_6328_USBH_MASK (1 << 5) 174 + #define SOFTRESET_6328_PCM_MASK (1 << 6) 175 + #define SOFTRESET_6328_PCIE_CORE_MASK (1 << 7) 176 + #define SOFTRESET_6328_PCIE_MASK (1 << 8) 177 + #define SOFTRESET_6328_PCIE_EXT_MASK (1 << 9) 178 + #define SOFTRESET_6328_PCIE_HARD_MASK (1 << 10) 193 179 194 180 #define SOFTRESET_6338_SPI_MASK (1 << 0) 195 181 #define SOFTRESET_6338_ENET_MASK (1 << 2) ··· 347 307 /* Watchdog reset length register */ 348 308 #define WDT_RSTLEN_REG 0x8 349 309 310 + /* Watchdog soft reset register (BCM6328 only) */ 311 + #define WDT_SOFTRESET_REG 0xc 350 312 351 313 /************************************************************************* 352 314 * _REG relative to RSET_UARTx ··· 548 506 #define GPIO_BASEMODE_6368_GPIO 0x0 549 507 #define GPIO_BASEMODE_6368_MASK 0x7 550 508 /* those bits must be kept as read in gpio basemode register*/ 509 + 510 + #define GPIO_STRAPBUS_REG 0x40 511 + #define STRAPBUS_6358_BOOT_SEL_PARALLEL (1 << 1) 512 + #define STRAPBUS_6358_BOOT_SEL_SERIAL (0 << 1) 513 + #define STRAPBUS_6368_BOOT_SEL_MASK 0x3 514 + #define STRAPBUS_6368_BOOT_SEL_NAND 0 515 + #define STRAPBUS_6368_BOOT_SEL_SERIAL 1 516 + #define STRAPBUS_6368_BOOT_SEL_PARALLEL 3 517 + 551 518 552 519 /************************************************************************* 553 520 * _REG relative to RSET_ENET ··· 975 924 * _REG relative to RSET_DDR 976 925 *************************************************************************/ 977 926 927 + #define DDR_CSEND_REG 0x8 928 + 978 929 #define DDR_DMIPSPLLCFG_REG 0x18 979 930 #define DMIPSPLLCFG_M1_SHIFT 0 980 931 #define DMIPSPLLCFG_M1_MASK (0xff << DMIPSPLLCFG_M1_SHIFT) ··· 1025 972 1026 973 #define M2M_SRCID_REG(x) ((x) * 0x40 + 0x14) 1027 974 #define M2M_DSTID_REG(x) ((x) * 0x40 + 0x18) 975 + 976 + /************************************************************************* 977 + * _REG relative to RSET_RNG 978 + *************************************************************************/ 979 + 980 + #define RNG_CTRL 0x00 981 + #define RNG_EN (1 << 0) 982 + 983 + #define RNG_STAT 0x04 984 + #define RNG_AVAIL_MASK (0xff000000) 985 + 986 + #define RNG_DATA 0x08 987 + #define RNG_THRES 0x0c 988 + #define RNG_MASK 0x10 989 + 990 + /************************************************************************* 991 + * _REG relative to RSET_SPI 992 + *************************************************************************/ 993 + 994 + /* BCM 6338 SPI core */ 995 + #define SPI_6338_CMD 0x00 /* 16-bits register */ 996 + #define SPI_6338_INT_STATUS 0x02 997 + #define SPI_6338_INT_MASK_ST 0x03 998 + #define SPI_6338_INT_MASK 0x04 999 + #define SPI_6338_ST 0x05 1000 + #define SPI_6338_CLK_CFG 0x06 1001 + #define SPI_6338_FILL_BYTE 0x07 1002 + #define SPI_6338_MSG_TAIL 0x09 1003 + #define SPI_6338_RX_TAIL 0x0b 1004 + #define SPI_6338_MSG_CTL 0x40 1005 + #define SPI_6338_MSG_DATA 0x41 1006 + #define SPI_6338_MSG_DATA_SIZE 0x3f 1007 + #define SPI_6338_RX_DATA 0x80 1008 + #define SPI_6338_RX_DATA_SIZE 0x3f 1009 + 1010 + /* BCM 6348 SPI core */ 1011 + #define SPI_6348_CMD 0x00 /* 16-bits register */ 1012 + #define SPI_6348_INT_STATUS 0x02 1013 + #define SPI_6348_INT_MASK_ST 0x03 1014 + #define SPI_6348_INT_MASK 0x04 1015 + #define SPI_6348_ST 0x05 1016 + #define SPI_6348_CLK_CFG 0x06 1017 + #define SPI_6348_FILL_BYTE 0x07 1018 + #define SPI_6348_MSG_TAIL 0x09 1019 + #define SPI_6348_RX_TAIL 0x0b 1020 + #define SPI_6348_MSG_CTL 0x40 1021 + #define SPI_6348_MSG_DATA 0x41 1022 + #define SPI_6348_MSG_DATA_SIZE 0x3f 1023 + #define SPI_6348_RX_DATA 0x80 1024 + #define SPI_6348_RX_DATA_SIZE 0x3f 1025 + 1026 + /* BCM 6358 SPI core */ 1027 + #define SPI_6358_MSG_CTL 0x00 /* 16-bits register */ 1028 + #define SPI_6358_MSG_DATA 0x02 1029 + #define SPI_6358_MSG_DATA_SIZE 0x21e 1030 + #define SPI_6358_RX_DATA 0x400 1031 + #define SPI_6358_RX_DATA_SIZE 0x220 1032 + #define SPI_6358_CMD 0x700 /* 16-bits register */ 1033 + #define SPI_6358_INT_STATUS 0x702 1034 + #define SPI_6358_INT_MASK_ST 0x703 1035 + #define SPI_6358_INT_MASK 0x704 1036 + #define SPI_6358_ST 0x705 1037 + #define SPI_6358_CLK_CFG 0x706 1038 + #define SPI_6358_FILL_BYTE 0x707 1039 + #define SPI_6358_MSG_TAIL 0x709 1040 + #define SPI_6358_RX_TAIL 0x70B 1041 + 1042 + /* BCM 6358 SPI core */ 1043 + #define SPI_6368_MSG_CTL 0x00 /* 16-bits register */ 1044 + #define SPI_6368_MSG_DATA 0x02 1045 + #define SPI_6368_MSG_DATA_SIZE 0x21e 1046 + #define SPI_6368_RX_DATA 0x400 1047 + #define SPI_6368_RX_DATA_SIZE 0x220 1048 + #define SPI_6368_CMD 0x700 /* 16-bits register */ 1049 + #define SPI_6368_INT_STATUS 0x702 1050 + #define SPI_6368_INT_MASK_ST 0x703 1051 + #define SPI_6368_INT_MASK 0x704 1052 + #define SPI_6368_ST 0x705 1053 + #define SPI_6368_CLK_CFG 0x706 1054 + #define SPI_6368_FILL_BYTE 0x707 1055 + #define SPI_6368_MSG_TAIL 0x709 1056 + #define SPI_6368_RX_TAIL 0x70B 1057 + 1058 + /* Shared SPI definitions */ 1059 + 1060 + /* Message configuration */ 1061 + #define SPI_FD_RW 0x00 1062 + #define SPI_HD_W 0x01 1063 + #define SPI_HD_R 0x02 1064 + #define SPI_BYTE_CNT_SHIFT 0 1065 + #define SPI_MSG_TYPE_SHIFT 14 1066 + 1067 + /* Command */ 1068 + #define SPI_CMD_NOOP 0x00 1069 + #define SPI_CMD_SOFT_RESET 0x01 1070 + #define SPI_CMD_HARD_RESET 0x02 1071 + #define SPI_CMD_START_IMMEDIATE 0x03 1072 + #define SPI_CMD_COMMAND_SHIFT 0 1073 + #define SPI_CMD_COMMAND_MASK 0x000f 1074 + #define SPI_CMD_DEVICE_ID_SHIFT 4 1075 + #define SPI_CMD_PREPEND_BYTE_CNT_SHIFT 8 1076 + #define SPI_CMD_ONE_BYTE_SHIFT 11 1077 + #define SPI_CMD_ONE_WIRE_SHIFT 12 1078 + #define SPI_DEV_ID_0 0 1079 + #define SPI_DEV_ID_1 1 1080 + #define SPI_DEV_ID_2 2 1081 + #define SPI_DEV_ID_3 3 1082 + 1083 + /* Interrupt mask */ 1084 + #define SPI_INTR_CMD_DONE 0x01 1085 + #define SPI_INTR_RX_OVERFLOW 0x02 1086 + #define SPI_INTR_TX_UNDERFLOW 0x04 1087 + #define SPI_INTR_TX_OVERFLOW 0x08 1088 + #define SPI_INTR_RX_UNDERFLOW 0x10 1089 + #define SPI_INTR_CLEAR_ALL 0x1f 1090 + 1091 + /* Status */ 1092 + #define SPI_RX_EMPTY 0x02 1093 + #define SPI_CMD_BUSY 0x04 1094 + #define SPI_SERIAL_BUSY 0x08 1095 + 1096 + /* Clock configuration */ 1097 + #define SPI_CLK_20MHZ 0x00 1098 + #define SPI_CLK_0_391MHZ 0x01 1099 + #define SPI_CLK_0_781MHZ 0x02 /* default */ 1100 + #define SPI_CLK_1_563MHZ 0x03 1101 + #define SPI_CLK_3_125MHZ 0x04 1102 + #define SPI_CLK_6_250MHZ 0x05 1103 + #define SPI_CLK_12_50MHZ 0x06 1104 + #define SPI_CLK_MASK 0x07 1105 + #define SPI_SSOFFTIME_MASK 0x38 1106 + #define SPI_SSOFFTIME_SHIFT 3 1107 + #define SPI_BYTE_SWAP 0x80 1108 + 1109 + /************************************************************************* 1110 + * _REG relative to RSET_MISC 1111 + *************************************************************************/ 1112 + #define MISC_SERDES_CTRL_REG 0x0 1113 + #define SERDES_PCIE_EN (1 << 0) 1114 + #define SERDES_PCIE_EXD_EN (1 << 15) 1115 + 1116 + #define MISC_STRAPBUS_6328_REG 0x240 1117 + #define STRAPBUS_6328_FCVO_SHIFT 7 1118 + #define STRAPBUS_6328_FCVO_MASK (0x1f << STRAPBUS_6328_FCVO_SHIFT) 1119 + #define STRAPBUS_6328_BOOT_SEL_SERIAL (1 << 28) 1120 + #define STRAPBUS_6328_BOOT_SEL_NAND (0 << 28) 1121 + 1122 + /************************************************************************* 1123 + * _REG relative to RSET_PCIE 1124 + *************************************************************************/ 1125 + 1126 + #define PCIE_CONFIG2_REG 0x408 1127 + #define CONFIG2_BAR1_SIZE_EN 1 1128 + #define CONFIG2_BAR1_SIZE_MASK 0xf 1129 + 1130 + #define PCIE_IDVAL3_REG 0x43c 1131 + #define IDVAL3_CLASS_CODE_MASK 0xffffff 1132 + #define IDVAL3_SUBCLASS_SHIFT 8 1133 + #define IDVAL3_CLASS_SHIFT 16 1134 + 1135 + #define PCIE_DLSTATUS_REG 0x1048 1136 + #define DLSTATUS_PHYLINKUP (1 << 13) 1137 + 1138 + #define PCIE_BRIDGE_OPT1_REG 0x2820 1139 + #define OPT1_RD_BE_OPT_EN (1 << 7) 1140 + #define OPT1_RD_REPLY_BE_FIX_EN (1 << 9) 1141 + #define OPT1_PCIE_BRIDGE_HOLE_DET_EN (1 << 11) 1142 + #define OPT1_L1_INT_STATUS_MASK_POL (1 << 12) 1143 + 1144 + #define PCIE_BRIDGE_OPT2_REG 0x2824 1145 + #define OPT2_UBUS_UR_DECODE_DIS (1 << 2) 1146 + #define OPT2_TX_CREDIT_CHK_EN (1 << 4) 1147 + #define OPT2_CFG_TYPE1_BD_SEL (1 << 7) 1148 + #define OPT2_CFG_TYPE1_BUS_NO_SHIFT 16 1149 + #define OPT2_CFG_TYPE1_BUS_NO_MASK (0xff << OPT2_CFG_TYPE1_BUS_NO_SHIFT) 1150 + 1151 + #define PCIE_BRIDGE_BAR0_BASEMASK_REG 0x2828 1152 + #define PCIE_BRIDGE_BAR1_BASEMASK_REG 0x2830 1153 + #define BASEMASK_REMAP_EN (1 << 0) 1154 + #define BASEMASK_SWAP_EN (1 << 1) 1155 + #define BASEMASK_MASK_SHIFT 4 1156 + #define BASEMASK_MASK_MASK (0xfff << BASEMASK_MASK_SHIFT) 1157 + #define BASEMASK_BASE_SHIFT 20 1158 + #define BASEMASK_BASE_MASK (0xfff << BASEMASK_BASE_SHIFT) 1159 + 1160 + #define PCIE_BRIDGE_BAR0_REBASE_ADDR_REG 0x282c 1161 + #define PCIE_BRIDGE_BAR1_REBASE_ADDR_REG 0x2834 1162 + #define REBASE_ADDR_BASE_SHIFT 20 1163 + #define REBASE_ADDR_BASE_MASK (0xfff << REBASE_ADDR_BASE_SHIFT) 1164 + 1165 + #define PCIE_BRIDGE_RC_INT_MASK_REG 0x2854 1166 + #define PCIE_RC_INT_A (1 << 0) 1167 + #define PCIE_RC_INT_B (1 << 1) 1168 + #define PCIE_RC_INT_C (1 << 2) 1169 + #define PCIE_RC_INT_D (1 << 3) 1170 + 1171 + #define PCIE_DEVICE_OFFSET 0x8000 1028 1172 1029 1173 #endif /* BCM63XX_REGS_H_ */
+1
arch/mips/include/asm/mach-bcm63xx/ioremap.h
··· 18 18 if (offset >= 0xfff00000) 19 19 return 1; 20 20 break; 21 + case BCM6328_CPU_ID: 21 22 case BCM6368_CPU_ID: 22 23 if (offset >= 0xb0000000 && offset < 0xb1000000) 23 24 return 1;
+5 -40
arch/mips/include/asm/mach-cavium-octeon/irq.h
··· 41 41 OCTEON_IRQ_TWSI, 42 42 OCTEON_IRQ_TWSI2, 43 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 44 OCTEON_IRQ_TIMER0, 49 45 OCTEON_IRQ_TIMER1, 50 46 OCTEON_IRQ_TIMER2, 51 47 OCTEON_IRQ_TIMER3, 52 48 OCTEON_IRQ_USB0, 53 49 OCTEON_IRQ_USB1, 54 - OCTEON_IRQ_PCM, 55 - OCTEON_IRQ_MPI, 56 - OCTEON_IRQ_POWIQ, 57 - OCTEON_IRQ_IPDPPTHR, 58 50 OCTEON_IRQ_MII0, 59 51 OCTEON_IRQ_MII1, 60 52 OCTEON_IRQ_BOOTDMA, 61 - 62 - OCTEON_IRQ_NAND, 63 - OCTEON_IRQ_MIO, /* Summary of MIO_BOOT_ERR */ 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, 53 + #ifndef CONFIG_PCI_MSI 54 + OCTEON_IRQ_LAST = 127 55 + #endif 89 56 }; 90 57 91 58 #ifdef CONFIG_PCI_MSI 92 - /* 152 - 407 represent the MSI interrupts 0-255 */ 93 - #define OCTEON_IRQ_MSI_BIT0 (OCTEON_IRQ_RST + 1) 59 + /* 256 - 511 represent the MSI interrupts 0-255 */ 60 + #define OCTEON_IRQ_MSI_BIT0 (256) 94 61 95 62 #define OCTEON_IRQ_MSI_LAST (OCTEON_IRQ_MSI_BIT0 + 255) 96 63 #define OCTEON_IRQ_LAST (OCTEON_IRQ_MSI_LAST + 1) 97 - #else 98 - #define OCTEON_IRQ_LAST (OCTEON_IRQ_RST + 1) 99 64 #endif 100 65 101 66 #endif
+4
arch/mips/include/asm/mach-jz4740/jz4740_nand.h
··· 19 19 #include <linux/mtd/nand.h> 20 20 #include <linux/mtd/partitions.h> 21 21 22 + #define JZ_NAND_NUM_BANKS 4 23 + 22 24 struct jz_nand_platform_data { 23 25 int num_partitions; 24 26 struct mtd_partition *partitions; ··· 28 26 struct nand_ecclayout *ecc_layout; 29 27 30 28 unsigned int busy_gpio; 29 + 30 + unsigned char banks[JZ_NAND_NUM_BANKS]; 31 31 32 32 void (*ident_callback)(struct platform_device *, struct nand_chip *, 33 33 struct mtd_partition **, int *num_partitions);
+2 -1
arch/mips/include/asm/mach-loongson/loongson.h
··· 14 14 #include <linux/io.h> 15 15 #include <linux/init.h> 16 16 #include <linux/irq.h> 17 + #include <linux/kconfig.h> 17 18 18 19 /* loongson internal northbridge initialization */ 19 20 extern void bonito_irq_init(void); ··· 67 66 #include <linux/interrupt.h> 68 67 static inline void do_perfcnt_IRQ(void) 69 68 { 70 - #if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE) 69 + #if IS_ENABLED(CONFIG_OPROFILE) 71 70 do_IRQ(LOONGSON2_PERFCNT_IRQ); 72 71 #endif 73 72 }
+73
arch/mips/include/asm/mach-loongson1/irq.h
··· 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 */
+44
arch/mips/include/asm/mach-loongson1/loongson1.h
··· 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 */
+23
arch/mips/include/asm/mach-loongson1/platform.h
··· 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 */
+24
arch/mips/include/asm/mach-loongson1/prom.h
··· 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 */
+33
arch/mips/include/asm/mach-loongson1/regs-clk.h
··· 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 */
+22
arch/mips/include/asm/mach-loongson1/regs-wdt.h
··· 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 */
+25
arch/mips/include/asm/mach-loongson1/war.h
··· 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 */
-1
arch/mips/include/asm/mach-netlogic/cpu-feature-overrides.h
··· 48 48 #define cpu_has_userlocal 1 49 49 #define cpu_has_mips32r2 1 50 50 #define cpu_has_mips64r2 1 51 - #define cpu_has_dc_aliases 1 52 51 #else 53 52 #error "Unknown Netlogic CPU" 54 53 #endif
+1 -1
arch/mips/include/asm/mach-tx49xx/mangle-port.h
··· 9 9 #define ioswabb(a, x) (x) 10 10 #define __mem_ioswabb(a, x) (x) 11 11 #if defined(CONFIG_TOSHIBA_RBTX4939) && \ 12 - (defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)) && \ 12 + IS_ENABLED(CONFIG_SMC91X) && \ 13 13 defined(__BIG_ENDIAN) 14 14 #define NEEDS_TXX9_IOSWABW 15 15 extern u16 (*ioswabw)(volatile u16 *a, u16 x);
+13
arch/mips/include/asm/mipsmtregs.h
··· 28 28 #define read_c0_vpeconf0() __read_32bit_c0_register($1, 2) 29 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 34 #define read_c0_tcstatus() __read_32bit_c0_register($2, 1) 32 35 #define write_c0_tcstatus(val) __write_32bit_c0_register($2, 1, val) 33 36 ··· 126 123 #define VPECONF0_MVP (_ULCAST_(1) << VPECONF0_MVP_SHIFT) 127 124 #define VPECONF0_XTC_SHIFT 21 128 125 #define VPECONF0_XTC (_ULCAST_(0xff) << VPECONF0_XTC_SHIFT) 126 + 127 + /* VPEConf1 fields (per VPE) */ 128 + #define VPECONF1_NCP1_SHIFT 0 129 + #define VPECONF1_NCP1 (_ULCAST_(0xff) << VPECONF1_NCP1_SHIFT) 130 + #define VPECONF1_NCP2_SHIFT 10 131 + #define VPECONF1_NCP2 (_ULCAST_(0xff) << VPECONF1_NCP2_SHIFT) 132 + #define VPECONF1_NCX_SHIFT 20 133 + #define VPECONF1_NCX (_ULCAST_(0xff) << VPECONF1_NCX_SHIFT) 129 134 130 135 /* TCStatus fields (per TC) */ 131 136 #define TCSTATUS_TASID (_ULCAST_(0xff)) ··· 361 350 #define write_vpe_c0_vpecontrol(val) mttc0(1, 1, val) 362 351 #define read_vpe_c0_vpeconf0() mftc0(1, 2) 363 352 #define write_vpe_c0_vpeconf0(val) mttc0(1, 2, val) 353 + #define read_vpe_c0_vpeconf1() mftc0(1, 3) 354 + #define write_vpe_c0_vpeconf1(val) mttc0(1, 3, val) 364 355 #define read_vpe_c0_count() mftc0(9, 0) 365 356 #define write_vpe_c0_count(val) mttc0(9, 0, val) 366 357 #define read_vpe_c0_status() mftc0(12, 0)
+2
arch/mips/include/asm/module.h
··· 117 117 #define MODULE_PROC_FAMILY "RM9000 " 118 118 #elif defined CONFIG_CPU_SB1 119 119 #define MODULE_PROC_FAMILY "SB1 " 120 + #elif defined CONFIG_CPU_LOONGSON1 121 + #define MODULE_PROC_FAMILY "LOONGSON1 " 120 122 #elif defined CONFIG_CPU_LOONGSON2 121 123 #define MODULE_PROC_FAMILY "LOONGSON2 " 122 124 #elif defined CONFIG_CPU_CAVIUM_OCTEON
+3 -1
arch/mips/include/asm/netlogic/xlp-hal/cpucontrol.h
··· 47 47 #define CPU_BLOCKID_MAP 10 48 48 49 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 53 #define SCHED_DEFEATURE 0x700 52 54 53 55 /* Offsets of interest from the 'MAP' Block */
+4 -1
arch/mips/include/asm/netlogic/xlp-hal/iomap.h
··· 36 36 #define __NLM_HAL_IOMAP_H__ 37 37 38 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 42 #define NMI_BASE 0xbfc00000 40 43 #define XLP_IO_CLK 133333333 41 44 ··· 132 129 #define PCI_DEVICE_ID_NLM_PIC 0x1003 133 130 #define PCI_DEVICE_ID_NLM_PCIE 0x1004 134 131 #define PCI_DEVICE_ID_NLM_EHCI 0x1007 135 - #define PCI_DEVICE_ID_NLM_ILK 0x1008 132 + #define PCI_DEVICE_ID_NLM_OHCI 0x1008 136 133 #define PCI_DEVICE_ID_NLM_NAE 0x1009 137 134 #define PCI_DEVICE_ID_NLM_POE 0x100A 138 135 #define PCI_DEVICE_ID_NLM_FMN 0x100B
+76
arch/mips/include/asm/netlogic/xlp-hal/pcibus.h
··· 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__ */
+4
arch/mips/include/asm/netlogic/xlp-hal/pic.h
··· 201 201 #define PIC_NUM_USB_IRTS 6 202 202 #define PIC_IRT_USB_0_INDEX 115 203 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 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 209 #define PIC_IRT_USB_INDEX(num) ((num) + PIC_IRT_USB_0_INDEX) 206 210 /* 115 to 120 */ 207 211 #define PIC_IRT_GDX_INDEX 121
+64
arch/mips/include/asm/netlogic/xlp-hal/usb.h
··· 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__ */
+15 -2
arch/mips/include/asm/netlogic/xlp-hal/xlp.h
··· 35 35 #ifndef _NLM_HAL_XLP_H 36 36 #define _NLM_HAL_XLP_H 37 37 38 - #define PIC_UART_0_IRQ 17 39 - #define PIC_UART_1_IRQ 18 38 + #define PIC_UART_0_IRQ 17 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 54 #ifndef __ASSEMBLY__ 42 55
+104
arch/mips/include/asm/netlogic/xlr/bridge.h
··· 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
+55
arch/mips/include/asm/netlogic/xlr/flash.h
··· 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
+30 -29
arch/mips/include/asm/netlogic/xlr/gpio.h
··· 35 35 #ifndef _ASM_NLM_GPIO_H 36 36 #define _ASM_NLM_GPIO_H 37 37 38 - #define NETLOGIC_GPIO_INT_EN_REG 0 39 - #define NETLOGIC_GPIO_INPUT_INVERSION_REG 1 40 - #define NETLOGIC_GPIO_IO_DIR_REG 2 41 - #define NETLOGIC_GPIO_IO_DATA_WR_REG 3 42 - #define NETLOGIC_GPIO_IO_DATA_RD_REG 4 38 + #define GPIO_INT_EN_REG 0 39 + #define GPIO_INPUT_INVERSION_REG 1 40 + #define GPIO_IO_DIR_REG 2 41 + #define GPIO_IO_DATA_WR_REG 3 42 + #define GPIO_IO_DATA_RD_REG 4 43 43 44 - #define NETLOGIC_GPIO_SWRESET_REG 8 45 - #define NETLOGIC_GPIO_DRAM1_CNTRL_REG 9 46 - #define NETLOGIC_GPIO_DRAM1_RATIO_REG 10 47 - #define NETLOGIC_GPIO_DRAM1_RESET_REG 11 48 - #define NETLOGIC_GPIO_DRAM1_STATUS_REG 12 49 - #define NETLOGIC_GPIO_DRAM2_CNTRL_REG 13 50 - #define NETLOGIC_GPIO_DRAM2_RATIO_REG 14 51 - #define NETLOGIC_GPIO_DRAM2_RESET_REG 15 52 - #define NETLOGIC_GPIO_DRAM2_STATUS_REG 16 44 + #define GPIO_SWRESET_REG 8 45 + #define GPIO_DRAM1_CNTRL_REG 9 46 + #define GPIO_DRAM1_RATIO_REG 10 47 + #define GPIO_DRAM1_RESET_REG 11 48 + #define GPIO_DRAM1_STATUS_REG 12 49 + #define GPIO_DRAM2_CNTRL_REG 13 50 + #define GPIO_DRAM2_RATIO_REG 14 51 + #define GPIO_DRAM2_RESET_REG 15 52 + #define GPIO_DRAM2_STATUS_REG 16 53 53 54 - #define NETLOGIC_GPIO_PWRON_RESET_CFG_REG 21 55 - #define NETLOGIC_GPIO_BIST_ALL_GO_STATUS_REG 24 56 - #define NETLOGIC_GPIO_BIST_CPU_GO_STATUS_REG 25 57 - #define NETLOGIC_GPIO_BIST_DEV_GO_STATUS_REG 26 54 + #define GPIO_PWRON_RESET_CFG_REG 21 55 + #define GPIO_BIST_ALL_GO_STATUS_REG 24 56 + #define GPIO_BIST_CPU_GO_STATUS_REG 25 57 + #define GPIO_BIST_DEV_GO_STATUS_REG 26 58 58 59 - #define NETLOGIC_GPIO_FUSE_BANK_REG 35 60 - #define NETLOGIC_GPIO_CPU_RESET_REG 40 61 - #define NETLOGIC_GPIO_RNG_REG 43 59 + #define GPIO_FUSE_BANK_REG 35 60 + #define GPIO_CPU_RESET_REG 40 61 + #define GPIO_RNG_REG 43 62 62 63 - #define NETLOGIC_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 63 + #define PWRON_RESET_PCMCIA_BOOT 17 67 64 68 - #define NETLOGIC_GPIO_LED_OUTPUT_CODE_RESET 0x01 69 - #define NETLOGIC_GPIO_LED_OUTPUT_CODE_HARD_RESET 0x02 70 - #define NETLOGIC_GPIO_LED_OUTPUT_CODE_SOFT_RESET 0x03 71 - #define NETLOGIC_GPIO_LED_OUTPUT_CODE_MAIN 0x04 65 + #define GPIO_LED_BITMAP 0x1700000 66 + #define GPIO_LED_0_SHIFT 20 67 + #define GPIO_LED_1_SHIFT 24 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 74 #endif
-64
arch/mips/include/asm/octeon/cvmx-helper-fpa.h
··· 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__ */
-2
arch/mips/include/asm/octeon/cvmx-helper.h
··· 61 61 } s; 62 62 } cvmx_helper_link_info_t; 63 63 64 - #include "cvmx-helper-fpa.h" 65 - 66 64 #include <asm/octeon/cvmx-helper-errata.h> 67 65 #include "cvmx-helper-loop.h" 68 66 #include "cvmx-helper-npi.h"
-5
arch/mips/include/asm/octeon/octeon.h
··· 215 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 218 extern void octeon_write_lcd(const char *s); 224 219 extern void octeon_check_cpu_bist(void); 225 220 extern int octeon_get_boot_debug_flag(void);
-3
arch/mips/include/asm/prom.h
··· 20 20 extern int early_init_dt_scan_memory_arch(unsigned long node, 21 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 23 extern void device_tree_init(void); 27 24 28 25 static inline unsigned long pci_address_to_pio(phys_addr_t address)
+6
arch/mips/include/asm/smtc.h
··· 33 33 #endif 34 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 42 extern asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS]; 37 43 38 44 struct mm_struct;
+3 -3
arch/mips/include/asm/uaccess.h
··· 687 687 __MODULE_JAL(__copy_user) \ 688 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 691 DADDI_SCRATCH, "memory"); \ 692 692 __cu_len_r; \ 693 693 }) ··· 797 797 ".set\treorder" \ 798 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 801 DADDI_SCRATCH, "memory"); \ 802 802 __cu_len_r; \ 803 803 }) ··· 820 820 ".set\treorder" \ 821 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 824 DADDI_SCRATCH, "memory"); \ 825 825 __cu_len_r; \ 826 826 })
+52 -50
arch/mips/include/asm/uasm.h
··· 6 6 * Copyright (C) 2004, 2005, 2006, 2008 Thiemo Seufer 7 7 * Copyright (C) 2005 Maciej W. Rozycki 8 8 * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org) 9 + * Copyright (C) 2012 MIPS Technologies, Inc. 9 10 */ 10 11 11 12 #include <linux/types.h> ··· 63 62 64 63 Ip_u2u1s3(_addiu); 65 64 Ip_u3u1u2(_addu); 66 - Ip_u2u1u3(_andi); 67 65 Ip_u3u1u2(_and); 66 + Ip_u2u1u3(_andi); 67 + Ip_u1u2s3(_bbit0); 68 + Ip_u1u2s3(_bbit1); 68 69 Ip_u1u2s3(_beq); 69 70 Ip_u1u2s3(_beql); 70 71 Ip_u1s2(_bgez); ··· 75 72 Ip_u1s2(_bltzl); 76 73 Ip_u1u2s3(_bne); 77 74 Ip_u2s3u1(_cache); 78 - Ip_u1u2u3(_dmfc0); 79 - Ip_u1u2u3(_dmtc0); 80 75 Ip_u2u1s3(_daddiu); 81 76 Ip_u3u1u2(_daddu); 77 + Ip_u2u1msbu3(_dins); 78 + Ip_u2u1msbu3(_dinsm); 79 + Ip_u1u2u3(_dmfc0); 80 + Ip_u1u2u3(_dmtc0); 81 + Ip_u2u1u3(_drotr); 82 + Ip_u2u1u3(_drotr32); 82 83 Ip_u2u1u3(_dsll); 83 84 Ip_u2u1u3(_dsll32); 84 85 Ip_u2u1u3(_dsra); 85 86 Ip_u2u1u3(_dsrl); 86 87 Ip_u2u1u3(_dsrl32); 87 - Ip_u2u1u3(_drotr); 88 - Ip_u2u1u3(_drotr32); 89 88 Ip_u3u1u2(_dsubu); 90 89 Ip_0(_eret); 91 90 Ip_u1(_j); 92 91 Ip_u1(_jal); 93 92 Ip_u1(_jr); 94 93 Ip_u2s3u1(_ld); 94 + Ip_u3u1u2(_ldx); 95 95 Ip_u2s3u1(_ll); 96 96 Ip_u2s3u1(_lld); 97 97 Ip_u1s2(_lui); 98 98 Ip_u2s3u1(_lw); 99 + Ip_u3u1u2(_lwx); 99 100 Ip_u1u2u3(_mfc0); 100 101 Ip_u1u2u3(_mtc0); 101 - Ip_u2u1u3(_ori); 102 102 Ip_u3u1u2(_or); 103 + Ip_u2u1u3(_ori); 103 104 Ip_u2s3u1(_pref); 104 105 Ip_0(_rfe); 106 + Ip_u2u1u3(_rotr); 105 107 Ip_u2s3u1(_sc); 106 108 Ip_u2s3u1(_scd); 107 109 Ip_u2s3u1(_sd); 108 110 Ip_u2u1u3(_sll); 109 111 Ip_u2u1u3(_sra); 110 112 Ip_u2u1u3(_srl); 111 - Ip_u2u1u3(_rotr); 112 113 Ip_u3u1u2(_subu); 113 114 Ip_u2s3u1(_sw); 115 + Ip_u1(_syscall); 114 116 Ip_0(_tlbp); 115 117 Ip_0(_tlbr); 116 118 Ip_0(_tlbwi); 117 119 Ip_0(_tlbwr); 118 120 Ip_u3u1u2(_xor); 119 121 Ip_u2u1u3(_xori); 120 - Ip_u2u1msbu3(_dins); 121 - Ip_u2u1msbu3(_dinsm); 122 - Ip_u1(_syscall); 123 - Ip_u1u2s3(_bbit0); 124 - Ip_u1u2s3(_bbit1); 125 - Ip_u3u1u2(_lwx); 126 - Ip_u3u1u2(_ldx); 122 + 127 123 128 124 /* Handle labels. */ 129 125 struct uasm_label { ··· 147 145 148 146 /* convenience macros for instructions */ 149 147 #ifdef CONFIG_64BIT 148 + # define UASM_i_ADDIU(buf, rs, rt, val) uasm_i_daddiu(buf, rs, rt, val) 149 + # define UASM_i_ADDU(buf, rs, rt, rd) uasm_i_daddu(buf, rs, rt, rd) 150 + # define UASM_i_LL(buf, rs, rt, off) uasm_i_lld(buf, rs, rt, off) 150 151 # define UASM_i_LW(buf, rs, rt, off) uasm_i_ld(buf, rs, rt, off) 151 - # define UASM_i_SW(buf, rs, rt, off) uasm_i_sd(buf, rs, rt, off) 152 + # define UASM_i_LWX(buf, rs, rt, rd) uasm_i_ldx(buf, rs, rt, rd) 153 + # define UASM_i_MFC0(buf, rt, rd...) uasm_i_dmfc0(buf, rt, rd) 154 + # define UASM_i_MTC0(buf, rt, rd...) uasm_i_dmtc0(buf, rt, rd) 155 + # define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_drotr(buf, rs, rt, sh) 156 + # define UASM_i_SC(buf, rs, rt, off) uasm_i_scd(buf, rs, rt, off) 152 157 # define UASM_i_SLL(buf, rs, rt, sh) uasm_i_dsll(buf, rs, rt, sh) 153 158 # define UASM_i_SRA(buf, rs, rt, sh) uasm_i_dsra(buf, rs, rt, sh) 154 159 # define UASM_i_SRL(buf, rs, rt, sh) uasm_i_dsrl(buf, rs, rt, sh) 155 160 # define UASM_i_SRL_SAFE(buf, rs, rt, sh) uasm_i_dsrl_safe(buf, rs, rt, sh) 156 - # define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_drotr(buf, rs, rt, sh) 157 - # define UASM_i_MFC0(buf, rt, rd...) uasm_i_dmfc0(buf, rt, rd) 158 - # define UASM_i_MTC0(buf, rt, rd...) uasm_i_dmtc0(buf, rt, rd) 159 - # define UASM_i_ADDIU(buf, rs, rt, val) uasm_i_daddiu(buf, rs, rt, val) 160 - # define UASM_i_ADDU(buf, rs, rt, rd) uasm_i_daddu(buf, rs, rt, rd) 161 161 # define UASM_i_SUBU(buf, rs, rt, rd) uasm_i_dsubu(buf, rs, rt, rd) 162 - # define UASM_i_LL(buf, rs, rt, off) uasm_i_lld(buf, rs, rt, off) 163 - # define UASM_i_SC(buf, rs, rt, off) uasm_i_scd(buf, rs, rt, off) 164 - # define UASM_i_LWX(buf, rs, rt, rd) uasm_i_ldx(buf, rs, rt, rd) 162 + # define UASM_i_SW(buf, rs, rt, off) uasm_i_sd(buf, rs, rt, off) 165 163 #else 164 + # define UASM_i_ADDIU(buf, rs, rt, val) uasm_i_addiu(buf, rs, rt, val) 165 + # define UASM_i_ADDU(buf, rs, rt, rd) uasm_i_addu(buf, rs, rt, rd) 166 + # define UASM_i_LL(buf, rs, rt, off) uasm_i_ll(buf, rs, rt, off) 166 167 # define UASM_i_LW(buf, rs, rt, off) uasm_i_lw(buf, rs, rt, off) 167 - # define UASM_i_SW(buf, rs, rt, off) uasm_i_sw(buf, rs, rt, off) 168 + # define UASM_i_LWX(buf, rs, rt, rd) uasm_i_lwx(buf, rs, rt, rd) 169 + # define UASM_i_MFC0(buf, rt, rd...) uasm_i_mfc0(buf, rt, rd) 170 + # define UASM_i_MTC0(buf, rt, rd...) uasm_i_mtc0(buf, rt, rd) 171 + # define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_rotr(buf, rs, rt, sh) 172 + # define UASM_i_SC(buf, rs, rt, off) uasm_i_sc(buf, rs, rt, off) 168 173 # define UASM_i_SLL(buf, rs, rt, sh) uasm_i_sll(buf, rs, rt, sh) 169 174 # define UASM_i_SRA(buf, rs, rt, sh) uasm_i_sra(buf, rs, rt, sh) 170 175 # define UASM_i_SRL(buf, rs, rt, sh) uasm_i_srl(buf, rs, rt, sh) 171 176 # define UASM_i_SRL_SAFE(buf, rs, rt, sh) uasm_i_srl(buf, rs, rt, sh) 172 - # define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_rotr(buf, rs, rt, sh) 173 - # define UASM_i_MFC0(buf, rt, rd...) uasm_i_mfc0(buf, rt, rd) 174 - # define UASM_i_MTC0(buf, rt, rd...) uasm_i_mtc0(buf, rt, rd) 175 - # define UASM_i_ADDIU(buf, rs, rt, val) uasm_i_addiu(buf, rs, rt, val) 176 - # define UASM_i_ADDU(buf, rs, rt, rd) uasm_i_addu(buf, rs, rt, rd) 177 177 # define UASM_i_SUBU(buf, rs, rt, rd) uasm_i_subu(buf, rs, rt, rd) 178 - # define UASM_i_LL(buf, rs, rt, off) uasm_i_ll(buf, rs, rt, off) 179 - # define UASM_i_SC(buf, rs, rt, off) uasm_i_sc(buf, rs, rt, off) 180 - # define UASM_i_LWX(buf, rs, rt, rd) uasm_i_lwx(buf, rs, rt, rd) 178 + # define UASM_i_SW(buf, rs, rt, off) uasm_i_sw(buf, rs, rt, off) 181 179 #endif 182 180 183 181 #define uasm_i_b(buf, off) uasm_i_beq(buf, 0, 0, off) ··· 185 183 #define uasm_i_beqzl(buf, rs, off) uasm_i_beql(buf, rs, 0, off) 186 184 #define uasm_i_bnez(buf, rs, off) uasm_i_bne(buf, rs, 0, off) 187 185 #define uasm_i_bnezl(buf, rs, off) uasm_i_bnel(buf, rs, 0, off) 186 + #define uasm_i_ehb(buf) uasm_i_sll(buf, 0, 0, 3) 188 187 #define uasm_i_move(buf, a, b) UASM_i_ADDU(buf, a, 0, b) 189 188 #define uasm_i_nop(buf) uasm_i_sll(buf, 0, 0, 0) 190 189 #define uasm_i_ssnop(buf) uasm_i_sll(buf, 0, 0, 1) 191 - #define uasm_i_ehb(buf) uasm_i_sll(buf, 0, 0, 3) 192 - 193 - static inline void uasm_i_dsrl_safe(u32 **p, unsigned int a1, 194 - unsigned int a2, unsigned int a3) 195 - { 196 - if (a3 < 32) 197 - uasm_i_dsrl(p, a1, a2, a3); 198 - else 199 - uasm_i_dsrl32(p, a1, a2, a3 - 32); 200 - } 201 190 202 191 static inline void uasm_i_drotr_safe(u32 **p, unsigned int a1, 203 192 unsigned int a2, unsigned int a3) ··· 206 213 uasm_i_dsll(p, a1, a2, a3); 207 214 else 208 215 uasm_i_dsll32(p, a1, a2, a3 - 32); 216 + } 217 + 218 + static inline void uasm_i_dsrl_safe(u32 **p, unsigned int a1, 219 + unsigned int a2, unsigned int a3) 220 + { 221 + if (a3 < 32) 222 + uasm_i_dsrl(p, a1, a2, a3); 223 + else 224 + uasm_i_dsrl32(p, a1, a2, a3 - 32); 209 225 } 210 226 211 227 /* Handle relocations. */ ··· 236 234 int uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr); 237 235 238 236 /* Convenience functions for labeled branches. */ 239 - void uasm_il_bltz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); 240 237 void uasm_il_b(u32 **p, struct uasm_reloc **r, int lid); 241 - void uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); 242 - void uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); 243 - void uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1, 244 - unsigned int reg2, int lid); 245 - void uasm_il_bnez(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 238 void uasm_il_bbit0(u32 **p, struct uasm_reloc **r, unsigned int reg, 249 239 unsigned int bit, int lid); 250 240 void uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg, 251 241 unsigned int bit, int lid); 242 + void uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); 243 + void uasm_il_beqzl(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_bltz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); 247 + void uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1, 248 + unsigned int reg2, int lid); 249 + void uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
+1
arch/mips/jz4740/board-qi_lb60.c
··· 140 140 static struct jz_nand_platform_data qi_lb60_nand_pdata = { 141 141 .ident_callback = qi_lb60_nand_ident, 142 142 .busy_gpio = 94, 143 + .banks = { 1 }, 143 144 }; 144 145 145 146 /* Keyboard*/
+19 -1
arch/mips/jz4740/platform.c
··· 157 157 .flags = IORESOURCE_MEM, 158 158 }, 159 159 { 160 - .name = "bank", 160 + .name = "bank1", 161 161 .start = 0x18000000, 162 162 .end = 0x180C0000 - 1, 163 + .flags = IORESOURCE_MEM, 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, 163 181 .flags = IORESOURCE_MEM, 164 182 }, 165 183 };
+44 -5
arch/mips/jz4740/reset.c
··· 21 21 #include <asm/mach-jz4740/base.h> 22 22 #include <asm/mach-jz4740/timer.h> 23 23 24 + #include "reset.h" 25 + #include "clock.h" 26 + 24 27 static void jz4740_halt(void) 25 28 { 26 29 while (1) { ··· 56 53 jz4740_halt(); 57 54 } 58 55 59 - #define JZ_REG_RTC_CTRL 0x00 60 - #define JZ_REG_RTC_HIBERNATE 0x20 56 + #define JZ_REG_RTC_CTRL 0x00 57 + #define JZ_REG_RTC_HIBERNATE 0x20 58 + #define JZ_REG_RTC_WAKEUP_FILTER 0x24 59 + #define JZ_REG_RTC_RESET_COUNTER 0x28 61 60 62 - #define JZ_RTC_CTRL_WRDY BIT(7) 61 + #define JZ_RTC_CTRL_WRDY BIT(7) 62 + #define JZ_RTC_WAKEUP_FILTER_MASK 0x0000FFE0 63 + #define JZ_RTC_RESET_COUNTER_MASK 0x00000FE0 63 64 64 - static void jz4740_power_off(void) 65 + static inline void jz4740_rtc_wait_ready(void __iomem *rtc_base) 65 66 { 66 - void __iomem *rtc_base = ioremap(JZ4740_RTC_BASE_ADDR, 0x24); 67 67 uint32_t ctrl; 68 68 69 69 do { 70 70 ctrl = readl(rtc_base + JZ_REG_RTC_CTRL); 71 71 } while (!(ctrl & JZ_RTC_CTRL_WRDY)); 72 + } 72 73 74 + static void jz4740_power_off(void) 75 + { 76 + void __iomem *rtc_base = ioremap(JZ4740_RTC_BASE_ADDR, 0x38); 77 + unsigned long wakeup_filter_ticks; 78 + unsigned long reset_counter_ticks; 79 + 80 + /* 81 + * Set minimum wakeup pin assertion time: 100 ms. 82 + * Range is 0 to 2 sec if RTC is clocked at 32 kHz. 83 + */ 84 + wakeup_filter_ticks = (100 * jz4740_clock_bdata.rtc_rate) / 1000; 85 + if (wakeup_filter_ticks < JZ_RTC_WAKEUP_FILTER_MASK) 86 + wakeup_filter_ticks &= JZ_RTC_WAKEUP_FILTER_MASK; 87 + else 88 + wakeup_filter_ticks = JZ_RTC_WAKEUP_FILTER_MASK; 89 + jz4740_rtc_wait_ready(rtc_base); 90 + writel(wakeup_filter_ticks, rtc_base + JZ_REG_RTC_WAKEUP_FILTER); 91 + 92 + /* 93 + * Set reset pin low-level assertion time after wakeup: 60 ms. 94 + * Range is 0 to 125 ms if RTC is clocked at 32 kHz. 95 + */ 96 + reset_counter_ticks = (60 * jz4740_clock_bdata.rtc_rate) / 1000; 97 + if (reset_counter_ticks < JZ_RTC_RESET_COUNTER_MASK) 98 + reset_counter_ticks &= JZ_RTC_RESET_COUNTER_MASK; 99 + else 100 + reset_counter_ticks = JZ_RTC_RESET_COUNTER_MASK; 101 + jz4740_rtc_wait_ready(rtc_base); 102 + writel(reset_counter_ticks, rtc_base + JZ_REG_RTC_RESET_COUNTER); 103 + 104 + jz4740_rtc_wait_ready(rtc_base); 73 105 writel(1, rtc_base + JZ_REG_RTC_HIBERNATE); 106 + 74 107 jz4740_halt(); 75 108 } 76 109
+156 -143
arch/mips/kernel/cpu-probe.c
··· 190 190 case CPU_CAVIUM_OCTEON_PLUS: 191 191 case CPU_CAVIUM_OCTEON2: 192 192 case CPU_JZRISC: 193 + case CPU_LOONGSON1: 193 194 case CPU_XLR: 194 195 case CPU_XLP: 195 196 cpu_wait = r4k_wait; ··· 329 328 back_to_back_c0_hazard(); 330 329 c->vmbits = fls64(read_c0_entryhi() & 0x3fffffffffffe000ULL); 331 330 #endif 331 + } 332 + 333 + static char unknown_isa[] __cpuinitdata = KERN_ERR \ 334 + "Unsupported ISA type, c0.config0: %d."; 335 + 336 + static inline unsigned int decode_config0(struct cpuinfo_mips *c) 337 + { 338 + unsigned int config0; 339 + int isa; 340 + 341 + config0 = read_c0_config(); 342 + 343 + if (((config0 & MIPS_CONF_MT) >> 7) == 1) 344 + c->options |= MIPS_CPU_TLB; 345 + isa = (config0 & MIPS_CONF_AT) >> 13; 346 + switch (isa) { 347 + case 0: 348 + switch ((config0 & MIPS_CONF_AR) >> 10) { 349 + case 0: 350 + c->isa_level = MIPS_CPU_ISA_M32R1; 351 + break; 352 + case 1: 353 + c->isa_level = MIPS_CPU_ISA_M32R2; 354 + break; 355 + default: 356 + goto unknown; 357 + } 358 + break; 359 + case 2: 360 + switch ((config0 & MIPS_CONF_AR) >> 10) { 361 + case 0: 362 + c->isa_level = MIPS_CPU_ISA_M64R1; 363 + break; 364 + case 1: 365 + c->isa_level = MIPS_CPU_ISA_M64R2; 366 + break; 367 + default: 368 + goto unknown; 369 + } 370 + break; 371 + default: 372 + goto unknown; 373 + } 374 + 375 + return config0 & MIPS_CONF_M; 376 + 377 + unknown: 378 + panic(unknown_isa, config0); 379 + } 380 + 381 + static inline unsigned int decode_config1(struct cpuinfo_mips *c) 382 + { 383 + unsigned int config1; 384 + 385 + config1 = read_c0_config1(); 386 + 387 + if (config1 & MIPS_CONF1_MD) 388 + c->ases |= MIPS_ASE_MDMX; 389 + if (config1 & MIPS_CONF1_WR) 390 + c->options |= MIPS_CPU_WATCH; 391 + if (config1 & MIPS_CONF1_CA) 392 + c->ases |= MIPS_ASE_MIPS16; 393 + if (config1 & MIPS_CONF1_EP) 394 + c->options |= MIPS_CPU_EJTAG; 395 + if (config1 & MIPS_CONF1_FP) { 396 + c->options |= MIPS_CPU_FPU; 397 + c->options |= MIPS_CPU_32FPR; 398 + } 399 + if (cpu_has_tlb) 400 + c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1; 401 + 402 + return config1 & MIPS_CONF_M; 403 + } 404 + 405 + static inline unsigned int decode_config2(struct cpuinfo_mips *c) 406 + { 407 + unsigned int config2; 408 + 409 + config2 = read_c0_config2(); 410 + 411 + if (config2 & MIPS_CONF2_SL) 412 + c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT; 413 + 414 + return config2 & MIPS_CONF_M; 415 + } 416 + 417 + static inline unsigned int decode_config3(struct cpuinfo_mips *c) 418 + { 419 + unsigned int config3; 420 + 421 + config3 = read_c0_config3(); 422 + 423 + if (config3 & MIPS_CONF3_SM) 424 + c->ases |= MIPS_ASE_SMARTMIPS; 425 + if (config3 & MIPS_CONF3_DSP) 426 + c->ases |= MIPS_ASE_DSP; 427 + if (config3 & MIPS_CONF3_VINT) 428 + c->options |= MIPS_CPU_VINT; 429 + if (config3 & MIPS_CONF3_VEIC) 430 + c->options |= MIPS_CPU_VEIC; 431 + if (config3 & MIPS_CONF3_MT) 432 + c->ases |= MIPS_ASE_MIPSMT; 433 + if (config3 & MIPS_CONF3_ULRI) 434 + c->options |= MIPS_CPU_ULRI; 435 + 436 + return config3 & MIPS_CONF_M; 437 + } 438 + 439 + static inline unsigned int decode_config4(struct cpuinfo_mips *c) 440 + { 441 + unsigned int config4; 442 + 443 + config4 = read_c0_config4(); 444 + 445 + if ((config4 & MIPS_CONF4_MMUEXTDEF) == MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT 446 + && cpu_has_tlb) 447 + c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40; 448 + 449 + c->kscratch_mask = (config4 >> 16) & 0xff; 450 + 451 + return config4 & MIPS_CONF_M; 452 + } 453 + 454 + static void __cpuinit decode_configs(struct cpuinfo_mips *c) 455 + { 456 + int ok; 457 + 458 + /* MIPS32 or MIPS64 compliant CPU. */ 459 + c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER | 460 + MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK; 461 + 462 + c->scache.flags = MIPS_CACHE_NOT_PRESENT; 463 + 464 + ok = decode_config0(c); /* Read Config registers. */ 465 + BUG_ON(!ok); /* Arch spec violation! */ 466 + if (ok) 467 + ok = decode_config1(c); 468 + if (ok) 469 + ok = decode_config2(c); 470 + if (ok) 471 + ok = decode_config3(c); 472 + if (ok) 473 + ok = decode_config4(c); 474 + 475 + mips_probe_watch_registers(c); 476 + 477 + if (cpu_has_mips_r2) 478 + c->core = read_c0_ebase() & 0x3ff; 332 479 } 333 480 334 481 #define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \ ··· 787 638 MIPS_CPU_32FPR; 788 639 c->tlbsize = 64; 789 640 break; 790 - } 791 - } 641 + case PRID_IMP_LOONGSON1: 642 + decode_configs(c); 792 643 793 - static char unknown_isa[] __cpuinitdata = KERN_ERR \ 794 - "Unsupported ISA type, c0.config0: %d."; 644 + c->cputype = CPU_LOONGSON1; 795 645 796 - static inline unsigned int decode_config0(struct cpuinfo_mips *c) 797 - { 798 - unsigned int config0; 799 - int isa; 800 - 801 - config0 = read_c0_config(); 802 - 803 - if (((config0 & MIPS_CONF_MT) >> 7) == 1) 804 - c->options |= MIPS_CPU_TLB; 805 - isa = (config0 & MIPS_CONF_AT) >> 13; 806 - switch (isa) { 807 - case 0: 808 - switch ((config0 & MIPS_CONF_AR) >> 10) { 809 - case 0: 810 - c->isa_level = MIPS_CPU_ISA_M32R1; 646 + switch (c->processor_id & PRID_REV_MASK) { 647 + case PRID_REV_LOONGSON1B: 648 + __cpu_name[cpu] = "Loongson 1B"; 811 649 break; 812 - case 1: 813 - c->isa_level = MIPS_CPU_ISA_M32R2; 814 - break; 815 - default: 816 - goto unknown; 817 650 } 651 + 818 652 break; 819 - case 2: 820 - switch ((config0 & MIPS_CONF_AR) >> 10) { 821 - case 0: 822 - c->isa_level = MIPS_CPU_ISA_M64R1; 823 - break; 824 - case 1: 825 - c->isa_level = MIPS_CPU_ISA_M64R2; 826 - break; 827 - default: 828 - goto unknown; 829 - } 830 - break; 831 - default: 832 - goto unknown; 833 653 } 834 - 835 - return config0 & MIPS_CONF_M; 836 - 837 - unknown: 838 - panic(unknown_isa, config0); 839 - } 840 - 841 - static inline unsigned int decode_config1(struct cpuinfo_mips *c) 842 - { 843 - unsigned int config1; 844 - 845 - config1 = read_c0_config1(); 846 - 847 - if (config1 & MIPS_CONF1_MD) 848 - c->ases |= MIPS_ASE_MDMX; 849 - if (config1 & MIPS_CONF1_WR) 850 - c->options |= MIPS_CPU_WATCH; 851 - if (config1 & MIPS_CONF1_CA) 852 - c->ases |= MIPS_ASE_MIPS16; 853 - if (config1 & MIPS_CONF1_EP) 854 - c->options |= MIPS_CPU_EJTAG; 855 - if (config1 & MIPS_CONF1_FP) { 856 - c->options |= MIPS_CPU_FPU; 857 - c->options |= MIPS_CPU_32FPR; 858 - } 859 - if (cpu_has_tlb) 860 - c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1; 861 - 862 - return config1 & MIPS_CONF_M; 863 - } 864 - 865 - static inline unsigned int decode_config2(struct cpuinfo_mips *c) 866 - { 867 - unsigned int config2; 868 - 869 - config2 = read_c0_config2(); 870 - 871 - if (config2 & MIPS_CONF2_SL) 872 - c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT; 873 - 874 - return config2 & MIPS_CONF_M; 875 - } 876 - 877 - static inline unsigned int decode_config3(struct cpuinfo_mips *c) 878 - { 879 - unsigned int config3; 880 - 881 - config3 = read_c0_config3(); 882 - 883 - if (config3 & MIPS_CONF3_SM) 884 - c->ases |= MIPS_ASE_SMARTMIPS; 885 - if (config3 & MIPS_CONF3_DSP) 886 - c->ases |= MIPS_ASE_DSP; 887 - if (config3 & MIPS_CONF3_VINT) 888 - c->options |= MIPS_CPU_VINT; 889 - if (config3 & MIPS_CONF3_VEIC) 890 - c->options |= MIPS_CPU_VEIC; 891 - if (config3 & MIPS_CONF3_MT) 892 - c->ases |= MIPS_ASE_MIPSMT; 893 - if (config3 & MIPS_CONF3_ULRI) 894 - c->options |= MIPS_CPU_ULRI; 895 - 896 - return config3 & MIPS_CONF_M; 897 - } 898 - 899 - static inline unsigned int decode_config4(struct cpuinfo_mips *c) 900 - { 901 - unsigned int config4; 902 - 903 - config4 = read_c0_config4(); 904 - 905 - if ((config4 & MIPS_CONF4_MMUEXTDEF) == MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT 906 - && cpu_has_tlb) 907 - c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40; 908 - 909 - c->kscratch_mask = (config4 >> 16) & 0xff; 910 - 911 - return config4 & MIPS_CONF_M; 912 - } 913 - 914 - static void __cpuinit decode_configs(struct cpuinfo_mips *c) 915 - { 916 - int ok; 917 - 918 - /* MIPS32 or MIPS64 compliant CPU. */ 919 - c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER | 920 - MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK; 921 - 922 - c->scache.flags = MIPS_CACHE_NOT_PRESENT; 923 - 924 - ok = decode_config0(c); /* Read Config registers. */ 925 - BUG_ON(!ok); /* Arch spec violation! */ 926 - if (ok) 927 - ok = decode_config1(c); 928 - if (ok) 929 - ok = decode_config2(c); 930 - if (ok) 931 - ok = decode_config3(c); 932 - if (ok) 933 - ok = decode_config4(c); 934 - 935 - mips_probe_watch_registers(c); 936 - 937 - if (cpu_has_mips_r2) 938 - c->core = read_c0_ebase() & 0x3ff; 939 654 } 940 655 941 656 static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
+5
arch/mips/kernel/perf_event_mipsxx.c
··· 1559 1559 mipspmu.general_event_map = &mipsxxcore_event_map; 1560 1560 mipspmu.cache_event_map = &mipsxxcore_cache_map; 1561 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 1567 case CPU_CAVIUM_OCTEON: 1563 1568 case CPU_CAVIUM_OCTEON_PLUS: 1564 1569 case CPU_CAVIUM_OCTEON2:
-29
arch/mips/kernel/prom.c
··· 35 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 38 void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) 49 39 { 50 40 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)); ··· 65 75 /* Scan memory nodes */ 66 76 of_scan_flat_dt(early_init_dt_scan_root, NULL); 67 77 of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL); 68 - } 69 - 70 - void __init device_tree_init(void) 71 - { 72 - unsigned long base, size; 73 - 74 - if (!initial_boot_params) 75 - return; 76 - 77 - base = virt_to_phys((void *)initial_boot_params); 78 - size = be32_to_cpu(initial_boot_params->totalsize); 79 - 80 - /* Before we do anything, lets reserve the dt blob */ 81 - reserve_mem_mach(base, size); 82 - 83 - unflatten_device_tree(); 84 - 85 - /* free the space reserved for the dt blob */ 86 - free_mem_mach(base, size); 87 78 } 88 79 89 80 void __init __dt_setup_arch(struct boot_param_header *bph)
+3 -1
arch/mips/kernel/smp.c
··· 102 102 103 103 #ifdef CONFIG_MIPS_MT_SMTC 104 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 108 #endif /* CONFIG_MIPS_MT_SMTC */ 107 109 cpu_probe(); 108 110 cpu_report();
+68 -8
arch/mips/kernel/smtc.c
··· 86 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 96 /* Forward declarations */ 90 97 91 98 void ipi_decode(struct smtc_ipi *); ··· 181 174 182 175 __setup("tintq=", tintq); 183 176 184 - static int imstuckcount[2][8]; 177 + static int imstuckcount[MAX_SMTC_VPES][8]; 185 178 /* vpemask represents IM/IE bits of per-VPE Status registers, low-to-high */ 186 - static int vpemask[2][8] = { 179 + static int vpemask[MAX_SMTC_VPES][8] = { 187 180 {0, 0, 1, 0, 0, 0, 0, 1}, 188 181 {0, 0, 0, 0, 0, 0, 0, 1} 189 182 }; ··· 338 331 339 332 static void smtc_tc_setup(int vpe, int tc, int cpu) 340 333 { 334 + static int cp1contexts[MAX_SMTC_VPES]; 335 + 336 + /* 337 + * Make a local copy of the available FPU contexts in order 338 + * to keep track of TCs that can have one. 339 + */ 340 + if (tc == 1) 341 + { 342 + /* 343 + * FIXME: Multi-core SMTC hasn't been tested and the 344 + * maximum number of VPEs may change. 345 + */ 346 + cp1contexts[0] = smtc_nconf1[0] - 1; 347 + cp1contexts[1] = smtc_nconf1[1]; 348 + } 349 + 341 350 settc(tc); 342 351 write_tc_c0_tchalt(TCHALT_H); 343 352 mips_ihb(); ··· 366 343 * an active IPI queue. 367 344 */ 368 345 write_tc_c0_tccontext((sizeof(struct smtc_ipi_q) * cpu) << 16); 369 - /* Bind tc to vpe */ 346 + 347 + /* Bind TC to VPE. */ 370 348 write_tc_c0_tcbind(vpe); 349 + 371 350 /* In general, all TCs should have the same cpu_data indications. */ 372 351 memcpy(&cpu_data[cpu], &cpu_data[0], sizeof(struct cpuinfo_mips)); 373 - /* For 34Kf, start with TC/CPU 0 as sole owner of single FPU context */ 374 - if (cpu_data[0].cputype == CPU_34K || 375 - cpu_data[0].cputype == CPU_1004K) 352 + 353 + /* Check to see if there is a FPU context available for this TC. */ 354 + if (!cp1contexts[vpe]) 376 355 cpu_data[cpu].options &= ~MIPS_CPU_FPU; 356 + else 357 + cp1contexts[vpe]--; 358 + 359 + /* Store the TC and VPE into the cpu_data structure. */ 377 360 cpu_data[cpu].vpe_id = vpe; 378 361 cpu_data[cpu].tc_id = tc; 379 - /* Multi-core SMTC hasn't been tested, but be prepared */ 362 + 363 + /* FIXME: Multi-core SMTC hasn't been tested, but be prepared. */ 380 364 cpu_data[cpu].core = (read_vpe_c0_ebase() >> 1) & 0xff; 381 365 } 382 366 383 367 /* 384 - * Tweak to get Count registes in as close a sync as possible. The 368 + * Tweak to get Count registers synced as closely as possible. The 385 369 * value seems good for 34K-class cores. 386 370 */ 387 371 ··· 496 466 smtc_configure_tlb(); 497 467 498 468 for (tc = 0, vpe = 0 ; (vpe < nvpe) && (tc < ntc) ; vpe++) { 469 + /* Get number of CP1 contexts for each VPE. */ 470 + if (tc == 0) 471 + { 472 + /* 473 + * Do not call settc() for TC0 or the FPU context 474 + * value will be incorrect. Besides, we know that 475 + * we are TC0 anyway. 476 + */ 477 + smtc_nconf1[0] = ((read_vpe_c0_vpeconf1() & 478 + VPECONF1_NCP1) >> VPECONF1_NCP1_SHIFT); 479 + if (nvpe == 2) 480 + { 481 + settc(1); 482 + smtc_nconf1[1] = ((read_vpe_c0_vpeconf1() & 483 + VPECONF1_NCP1) >> VPECONF1_NCP1_SHIFT); 484 + settc(0); 485 + } 486 + } 499 487 if (tcpervpe[vpe] == 0) 500 488 continue; 501 489 if (vpe != 0) ··· 527 479 */ 528 480 if (tc != 0) { 529 481 smtc_tc_setup(vpe, tc, cpu); 482 + if (vpe != 0) { 483 + /* 484 + * Set MVP bit (possibly again). Do it 485 + * here to catch CPUs that have no TCs 486 + * bound to the VPE at reset. In that 487 + * case, a TC must be bound to the VPE 488 + * before we can set VPEControl[MVP] 489 + */ 490 + write_vpe_c0_vpeconf0( 491 + read_vpe_c0_vpeconf0() | 492 + VPECONF0_MVP); 493 + } 530 494 cpu++; 531 495 } 532 496 printk(" %d", tc);
+1
arch/mips/kernel/traps.c
··· 1253 1253 1254 1254 case CPU_5KC: 1255 1255 case CPU_5KE: 1256 + case CPU_LOONGSON1: 1256 1257 write_c0_ecc(0x80000000); 1257 1258 back_to_back_c0_hazard(); 1258 1259 /* Set the PE bit (bit 31) in the c0_errctl register. */
+1 -1
arch/mips/lib/Makefile
··· 2 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 6 strlen_user.o strncpy_user.o strnlen_user.o uncached.o 7 7 8 8 obj-y += iomap.o
-451
arch/mips/lib/memcpy-inatomic.S
··· 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
+11
arch/mips/lib/memcpy.S
··· 183 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 194 * A combined memcpy/__copy_user 187 195 * __copy_user sets len to 0 for success; else to an upper bound of 188 196 * the number of uncopied bytes. ··· 201 193 move v0, dst /* return value */ 202 194 .L__memcpy: 203 195 FEXPORT(__copy_user) 196 + li t6, 0 /* not inatomic */ 197 + __copy_user_common: 204 198 /* 205 199 * Note: dst & src may be unaligned, len may be 0 206 200 * Temps ··· 468 458 LOAD t0, THREAD_BUADDR(t0) # t0 is just past last good address 469 459 nop 470 460 SUB len, AT, t0 # len number of uncopied bytes 461 + bnez t6, .Ldone /* Skip the zeroing part if inatomic */ 471 462 /* 472 463 * Here's where we rely on src and dst being incremented in tandem, 473 464 * See (3) above.
+21
arch/mips/loongson1/Kconfig
··· 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
+11
arch/mips/loongson1/Makefile
··· 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/
+7
arch/mips/loongson1/Platform
··· 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
+5
arch/mips/loongson1/common/Makefile
··· 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
+165
arch/mips/loongson1/common/clock.c
··· 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 + }
+147
arch/mips/loongson1/common/irq.c
··· 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 + }
+124
arch/mips/loongson1/common/platform.c
··· 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 + };
+87
arch/mips/loongson1/common/prom.c
··· 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 + }
+45
arch/mips/loongson1/common/reset.c
··· 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);
+29
arch/mips/loongson1/common/setup.c
··· 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 = (&current_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 + }
+5
arch/mips/loongson1/ls1b/Makefile
··· 1 + # 2 + # Makefile for loongson1B based machines. 3 + # 4 + 5 + obj-y += board.o
+33
arch/mips/loongson1/ls1b/board.c
··· 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);
+32 -34
arch/mips/mm/uasm.c
··· 58 58 59 59 enum opcode { 60 60 insn_invalid, 61 - insn_addu, insn_addiu, insn_and, insn_andi, insn_beq, 62 - insn_beql, insn_bgez, insn_bgezl, insn_bltz, insn_bltzl, 63 - insn_bne, insn_cache, insn_daddu, insn_daddiu, insn_dmfc0, 64 - insn_dmtc0, insn_dsll, insn_dsll32, insn_dsra, insn_dsrl, 65 - insn_dsrl32, insn_drotr, insn_drotr32, insn_dsubu, insn_eret, 66 - insn_j, insn_jal, insn_jr, insn_ld, insn_ll, insn_lld, 67 - insn_lui, insn_lw, insn_mfc0, insn_mtc0, insn_or, insn_ori, 68 - insn_pref, insn_rfe, insn_sc, insn_scd, insn_sd, insn_sll, 69 - insn_sra, insn_srl, insn_rotr, insn_subu, insn_sw, insn_tlbp, 61 + insn_addiu, insn_addu, insn_and, insn_andi, insn_bbit0, insn_bbit1, 62 + insn_beq, insn_beql, insn_bgez, insn_bgezl, insn_bltz, insn_bltzl, 63 + insn_bne, insn_cache, insn_daddiu, insn_daddu, insn_dins, insn_dinsm, 64 + insn_dmfc0, insn_dmtc0, insn_drotr, insn_drotr32, insn_dsll, 65 + insn_dsll32, insn_dsra, insn_dsrl, insn_dsrl32, insn_dsubu, insn_eret, 66 + insn_j, insn_jal, insn_jr, insn_ld, insn_ldx, insn_ll, insn_lld, 67 + insn_lui, insn_lw, insn_lwx, insn_mfc0, insn_mtc0, insn_or, insn_ori, 68 + insn_pref, insn_rfe, insn_rotr, insn_sc, insn_scd, insn_sd, insn_sll, 69 + insn_sra, insn_srl, insn_subu, insn_sw, insn_syscall, insn_tlbp, 70 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 73 struct insn { ··· 88 90 static struct insn insn_table[] __uasminitdata = { 89 91 { insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 90 92 { insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD }, 91 - { insn_and, M(spec_op, 0, 0, 0, 0, and_op), RS | RT | RD }, 92 93 { insn_andi, M(andi_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, 93 - { insn_beq, M(beq_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, 94 + { insn_and, M(spec_op, 0, 0, 0, 0, and_op), RS | RT | RD }, 95 + { insn_bbit0, M(lwc2_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, 96 + { insn_bbit1, M(swc2_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, 94 97 { insn_beql, M(beql_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, 95 - { insn_bgez, M(bcond_op, 0, bgez_op, 0, 0, 0), RS | BIMM }, 98 + { insn_beq, M(beq_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, 96 99 { insn_bgezl, M(bcond_op, 0, bgezl_op, 0, 0, 0), RS | BIMM }, 97 - { insn_bltz, M(bcond_op, 0, bltz_op, 0, 0, 0), RS | BIMM }, 100 + { insn_bgez, M(bcond_op, 0, bgez_op, 0, 0, 0), RS | BIMM }, 98 101 { insn_bltzl, M(bcond_op, 0, bltzl_op, 0, 0, 0), RS | BIMM }, 102 + { insn_bltz, M(bcond_op, 0, bltz_op, 0, 0, 0), RS | BIMM }, 99 103 { insn_bne, M(bne_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, 100 104 { insn_cache, M(cache_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 101 105 { insn_daddiu, M(daddiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 102 106 { insn_daddu, M(spec_op, 0, 0, 0, 0, daddu_op), RS | RT | RD }, 107 + { insn_dinsm, M(spec3_op, 0, 0, 0, 0, dinsm_op), RS | RT | RD | RE }, 108 + { insn_dins, M(spec3_op, 0, 0, 0, 0, dins_op), RS | RT | RD | RE }, 103 109 { insn_dmfc0, M(cop0_op, dmfc_op, 0, 0, 0, 0), RT | RD | SET}, 104 110 { insn_dmtc0, M(cop0_op, dmtc_op, 0, 0, 0, 0), RT | RD | SET}, 105 - { insn_dsll, M(spec_op, 0, 0, 0, 0, dsll_op), RT | RD | RE }, 106 - { insn_dsll32, M(spec_op, 0, 0, 0, 0, dsll32_op), RT | RD | RE }, 107 - { insn_dsra, M(spec_op, 0, 0, 0, 0, dsra_op), RT | RD | RE }, 108 - { insn_dsrl, M(spec_op, 0, 0, 0, 0, dsrl_op), RT | RD | RE }, 109 - { insn_dsrl32, M(spec_op, 0, 0, 0, 0, dsrl32_op), RT | RD | RE }, 110 - { insn_drotr, M(spec_op, 1, 0, 0, 0, dsrl_op), RT | RD | RE }, 111 111 { insn_drotr32, M(spec_op, 1, 0, 0, 0, dsrl32_op), RT | RD | RE }, 112 + { insn_drotr, M(spec_op, 1, 0, 0, 0, dsrl_op), RT | RD | RE }, 113 + { insn_dsll32, M(spec_op, 0, 0, 0, 0, dsll32_op), RT | RD | RE }, 114 + { insn_dsll, M(spec_op, 0, 0, 0, 0, dsll_op), RT | RD | RE }, 115 + { insn_dsra, M(spec_op, 0, 0, 0, 0, dsra_op), RT | RD | RE }, 116 + { insn_dsrl32, M(spec_op, 0, 0, 0, 0, dsrl32_op), RT | RD | RE }, 117 + { insn_dsrl, M(spec_op, 0, 0, 0, 0, dsrl_op), RT | RD | RE }, 112 118 { insn_dsubu, M(spec_op, 0, 0, 0, 0, dsubu_op), RS | RT | RD }, 113 119 { insn_eret, M(cop0_op, cop_op, 0, 0, 0, eret_op), 0 }, 114 - { insn_j, M(j_op, 0, 0, 0, 0, 0), JIMM }, 115 120 { insn_jal, M(jal_op, 0, 0, 0, 0, 0), JIMM }, 121 + { insn_j, M(j_op, 0, 0, 0, 0, 0), JIMM }, 116 122 { insn_jr, M(spec_op, 0, 0, 0, 0, jr_op), RS }, 117 123 { insn_ld, M(ld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 118 - { insn_ll, M(ll_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 124 + { insn_ldx, M(spec3_op, 0, 0, 0, ldx_op, lx_op), RS | RT | RD }, 119 125 { insn_lld, M(lld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 126 + { insn_ll, M(ll_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 120 127 { insn_lui, M(lui_op, 0, 0, 0, 0, 0), RT | SIMM }, 121 128 { insn_lw, M(lw_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 129 + { insn_lwx, M(spec3_op, 0, 0, 0, lwx_op, lx_op), RS | RT | RD }, 122 130 { insn_mfc0, M(cop0_op, mfc_op, 0, 0, 0, 0), RT | RD | SET}, 123 131 { insn_mtc0, M(cop0_op, mtc_op, 0, 0, 0, 0), RT | RD | SET}, 124 - { insn_or, M(spec_op, 0, 0, 0, 0, or_op), RS | RT | RD }, 125 132 { insn_ori, M(ori_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, 133 + { insn_or, M(spec_op, 0, 0, 0, 0, or_op), RS | RT | RD }, 126 134 { insn_pref, M(pref_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 127 135 { insn_rfe, M(cop0_op, cop_op, 0, 0, 0, rfe_op), 0 }, 128 - { insn_sc, M(sc_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 136 + { insn_rotr, M(spec_op, 1, 0, 0, 0, srl_op), RT | RD | RE }, 129 137 { insn_scd, M(scd_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 138 + { insn_sc, M(sc_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 130 139 { insn_sd, M(sd_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 131 140 { insn_sll, M(spec_op, 0, 0, 0, 0, sll_op), RT | RD | RE }, 132 141 { insn_sra, M(spec_op, 0, 0, 0, 0, sra_op), RT | RD | RE }, 133 142 { insn_srl, M(spec_op, 0, 0, 0, 0, srl_op), RT | RD | RE }, 134 - { insn_rotr, M(spec_op, 1, 0, 0, 0, srl_op), RT | RD | RE }, 135 143 { insn_subu, M(spec_op, 0, 0, 0, 0, subu_op), RS | RT | RD }, 136 144 { insn_sw, M(sw_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 145 + { insn_syscall, M(spec_op, 0, 0, 0, 0, syscall_op), SCIMM}, 137 146 { insn_tlbp, M(cop0_op, cop_op, 0, 0, 0, tlbp_op), 0 }, 138 147 { insn_tlbr, M(cop0_op, cop_op, 0, 0, 0, tlbr_op), 0 }, 139 148 { insn_tlbwi, M(cop0_op, cop_op, 0, 0, 0, tlbwi_op), 0 }, 140 149 { insn_tlbwr, M(cop0_op, cop_op, 0, 0, 0, tlbwr_op), 0 }, 141 - { insn_xor, M(spec_op, 0, 0, 0, 0, xor_op), RS | RT | RD }, 142 150 { insn_xori, M(xori_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, 143 - { insn_dins, M(spec3_op, 0, 0, 0, 0, dins_op), RS | RT | RD | RE }, 144 - { insn_dinsm, M(spec3_op, 0, 0, 0, 0, dinsm_op), RS | RT | RD | RE }, 145 - { insn_syscall, M(spec_op, 0, 0, 0, 0, syscall_op), SCIMM}, 146 - { insn_bbit0, M(lwc2_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, 147 - { insn_bbit1, M(swc2_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, 148 - { insn_lwx, M(spec3_op, 0, 0, 0, lwx_op, lx_op), RS | RT | RD }, 149 - { insn_ldx, M(spec3_op, 0, 0, 0, ldx_op, lx_op), RS | RT | RD }, 151 + { insn_xor, M(spec_op, 0, 0, 0, 0, xor_op), RS | RT | RD }, 150 152 { insn_invalid, 0, 0 } 151 153 }; 152 154
+1 -1
arch/mips/netlogic/common/earlycons.c
··· 54 54 #elif defined(CONFIG_CPU_XLR) 55 55 uartbase = nlm_mmio_base(NETLOGIC_IO_UART_0_OFFSET); 56 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 59 nlm_write_reg(uartbase, UART_TX, c); 60 60 }
+102 -55
arch/mips/netlogic/common/smpboot.S
··· 54 54 XLP_IO_SYS_OFFSET(node) + XLP_IO_PCI_HDRSZ + \ 55 55 SYS_CPU_NONCOHERENT_MODE * 4 56 56 57 - .macro __config_lsu 58 - li t0, LSU_DEFEATURE 59 - mfcr t1, t0 57 + #define XLP_AX_WORKAROUND /* enable Ax silicon workarounds */ 60 58 61 - lui t2, 0x4080 /* Enable Unaligned Access, L2HPE */ 62 - or t1, t1, t2 63 - li t2, ~0xe /* S1RCM */ 59 + /* Enable XLP features and workarounds in the LSU */ 60 + .macro xlp_config_lsu 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 68 and t1, t1, t2 65 - mtcr t1, t0 69 + #endif 70 + mtcr t1, t0 66 71 67 - li t0, SCHED_DEFEATURE 68 - lui t1, 0x0100 /* Experimental: Disable BRU accepting ALU ops */ 69 - mtcr t1, t0 72 + #ifdef XLP_AX_WORKAROUND 73 + li t0, SCHED_DEFEATURE 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 110 .endm 71 111 72 112 /* 73 113 * The cores can come start when they are woken up. This is also the NMI 74 114 * entry, so check that first. 75 115 * 76 - * The data corresponding to reset is stored at RESET_DATA_PHYS location, 77 - * this will have the thread mask (used when core is woken up) and the 78 - * current NMI handler in case we reached here for an NMI. 116 + * The data corresponding to reset/NMI is stored at RESET_DATA_PHYS 117 + * location, this will have the thread mask (used when core is woken up) 118 + * and the current NMI handler in case we reached here for an NMI. 79 119 * 80 120 * When a core or thread is newly woken up, it loops in a 'wait'. When 81 121 * the CPU really needs waking up, we send an NMI to it, with the NMI ··· 129 89 FEXPORT(nlm_reset_entry) 130 90 dmtc0 k0, $22, 6 131 91 dmtc0 k1, $22, 7 132 - mfc0 k0, CP0_STATUS 133 - li k1, 0x80000 134 - and k1, k0, k1 135 - beqz k1, 1f /* go to real reset entry */ 92 + mfc0 k0, CP0_STATUS 93 + li k1, 0x80000 94 + and k1, k0, k1 95 + beqz k1, 1f /* go to real reset entry */ 136 96 nop 137 - li k1, CKSEG1ADDR(RESET_DATA_PHYS) /* NMI */ 97 + li k1, CKSEG1ADDR(RESET_DATA_PHYS) /* NMI */ 138 98 ld k0, BOOT_NMI_HANDLER(k1) 139 99 jr k0 140 100 nop ··· 154 114 li t2, SYS_CPU_COHERENT_BASE(0) 155 115 add t2, t2, t3 /* t2 <- SYS offset for node */ 156 116 lw t1, 0(t2) 157 - and t1, t1, t0 158 - sw t1, 0(t2) 117 + and t1, t1, t0 118 + sw t1, 0(t2) 159 119 160 120 /* read back to ensure complete */ 161 - lw t1, 0(t2) 121 + lw t1, 0(t2) 162 122 sync 163 123 164 124 /* Configure LSU on Non-0 Cores. */ 165 - __config_lsu 125 + xlp_config_lsu 126 + /* FALL THROUGH */ 166 127 167 128 /* 168 129 * Wake up sibling threads from the initial thread in 169 130 * a core. 170 131 */ 171 132 EXPORT(nlm_boot_siblings) 133 + /* core L1D flush before enable threads */ 134 + xlp_flush_l1_dcache 135 + /* Enable hw threads by writing to MAP_THREADMODE of the core */ 172 136 li t0, CKSEG1ADDR(RESET_DATA_PHYS) 173 137 lw t1, BOOT_THREAD_MODE(t0) /* t1 <- thread mode */ 174 138 li t0, ((CPU_BLOCKID_MAP << 8) | MAP_THREADMODE) ··· 183 139 /* 184 140 * The new hardware thread starts at the next instruction 185 141 * For all the cases other than core 0 thread 0, we will 186 - * jump to the secondary wait function. 187 - */ 142 + * jump to the secondary wait function. 143 + */ 188 144 mfc0 v0, CP0_EBASE, 1 189 145 andi v0, 0x7f /* v0 <- node/core */ 190 146 191 - #if 1 192 - /* A0 errata - Write MMU_SETUP after changing thread mode register. */ 147 + /* Init MMU in the first thread after changing THREAD_MODE 148 + * register (Ax Errata?) 149 + */ 193 150 andi v1, v0, 0x3 /* v1 <- thread id */ 194 151 bnez v1, 2f 195 152 nop 196 153 197 - li t0, MMU_SETUP 198 - li t1, 0 199 - mtcr t1, t0 200 - ehb 201 - #endif 154 + li t0, MMU_SETUP 155 + li t1, 0 156 + mtcr t1, t0 157 + _ehb 202 158 203 - 2: beqz v0, 4f 159 + 2: beqz v0, 4f /* boot cpu (cpuid == 0)? */ 204 160 nop 205 161 206 162 /* setup status reg */ 207 - mfc0 t1, CP0_STATUS 208 - li t0, ST0_BEV 209 - or t1, t0 210 - xor t1, t0 163 + move t1, zero 211 164 #ifdef CONFIG_64BIT 212 165 ori t1, ST0_KX 213 166 #endif ··· 224 183 * For the boot CPU, we have to restore registers and 225 184 * return 226 185 */ 227 - 4: dmfc0 t0, $4, 2 /* restore SP from UserLocal */ 186 + 4: dmfc0 t0, $4, 2 /* restore SP from UserLocal */ 228 187 li t1, 0xfadebeef 229 - dmtc0 t1, $4, 2 /* restore SP from UserLocal */ 188 + dmtc0 t1, $4, 2 /* restore SP from UserLocal */ 230 189 PTR_SUBU sp, t0, PT_SIZE 231 190 RESTORE_ALL 232 191 jr ra ··· 234 193 EXPORT(nlm_reset_entry_end) 235 194 236 195 FEXPORT(xlp_boot_core0_siblings) /* "Master" cpu starts from here */ 237 - __config_lsu 196 + xlp_config_lsu 238 197 dmtc0 sp, $4, 2 /* SP saved in UserLocal */ 239 198 SAVE_ALL 240 199 sync ··· 251 210 252 211 __CPUINIT 253 212 NESTED(nlm_boot_secondary_cpus, 16, sp) 213 + /* Initialize CP0 Status */ 214 + move t1, zero 215 + #ifdef CONFIG_64BIT 216 + ori t1, ST0_KX 217 + #endif 218 + mtc0 t1, CP0_STATUS 254 219 PTR_LA t1, nlm_next_sp 255 220 PTR_L sp, 0(t1) 256 221 PTR_LA t1, nlm_next_gp ··· 281 234 */ 282 235 __CPUINIT 283 236 NESTED(nlm_rmiboot_preboot, 16, sp) 284 - mfc0 t0, $15, 1 # read ebase 285 - andi t0, 0x1f # t0 has the processor_id() 286 - andi t2, t0, 0x3 # thread no 287 - sll t0, 2 # offset in cpu array 237 + mfc0 t0, $15, 1 /* read ebase */ 238 + andi t0, 0x1f /* t0 has the processor_id() */ 239 + andi t2, t0, 0x3 /* thread num */ 240 + sll t0, 2 /* offset in cpu array */ 288 241 289 - PTR_LA t1, nlm_cpu_ready # mark CPU ready 242 + PTR_LA t1, nlm_cpu_ready /* mark CPU ready */ 290 243 PTR_ADDU t1, t0 291 244 li t3, 1 292 245 sw t3, 0(t1) 293 246 294 - bnez t2, 1f # skip thread programming 295 - nop # for non zero hw threads 247 + bnez t2, 1f /* skip thread programming */ 248 + nop /* for thread id != 0 */ 296 249 297 250 /* 298 - * MMU setup only for first thread in core 251 + * XLR MMU setup only for first thread in core 299 252 */ 300 253 li t0, 0x400 301 254 mfcr t1, t0 302 - li t2, 6 # XLR thread mode mask 255 + li t2, 6 /* XLR thread mode mask */ 303 256 nor t3, t2, zero 304 - and t2, t1, t2 # t2 - current thread mode 257 + and t2, t1, t2 /* t2 - current thread mode */ 305 258 li v0, CKSEG1ADDR(RESET_DATA_PHYS) 306 - lw v1, BOOT_THREAD_MODE(v0) # v1 - new thread mode 259 + lw v1, BOOT_THREAD_MODE(v0) /* v1 - new thread mode */ 307 260 sll v1, 1 308 - beq v1, t2, 1f # same as request value 309 - nop # nothing to do */ 261 + beq v1, t2, 1f /* same as request value */ 262 + nop /* nothing to do */ 310 263 311 - and t2, t1, t3 # mask out old thread mode 312 - or t1, t2, v1 # put in new value 313 - mtcr t1, t0 # update core control 264 + and t2, t1, t3 /* mask out old thread mode */ 265 + or t1, t2, v1 /* put in new value */ 266 + mtcr t1, t0 /* update core control */ 314 267 315 268 1: wait 316 269 j 1b
+2
arch/mips/netlogic/xlp/Makefile
··· 1 1 obj-y += setup.o platform.o nlm_hal.o 2 + obj-$(CONFIG_OF) += of.o 2 3 obj-$(CONFIG_SMP) += wakeup.o 4 + obj-$(CONFIG_USB) += usb-init.o
+52
arch/mips/netlogic/xlp/nlm_hal.c
··· 69 69 return PIC_IRT_UART_0_INDEX; 70 70 case PIC_UART_1_IRQ: 71 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 98 default: 73 99 return -1; 74 100 } ··· 107 81 return PIC_UART_0_IRQ; 108 82 case PIC_IRT_UART_1_INDEX: 109 83 return PIC_UART_1_IRQ; 84 + case PIC_IRT_PCIE_LINK_0_INDEX: 85 + return PIC_PCIE_LINK_0_IRQ; 86 + case PIC_IRT_PCIE_LINK_1_INDEX: 87 + return PIC_PCIE_LINK_1_IRQ; 88 + case PIC_IRT_PCIE_LINK_2_INDEX: 89 + return PIC_PCIE_LINK_2_IRQ; 90 + case PIC_IRT_PCIE_LINK_3_INDEX: 91 + return PIC_PCIE_LINK_3_IRQ; 92 + case PIC_IRT_EHCI_0_INDEX: 93 + return PIC_EHCI_0_IRQ; 94 + case PIC_IRT_EHCI_1_INDEX: 95 + return PIC_EHCI_1_IRQ; 96 + case PIC_IRT_OHCI_0_INDEX: 97 + return PIC_OHCI_0_IRQ; 98 + case PIC_IRT_OHCI_1_INDEX: 99 + return PIC_OHCI_1_IRQ; 100 + case PIC_IRT_OHCI_2_INDEX: 101 + return PIC_OHCI_2_IRQ; 102 + case PIC_IRT_OHCI_3_INDEX: 103 + return PIC_OHCI_3_IRQ; 104 + case PIC_IRT_MMC_INDEX: 105 + return PIC_MMC_IRQ; 106 + case PIC_IRT_I2C_0_INDEX: 107 + return PIC_I2C_0_IRQ; 108 + case PIC_IRT_I2C_1_INDEX: 109 + return PIC_I2C_1_IRQ; 110 110 default: 111 111 return -1; 112 112 }
+34
arch/mips/netlogic/xlp/of.c
··· 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 + }
+1 -1
arch/mips/netlogic/xlp/platform.c
··· 53 53 54 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 59 static void nlm_xlp_uart_out(struct uart_port *p, int offset, int value)
+16
arch/mips/netlogic/xlp/setup.c
··· 41 41 #include <asm/bootinfo.h> 42 42 43 43 #include <linux/of_fdt.h> 44 + #include <linux/of_platform.h> 45 + #include <linux/of_device.h> 44 46 45 47 #include <asm/netlogic/haldefs.h> 46 48 #include <asm/netlogic/common.h> ··· 111 109 register_smp_ops(&nlm_smp_ops); 112 110 #endif 113 111 } 112 + 113 + static struct of_device_id __initdata xlp_ids[] = { 114 + { .compatible = "simple-bus", }, 115 + {}, 116 + }; 117 + 118 + int __init xlp8xx_ds_publish_devices(void) 119 + { 120 + if (!of_have_populated_dt()) 121 + return 0; 122 + return of_platform_bus_probe(NULL, xlp_ids, NULL); 123 + } 124 + 125 + device_initcall(xlp8xx_ds_publish_devices);
+124
arch/mips/netlogic/xlp/usb-init.c
··· 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);
+1 -1
arch/mips/netlogic/xlr/Makefile
··· 1 - obj-y += setup.o platform.o 1 + obj-y += setup.o platform.o platform-flash.o 2 2 obj-$(CONFIG_SMP) += wakeup.o
+220
arch/mips/netlogic/xlr/platform-flash.c
··· 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);
+140
arch/mips/netlogic/xlr/platform.c
··· 14 14 #include <linux/resource.h> 15 15 #include <linux/serial_8250.h> 16 16 #include <linux/serial_reg.h> 17 + #include <linux/i2c.h> 17 18 18 19 #include <asm/netlogic/haldefs.h> 19 20 #include <asm/netlogic/xlr/iomap.h> ··· 98 97 } 99 98 100 99 arch_initcall(nlm_uart_init); 100 + 101 + #ifdef CONFIG_USB 102 + /* Platform USB devices, only on XLS chips */ 103 + static u64 xls_usb_dmamask = ~(u32)0; 104 + #define USB_PLATFORM_DEV(n, i, irq) \ 105 + { \ 106 + .name = n, \ 107 + .id = i, \ 108 + .num_resources = 2, \ 109 + .dev = { \ 110 + .dma_mask = &xls_usb_dmamask, \ 111 + .coherent_dma_mask = 0xffffffff, \ 112 + }, \ 113 + .resource = (struct resource[]) { \ 114 + { \ 115 + .flags = IORESOURCE_MEM, \ 116 + }, \ 117 + { \ 118 + .start = irq, \ 119 + .end = irq, \ 120 + .flags = IORESOURCE_IRQ, \ 121 + }, \ 122 + }, \ 123 + } 124 + 125 + static struct platform_device xls_usb_ehci_device = 126 + USB_PLATFORM_DEV("ehci-xls", 0, PIC_USB_IRQ); 127 + static struct platform_device xls_usb_ohci_device_0 = 128 + USB_PLATFORM_DEV("ohci-xls-0", 1, PIC_USB_IRQ); 129 + static struct platform_device xls_usb_ohci_device_1 = 130 + USB_PLATFORM_DEV("ohci-xls-1", 2, PIC_USB_IRQ); 131 + 132 + static struct platform_device *xls_platform_devices[] = { 133 + &xls_usb_ehci_device, 134 + &xls_usb_ohci_device_0, 135 + &xls_usb_ohci_device_1, 136 + }; 137 + 138 + int xls_platform_usb_init(void) 139 + { 140 + uint64_t usb_mmio, gpio_mmio; 141 + unsigned long memres; 142 + uint32_t val; 143 + 144 + if (!nlm_chip_is_xls()) 145 + return 0; 146 + 147 + gpio_mmio = nlm_mmio_base(NETLOGIC_IO_GPIO_OFFSET); 148 + usb_mmio = nlm_mmio_base(NETLOGIC_IO_USB_1_OFFSET); 149 + 150 + /* Clear Rogue Phy INTs */ 151 + nlm_write_reg(usb_mmio, 49, 0x10000000); 152 + /* Enable all interrupts */ 153 + nlm_write_reg(usb_mmio, 50, 0x1f000000); 154 + 155 + /* Enable ports */ 156 + nlm_write_reg(usb_mmio, 1, 0x07000500); 157 + 158 + val = nlm_read_reg(gpio_mmio, 21); 159 + if (((val >> 22) & 0x01) == 0) { 160 + pr_info("Detected USB Device mode - Not supported!\n"); 161 + nlm_write_reg(usb_mmio, 0, 0x01000000); 162 + return 0; 163 + } 164 + 165 + pr_info("Detected USB Host mode - Adding XLS USB devices.\n"); 166 + /* Clear reset, host mode */ 167 + nlm_write_reg(usb_mmio, 0, 0x02000000); 168 + 169 + /* Memory resource for various XLS usb ports */ 170 + usb_mmio = nlm_mmio_base(NETLOGIC_IO_USB_0_OFFSET); 171 + memres = CPHYSADDR((unsigned long)usb_mmio); 172 + xls_usb_ehci_device.resource[0].start = memres; 173 + xls_usb_ehci_device.resource[0].end = memres + 0x400 - 1; 174 + 175 + memres += 0x400; 176 + xls_usb_ohci_device_0.resource[0].start = memres; 177 + xls_usb_ohci_device_0.resource[0].end = memres + 0x400 - 1; 178 + 179 + memres += 0x400; 180 + xls_usb_ohci_device_1.resource[0].start = memres; 181 + xls_usb_ohci_device_1.resource[0].end = memres + 0x400 - 1; 182 + 183 + return platform_add_devices(xls_platform_devices, 184 + ARRAY_SIZE(xls_platform_devices)); 185 + } 186 + 187 + arch_initcall(xls_platform_usb_init); 188 + #endif 189 + 190 + #ifdef CONFIG_I2C 191 + static struct i2c_board_info nlm_i2c_board_info1[] __initdata = { 192 + /* All XLR boards have this RTC and Max6657 Temp Chip */ 193 + [0] = { 194 + .type = "ds1374", 195 + .addr = 0x68 196 + }, 197 + [1] = { 198 + .type = "lm90", 199 + .addr = 0x4c 200 + }, 201 + }; 202 + 203 + static struct resource i2c_resources[] = { 204 + [0] = { 205 + .start = 0, /* filled at init */ 206 + .end = 0, 207 + .flags = IORESOURCE_MEM, 208 + }, 209 + }; 210 + 211 + static struct platform_device nlm_xlr_i2c_1 = { 212 + .name = "xlr-i2cbus", 213 + .id = 1, 214 + .num_resources = 1, 215 + .resource = i2c_resources, 216 + }; 217 + 218 + static int __init nlm_i2c_init(void) 219 + { 220 + int err = 0; 221 + unsigned int offset; 222 + 223 + /* I2C bus 0 does not have any useful devices, configure only bus 1 */ 224 + offset = NETLOGIC_IO_I2C_1_OFFSET; 225 + nlm_xlr_i2c_1.resource[0].start = CPHYSADDR(nlm_mmio_base(offset)); 226 + nlm_xlr_i2c_1.resource[0].end = nlm_xlr_i2c_1.resource[0].start + 0xfff; 227 + 228 + platform_device_register(&nlm_xlr_i2c_1); 229 + 230 + err = i2c_register_board_info(1, nlm_i2c_board_info1, 231 + ARRAY_SIZE(nlm_i2c_board_info1)); 232 + if (err < 0) 233 + pr_err("nlm-i2c: cannot register board I2C devices\n"); 234 + return err; 235 + } 236 + 237 + arch_initcall(nlm_i2c_init); 238 + #endif
+1 -1
arch/mips/netlogic/xlr/setup.c
··· 85 85 86 86 gpiobase = nlm_mmio_base(NETLOGIC_IO_GPIO_OFFSET); 87 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 89 for ( ; ; ) 90 90 cpu_wait(); 91 91 }
+1
arch/mips/oprofile/common.c
··· 85 85 case CPU_34K: 86 86 case CPU_1004K: 87 87 case CPU_74K: 88 + case CPU_LOONGSON1: 88 89 case CPU_SB1: 89 90 case CPU_SB1A: 90 91 case CPU_R10000:
+4 -6
arch/mips/oprofile/op_model_mipsxx.c
··· 339 339 break; 340 340 341 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 342 case CPU_34K: 349 343 op_model_mipsxx_ops.cpu_type = "mips/34K"; 350 344 break; ··· 366 372 case CPU_SB1: 367 373 case CPU_SB1A: 368 374 op_model_mipsxx_ops.cpu_type = "mips/sb1"; 375 + break; 376 + 377 + case CPU_LOONGSON1: 378 + op_model_mipsxx_ops.cpu_type = "mips/loongson1"; 369 379 break; 370 380 371 381 default:
+1
arch/mips/pci/Makefile
··· 59 59 obj-$(CONFIG_MIKROTIK_RB532) += pci-rc32434.o ops-rc32434.o fixup-rc32434.o 60 60 obj-$(CONFIG_CPU_CAVIUM_OCTEON) += pci-octeon.o pcie-octeon.o 61 61 obj-$(CONFIG_CPU_XLR) += pci-xlr.o 62 + obj-$(CONFIG_CPU_XLP) += pci-xlp.o 62 63 63 64 ifdef CONFIG_PCI_MSI 64 65 obj-$(CONFIG_CPU_CAVIUM_OCTEON) += msi-octeon.o
+4 -4
arch/mips/pci/fixup-cobalt.c
··· 37 37 #define VIA_COBALT_BRD_ID_REG 0x94 38 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 42 if (dev->devfn == PCI_DEVFN(0, 0) && 43 43 (dev->class >> 8) == PCI_CLASS_MEMORY_OTHER) { ··· 51 51 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_GT64111, 52 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 56 unsigned short cfgword; 57 57 unsigned char lt; ··· 74 74 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, 75 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 79 if (dev->devfn != PCI_DEVFN(0, 0)) 80 80 return; ··· 129 129 130 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 134 u8 id; 135 135 int retval;
+14
arch/mips/pci/fixup-malta.c
··· 101 101 102 102 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB, 103 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);
+1 -1
arch/mips/pci/fixup-rc32434.c
··· 47 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 52 if (PCI_SLOT(dev->devfn) == 6 && dev->bus->number == 0) { 53 53 /* disable prefetched memory range */
+62 -1
arch/mips/pci/ops-bcm63xx.c
··· 411 411 * only one IO window, so it cannot be shared by PCI and cardbus, use 412 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 416 static int io_window = -1; 417 417 int i, found, new_io_window; ··· 465 465 466 466 DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, bcm63xx_fixup); 467 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 + };
+129 -8
arch/mips/pci/pci-bcm63xx.c
··· 10 10 #include <linux/pci.h> 11 11 #include <linux/kernel.h> 12 12 #include <linux/init.h> 13 + #include <linux/delay.h> 13 14 #include <asm/bootinfo.h> 14 15 15 16 #include "pci-bcm63xx.h" ··· 72 71 }; 73 72 #endif 74 73 74 + static struct resource bcm_pcie_mem_resource = { 75 + .name = "bcm63xx PCIe memory space", 76 + .start = BCM_PCIE_MEM_BASE_PA, 77 + .end = BCM_PCIE_MEM_END_PA, 78 + .flags = IORESOURCE_MEM, 79 + }; 80 + 81 + static struct resource bcm_pcie_io_resource = { 82 + .name = "bcm63xx PCIe IO space", 83 + .start = 0, 84 + .end = 0, 85 + .flags = 0, 86 + }; 87 + 88 + struct pci_controller bcm63xx_pcie_controller = { 89 + .pci_ops = &bcm63xx_pcie_ops, 90 + .io_resource = &bcm_pcie_io_resource, 91 + .mem_resource = &bcm_pcie_mem_resource, 92 + }; 93 + 75 94 static u32 bcm63xx_int_cfg_readl(u32 reg) 76 95 { 77 96 u32 tmp; ··· 115 94 116 95 void __iomem *pci_iospace_start; 117 96 118 - static int __init bcm63xx_pci_init(void) 97 + static void __init bcm63xx_reset_pcie(void) 98 + { 99 + u32 val; 100 + 101 + /* enable clock */ 102 + val = bcm_perf_readl(PERF_CKCTL_REG); 103 + val |= CKCTL_6328_PCIE_EN; 104 + bcm_perf_writel(val, PERF_CKCTL_REG); 105 + 106 + /* enable SERDES */ 107 + val = bcm_misc_readl(MISC_SERDES_CTRL_REG); 108 + val |= SERDES_PCIE_EN | SERDES_PCIE_EXD_EN; 109 + bcm_misc_writel(val, MISC_SERDES_CTRL_REG); 110 + 111 + /* reset the PCIe core */ 112 + val = bcm_perf_readl(PERF_SOFTRESET_6328_REG); 113 + 114 + val &= ~SOFTRESET_6328_PCIE_MASK; 115 + val &= ~SOFTRESET_6328_PCIE_CORE_MASK; 116 + val &= ~SOFTRESET_6328_PCIE_HARD_MASK; 117 + val &= ~SOFTRESET_6328_PCIE_EXT_MASK; 118 + bcm_perf_writel(val, PERF_SOFTRESET_6328_REG); 119 + mdelay(10); 120 + 121 + val |= SOFTRESET_6328_PCIE_MASK; 122 + val |= SOFTRESET_6328_PCIE_CORE_MASK; 123 + val |= SOFTRESET_6328_PCIE_HARD_MASK; 124 + bcm_perf_writel(val, PERF_SOFTRESET_6328_REG); 125 + mdelay(10); 126 + 127 + val |= SOFTRESET_6328_PCIE_EXT_MASK; 128 + bcm_perf_writel(val, PERF_SOFTRESET_6328_REG); 129 + mdelay(200); 130 + } 131 + 132 + static int __init bcm63xx_register_pcie(void) 133 + { 134 + u32 val; 135 + 136 + bcm63xx_reset_pcie(); 137 + 138 + /* configure the PCIe bridge */ 139 + val = bcm_pcie_readl(PCIE_BRIDGE_OPT1_REG); 140 + val |= OPT1_RD_BE_OPT_EN; 141 + val |= OPT1_RD_REPLY_BE_FIX_EN; 142 + val |= OPT1_PCIE_BRIDGE_HOLE_DET_EN; 143 + val |= OPT1_L1_INT_STATUS_MASK_POL; 144 + bcm_pcie_writel(val, PCIE_BRIDGE_OPT1_REG); 145 + 146 + /* setup the interrupts */ 147 + val = bcm_pcie_readl(PCIE_BRIDGE_RC_INT_MASK_REG); 148 + val |= PCIE_RC_INT_A | PCIE_RC_INT_B | PCIE_RC_INT_C | PCIE_RC_INT_D; 149 + bcm_pcie_writel(val, PCIE_BRIDGE_RC_INT_MASK_REG); 150 + 151 + val = bcm_pcie_readl(PCIE_BRIDGE_OPT2_REG); 152 + /* enable credit checking and error checking */ 153 + val |= OPT2_TX_CREDIT_CHK_EN; 154 + val |= OPT2_UBUS_UR_DECODE_DIS; 155 + 156 + /* set device bus/func for the pcie device */ 157 + val |= (PCIE_BUS_DEVICE << OPT2_CFG_TYPE1_BUS_NO_SHIFT); 158 + val |= OPT2_CFG_TYPE1_BD_SEL; 159 + bcm_pcie_writel(val, PCIE_BRIDGE_OPT2_REG); 160 + 161 + /* setup class code as bridge */ 162 + val = bcm_pcie_readl(PCIE_IDVAL3_REG); 163 + val &= ~IDVAL3_CLASS_CODE_MASK; 164 + val |= (PCI_CLASS_BRIDGE_PCI << IDVAL3_SUBCLASS_SHIFT); 165 + bcm_pcie_writel(val, PCIE_IDVAL3_REG); 166 + 167 + /* disable bar1 size */ 168 + val = bcm_pcie_readl(PCIE_CONFIG2_REG); 169 + val &= ~CONFIG2_BAR1_SIZE_MASK; 170 + bcm_pcie_writel(val, PCIE_CONFIG2_REG); 171 + 172 + /* set bar0 to little endian */ 173 + val = (BCM_PCIE_MEM_BASE_PA >> 20) << BASEMASK_BASE_SHIFT; 174 + val |= (BCM_PCIE_MEM_BASE_PA >> 20) << BASEMASK_MASK_SHIFT; 175 + val |= BASEMASK_REMAP_EN; 176 + bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_BASEMASK_REG); 177 + 178 + val = (BCM_PCIE_MEM_BASE_PA >> 20) << REBASE_ADDR_BASE_SHIFT; 179 + bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_REBASE_ADDR_REG); 180 + 181 + register_pci_controller(&bcm63xx_pcie_controller); 182 + 183 + return 0; 184 + } 185 + 186 + static int __init bcm63xx_register_pci(void) 119 187 { 120 188 unsigned int mem_size; 121 189 u32 val; 122 - 123 - if (!BCMCPU_IS_6348() && !BCMCPU_IS_6358() && !BCMCPU_IS_6368()) 124 - return -ENODEV; 125 - 126 - if (!bcm63xx_pci_enabled) 127 - return -ENODEV; 128 - 129 190 /* 130 191 * configuration access are done through IO space, remap 4 131 192 * first bytes to access it from CPU. ··· 322 219 request_mem_region(BCM_PCI_IO_BASE_PA, BCM_PCI_IO_SIZE, 323 220 "bcm63xx PCI IO space"); 324 221 return 0; 222 + } 223 + 224 + 225 + static int __init bcm63xx_pci_init(void) 226 + { 227 + if (!bcm63xx_pci_enabled) 228 + return -ENODEV; 229 + 230 + switch (bcm63xx_get_cpu_id()) { 231 + case BCM6328_CPU_ID: 232 + return bcm63xx_register_pcie(); 233 + case BCM6348_CPU_ID: 234 + case BCM6358_CPU_ID: 235 + case BCM6368_CPU_ID: 236 + return bcm63xx_register_pci(); 237 + default: 238 + return -ENODEV; 239 + } 325 240 } 326 241 327 242 arch_initcall(bcm63xx_pci_init);
+5
arch/mips/pci/pci-bcm63xx.h
··· 13 13 */ 14 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 21 * defined in ops-bcm63xx.c 18 22 */ 19 23 extern struct pci_ops bcm63xx_pci_ops; 20 24 extern struct pci_ops bcm63xx_cb_ops; 25 + extern struct pci_ops bcm63xx_pcie_ops; 21 26 22 27 /* 23 28 * defined in pci-bcm63xx.c
+248
arch/mips/pci/pci-xlp.c
··· 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);
-4
arch/mips/pci/pci-xlr.c
··· 375 375 } 376 376 377 377 arch_initcall(pcibios_init); 378 - 379 - struct pci_fixup pcibios_fixups[] = { 380 - {0} 381 - };
+2 -2
arch/mips/pnx833x/stb22x/board.c
··· 91 91 pnx833x_gpio_select_function_alt(32); 92 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 95 /* Setup MIU for NAND access on CS0... 96 96 * 97 97 * (it seems that we must also configure CS1 for reliable operation, ··· 117 117 pnx833x_gpio_select_output(5); 118 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 122 /* Set up MIU for 16-bit NOR access on CS0 and CS1... */ 123 123
+3 -3
arch/mips/txx9/generic/pci.c
··· 304 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 309 unsigned char dat; 310 310 int regs[2] = {0x41, 0x43}; ··· 339 339 } 340 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 344 /* This device may have PM registers but not they are not suported. */ 345 345 if (dev->pm_cap) { ··· 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 353 unsigned char bist; 354 354
+5 -7
arch/mips/txx9/generic/setup.c
··· 632 632 unsigned long size, 633 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 636 struct resource res = { 637 637 .start = addr, 638 638 .end = addr + size - 1, ··· 670 670 void __init txx9_ndfmc_init(unsigned long baseaddr, 671 671 const struct txx9ndfmc_platform_data *pdata) 672 672 { 673 - #if defined(CONFIG_MTD_NAND_TXX9NDFMC) || \ 674 - defined(CONFIG_MTD_NAND_TXX9NDFMC_MODULE) 673 + #if IS_ENABLED(CONFIG_MTD_NAND_TXX9NDFMC) 675 674 struct resource res = { 676 675 .start = baseaddr, 677 676 .end = baseaddr + 0x1000 - 1, ··· 686 687 #endif 687 688 } 688 689 689 - #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) 690 + #if IS_ENABLED(CONFIG_LEDS_GPIO) 690 691 static DEFINE_SPINLOCK(txx9_iocled_lock); 691 692 692 693 #define TXX9_IOCLED_MAXLEDS 8 ··· 809 810 void __init txx9_dmac_init(int id, unsigned long baseaddr, int irq, 810 811 const struct txx9dmac_platform_data *pdata) 811 812 { 812 - #if defined(CONFIG_TXX9_DMAC) || defined(CONFIG_TXX9_DMAC_MODULE) 813 + #if IS_ENABLED(CONFIG_TXX9_DMAC) 813 814 struct resource res[] = { 814 815 { 815 816 .start = baseaddr, ··· 865 866 unsigned int dma_chan_out, 866 867 unsigned int dma_chan_in) 867 868 { 868 - #if defined(CONFIG_SND_SOC_TXX9ACLC) || \ 869 - defined(CONFIG_SND_SOC_TXX9ACLC_MODULE) 869 + #if IS_ENABLED(CONFIG_SND_SOC_TXX9ACLC) 870 870 unsigned int dma_base = dmac_id * TXX9_DMA_MAX_NR_CHANNELS; 871 871 struct resource res[] = { 872 872 {
+1 -1
arch/mips/txx9/generic/setup_tx4939.c
··· 317 317 } 318 318 } 319 319 320 - #if defined(CONFIG_TC35815) || defined(CONFIG_TC35815_MODULE) 320 + #if IS_ENABLED(CONFIG_TC35815) 321 321 static u32 tx4939_get_eth_speed(struct net_device *dev) 322 322 { 323 323 struct ethtool_cmd cmd;
+5 -6
arch/mips/txx9/rbtx4939/setup.c
··· 40 40 tx4939_time_init(0); 41 41 } 42 42 43 - #if defined(__BIG_ENDIAN) && \ 44 - (defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)) 43 + #if defined(__BIG_ENDIAN) && IS_ENABLED(CONFIG_SMC91X) 45 44 #define HAVE_RBTX4939_IOSWAB 46 45 #define IS_CE1_ADDR(addr) \ 47 46 ((((unsigned long)(addr) - IO_BASE) & 0xfff00000) == TXX9_CE(1)) ··· 186 187 187 188 #define RBTX4939_MAX_7SEGLEDS 8 188 189 189 - #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) 190 + #if IS_ENABLED(CONFIG_LEDS_CLASS) 190 191 static u8 led_val[RBTX4939_MAX_7SEGLEDS]; 191 192 struct rbtx4939_led_data { 192 193 struct led_classdev cdev; ··· 262 263 263 264 static void __rbtx4939_7segled_putc(unsigned int pos, unsigned char val) 264 265 { 265 - #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) 266 + #if IS_ENABLED(CONFIG_LEDS_CLASS) 266 267 unsigned long flags; 267 268 local_irq_save(flags); 268 269 /* bit7: reserved for LED class */ ··· 286 287 __rbtx4939_7segled_putc(pos, val); 287 288 } 288 289 289 - #if defined(CONFIG_MTD_RBTX4939) || defined(CONFIG_MTD_RBTX4939_MODULE) 290 + #if IS_ENABLED(CONFIG_MTD_RBTX4939) 290 291 /* special mapping for boot rom */ 291 292 static unsigned long rbtx4939_flash_fixup_ofs(unsigned long ofs) 292 293 { ··· 462 463 .flags = SMC91X_USE_16BIT, 463 464 }; 464 465 struct platform_device *pdev; 465 - #if defined(CONFIG_TC35815) || defined(CONFIG_TC35815_MODULE) 466 + #if IS_ENABLED(CONFIG_TC35815) 466 467 int i, j; 467 468 unsigned char ethaddr[2][6]; 468 469 u8 bdipsw = readb(rbtx4939_bdipsw_addr) & 0x0f;
+14
drivers/char/hw_random/Kconfig
··· 73 73 74 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 90 config HW_RANDOM_GEODE 77 91 tristate "AMD Geode HW Random Number Generator support" 78 92 depends on HW_RANDOM && X86_32 && PCI
+1
drivers/char/hw_random/Makefile
··· 8 8 obj-$(CONFIG_HW_RANDOM_INTEL) += intel-rng.o 9 9 obj-$(CONFIG_HW_RANDOM_AMD) += amd-rng.o 10 10 obj-$(CONFIG_HW_RANDOM_ATMEL) += atmel-rng.o 11 + obj-$(CONFIG_HW_RANDOM_BCM63XX) += bcm63xx-rng.o 11 12 obj-$(CONFIG_HW_RANDOM_GEODE) += geode-rng.o 12 13 obj-$(CONFIG_HW_RANDOM_N2RNG) += n2-rng.o 13 14 n2-rng-y := n2-drv.o n2-asm.o
+175
drivers/char/hw_random/bcm63xx-rng.c
··· 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");
+52 -46
drivers/i2c/busses/i2c-octeon.c
··· 2 2 * (C) Copyright 2009-2010 3 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 7 * This is a driver for the i2c adapter in Cavium Networks' OCTEON processors. 8 8 * ··· 11 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 16 #include <linux/kernel.h> 15 17 #include <linux/module.h> 18 + #include <linux/of_i2c.h> 19 + #include <linux/delay.h> 16 20 #include <linux/sched.h> 17 21 #include <linux/slab.h> 18 22 #include <linux/init.h> 19 - 20 - #include <linux/io.h> 21 23 #include <linux/i2c.h> 22 - #include <linux/interrupt.h> 23 - #include <linux/delay.h> 24 - #include <linux/platform_device.h> 24 + #include <linux/io.h> 25 + #include <linux/of.h> 25 26 26 27 #include <asm/octeon/octeon.h> 27 28 ··· 66 65 wait_queue_head_t queue; 67 66 struct i2c_adapter adap; 68 67 int irq; 69 - int twsi_freq; 68 + u32 twsi_freq; 70 69 int sys_freq; 71 70 resource_size_t twsi_phys; 72 71 void __iomem *twsi_base; ··· 122 121 */ 123 122 static void octeon_i2c_write_int(struct octeon_i2c *i2c, u64 data) 124 123 { 125 - u64 tmp; 126 - 127 124 __raw_writeq(data, i2c->twsi_base + TWSI_INT); 128 - tmp = __raw_readq(i2c->twsi_base + TWSI_INT); 125 + __raw_readq(i2c->twsi_base + TWSI_INT); 129 126 } 130 127 131 128 /** ··· 514 515 { 515 516 int irq, result = 0; 516 517 struct octeon_i2c *i2c; 517 - struct octeon_i2c_data *i2c_data; 518 518 struct resource *res_mem; 519 519 520 520 /* All adaptors have an irq. */ ··· 521 523 if (irq < 0) 522 524 return irq; 523 525 524 - i2c = kzalloc(sizeof(*i2c), GFP_KERNEL); 526 + i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); 525 527 if (!i2c) { 526 528 dev_err(&pdev->dev, "kzalloc failed\n"); 527 529 result = -ENOMEM; 528 530 goto out; 529 531 } 530 532 i2c->dev = &pdev->dev; 531 - i2c_data = pdev->dev.platform_data; 532 533 533 534 res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 534 535 535 536 if (res_mem == NULL) { 536 537 dev_err(i2c->dev, "found no memory resource\n"); 537 538 result = -ENXIO; 538 - goto fail_region; 539 + goto out; 539 540 } 540 - 541 - if (i2c_data == NULL) { 542 - dev_err(i2c->dev, "no I2C frequency data\n"); 543 - result = -ENXIO; 544 - goto fail_region; 545 - } 546 - 547 541 i2c->twsi_phys = res_mem->start; 548 542 i2c->regsize = resource_size(res_mem); 549 - i2c->twsi_freq = i2c_data->i2c_freq; 550 - i2c->sys_freq = i2c_data->sys_freq; 551 543 552 - if (!request_mem_region(i2c->twsi_phys, i2c->regsize, res_mem->name)) { 553 - dev_err(i2c->dev, "request_mem_region failed\n"); 554 - goto fail_region; 544 + /* 545 + * "clock-rate" is a legacy binding, the official binding is 546 + * "clock-frequency". Try the official one first and then 547 + * fall back if it doesn't exist. 548 + */ 549 + if (of_property_read_u32(pdev->dev.of_node, 550 + "clock-frequency", &i2c->twsi_freq) && 551 + of_property_read_u32(pdev->dev.of_node, 552 + "clock-rate", &i2c->twsi_freq)) { 553 + dev_err(i2c->dev, 554 + "no I2C 'clock-rate' or 'clock-frequency' property\n"); 555 + result = -ENXIO; 556 + goto out; 555 557 } 556 - i2c->twsi_base = ioremap(i2c->twsi_phys, i2c->regsize); 558 + 559 + i2c->sys_freq = octeon_get_io_clock_rate(); 560 + 561 + if (!devm_request_mem_region(&pdev->dev, i2c->twsi_phys, i2c->regsize, 562 + res_mem->name)) { 563 + dev_err(i2c->dev, "request_mem_region failed\n"); 564 + goto out; 565 + } 566 + i2c->twsi_base = devm_ioremap(&pdev->dev, i2c->twsi_phys, i2c->regsize); 557 567 558 568 init_waitqueue_head(&i2c->queue); 559 569 560 570 i2c->irq = irq; 561 571 562 - result = request_irq(i2c->irq, octeon_i2c_isr, 0, DRV_NAME, i2c); 572 + result = devm_request_irq(&pdev->dev, i2c->irq, 573 + octeon_i2c_isr, 0, DRV_NAME, i2c); 563 574 if (result < 0) { 564 575 dev_err(i2c->dev, "failed to attach interrupt\n"); 565 - goto fail_irq; 576 + goto out; 566 577 } 567 578 568 579 result = octeon_i2c_initlowlevel(i2c); 569 580 if (result) { 570 581 dev_err(i2c->dev, "init low level failed\n"); 571 - goto fail_add; 582 + goto out; 572 583 } 573 584 574 585 result = octeon_i2c_setclock(i2c); 575 586 if (result) { 576 587 dev_err(i2c->dev, "clock init failed\n"); 577 - goto fail_add; 588 + goto out; 578 589 } 579 590 580 591 i2c->adap = octeon_i2c_ops; 581 592 i2c->adap.dev.parent = &pdev->dev; 582 - i2c->adap.nr = pdev->id >= 0 ? pdev->id : 0; 593 + i2c->adap.dev.of_node = pdev->dev.of_node; 583 594 i2c_set_adapdata(&i2c->adap, i2c); 584 595 platform_set_drvdata(pdev, i2c); 585 596 586 - result = i2c_add_numbered_adapter(&i2c->adap); 597 + result = i2c_add_adapter(&i2c->adap); 587 598 if (result < 0) { 588 599 dev_err(i2c->dev, "failed to add adapter\n"); 589 600 goto fail_add; 590 601 } 591 - 592 602 dev_info(i2c->dev, "version %s\n", DRV_VERSION); 593 603 594 - return result; 604 + of_i2c_register_devices(&i2c->adap); 605 + 606 + return 0; 595 607 596 608 fail_add: 597 609 platform_set_drvdata(pdev, NULL); 598 - free_irq(i2c->irq, i2c); 599 - fail_irq: 600 - iounmap(i2c->twsi_base); 601 - release_mem_region(i2c->twsi_phys, i2c->regsize); 602 - fail_region: 603 - kfree(i2c); 604 610 out: 605 611 return result; 606 612 }; ··· 615 613 616 614 i2c_del_adapter(&i2c->adap); 617 615 platform_set_drvdata(pdev, NULL); 618 - free_irq(i2c->irq, i2c); 619 - iounmap(i2c->twsi_base); 620 - release_mem_region(i2c->twsi_phys, i2c->regsize); 621 - kfree(i2c); 622 616 return 0; 623 617 }; 618 + 619 + static struct of_device_id octeon_i2c_match[] = { 620 + { 621 + .compatible = "cavium,octeon-3860-twsi", 622 + }, 623 + {}, 624 + }; 625 + MODULE_DEVICE_TABLE(of, octeon_i2c_match); 624 626 625 627 static struct platform_driver octeon_i2c_driver = { 626 628 .probe = octeon_i2c_probe, ··· 632 626 .driver = { 633 627 .owner = THIS_MODULE, 634 628 .name = DRV_NAME, 629 + .of_match_table = octeon_i2c_match, 635 630 }, 636 631 }; 637 632 ··· 642 635 MODULE_DESCRIPTION("I2C-Bus adapter for Cavium OCTEON processors"); 643 636 MODULE_LICENSE("GPL"); 644 637 MODULE_VERSION(DRV_VERSION); 645 - MODULE_ALIAS("platform:" DRV_NAME);
+191 -35
drivers/mtd/nand/jz4740_nand.c
··· 52 52 53 53 #define JZ_NAND_CTRL_ENABLE_CHIP(x) BIT((x) << 1) 54 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 57 #define JZ_NAND_MEM_CMD_OFFSET 0x08000 58 + #define JZ_NAND_MEM_ADDR_OFFSET 0x10000 58 59 59 60 struct jz_nand { 60 61 struct mtd_info mtd; ··· 63 62 void __iomem *base; 64 63 struct resource *mem; 65 64 66 - void __iomem *bank_base; 67 - struct resource *bank_mem; 65 + unsigned char banks[JZ_NAND_NUM_BANKS]; 66 + void __iomem *bank_base[JZ_NAND_NUM_BANKS]; 67 + struct resource *bank_mem[JZ_NAND_NUM_BANKS]; 68 + 69 + int selected_bank; 68 70 69 71 struct jz_nand_platform_data *pdata; 70 72 bool is_reading; ··· 78 74 return container_of(mtd, struct jz_nand, mtd); 79 75 } 80 76 77 + static void jz_nand_select_chip(struct mtd_info *mtd, int chipnr) 78 + { 79 + struct jz_nand *nand = mtd_to_jz_nand(mtd); 80 + struct nand_chip *chip = mtd->priv; 81 + uint32_t ctrl; 82 + int banknr; 83 + 84 + ctrl = readl(nand->base + JZ_REG_NAND_CTRL); 85 + ctrl &= ~JZ_NAND_CTRL_ASSERT_CHIP_MASK; 86 + 87 + if (chipnr == -1) { 88 + banknr = -1; 89 + } else { 90 + banknr = nand->banks[chipnr] - 1; 91 + chip->IO_ADDR_R = nand->bank_base[banknr]; 92 + chip->IO_ADDR_W = nand->bank_base[banknr]; 93 + } 94 + writel(ctrl, nand->base + JZ_REG_NAND_CTRL); 95 + 96 + nand->selected_bank = banknr; 97 + } 98 + 81 99 static void jz_nand_cmd_ctrl(struct mtd_info *mtd, int dat, unsigned int ctrl) 82 100 { 83 101 struct jz_nand *nand = mtd_to_jz_nand(mtd); 84 102 struct nand_chip *chip = mtd->priv; 85 103 uint32_t reg; 104 + void __iomem *bank_base = nand->bank_base[nand->selected_bank]; 105 + 106 + BUG_ON(nand->selected_bank < 0); 86 107 87 108 if (ctrl & NAND_CTRL_CHANGE) { 88 109 BUG_ON((ctrl & NAND_ALE) && (ctrl & NAND_CLE)); 89 110 if (ctrl & NAND_ALE) 90 - chip->IO_ADDR_W = nand->bank_base + JZ_NAND_MEM_ADDR_OFFSET; 111 + bank_base += JZ_NAND_MEM_ADDR_OFFSET; 91 112 else if (ctrl & NAND_CLE) 92 - chip->IO_ADDR_W = nand->bank_base + JZ_NAND_MEM_CMD_OFFSET; 93 - else 94 - chip->IO_ADDR_W = nand->bank_base; 113 + bank_base += JZ_NAND_MEM_CMD_OFFSET; 114 + chip->IO_ADDR_W = bank_base; 95 115 96 116 reg = readl(nand->base + JZ_REG_NAND_CTRL); 97 117 if (ctrl & NAND_NCE) 98 - reg |= JZ_NAND_CTRL_ASSERT_CHIP(0); 118 + reg |= JZ_NAND_CTRL_ASSERT_CHIP(nand->selected_bank); 99 119 else 100 - reg &= ~JZ_NAND_CTRL_ASSERT_CHIP(0); 120 + reg &= ~JZ_NAND_CTRL_ASSERT_CHIP(nand->selected_bank); 101 121 writel(reg, nand->base + JZ_REG_NAND_CTRL); 102 122 } 103 123 if (dat != NAND_CMD_NONE) ··· 280 252 } 281 253 282 254 static int jz_nand_ioremap_resource(struct platform_device *pdev, 283 - const char *name, struct resource **res, void __iomem **base) 255 + const char *name, struct resource **res, void *__iomem *base) 284 256 { 285 257 int ret; 286 258 ··· 316 288 return ret; 317 289 } 318 290 291 + static inline void jz_nand_iounmap_resource(struct resource *res, void __iomem *base) 292 + { 293 + iounmap(base); 294 + release_mem_region(res->start, resource_size(res)); 295 + } 296 + 297 + 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) { 298 + int ret; 299 + int gpio; 300 + char gpio_name[9]; 301 + char res_name[6]; 302 + uint32_t ctrl; 303 + struct mtd_info *mtd = &nand->mtd; 304 + struct nand_chip *chip = &nand->chip; 305 + 306 + /* Request GPIO port. */ 307 + gpio = JZ_GPIO_MEM_CS0 + bank - 1; 308 + sprintf(gpio_name, "NAND CS%d", bank); 309 + ret = gpio_request(gpio, gpio_name); 310 + if (ret) { 311 + dev_warn(&pdev->dev, 312 + "Failed to request %s gpio %d: %d\n", 313 + gpio_name, gpio, ret); 314 + goto notfound_gpio; 315 + } 316 + 317 + /* Request I/O resource. */ 318 + sprintf(res_name, "bank%d", bank); 319 + ret = jz_nand_ioremap_resource(pdev, res_name, 320 + &nand->bank_mem[bank - 1], 321 + &nand->bank_base[bank - 1]); 322 + if (ret) 323 + goto notfound_resource; 324 + 325 + /* Enable chip in bank. */ 326 + jz_gpio_set_function(gpio, JZ_GPIO_FUNC_MEM_CS0); 327 + ctrl = readl(nand->base + JZ_REG_NAND_CTRL); 328 + ctrl |= JZ_NAND_CTRL_ENABLE_CHIP(bank - 1); 329 + writel(ctrl, nand->base + JZ_REG_NAND_CTRL); 330 + 331 + if (chipnr == 0) { 332 + /* Detect first chip. */ 333 + ret = nand_scan_ident(mtd, 1, NULL); 334 + if (ret) 335 + goto notfound_id; 336 + 337 + /* Retrieve the IDs from the first chip. */ 338 + chip->select_chip(mtd, 0); 339 + chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1); 340 + chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1); 341 + *nand_maf_id = chip->read_byte(mtd); 342 + *nand_dev_id = chip->read_byte(mtd); 343 + } else { 344 + /* Detect additional chip. */ 345 + chip->select_chip(mtd, chipnr); 346 + chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1); 347 + chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1); 348 + if (*nand_maf_id != chip->read_byte(mtd) 349 + || *nand_dev_id != chip->read_byte(mtd)) { 350 + ret = -ENODEV; 351 + goto notfound_id; 352 + } 353 + 354 + /* Update size of the MTD. */ 355 + chip->numchips++; 356 + mtd->size += chip->chipsize; 357 + } 358 + 359 + dev_info(&pdev->dev, "Found chip %i on bank %i\n", chipnr, bank); 360 + return 0; 361 + 362 + notfound_id: 363 + dev_info(&pdev->dev, "No chip found on bank %i\n", bank); 364 + ctrl &= ~(JZ_NAND_CTRL_ENABLE_CHIP(bank - 1)); 365 + writel(ctrl, nand->base + JZ_REG_NAND_CTRL); 366 + jz_gpio_set_function(gpio, JZ_GPIO_FUNC_NONE); 367 + jz_nand_iounmap_resource(nand->bank_mem[bank - 1], 368 + nand->bank_base[bank - 1]); 369 + notfound_resource: 370 + gpio_free(gpio); 371 + notfound_gpio: 372 + return ret; 373 + } 374 + 319 375 static int __devinit jz_nand_probe(struct platform_device *pdev) 320 376 { 321 377 int ret; ··· 407 295 struct nand_chip *chip; 408 296 struct mtd_info *mtd; 409 297 struct jz_nand_platform_data *pdata = pdev->dev.platform_data; 298 + size_t chipnr, bank_idx; 299 + uint8_t nand_maf_id = 0, nand_dev_id = 0; 410 300 411 301 nand = kzalloc(sizeof(*nand), GFP_KERNEL); 412 302 if (!nand) { ··· 419 305 ret = jz_nand_ioremap_resource(pdev, "mmio", &nand->mem, &nand->base); 420 306 if (ret) 421 307 goto err_free; 422 - ret = jz_nand_ioremap_resource(pdev, "bank", &nand->bank_mem, 423 - &nand->bank_base); 424 - if (ret) 425 - goto err_iounmap_mmio; 426 308 427 309 if (pdata && gpio_is_valid(pdata->busy_gpio)) { 428 310 ret = gpio_request(pdata->busy_gpio, "NAND busy pin"); ··· 426 316 dev_err(&pdev->dev, 427 317 "Failed to request busy gpio %d: %d\n", 428 318 pdata->busy_gpio, ret); 429 - goto err_iounmap_mem; 319 + goto err_iounmap_mmio; 430 320 } 431 321 } 432 322 ··· 449 339 450 340 chip->chip_delay = 50; 451 341 chip->cmd_ctrl = jz_nand_cmd_ctrl; 342 + chip->select_chip = jz_nand_select_chip; 452 343 453 344 if (pdata && gpio_is_valid(pdata->busy_gpio)) 454 345 chip->dev_ready = jz_nand_dev_ready; 455 346 456 - chip->IO_ADDR_R = nand->bank_base; 457 - chip->IO_ADDR_W = nand->bank_base; 458 - 459 347 nand->pdata = pdata; 460 348 platform_set_drvdata(pdev, nand); 461 349 462 - writel(JZ_NAND_CTRL_ENABLE_CHIP(0), nand->base + JZ_REG_NAND_CTRL); 350 + /* We are going to autodetect NAND chips in the banks specified in the 351 + * platform data. Although nand_scan_ident() can detect multiple chips, 352 + * it requires those chips to be numbered consecuitively, which is not 353 + * always the case for external memory banks. And a fixed chip-to-bank 354 + * mapping is not practical either, since for example Dingoo units 355 + * produced at different times have NAND chips in different banks. 356 + */ 357 + chipnr = 0; 358 + for (bank_idx = 0; bank_idx < JZ_NAND_NUM_BANKS; bank_idx++) { 359 + unsigned char bank; 463 360 464 - ret = nand_scan_ident(mtd, 1, NULL); 465 - if (ret) { 466 - dev_err(&pdev->dev, "Failed to scan nand\n"); 467 - goto err_gpio_free; 361 + /* If there is no platform data, look for NAND in bank 1, 362 + * which is the most likely bank since it is the only one 363 + * that can be booted from. 364 + */ 365 + bank = pdata ? pdata->banks[bank_idx] : bank_idx ^ 1; 366 + if (bank == 0) 367 + break; 368 + if (bank > JZ_NAND_NUM_BANKS) { 369 + dev_warn(&pdev->dev, 370 + "Skipping non-existing bank: %d\n", bank); 371 + continue; 372 + } 373 + /* The detection routine will directly or indirectly call 374 + * jz_nand_select_chip(), so nand->banks has to contain the 375 + * bank we're checking. 376 + */ 377 + nand->banks[chipnr] = bank; 378 + if (jz_nand_detect_bank(pdev, nand, bank, chipnr, 379 + &nand_maf_id, &nand_dev_id) == 0) 380 + chipnr++; 381 + else 382 + nand->banks[chipnr] = 0; 383 + } 384 + if (chipnr == 0) { 385 + dev_err(&pdev->dev, "No NAND chips found\n"); 386 + goto err_gpio_busy; 468 387 } 469 388 470 389 if (pdata && pdata->ident_callback) { ··· 503 364 504 365 ret = nand_scan_tail(mtd); 505 366 if (ret) { 506 - dev_err(&pdev->dev, "Failed to scan nand\n"); 507 - goto err_gpio_free; 367 + dev_err(&pdev->dev, "Failed to scan NAND\n"); 368 + goto err_unclaim_banks; 508 369 } 509 370 510 371 ret = mtd_device_parse_register(mtd, NULL, NULL, ··· 521 382 return 0; 522 383 523 384 err_nand_release: 524 - nand_release(&nand->mtd); 525 - err_gpio_free: 385 + nand_release(mtd); 386 + err_unclaim_banks: 387 + while (chipnr--) { 388 + unsigned char bank = nand->banks[chipnr]; 389 + gpio_free(JZ_GPIO_MEM_CS0 + bank - 1); 390 + jz_nand_iounmap_resource(nand->bank_mem[bank - 1], 391 + nand->bank_base[bank - 1]); 392 + } 393 + writel(0, nand->base + JZ_REG_NAND_CTRL); 394 + err_gpio_busy: 395 + if (pdata && gpio_is_valid(pdata->busy_gpio)) 396 + gpio_free(pdata->busy_gpio); 526 397 platform_set_drvdata(pdev, NULL); 527 - gpio_free(pdata->busy_gpio); 528 - err_iounmap_mem: 529 - iounmap(nand->bank_base); 530 398 err_iounmap_mmio: 531 - iounmap(nand->base); 399 + jz_nand_iounmap_resource(nand->mem, nand->base); 532 400 err_free: 533 401 kfree(nand); 534 402 return ret; ··· 544 398 static int __devexit jz_nand_remove(struct platform_device *pdev) 545 399 { 546 400 struct jz_nand *nand = platform_get_drvdata(pdev); 401 + struct jz_nand_platform_data *pdata = pdev->dev.platform_data; 402 + size_t i; 547 403 548 404 nand_release(&nand->mtd); 549 405 550 406 /* Deassert and disable all chips */ 551 407 writel(0, nand->base + JZ_REG_NAND_CTRL); 552 408 553 - iounmap(nand->bank_base); 554 - release_mem_region(nand->bank_mem->start, resource_size(nand->bank_mem)); 555 - iounmap(nand->base); 556 - release_mem_region(nand->mem->start, resource_size(nand->mem)); 409 + for (i = 0; i < JZ_NAND_NUM_BANKS; ++i) { 410 + unsigned char bank = nand->banks[i]; 411 + if (bank != 0) { 412 + jz_nand_iounmap_resource(nand->bank_mem[bank - 1], 413 + nand->bank_base[bank - 1]); 414 + gpio_free(JZ_GPIO_MEM_CS0 + bank - 1); 415 + } 416 + } 417 + if (pdata && gpio_is_valid(pdata->busy_gpio)) 418 + gpio_free(pdata->busy_gpio); 419 + 420 + jz_nand_iounmap_resource(nand->mem, nand->base); 557 421 558 422 platform_set_drvdata(pdev, NULL); 559 423 kfree(nand);
+208 -106
drivers/net/ethernet/octeon/octeon_mgmt.c
··· 6 6 * Copyright (C) 2009 Cavium Networks 7 7 */ 8 8 9 - #include <linux/capability.h> 10 - #include <linux/dma-mapping.h> 11 - #include <linux/init.h> 12 - #include <linux/module.h> 13 - #include <linux/interrupt.h> 14 9 #include <linux/platform_device.h> 15 - #include <linux/netdevice.h> 10 + #include <linux/dma-mapping.h> 16 11 #include <linux/etherdevice.h> 17 - #include <linux/if.h> 12 + #include <linux/capability.h> 13 + #include <linux/interrupt.h> 14 + #include <linux/netdevice.h> 15 + #include <linux/spinlock.h> 18 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 21 #include <linux/slab.h> 20 22 #include <linux/phy.h> 21 - #include <linux/spinlock.h> 23 + #include <linux/io.h> 22 24 23 25 #include <asm/octeon/octeon.h> 24 26 #include <asm/octeon/cvmx-mixx-defs.h> ··· 60 58 } s; 61 59 }; 62 60 61 + #define MIX_ORING1 0x0 62 + #define MIX_ORING2 0x8 63 + #define MIX_IRING1 0x10 64 + #define MIX_IRING2 0x18 65 + #define MIX_CTL 0x20 66 + #define MIX_IRHWM 0x28 67 + #define MIX_IRCNT 0x30 68 + #define MIX_ORHWM 0x38 69 + #define MIX_ORCNT 0x40 70 + #define MIX_ISR 0x48 71 + #define MIX_INTENA 0x50 72 + #define MIX_REMCNT 0x58 73 + #define MIX_BIST 0x78 74 + 75 + #define AGL_GMX_PRT_CFG 0x10 76 + #define AGL_GMX_RX_FRM_CTL 0x18 77 + #define AGL_GMX_RX_FRM_MAX 0x30 78 + #define AGL_GMX_RX_JABBER 0x38 79 + #define AGL_GMX_RX_STATS_CTL 0x50 80 + 81 + #define AGL_GMX_RX_STATS_PKTS_DRP 0xb0 82 + #define AGL_GMX_RX_STATS_OCTS_DRP 0xb8 83 + #define AGL_GMX_RX_STATS_PKTS_BAD 0xc0 84 + 85 + #define AGL_GMX_RX_ADR_CTL 0x100 86 + #define AGL_GMX_RX_ADR_CAM_EN 0x108 87 + #define AGL_GMX_RX_ADR_CAM0 0x180 88 + #define AGL_GMX_RX_ADR_CAM1 0x188 89 + #define AGL_GMX_RX_ADR_CAM2 0x190 90 + #define AGL_GMX_RX_ADR_CAM3 0x198 91 + #define AGL_GMX_RX_ADR_CAM4 0x1a0 92 + #define AGL_GMX_RX_ADR_CAM5 0x1a8 93 + 94 + #define AGL_GMX_TX_STATS_CTL 0x268 95 + #define AGL_GMX_TX_CTL 0x270 96 + #define AGL_GMX_TX_STAT0 0x280 97 + #define AGL_GMX_TX_STAT1 0x288 98 + #define AGL_GMX_TX_STAT2 0x290 99 + #define AGL_GMX_TX_STAT3 0x298 100 + #define AGL_GMX_TX_STAT4 0x2a0 101 + #define AGL_GMX_TX_STAT5 0x2a8 102 + #define AGL_GMX_TX_STAT6 0x2b0 103 + #define AGL_GMX_TX_STAT7 0x2b8 104 + #define AGL_GMX_TX_STAT8 0x2c0 105 + #define AGL_GMX_TX_STAT9 0x2c8 106 + 63 107 struct octeon_mgmt { 64 108 struct net_device *netdev; 109 + u64 mix; 110 + u64 agl; 65 111 int port; 66 112 int irq; 67 113 u64 *tx_ring; ··· 135 85 struct napi_struct napi; 136 86 struct tasklet_struct tx_clean_tasklet; 137 87 struct phy_device *phydev; 88 + struct device_node *phy_np; 89 + resource_size_t mix_phys; 90 + resource_size_t mix_size; 91 + resource_size_t agl_phys; 92 + resource_size_t agl_size; 138 93 }; 139 94 140 95 static void octeon_mgmt_set_rx_irq(struct octeon_mgmt *p, int enable) 141 96 { 142 - int port = p->port; 143 97 union cvmx_mixx_intena mix_intena; 144 98 unsigned long flags; 145 99 146 100 spin_lock_irqsave(&p->lock, flags); 147 - mix_intena.u64 = cvmx_read_csr(CVMX_MIXX_INTENA(port)); 101 + mix_intena.u64 = cvmx_read_csr(p->mix + MIX_INTENA); 148 102 mix_intena.s.ithena = enable ? 1 : 0; 149 - cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64); 103 + cvmx_write_csr(p->mix + MIX_INTENA, mix_intena.u64); 150 104 spin_unlock_irqrestore(&p->lock, flags); 151 105 } 152 106 153 107 static void octeon_mgmt_set_tx_irq(struct octeon_mgmt *p, int enable) 154 108 { 155 - int port = p->port; 156 109 union cvmx_mixx_intena mix_intena; 157 110 unsigned long flags; 158 111 159 112 spin_lock_irqsave(&p->lock, flags); 160 - mix_intena.u64 = cvmx_read_csr(CVMX_MIXX_INTENA(port)); 113 + mix_intena.u64 = cvmx_read_csr(p->mix + MIX_INTENA); 161 114 mix_intena.s.othena = enable ? 1 : 0; 162 - cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64); 115 + cvmx_write_csr(p->mix + MIX_INTENA, mix_intena.u64); 163 116 spin_unlock_irqrestore(&p->lock, flags); 164 117 } 165 118 ··· 199 146 static void octeon_mgmt_rx_fill_ring(struct net_device *netdev) 200 147 { 201 148 struct octeon_mgmt *p = netdev_priv(netdev); 202 - int port = p->port; 203 149 204 150 while (p->rx_current_fill < ring_max_fill(OCTEON_MGMT_RX_RING_SIZE)) { 205 151 unsigned int size; ··· 229 177 (p->rx_next_fill + 1) % OCTEON_MGMT_RX_RING_SIZE; 230 178 p->rx_current_fill++; 231 179 /* Ring the bell. */ 232 - cvmx_write_csr(CVMX_MIXX_IRING2(port), 1); 180 + cvmx_write_csr(p->mix + MIX_IRING2, 1); 233 181 } 234 182 } 235 183 236 184 static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p) 237 185 { 238 - int port = p->port; 239 186 union cvmx_mixx_orcnt mix_orcnt; 240 187 union mgmt_port_ring_entry re; 241 188 struct sk_buff *skb; 242 189 int cleaned = 0; 243 190 unsigned long flags; 244 191 245 - mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port)); 192 + mix_orcnt.u64 = cvmx_read_csr(p->mix + MIX_ORCNT); 246 193 while (mix_orcnt.s.orcnt) { 247 194 spin_lock_irqsave(&p->tx_list.lock, flags); 248 195 249 - mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port)); 196 + mix_orcnt.u64 = cvmx_read_csr(p->mix + MIX_ORCNT); 250 197 251 198 if (mix_orcnt.s.orcnt == 0) { 252 199 spin_unlock_irqrestore(&p->tx_list.lock, flags); ··· 265 214 mix_orcnt.s.orcnt = 1; 266 215 267 216 /* Acknowledge to hardware that we have the buffer. */ 268 - cvmx_write_csr(CVMX_MIXX_ORCNT(port), mix_orcnt.u64); 217 + cvmx_write_csr(p->mix + MIX_ORCNT, mix_orcnt.u64); 269 218 p->tx_current_fill--; 270 219 271 220 spin_unlock_irqrestore(&p->tx_list.lock, flags); ··· 275 224 dev_kfree_skb_any(skb); 276 225 cleaned++; 277 226 278 - mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port)); 227 + mix_orcnt.u64 = cvmx_read_csr(p->mix + MIX_ORCNT); 279 228 } 280 229 281 230 if (cleaned && netif_queue_stopped(p->netdev)) ··· 292 241 static void octeon_mgmt_update_rx_stats(struct net_device *netdev) 293 242 { 294 243 struct octeon_mgmt *p = netdev_priv(netdev); 295 - int port = p->port; 296 244 unsigned long flags; 297 245 u64 drop, bad; 298 246 299 247 /* These reads also clear the count registers. */ 300 - drop = cvmx_read_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(port)); 301 - bad = cvmx_read_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(port)); 248 + drop = cvmx_read_csr(p->agl + AGL_GMX_RX_STATS_PKTS_DRP); 249 + bad = cvmx_read_csr(p->agl + AGL_GMX_RX_STATS_PKTS_BAD); 302 250 303 251 if (drop || bad) { 304 252 /* Do an atomic update. */ ··· 311 261 static void octeon_mgmt_update_tx_stats(struct net_device *netdev) 312 262 { 313 263 struct octeon_mgmt *p = netdev_priv(netdev); 314 - int port = p->port; 315 264 unsigned long flags; 316 265 317 266 union cvmx_agl_gmx_txx_stat0 s0; 318 267 union cvmx_agl_gmx_txx_stat1 s1; 319 268 320 269 /* These reads also clear the count registers. */ 321 - s0.u64 = cvmx_read_csr(CVMX_AGL_GMX_TXX_STAT0(port)); 322 - s1.u64 = cvmx_read_csr(CVMX_AGL_GMX_TXX_STAT1(port)); 270 + s0.u64 = cvmx_read_csr(p->agl + AGL_GMX_TX_STAT0); 271 + s1.u64 = cvmx_read_csr(p->agl + AGL_GMX_TX_STAT1); 323 272 324 273 if (s0.s.xsdef || s0.s.xscol || s1.s.scol || s1.s.mcol) { 325 274 /* Do an atomic update. */ ··· 357 308 358 309 static int octeon_mgmt_receive_one(struct octeon_mgmt *p) 359 310 { 360 - int port = p->port; 361 311 struct net_device *netdev = p->netdev; 362 312 union cvmx_mixx_ircnt mix_ircnt; 363 313 union mgmt_port_ring_entry re; ··· 429 381 /* Tell the hardware we processed a packet. */ 430 382 mix_ircnt.u64 = 0; 431 383 mix_ircnt.s.ircnt = 1; 432 - cvmx_write_csr(CVMX_MIXX_IRCNT(port), mix_ircnt.u64); 384 + cvmx_write_csr(p->mix + MIX_IRCNT, mix_ircnt.u64); 433 385 return rc; 434 386 } 435 387 436 388 static int octeon_mgmt_receive_packets(struct octeon_mgmt *p, int budget) 437 389 { 438 - int port = p->port; 439 390 unsigned int work_done = 0; 440 391 union cvmx_mixx_ircnt mix_ircnt; 441 392 int rc; 442 393 443 - mix_ircnt.u64 = cvmx_read_csr(CVMX_MIXX_IRCNT(port)); 394 + mix_ircnt.u64 = cvmx_read_csr(p->mix + MIX_IRCNT); 444 395 while (work_done < budget && mix_ircnt.s.ircnt) { 445 396 446 397 rc = octeon_mgmt_receive_one(p); ··· 447 400 work_done++; 448 401 449 402 /* Check for more packets. */ 450 - mix_ircnt.u64 = cvmx_read_csr(CVMX_MIXX_IRCNT(port)); 403 + mix_ircnt.u64 = cvmx_read_csr(p->mix + MIX_IRCNT); 451 404 } 452 405 453 406 octeon_mgmt_rx_fill_ring(p->netdev); ··· 481 434 union cvmx_agl_gmx_bist agl_gmx_bist; 482 435 483 436 mix_ctl.u64 = 0; 484 - cvmx_write_csr(CVMX_MIXX_CTL(p->port), mix_ctl.u64); 437 + cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64); 485 438 do { 486 - mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(p->port)); 439 + mix_ctl.u64 = cvmx_read_csr(p->mix + MIX_CTL); 487 440 } while (mix_ctl.s.busy); 488 441 mix_ctl.s.reset = 1; 489 - cvmx_write_csr(CVMX_MIXX_CTL(p->port), mix_ctl.u64); 490 - cvmx_read_csr(CVMX_MIXX_CTL(p->port)); 442 + cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64); 443 + cvmx_read_csr(p->mix + MIX_CTL); 491 444 cvmx_wait(64); 492 445 493 - mix_bist.u64 = cvmx_read_csr(CVMX_MIXX_BIST(p->port)); 446 + mix_bist.u64 = cvmx_read_csr(p->mix + MIX_BIST); 494 447 if (mix_bist.u64) 495 448 dev_warn(p->dev, "MIX failed BIST (0x%016llx)\n", 496 449 (unsigned long long)mix_bist.u64); ··· 521 474 static void octeon_mgmt_set_rx_filtering(struct net_device *netdev) 522 475 { 523 476 struct octeon_mgmt *p = netdev_priv(netdev); 524 - int port = p->port; 525 477 union cvmx_agl_gmx_rxx_adr_ctl adr_ctl; 526 478 union cvmx_agl_gmx_prtx_cfg agl_gmx_prtx; 527 479 unsigned long flags; ··· 566 520 spin_lock_irqsave(&p->lock, flags); 567 521 568 522 /* Disable packet I/O. */ 569 - agl_gmx_prtx.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port)); 523 + agl_gmx_prtx.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG); 570 524 prev_packet_enable = agl_gmx_prtx.s.en; 571 525 agl_gmx_prtx.s.en = 0; 572 - cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), agl_gmx_prtx.u64); 526 + cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, agl_gmx_prtx.u64); 573 527 574 528 adr_ctl.u64 = 0; 575 529 adr_ctl.s.cam_mode = cam_mode; 576 530 adr_ctl.s.mcst = multicast_mode; 577 531 adr_ctl.s.bcst = 1; /* Allow broadcast */ 578 532 579 - cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CTL(port), adr_ctl.u64); 533 + cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CTL, adr_ctl.u64); 580 534 581 - cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM0(port), cam_state.cam[0]); 582 - cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM1(port), cam_state.cam[1]); 583 - cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM2(port), cam_state.cam[2]); 584 - cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM3(port), cam_state.cam[3]); 585 - cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM4(port), cam_state.cam[4]); 586 - cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM5(port), cam_state.cam[5]); 587 - cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM_EN(port), cam_state.cam_mask); 535 + cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM0, cam_state.cam[0]); 536 + cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM1, cam_state.cam[1]); 537 + cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM2, cam_state.cam[2]); 538 + cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM3, cam_state.cam[3]); 539 + cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM4, cam_state.cam[4]); 540 + cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM5, cam_state.cam[5]); 541 + cvmx_write_csr(p->agl + AGL_GMX_RX_ADR_CAM_EN, cam_state.cam_mask); 588 542 589 543 /* Restore packet I/O. */ 590 544 agl_gmx_prtx.s.en = prev_packet_enable; 591 - cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), agl_gmx_prtx.u64); 545 + cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, agl_gmx_prtx.u64); 592 546 593 547 spin_unlock_irqrestore(&p->lock, flags); 594 548 } ··· 610 564 static int octeon_mgmt_change_mtu(struct net_device *netdev, int new_mtu) 611 565 { 612 566 struct octeon_mgmt *p = netdev_priv(netdev); 613 - int port = p->port; 614 567 int size_without_fcs = new_mtu + OCTEON_MGMT_RX_HEADROOM; 615 568 616 569 /* ··· 625 580 626 581 netdev->mtu = new_mtu; 627 582 628 - cvmx_write_csr(CVMX_AGL_GMX_RXX_FRM_MAX(port), size_without_fcs); 629 - cvmx_write_csr(CVMX_AGL_GMX_RXX_JABBER(port), 583 + cvmx_write_csr(p->agl + AGL_GMX_RX_FRM_MAX, size_without_fcs); 584 + cvmx_write_csr(p->agl + AGL_GMX_RX_JABBER, 630 585 (size_without_fcs + 7) & 0xfff8); 631 586 632 587 return 0; ··· 636 591 { 637 592 struct net_device *netdev = dev_id; 638 593 struct octeon_mgmt *p = netdev_priv(netdev); 639 - int port = p->port; 640 594 union cvmx_mixx_isr mixx_isr; 641 595 642 - mixx_isr.u64 = cvmx_read_csr(CVMX_MIXX_ISR(port)); 596 + mixx_isr.u64 = cvmx_read_csr(p->mix + MIX_ISR); 643 597 644 598 /* Clear any pending interrupts */ 645 - cvmx_write_csr(CVMX_MIXX_ISR(port), mixx_isr.u64); 646 - cvmx_read_csr(CVMX_MIXX_ISR(port)); 599 + cvmx_write_csr(p->mix + MIX_ISR, mixx_isr.u64); 600 + cvmx_read_csr(p->mix + MIX_ISR); 647 601 648 602 if (mixx_isr.s.irthresh) { 649 603 octeon_mgmt_disable_rx_irq(p); ··· 673 629 static void octeon_mgmt_adjust_link(struct net_device *netdev) 674 630 { 675 631 struct octeon_mgmt *p = netdev_priv(netdev); 676 - int port = p->port; 677 632 union cvmx_agl_gmx_prtx_cfg prtx_cfg; 678 633 unsigned long flags; 679 634 int link_changed = 0; ··· 683 640 link_changed = 1; 684 641 if (p->last_duplex != p->phydev->duplex) { 685 642 p->last_duplex = p->phydev->duplex; 686 - prtx_cfg.u64 = 687 - cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port)); 643 + prtx_cfg.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG); 688 644 prtx_cfg.s.duplex = p->phydev->duplex; 689 - cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), 690 - prtx_cfg.u64); 645 + cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, prtx_cfg.u64); 691 646 } 692 647 } else { 693 648 if (p->last_link) ··· 711 670 static int octeon_mgmt_init_phy(struct net_device *netdev) 712 671 { 713 672 struct octeon_mgmt *p = netdev_priv(netdev); 714 - char phy_id[MII_BUS_ID_SIZE + 3]; 715 673 716 - if (octeon_is_simulation()) { 674 + if (octeon_is_simulation() || p->phy_np == NULL) { 717 675 /* No PHYs in the simulator. */ 718 676 netif_carrier_on(netdev); 719 677 return 0; 720 678 } 721 679 722 - snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "mdio-octeon-0", p->port); 723 - 724 - p->phydev = phy_connect(netdev, phy_id, octeon_mgmt_adjust_link, 0, 725 - PHY_INTERFACE_MODE_MII); 680 + p->phydev = of_phy_connect(netdev, p->phy_np, 681 + octeon_mgmt_adjust_link, 0, 682 + PHY_INTERFACE_MODE_MII); 726 683 727 684 if (IS_ERR(p->phydev)) { 728 685 p->phydev = NULL; ··· 776 737 777 738 octeon_mgmt_reset_hw(p); 778 739 779 - mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(port)); 740 + mix_ctl.u64 = cvmx_read_csr(p->mix + MIX_CTL); 780 741 781 742 /* Bring it out of reset if needed. */ 782 743 if (mix_ctl.s.reset) { 783 744 mix_ctl.s.reset = 0; 784 - cvmx_write_csr(CVMX_MIXX_CTL(port), mix_ctl.u64); 745 + cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64); 785 746 do { 786 - mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(port)); 747 + mix_ctl.u64 = cvmx_read_csr(p->mix + MIX_CTL); 787 748 } while (mix_ctl.s.reset); 788 749 } 789 750 ··· 794 755 oring1.u64 = 0; 795 756 oring1.s.obase = p->tx_ring_handle >> 3; 796 757 oring1.s.osize = OCTEON_MGMT_TX_RING_SIZE; 797 - cvmx_write_csr(CVMX_MIXX_ORING1(port), oring1.u64); 758 + cvmx_write_csr(p->mix + MIX_ORING1, oring1.u64); 798 759 799 760 iring1.u64 = 0; 800 761 iring1.s.ibase = p->rx_ring_handle >> 3; 801 762 iring1.s.isize = OCTEON_MGMT_RX_RING_SIZE; 802 - cvmx_write_csr(CVMX_MIXX_IRING1(port), iring1.u64); 763 + cvmx_write_csr(p->mix + MIX_IRING1, iring1.u64); 803 764 804 765 /* Disable packet I/O. */ 805 - prtx_cfg.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port)); 766 + prtx_cfg.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG); 806 767 prtx_cfg.s.en = 0; 807 - cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), prtx_cfg.u64); 768 + cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, prtx_cfg.u64); 808 769 809 770 memcpy(sa.sa_data, netdev->dev_addr, ETH_ALEN); 810 771 octeon_mgmt_set_mac_address(netdev, &sa); ··· 821 782 mix_ctl.s.nbtarb = 0; /* Arbitration mode */ 822 783 /* MII CB-request FIFO programmable high watermark */ 823 784 mix_ctl.s.mrq_hwm = 1; 824 - cvmx_write_csr(CVMX_MIXX_CTL(port), mix_ctl.u64); 785 + cvmx_write_csr(p->mix + MIX_CTL, mix_ctl.u64); 825 786 826 787 if (OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X) 827 788 || OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_X)) { ··· 848 809 849 810 /* Clear statistics. */ 850 811 /* Clear on read. */ 851 - cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_CTL(port), 1); 852 - cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(port), 0); 853 - cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(port), 0); 812 + cvmx_write_csr(p->agl + AGL_GMX_RX_STATS_CTL, 1); 813 + cvmx_write_csr(p->agl + AGL_GMX_RX_STATS_PKTS_DRP, 0); 814 + cvmx_write_csr(p->agl + AGL_GMX_RX_STATS_PKTS_BAD, 0); 854 815 855 - cvmx_write_csr(CVMX_AGL_GMX_TXX_STATS_CTL(port), 1); 856 - cvmx_write_csr(CVMX_AGL_GMX_TXX_STAT0(port), 0); 857 - cvmx_write_csr(CVMX_AGL_GMX_TXX_STAT1(port), 0); 816 + cvmx_write_csr(p->agl + AGL_GMX_TX_STATS_CTL, 1); 817 + cvmx_write_csr(p->agl + AGL_GMX_TX_STAT0, 0); 818 + cvmx_write_csr(p->agl + AGL_GMX_TX_STAT1, 0); 858 819 859 820 /* Clear any pending interrupts */ 860 - cvmx_write_csr(CVMX_MIXX_ISR(port), cvmx_read_csr(CVMX_MIXX_ISR(port))); 821 + cvmx_write_csr(p->mix + MIX_ISR, cvmx_read_csr(p->mix + MIX_ISR)); 861 822 862 823 if (request_irq(p->irq, octeon_mgmt_interrupt, 0, netdev->name, 863 824 netdev)) { ··· 868 829 /* Interrupt every single RX packet */ 869 830 mix_irhwm.u64 = 0; 870 831 mix_irhwm.s.irhwm = 0; 871 - cvmx_write_csr(CVMX_MIXX_IRHWM(port), mix_irhwm.u64); 832 + cvmx_write_csr(p->mix + MIX_IRHWM, mix_irhwm.u64); 872 833 873 834 /* Interrupt when we have 1 or more packets to clean. */ 874 835 mix_orhwm.u64 = 0; 875 836 mix_orhwm.s.orhwm = 1; 876 - cvmx_write_csr(CVMX_MIXX_ORHWM(port), mix_orhwm.u64); 837 + cvmx_write_csr(p->mix + MIX_ORHWM, mix_orhwm.u64); 877 838 878 839 /* Enable receive and transmit interrupts */ 879 840 mix_intena.u64 = 0; 880 841 mix_intena.s.ithena = 1; 881 842 mix_intena.s.othena = 1; 882 - cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64); 843 + cvmx_write_csr(p->mix + MIX_INTENA, mix_intena.u64); 883 844 884 845 885 846 /* Enable packet I/O. */ ··· 910 871 * frame. GMX checks that the PREAMBLE is sent correctly. 911 872 */ 912 873 rxx_frm_ctl.s.pre_chk = 1; 913 - cvmx_write_csr(CVMX_AGL_GMX_RXX_FRM_CTL(port), rxx_frm_ctl.u64); 874 + cvmx_write_csr(p->agl + AGL_GMX_RX_FRM_CTL, rxx_frm_ctl.u64); 914 875 915 876 /* Enable the AGL block */ 916 877 agl_gmx_inf_mode.u64 = 0; ··· 918 879 cvmx_write_csr(CVMX_AGL_GMX_INF_MODE, agl_gmx_inf_mode.u64); 919 880 920 881 /* Configure the port duplex and enables */ 921 - prtx_cfg.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port)); 882 + prtx_cfg.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG); 922 883 prtx_cfg.s.tx_en = 1; 923 884 prtx_cfg.s.rx_en = 1; 924 885 prtx_cfg.s.en = 1; 925 886 p->last_duplex = 1; 926 887 prtx_cfg.s.duplex = p->last_duplex; 927 - cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), prtx_cfg.u64); 888 + cvmx_write_csr(p->agl + AGL_GMX_PRT_CFG, prtx_cfg.u64); 928 889 929 890 p->last_link = 0; 930 891 netif_carrier_off(netdev); ··· 988 949 static int octeon_mgmt_xmit(struct sk_buff *skb, struct net_device *netdev) 989 950 { 990 951 struct octeon_mgmt *p = netdev_priv(netdev); 991 - int port = p->port; 992 952 union mgmt_port_ring_entry re; 993 953 unsigned long flags; 994 954 int rv = NETDEV_TX_BUSY; ··· 1031 993 netdev->stats.tx_bytes += skb->len; 1032 994 1033 995 /* Ring the bell. */ 1034 - cvmx_write_csr(CVMX_MIXX_ORING2(port), 1); 996 + cvmx_write_csr(p->mix + MIX_ORING2, 1); 1035 997 1036 998 rv = NETDEV_TX_OK; 1037 999 out: ··· 1109 1071 1110 1072 static int __devinit octeon_mgmt_probe(struct platform_device *pdev) 1111 1073 { 1112 - struct resource *res_irq; 1113 1074 struct net_device *netdev; 1114 1075 struct octeon_mgmt *p; 1115 - int i; 1076 + const __be32 *data; 1077 + const u8 *mac; 1078 + struct resource *res_mix; 1079 + struct resource *res_agl; 1080 + int len; 1081 + int result; 1116 1082 1117 1083 netdev = alloc_etherdev(sizeof(struct octeon_mgmt)); 1118 1084 if (netdev == NULL) ··· 1130 1088 p->netdev = netdev; 1131 1089 p->dev = &pdev->dev; 1132 1090 1133 - p->port = pdev->id; 1091 + data = of_get_property(pdev->dev.of_node, "cell-index", &len); 1092 + if (data && len == sizeof(*data)) { 1093 + p->port = be32_to_cpup(data); 1094 + } else { 1095 + dev_err(&pdev->dev, "no 'cell-index' property\n"); 1096 + result = -ENXIO; 1097 + goto err; 1098 + } 1099 + 1134 1100 snprintf(netdev->name, IFNAMSIZ, "mgmt%d", p->port); 1135 1101 1136 - res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 1137 - if (!res_irq) 1102 + result = platform_get_irq(pdev, 0); 1103 + if (result < 0) 1138 1104 goto err; 1139 1105 1140 - p->irq = res_irq->start; 1106 + p->irq = result; 1107 + 1108 + res_mix = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1109 + if (res_mix == NULL) { 1110 + dev_err(&pdev->dev, "no 'reg' resource\n"); 1111 + result = -ENXIO; 1112 + goto err; 1113 + } 1114 + 1115 + res_agl = platform_get_resource(pdev, IORESOURCE_MEM, 1); 1116 + if (res_agl == NULL) { 1117 + dev_err(&pdev->dev, "no 'reg' resource\n"); 1118 + result = -ENXIO; 1119 + goto err; 1120 + } 1121 + 1122 + p->mix_phys = res_mix->start; 1123 + p->mix_size = resource_size(res_mix); 1124 + p->agl_phys = res_agl->start; 1125 + p->agl_size = resource_size(res_agl); 1126 + 1127 + 1128 + if (!devm_request_mem_region(&pdev->dev, p->mix_phys, p->mix_size, 1129 + res_mix->name)) { 1130 + dev_err(&pdev->dev, "request_mem_region (%s) failed\n", 1131 + res_mix->name); 1132 + result = -ENXIO; 1133 + goto err; 1134 + } 1135 + 1136 + if (!devm_request_mem_region(&pdev->dev, p->agl_phys, p->agl_size, 1137 + res_agl->name)) { 1138 + result = -ENXIO; 1139 + dev_err(&pdev->dev, "request_mem_region (%s) failed\n", 1140 + res_agl->name); 1141 + goto err; 1142 + } 1143 + 1144 + 1145 + p->mix = (u64)devm_ioremap(&pdev->dev, p->mix_phys, p->mix_size); 1146 + p->agl = (u64)devm_ioremap(&pdev->dev, p->agl_phys, p->agl_size); 1147 + 1141 1148 spin_lock_init(&p->lock); 1142 1149 1143 1150 skb_queue_head_init(&p->tx_list); ··· 1199 1108 netdev->netdev_ops = &octeon_mgmt_ops; 1200 1109 netdev->ethtool_ops = &octeon_mgmt_ethtool_ops; 1201 1110 1202 - /* The mgmt ports get the first N MACs. */ 1203 - for (i = 0; i < 6; i++) 1204 - netdev->dev_addr[i] = octeon_bootinfo->mac_addr_base[i]; 1205 - netdev->dev_addr[5] += p->port; 1111 + mac = of_get_mac_address(pdev->dev.of_node); 1206 1112 1207 - if (p->port >= octeon_bootinfo->mac_addr_count) 1208 - dev_err(&pdev->dev, 1209 - "Error %s: Using MAC outside of the assigned range: %pM\n", 1210 - netdev->name, netdev->dev_addr); 1113 + if (mac) 1114 + memcpy(netdev->dev_addr, mac, 6); 1211 1115 1212 - if (register_netdev(netdev)) 1116 + p->phy_np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); 1117 + 1118 + pdev->dev.coherent_dma_mask = DMA_BIT_MASK(64); 1119 + pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 1120 + 1121 + result = register_netdev(netdev); 1122 + if (result) 1213 1123 goto err; 1214 1124 1215 1125 dev_info(&pdev->dev, "Version " DRV_VERSION "\n"); 1216 1126 return 0; 1127 + 1217 1128 err: 1218 1129 free_netdev(netdev); 1219 - return -ENOENT; 1130 + return result; 1220 1131 } 1221 1132 1222 1133 static int __devexit octeon_mgmt_remove(struct platform_device *pdev) ··· 1230 1137 return 0; 1231 1138 } 1232 1139 1140 + static struct of_device_id octeon_mgmt_match[] = { 1141 + { 1142 + .compatible = "cavium,octeon-5750-mix", 1143 + }, 1144 + {}, 1145 + }; 1146 + MODULE_DEVICE_TABLE(of, octeon_mgmt_match); 1147 + 1233 1148 static struct platform_driver octeon_mgmt_driver = { 1234 1149 .driver = { 1235 1150 .name = "octeon_mgmt", 1236 1151 .owner = THIS_MODULE, 1152 + .of_match_table = octeon_mgmt_match, 1237 1153 }, 1238 1154 .probe = octeon_mgmt_probe, 1239 1155 .remove = __devexit_p(octeon_mgmt_remove),
+58 -34
drivers/net/phy/mdio-octeon.c
··· 3 3 * License. See the file "COPYING" in the main directory of this archive 4 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 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 15 #include <linux/phy.h> 16 + #include <linux/io.h> 14 17 15 18 #include <asm/octeon/octeon.h> 16 19 #include <asm/octeon/cvmx-smix-defs.h> ··· 21 18 #define DRV_VERSION "1.0" 22 19 #define DRV_DESCRIPTION "Cavium Networks Octeon SMI/MDIO driver" 23 20 21 + #define SMI_CMD 0x0 22 + #define SMI_WR_DAT 0x8 23 + #define SMI_RD_DAT 0x10 24 + #define SMI_CLK 0x18 25 + #define SMI_EN 0x20 26 + 24 27 struct octeon_mdiobus { 25 28 struct mii_bus *mii_bus; 26 - int unit; 29 + u64 register_base; 30 + resource_size_t mdio_phys; 31 + resource_size_t regsize; 27 32 int phy_irq[PHY_MAX_ADDR]; 28 33 }; 29 34 ··· 46 35 smi_cmd.s.phy_op = 1; /* MDIO_CLAUSE_22_READ */ 47 36 smi_cmd.s.phy_adr = phy_id; 48 37 smi_cmd.s.reg_adr = regnum; 49 - cvmx_write_csr(CVMX_SMIX_CMD(p->unit), smi_cmd.u64); 38 + cvmx_write_csr(p->register_base + SMI_CMD, smi_cmd.u64); 50 39 51 40 do { 52 41 /* 53 42 * Wait 1000 clocks so we don't saturate the RSL bus 54 43 * doing reads. 55 44 */ 56 - cvmx_wait(1000); 57 - smi_rd.u64 = cvmx_read_csr(CVMX_SMIX_RD_DAT(p->unit)); 45 + __delay(1000); 46 + smi_rd.u64 = cvmx_read_csr(p->register_base + SMI_RD_DAT); 58 47 } while (smi_rd.s.pending && --timeout); 59 48 60 49 if (smi_rd.s.val) ··· 73 62 74 63 smi_wr.u64 = 0; 75 64 smi_wr.s.dat = val; 76 - cvmx_write_csr(CVMX_SMIX_WR_DAT(p->unit), smi_wr.u64); 65 + cvmx_write_csr(p->register_base + SMI_WR_DAT, smi_wr.u64); 77 66 78 67 smi_cmd.u64 = 0; 79 68 smi_cmd.s.phy_op = 0; /* MDIO_CLAUSE_22_WRITE */ 80 69 smi_cmd.s.phy_adr = phy_id; 81 70 smi_cmd.s.reg_adr = regnum; 82 - cvmx_write_csr(CVMX_SMIX_CMD(p->unit), smi_cmd.u64); 71 + cvmx_write_csr(p->register_base + SMI_CMD, smi_cmd.u64); 83 72 84 73 do { 85 74 /* 86 75 * Wait 1000 clocks so we don't saturate the RSL bus 87 76 * doing reads. 88 77 */ 89 - cvmx_wait(1000); 90 - smi_wr.u64 = cvmx_read_csr(CVMX_SMIX_WR_DAT(p->unit)); 78 + __delay(1000); 79 + smi_wr.u64 = cvmx_read_csr(p->register_base + SMI_WR_DAT); 91 80 } while (smi_wr.s.pending && --timeout); 92 81 93 82 if (timeout <= 0) ··· 99 88 static int __devinit octeon_mdiobus_probe(struct platform_device *pdev) 100 89 { 101 90 struct octeon_mdiobus *bus; 91 + struct resource *res_mem; 102 92 union cvmx_smix_en smi_en; 103 - int i; 104 93 int err = -ENOENT; 105 94 106 95 bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); 107 96 if (!bus) 108 97 return -ENOMEM; 109 98 110 - /* The platform_device id is our unit number. */ 111 - bus->unit = pdev->id; 99 + res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 100 + 101 + if (res_mem == NULL) { 102 + dev_err(&pdev->dev, "found no memory resource\n"); 103 + err = -ENXIO; 104 + goto fail; 105 + } 106 + bus->mdio_phys = res_mem->start; 107 + bus->regsize = resource_size(res_mem); 108 + if (!devm_request_mem_region(&pdev->dev, bus->mdio_phys, bus->regsize, 109 + res_mem->name)) { 110 + dev_err(&pdev->dev, "request_mem_region failed\n"); 111 + goto fail; 112 + } 113 + bus->register_base = 114 + (u64)devm_ioremap(&pdev->dev, bus->mdio_phys, bus->regsize); 112 115 113 116 bus->mii_bus = mdiobus_alloc(); 114 117 115 118 if (!bus->mii_bus) 116 - goto err; 119 + goto fail; 117 120 118 121 smi_en.u64 = 0; 119 122 smi_en.s.en = 1; 120 - cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64); 121 - 122 - /* 123 - * Standard Octeon evaluation boards don't support phy 124 - * interrupts, we need to poll. 125 - */ 126 - for (i = 0; i < PHY_MAX_ADDR; i++) 127 - bus->phy_irq[i] = PHY_POLL; 123 + cvmx_write_csr(bus->register_base + SMI_EN, smi_en.u64); 128 124 129 125 bus->mii_bus->priv = bus; 130 126 bus->mii_bus->irq = bus->phy_irq; 131 127 bus->mii_bus->name = "mdio-octeon"; 132 - snprintf(bus->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", 133 - bus->mii_bus->name, bus->unit); 128 + snprintf(bus->mii_bus->id, MII_BUS_ID_SIZE, "%llx", bus->register_base); 134 129 bus->mii_bus->parent = &pdev->dev; 135 130 136 131 bus->mii_bus->read = octeon_mdiobus_read; ··· 144 127 145 128 dev_set_drvdata(&pdev->dev, bus); 146 129 147 - err = mdiobus_register(bus->mii_bus); 130 + err = of_mdiobus_register(bus->mii_bus, pdev->dev.of_node); 148 131 if (err) 149 - goto err_register; 132 + goto fail_register; 150 133 151 134 dev_info(&pdev->dev, "Version " DRV_VERSION "\n"); 152 135 153 136 return 0; 154 - err_register: 137 + fail_register: 155 138 mdiobus_free(bus->mii_bus); 156 - 157 - err: 158 - devm_kfree(&pdev->dev, bus); 139 + fail: 159 140 smi_en.u64 = 0; 160 - cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64); 141 + cvmx_write_csr(bus->register_base + SMI_EN, smi_en.u64); 161 142 return err; 162 143 } 163 144 ··· 169 154 mdiobus_unregister(bus->mii_bus); 170 155 mdiobus_free(bus->mii_bus); 171 156 smi_en.u64 = 0; 172 - cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64); 157 + cvmx_write_csr(bus->register_base + SMI_EN, smi_en.u64); 173 158 return 0; 174 159 } 160 + 161 + static struct of_device_id octeon_mdiobus_match[] = { 162 + { 163 + .compatible = "cavium,octeon-3860-mdio", 164 + }, 165 + {}, 166 + }; 167 + MODULE_DEVICE_TABLE(of, octeon_mdiobus_match); 175 168 176 169 static struct platform_driver octeon_mdiobus_driver = { 177 170 .driver = { 178 171 .name = "mdio-octeon", 179 172 .owner = THIS_MODULE, 173 + .of_match_table = octeon_mdiobus_match, 180 174 }, 181 175 .probe = octeon_mdiobus_probe, 182 176 .remove = __devexit_p(octeon_mdiobus_remove),
+9
drivers/spi/Kconfig
··· 144 144 This enables using the Cirrus EP93xx SPI controller in master 145 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 156 config SPI_GPIO 148 157 tristate "GPIO-based bitbanging SPI Master" 149 158 depends on GENERIC_GPIO
+1
drivers/spi/Makefile
··· 26 26 obj-$(CONFIG_SPI_DW_PCI) += spi-dw-midpci.o 27 27 spi-dw-midpci-objs := spi-dw-pci.o spi-dw-mid.o 28 28 obj-$(CONFIG_SPI_EP93XX) += spi-ep93xx.o 29 + obj-$(CONFIG_SPI_FALCON) += spi-falcon.o 29 30 obj-$(CONFIG_SPI_FSL_LIB) += spi-fsl-lib.o 30 31 obj-$(CONFIG_SPI_FSL_ESPI) += spi-fsl-espi.o 31 32 obj-$(CONFIG_SPI_FSL_SPI) += spi-fsl-spi.o
+469
drivers/spi/spi-falcon.c
··· 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");
+15 -13
drivers/staging/octeon/ethernet-mdio.c
··· 28 28 #include <linux/ethtool.h> 29 29 #include <linux/phy.h> 30 30 #include <linux/ratelimit.h> 31 + #include <linux/of_mdio.h> 31 32 32 33 #include <net/dst.h> 33 34 ··· 162 161 int cvm_oct_phy_setup_device(struct net_device *dev) 163 162 { 164 163 struct octeon_ethernet *priv = netdev_priv(dev); 164 + struct device_node *phy_node; 165 165 166 - int phy_addr = cvmx_helper_board_get_mii_address(priv->port); 167 - if (phy_addr != -1) { 168 - char phy_id[MII_BUS_ID_SIZE + 3]; 166 + if (!priv->of_node) 167 + return 0; 169 168 170 - snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "mdio-octeon-0", phy_addr); 169 + phy_node = of_parse_phandle(priv->of_node, "phy-handle", 0); 170 + if (!phy_node) 171 + return 0; 171 172 172 - priv->phydev = phy_connect(dev, phy_id, cvm_oct_adjust_link, 0, 173 - PHY_INTERFACE_MODE_GMII); 173 + priv->phydev = of_phy_connect(dev, phy_node, cvm_oct_adjust_link, 0, 174 + PHY_INTERFACE_MODE_GMII); 174 175 175 - if (IS_ERR(priv->phydev)) { 176 - priv->phydev = NULL; 177 - return -1; 178 - } 179 - priv->last_link = 0; 180 - phy_start_aneg(priv->phydev); 181 - } 176 + if (priv->phydev == NULL) 177 + return -ENODEV; 178 + 179 + priv->last_link = 0; 180 + phy_start_aneg(priv->phydev); 181 + 182 182 return 0; 183 183 }
+97 -52
drivers/staging/octeon/ethernet.c
··· 24 24 * This file may also be available under a different license from Cavium. 25 25 * Contact Cavium Networks for more information 26 26 **********************************************************************/ 27 + #include <linux/platform_device.h> 27 28 #include <linux/kernel.h> 28 29 #include <linux/init.h> 29 30 #include <linux/module.h> ··· 33 32 #include <linux/phy.h> 34 33 #include <linux/slab.h> 35 34 #include <linux/interrupt.h> 35 + #include <linux/of_net.h> 36 36 37 37 #include <net/dst.h> 38 38 ··· 115 113 module_param(rx_napi_weight, int, 0444); 116 114 MODULE_PARM_DESC(rx_napi_weight, "The NAPI WEIGHT parameter."); 117 115 118 - /* 119 - * The offset from mac_addr_base that should be used for the next port 120 - * that is configured. By convention, if any mgmt ports exist on the 121 - * chip, they get the first mac addresses, The ports controlled by 122 - * this driver are numbered sequencially following any mgmt addresses 123 - * that may exist. 124 - */ 125 - static unsigned int cvm_oct_mac_addr_offset; 126 - 127 116 /** 128 117 * cvm_oct_poll_queue - Workqueue for polling operations. 129 118 */ ··· 169 176 queue_delayed_work(cvm_oct_poll_queue, &priv->port_periodic_work, HZ); 170 177 } 171 178 172 - static __init void cvm_oct_configure_common_hw(void) 179 + static __devinit void cvm_oct_configure_common_hw(void) 173 180 { 174 181 /* Setup the FPA */ 175 182 cvmx_fpa_enable(); ··· 389 396 390 397 * Returns Zero on success 391 398 */ 392 - static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr) 399 + static int cvm_oct_set_mac_filter(struct net_device *dev) 393 400 { 394 401 struct octeon_ethernet *priv = netdev_priv(dev); 395 402 union cvmx_gmxx_prtx_cfg gmx_cfg; 396 403 int interface = INTERFACE(priv->port); 397 404 int index = INDEX(priv->port); 398 405 399 - memcpy(dev->dev_addr, addr + 2, 6); 400 - 401 406 if ((interface < 2) 402 407 && (cvmx_helper_interface_get_mode(interface) != 403 408 CVMX_HELPER_INTERFACE_MODE_SPI)) { 404 409 int i; 405 - uint8_t *ptr = addr; 410 + uint8_t *ptr = dev->dev_addr; 406 411 uint64_t mac = 0; 407 412 for (i = 0; i < 6; i++) 408 - mac = (mac << 8) | (uint64_t) (ptr[i + 2]); 413 + mac = (mac << 8) | (uint64_t)ptr[i]; 409 414 410 415 gmx_cfg.u64 = 411 416 cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface)); ··· 412 421 413 422 cvmx_write_csr(CVMX_GMXX_SMACX(index, interface), mac); 414 423 cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM0(index, interface), 415 - ptr[2]); 424 + ptr[0]); 416 425 cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM1(index, interface), 417 - ptr[3]); 426 + ptr[1]); 418 427 cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM2(index, interface), 419 - ptr[4]); 428 + ptr[2]); 420 429 cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM3(index, interface), 421 - ptr[5]); 430 + ptr[3]); 422 431 cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM4(index, interface), 423 - ptr[6]); 432 + ptr[4]); 424 433 cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM5(index, interface), 425 - ptr[7]); 434 + ptr[5]); 426 435 cvm_oct_common_set_multicast_list(dev); 427 436 cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), 428 437 gmx_cfg.u64); 429 438 } 430 439 return 0; 440 + } 441 + 442 + static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr) 443 + { 444 + int r = eth_mac_addr(dev, addr); 445 + 446 + if (r) 447 + return r; 448 + return cvm_oct_set_mac_filter(dev); 431 449 } 432 450 433 451 /** ··· 448 448 int cvm_oct_common_init(struct net_device *dev) 449 449 { 450 450 struct octeon_ethernet *priv = netdev_priv(dev); 451 - struct sockaddr sa; 452 - u64 mac = ((u64)(octeon_bootinfo->mac_addr_base[0] & 0xff) << 40) | 453 - ((u64)(octeon_bootinfo->mac_addr_base[1] & 0xff) << 32) | 454 - ((u64)(octeon_bootinfo->mac_addr_base[2] & 0xff) << 24) | 455 - ((u64)(octeon_bootinfo->mac_addr_base[3] & 0xff) << 16) | 456 - ((u64)(octeon_bootinfo->mac_addr_base[4] & 0xff) << 8) | 457 - (u64)(octeon_bootinfo->mac_addr_base[5] & 0xff); 451 + const u8 *mac = NULL; 458 452 459 - mac += cvm_oct_mac_addr_offset; 460 - sa.sa_data[0] = (mac >> 40) & 0xff; 461 - sa.sa_data[1] = (mac >> 32) & 0xff; 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; 453 + if (priv->of_node) 454 + mac = of_get_mac_address(priv->of_node); 466 455 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++; 456 + if (mac && is_valid_ether_addr(mac)) { 457 + memcpy(dev->dev_addr, mac, ETH_ALEN); 458 + dev->addr_assign_type &= ~NET_ADDR_RANDOM; 459 + } else { 460 + eth_hw_addr_random(dev); 461 + } 471 462 472 463 /* 473 464 * Force the interface to use the POW send if always_use_pow ··· 479 488 SET_ETHTOOL_OPS(dev, &cvm_oct_ethtool_ops); 480 489 481 490 cvm_oct_phy_setup_device(dev); 482 - dev->netdev_ops->ndo_set_mac_address(dev, &sa); 491 + cvm_oct_set_mac_filter(dev); 483 492 dev->netdev_ops->ndo_change_mtu(dev, dev->mtu); 484 493 485 494 /* ··· 586 595 587 596 extern void octeon_mdiobus_force_mod_depencency(void); 588 597 589 - static int __init cvm_oct_init_module(void) 598 + static struct device_node * __devinit cvm_oct_of_get_child(const struct device_node *parent, 599 + int reg_val) 600 + { 601 + struct device_node *node = NULL; 602 + int size; 603 + const __be32 *addr; 604 + 605 + for (;;) { 606 + node = of_get_next_child(parent, node); 607 + if (!node) 608 + break; 609 + addr = of_get_property(node, "reg", &size); 610 + if (addr && (be32_to_cpu(*addr) == reg_val)) 611 + break; 612 + } 613 + return node; 614 + } 615 + 616 + static struct device_node * __devinit cvm_oct_node_for_port(struct device_node *pip, 617 + int interface, int port) 618 + { 619 + struct device_node *ni, *np; 620 + 621 + ni = cvm_oct_of_get_child(pip, interface); 622 + if (!ni) 623 + return NULL; 624 + 625 + np = cvm_oct_of_get_child(ni, port); 626 + of_node_put(ni); 627 + 628 + return np; 629 + } 630 + 631 + static int __devinit cvm_oct_probe(struct platform_device *pdev) 590 632 { 591 633 int num_interfaces; 592 634 int interface; 593 635 int fau = FAU_NUM_PACKET_BUFFERS_TO_FREE; 594 636 int qos; 637 + struct device_node *pip; 595 638 596 639 octeon_mdiobus_force_mod_depencency(); 597 640 pr_notice("cavium-ethernet %s\n", OCTEON_ETHERNET_VERSION); 598 641 599 - if (OCTEON_IS_MODEL(OCTEON_CN52XX)) 600 - cvm_oct_mac_addr_offset = 2; /* First two are the mgmt ports. */ 601 - else if (OCTEON_IS_MODEL(OCTEON_CN56XX)) 602 - cvm_oct_mac_addr_offset = 1; /* First one is the mgmt port. */ 603 - else 604 - cvm_oct_mac_addr_offset = 0; 642 + pip = pdev->dev.of_node; 643 + if (!pip) { 644 + pr_err("Error: No 'pip' in /aliases\n"); 645 + return -EINVAL; 646 + } 605 647 606 648 cvm_oct_poll_queue = create_singlethread_workqueue("octeon-ethernet"); 607 649 if (cvm_oct_poll_queue == NULL) { ··· 713 689 cvmx_helper_interface_get_mode(interface); 714 690 int num_ports = cvmx_helper_ports_on_interface(interface); 715 691 int port; 692 + int port_index; 716 693 717 - for (port = cvmx_helper_get_ipd_port(interface, 0); 694 + for (port_index = 0, port = cvmx_helper_get_ipd_port(interface, 0); 718 695 port < cvmx_helper_get_ipd_port(interface, num_ports); 719 - port++) { 696 + port_index++, port++) { 720 697 struct octeon_ethernet *priv; 721 698 struct net_device *dev = 722 699 alloc_etherdev(sizeof(struct octeon_ethernet)); ··· 728 703 729 704 /* Initialize the device private structure. */ 730 705 priv = netdev_priv(dev); 706 + priv->of_node = cvm_oct_node_for_port(pip, interface, port_index); 731 707 732 708 INIT_DELAYED_WORK(&priv->port_periodic_work, 733 709 cvm_oct_periodic_worker); ··· 813 787 return 0; 814 788 } 815 789 816 - static void __exit cvm_oct_cleanup_module(void) 790 + static int __devexit cvm_oct_remove(struct platform_device *pdev) 817 791 { 818 792 int port; 819 793 ··· 861 835 if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL) 862 836 cvm_oct_mem_empty_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL, 863 837 CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128); 838 + return 0; 864 839 } 840 + 841 + static struct of_device_id cvm_oct_match[] = { 842 + { 843 + .compatible = "cavium,octeon-3860-pip", 844 + }, 845 + {}, 846 + }; 847 + MODULE_DEVICE_TABLE(of, cvm_oct_match); 848 + 849 + static struct platform_driver cvm_oct_driver = { 850 + .probe = cvm_oct_probe, 851 + .remove = __devexit_p(cvm_oct_remove), 852 + .driver = { 853 + .owner = THIS_MODULE, 854 + .name = KBUILD_MODNAME, 855 + .of_match_table = cvm_oct_match, 856 + }, 857 + }; 858 + 859 + module_platform_driver(cvm_oct_driver); 865 860 866 861 MODULE_LICENSE("GPL"); 867 862 MODULE_AUTHOR("Cavium Networks <support@caviumnetworks.com>"); 868 863 MODULE_DESCRIPTION("Cavium Networks Octeon ethernet driver."); 869 - module_init(cvm_oct_init_module); 870 - module_exit(cvm_oct_cleanup_module);
+3
drivers/staging/octeon/octeon-ethernet.h
··· 31 31 #ifndef OCTEON_ETHERNET_H 32 32 #define OCTEON_ETHERNET_H 33 33 34 + #include <linux/of.h> 35 + 34 36 /** 35 37 * This is the definition of the Ethernet driver's private 36 38 * driver state stored in netdev_priv(dev). ··· 61 59 void (*poll) (struct net_device *dev); 62 60 struct delayed_work port_periodic_work; 63 61 struct work_struct port_work; /* may be unused. */ 62 + struct device_node *of_node; 64 63 }; 65 64 66 65 int cvm_oct_free_work(void *work_queue_entry);
+8
include/linux/libfdt.h
··· 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_ */
+13
include/linux/libfdt_env.h
··· 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 */
+6
lib/Kconfig
··· 387 387 Digital signature verification. Currently only RSA is supported. 388 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 396 endmenu
+5
lib/Makefile
··· 130 130 131 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 138 hostprogs-y := gen_crc32table 134 139 clean-files := crc32table.h 135 140
+2
lib/fdt.c
··· 1 + #include <linux/libfdt_env.h> 2 + #include "../scripts/dtc/libfdt/fdt.c"
+2
lib/fdt_ro.c
··· 1 + #include <linux/libfdt_env.h> 2 + #include "../scripts/dtc/libfdt/fdt_ro.c"
+2
lib/fdt_rw.c
··· 1 + #include <linux/libfdt_env.h> 2 + #include "../scripts/dtc/libfdt/fdt_rw.c"
+2
lib/fdt_strerror.c
··· 1 + #include <linux/libfdt_env.h> 2 + #include "../scripts/dtc/libfdt/fdt_strerror.c"
+2
lib/fdt_sw.c
··· 1 + #include <linux/libfdt_env.h> 2 + #include "../scripts/dtc/libfdt/fdt_sw.c"
+2
lib/fdt_wip.c
··· 1 + #include <linux/libfdt_env.h> 2 + #include "../scripts/dtc/libfdt/fdt_wip.c"