octeon: add support for the octeon mips64 SoC
[15.05/openwrt.git] / target / linux / octeon / patches-3.10 / 0002-MIPS-Octeon-Enable-interfaces-on-EdgeRouter-Lite.patch
1 From a135a9b5d9683ace787c7d86f1e642d9acfacdde Mon Sep 17 00:00:00 2001
2 From: Aaro Koskinen <aaro.koskinen@iki.fi>
3 Date: Sun, 23 Jun 2013 20:38:44 +0000
4 Subject: [PATCH] MIPS: Octeon: Enable interfaces on EdgeRouter Lite
5
6 Enable interfaces on EdgeRouter Lite. Tested with cavium_octeon_defconfig
7 and busybox shell. DHCP & ping works with eth0, eth1 and eth2.
8
9 The board type "UBNT_E100" is taken from the sources of the vendor kernel
10 shipped with the product.
11
12 Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
13 Acked-by: David Daney <david.daney@cavium.com>
14 Cc: linux-mips@linux-mips.org
15 Patchwork: https://patchwork.linux-mips.org/patch/5546/
16 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
17 ---
18  arch/mips/cavium-octeon/executive/cvmx-helper-board.c |   13 +++++++++++++
19  arch/mips/include/asm/octeon/cvmx-bootinfo.h          |    2 ++
20  2 files changed, 15 insertions(+)
21
22 diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
23 index 7c64977..0a1283c 100644
24 --- a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
25 +++ b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
26 @@ -181,6 +181,11 @@ int cvmx_helper_board_get_mii_address(int ipd_port)
27                         return ipd_port - 16 + 4;
28                 else
29                         return -1;
30 +       case CVMX_BOARD_TYPE_UBNT_E100:
31 +               if (ipd_port >= 0 && ipd_port <= 2)
32 +                       return 7 - ipd_port;
33 +               else
34 +                       return -1;
35         }
36  
37         /* Some unknown board. Somebody forgot to update this function... */
38 @@ -706,6 +711,14 @@ int __cvmx_helper_board_hardware_enable(int interface)
39                                 }
40                         }
41                 }
42 +       } else if (cvmx_sysinfo_get()->board_type ==
43 +                       CVMX_BOARD_TYPE_UBNT_E100) {
44 +               cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(0, interface), 0);
45 +               cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(0, interface), 0x10);
46 +               cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(1, interface), 0);
47 +               cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(1, interface), 0x10);
48 +               cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(2, interface), 0);
49 +               cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(2, interface), 0x10);
50         }
51         return 0;
52  }
53 diff --git a/arch/mips/include/asm/octeon/cvmx-bootinfo.h b/arch/mips/include/asm/octeon/cvmx-bootinfo.h
54 index 284fa8d..7b7818d 100644
55 --- a/arch/mips/include/asm/octeon/cvmx-bootinfo.h
56 +++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h
57 @@ -227,6 +227,7 @@ enum cvmx_board_types_enum {
58          * use any numbers in this range.
59          */
60         CVMX_BOARD_TYPE_CUST_PRIVATE_MIN = 20001,
61 +       CVMX_BOARD_TYPE_UBNT_E100 = 20002,
62         CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 30000,
63  
64         /* The remaining range is reserved for future use. */
65 @@ -325,6 +326,7 @@ static inline const char *cvmx_board_type_to_string(enum
66  
67                     /* Customer private range */
68                 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MIN)
69 +               ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_UBNT_E100)
70                 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX)
71         }
72         return "Unsupported Board";
73 -- 
74 1.7.10.4
75