aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/cavium-octeon
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/cavium-octeon')
-rw-r--r--arch/mips/cavium-octeon/Kconfig17
-rw-r--r--arch/mips/cavium-octeon/Makefile2
-rw-r--r--arch/mips/cavium-octeon/Platform8
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper-board.c13
-rw-r--r--arch/mips/cavium-octeon/octeon-platform.c9
-rw-r--r--arch/mips/cavium-octeon/serial.c109
-rw-r--r--arch/mips/cavium-octeon/setup.c27
7 files changed, 31 insertions, 154 deletions
diff --git a/arch/mips/cavium-octeon/Kconfig b/arch/mips/cavium-octeon/Kconfig
index 75a6df7fd265..227705d9d5ae 100644
--- a/arch/mips/cavium-octeon/Kconfig
+++ b/arch/mips/cavium-octeon/Kconfig
@@ -10,6 +10,10 @@ config CAVIUM_CN63XXP1
10 non-CN63XXP1 hardware, so it is recommended to select "n" 10 non-CN63XXP1 hardware, so it is recommended to select "n"
11 unless it is known the workarounds are needed. 11 unless it is known the workarounds are needed.
12 12
13endif # CPU_CAVIUM_OCTEON
14
15if CAVIUM_OCTEON_SOC
16
13config CAVIUM_OCTEON_2ND_KERNEL 17config CAVIUM_OCTEON_2ND_KERNEL
14 bool "Build the kernel to be used as a 2nd kernel on the same chip" 18 bool "Build the kernel to be used as a 2nd kernel on the same chip"
15 default "n" 19 default "n"
@@ -19,17 +23,6 @@ config CAVIUM_OCTEON_2ND_KERNEL
19 with this option to be run at the same time as one built without this 23 with this option to be run at the same time as one built without this
20 option. 24 option.
21 25
22config CAVIUM_OCTEON_HW_FIX_UNALIGNED
23 bool "Enable hardware fixups of unaligned loads and stores"
24 default "y"
25 help
26 Configure the Octeon hardware to automatically fix unaligned loads
27 and stores. Normally unaligned accesses are fixed using a kernel
28 exception handler. This option enables the hardware automatic fixups,
29 which requires only an extra 3 cycles. Disable this option if you
30 are running code that relies on address exceptions on unaligned
31 accesses.
32
33config CAVIUM_OCTEON_CVMSEG_SIZE 26config CAVIUM_OCTEON_CVMSEG_SIZE
34 int "Number of L1 cache lines reserved for CVMSEG memory" 27 int "Number of L1 cache lines reserved for CVMSEG memory"
35 range 0 54 28 range 0 54
@@ -103,4 +96,4 @@ config OCTEON_ILM
103 To compile this driver as a module, choose M here. The module 96 To compile this driver as a module, choose M here. The module
104 will be called octeon-ilm 97 will be called octeon-ilm
105 98
106endif # CPU_CAVIUM_OCTEON 99endif # CAVIUM_OCTEON_SOC
diff --git a/arch/mips/cavium-octeon/Makefile b/arch/mips/cavium-octeon/Makefile
index e3fd50cc709c..4e952043c922 100644
--- a/arch/mips/cavium-octeon/Makefile
+++ b/arch/mips/cavium-octeon/Makefile
@@ -12,7 +12,7 @@
12CFLAGS_octeon-platform.o = -I$(src)/../../../scripts/dtc/libfdt 12CFLAGS_octeon-platform.o = -I$(src)/../../../scripts/dtc/libfdt
13CFLAGS_setup.o = -I$(src)/../../../scripts/dtc/libfdt 13CFLAGS_setup.o = -I$(src)/../../../scripts/dtc/libfdt
14 14
15obj-y := cpu.o setup.o serial.o octeon-platform.o octeon-irq.o csrc-octeon.o 15obj-y := cpu.o setup.o octeon-platform.o octeon-irq.o csrc-octeon.o
16obj-y += dma-octeon.o 16obj-y += dma-octeon.o
17obj-y += octeon-memcpy.o 17obj-y += octeon-memcpy.o
18obj-y += executive/ 18obj-y += executive/
diff --git a/arch/mips/cavium-octeon/Platform b/arch/mips/cavium-octeon/Platform
index 1e43ccf1a792..8a301cb12d68 100644
--- a/arch/mips/cavium-octeon/Platform
+++ b/arch/mips/cavium-octeon/Platform
@@ -1,11 +1,11 @@
1# 1#
2# Cavium Octeon 2# Cavium Octeon
3# 3#
4platform-$(CONFIG_CPU_CAVIUM_OCTEON) += cavium-octeon/ 4platform-$(CONFIG_CAVIUM_OCTEON_SOC) += cavium-octeon/
5cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += \ 5cflags-$(CONFIG_CAVIUM_OCTEON_SOC) += \
6 -I$(srctree)/arch/mips/include/asm/mach-cavium-octeon 6 -I$(srctree)/arch/mips/include/asm/mach-cavium-octeon
7ifdef CONFIG_CAVIUM_OCTEON_2ND_KERNEL 7ifdef CONFIG_CAVIUM_OCTEON_2ND_KERNEL
8load-$(CONFIG_CPU_CAVIUM_OCTEON) += 0xffffffff84100000 8load-$(CONFIG_CAVIUM_OCTEON_SOC) += 0xffffffff84100000
9else 9else
10load-$(CONFIG_CPU_CAVIUM_OCTEON) += 0xffffffff81100000 10load-$(CONFIG_CAVIUM_OCTEON_SOC) += 0xffffffff81100000
11endif 11endif
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
index 7c6497781895..0a1283ce47f5 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
@@ -181,6 +181,11 @@ int cvmx_helper_board_get_mii_address(int ipd_port)
181 return ipd_port - 16 + 4; 181 return ipd_port - 16 + 4;
182 else 182 else
183 return -1; 183 return -1;
184 case CVMX_BOARD_TYPE_UBNT_E100:
185 if (ipd_port >= 0 && ipd_port <= 2)
186 return 7 - ipd_port;
187 else
188 return -1;
184 } 189 }
185 190
186 /* Some unknown board. Somebody forgot to update this function... */ 191 /* Some unknown board. Somebody forgot to update this function... */
@@ -706,6 +711,14 @@ int __cvmx_helper_board_hardware_enable(int interface)
706 } 711 }
707 } 712 }
708 } 713 }
714 } else if (cvmx_sysinfo_get()->board_type ==
715 CVMX_BOARD_TYPE_UBNT_E100) {
716 cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(0, interface), 0);
717 cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(0, interface), 0x10);
718 cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(1, interface), 0);
719 cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(1, interface), 0x10);
720 cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(2, interface), 0);
721 cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(2, interface), 0x10);
709 } 722 }
710 return 0; 723 return 0;
711} 724}
diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index 389512e2abd6..7b746e7bf7a1 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -490,8 +490,15 @@ int __init octeon_prune_device_tree(void)
490 490
491 if (alias_prop) { 491 if (alias_prop) {
492 uart = fdt_path_offset(initial_boot_params, alias_prop); 492 uart = fdt_path_offset(initial_boot_params, alias_prop);
493 if (uart_mask & (1 << i)) 493 if (uart_mask & (1 << i)) {
494 __be32 f;
495
496 f = cpu_to_be32(octeon_get_io_clock_rate());
497 fdt_setprop_inplace(initial_boot_params,
498 uart, "clock-frequency",
499 &f, sizeof(f));
494 continue; 500 continue;
501 }
495 pr_debug("Deleting uart%d\n", i); 502 pr_debug("Deleting uart%d\n", i);
496 fdt_nop_node(initial_boot_params, uart); 503 fdt_nop_node(initial_boot_params, uart);
497 fdt_nop_property(initial_boot_params, aliases, 504 fdt_nop_property(initial_boot_params, aliases,
diff --git a/arch/mips/cavium-octeon/serial.c b/arch/mips/cavium-octeon/serial.c
deleted file mode 100644
index f393f65f3923..000000000000
--- a/arch/mips/cavium-octeon/serial.c
+++ /dev/null
@@ -1,109 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2004-2007 Cavium Networks
7 */
8#include <linux/console.h>
9#include <linux/module.h>
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/serial.h>
13#include <linux/serial_8250.h>
14#include <linux/serial_reg.h>
15#include <linux/tty.h>
16#include <linux/irq.h>
17
18#include <asm/time.h>
19
20#include <asm/octeon/octeon.h>
21
22#define DEBUG_UART 1
23
24unsigned int octeon_serial_in(struct uart_port *up, int offset)
25{
26 int rv = cvmx_read_csr((uint64_t)(up->membase + (offset << 3)));
27 if (offset == UART_IIR && (rv & 0xf) == 7) {
28 /* Busy interrupt, read the USR (39) and try again. */
29 cvmx_read_csr((uint64_t)(up->membase + (39 << 3)));
30 rv = cvmx_read_csr((uint64_t)(up->membase + (offset << 3)));
31 }
32 return rv;
33}
34
35void octeon_serial_out(struct uart_port *up, int offset, int value)
36{
37 /*
38 * If bits 6 or 7 of the OCTEON UART's LCR are set, it quits
39 * working.
40 */
41 if (offset == UART_LCR)
42 value &= 0x9f;
43 cvmx_write_csr((uint64_t)(up->membase + (offset << 3)), (u8)value);
44}
45
46static int octeon_serial_probe(struct platform_device *pdev)
47{
48 int irq, res;
49 struct resource *res_mem;
50 struct uart_8250_port up;
51
52 /* All adaptors have an irq. */
53 irq = platform_get_irq(pdev, 0);
54 if (irq < 0)
55 return irq;
56
57 memset(&up, 0, sizeof(up));
58
59 up.port.flags = ASYNC_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE;
60 up.port.type = PORT_OCTEON;
61 up.port.iotype = UPIO_MEM;
62 up.port.regshift = 3;
63 up.port.dev = &pdev->dev;
64
65 if (octeon_is_simulation())
66 /* Make simulator output fast*/
67 up.port.uartclk = 115200 * 16;
68 else
69 up.port.uartclk = octeon_get_io_clock_rate();
70
71 up.port.serial_in = octeon_serial_in;
72 up.port.serial_out = octeon_serial_out;
73 up.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 up.port.mapbase = res_mem->start;
81 up.port.membase = ioremap(res_mem->start, resource_size(res_mem));
82
83 res = serial8250_register_8250_port(&up);
84
85 return res >= 0 ? 0 : res;
86}
87
88static struct of_device_id octeon_serial_match[] = {
89 {
90 .compatible = "cavium,octeon-3860-uart",
91 },
92 {},
93};
94MODULE_DEVICE_TABLE(of, octeon_serial_match);
95
96static struct platform_driver octeon_serial_driver = {
97 .probe = octeon_serial_probe,
98 .driver = {
99 .owner = THIS_MODULE,
100 .name = "octeon_serial",
101 .of_match_table = octeon_serial_match,
102 },
103};
104
105static int __init octeon_serial_init(void)
106{
107 return platform_driver_register(&octeon_serial_driver);
108}
109late_initcall(octeon_serial_init);
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 2a75ff249e71..48b08eb9d9e4 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -41,12 +41,6 @@
41#include <asm/octeon/pci-octeon.h> 41#include <asm/octeon/pci-octeon.h>
42#include <asm/octeon/cvmx-mio-defs.h> 42#include <asm/octeon/cvmx-mio-defs.h>
43 43
44#ifdef CONFIG_CAVIUM_DECODE_RSL
45extern void cvmx_interrupt_rsl_decode(void);
46extern int __cvmx_interrupt_ecc_report_single_bit_errors;
47extern void cvmx_interrupt_rsl_enable(void);
48#endif
49
50extern struct plat_smp_ops octeon_smp_ops; 44extern struct plat_smp_ops octeon_smp_ops;
51 45
52#ifdef CONFIG_PCI 46#ifdef CONFIG_PCI
@@ -464,18 +458,6 @@ static void octeon_halt(void)
464} 458}
465 459
466/** 460/**
467 * Handle all the error condition interrupts that might occur.
468 *
469 */
470#ifdef CONFIG_CAVIUM_DECODE_RSL
471static irqreturn_t octeon_rlm_interrupt(int cpl, void *dev_id)
472{
473 cvmx_interrupt_rsl_decode();
474 return IRQ_HANDLED;
475}
476#endif
477
478/**
479 * Return a string representing the system type 461 * Return a string representing the system type
480 * 462 *
481 * Returns 463 * Returns
@@ -1065,15 +1047,6 @@ void prom_free_prom_memory(void)
1065 panic("Core-14449 WAR not in place (%04x).\n" 1047 panic("Core-14449 WAR not in place (%04x).\n"
1066 "Please build kernel with proper options (CONFIG_CAVIUM_CN63XXP1).", insn); 1048 "Please build kernel with proper options (CONFIG_CAVIUM_CN63XXP1).", insn);
1067 } 1049 }
1068#ifdef CONFIG_CAVIUM_DECODE_RSL
1069 cvmx_interrupt_rsl_enable();
1070
1071 /* Add an interrupt handler for general failures. */
1072 if (request_irq(OCTEON_IRQ_RML, octeon_rlm_interrupt, IRQF_SHARED,
1073 "RML/RSL", octeon_rlm_interrupt)) {
1074 panic("Unable to request_irq(OCTEON_IRQ_RML)");
1075 }
1076#endif
1077} 1050}
1078 1051
1079int octeon_prune_device_tree(void); 1052int octeon_prune_device_tree(void);