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

MIPS: Octeon: Add Octeon III CN7xxx interface detection

Add basic CN7XXX interface detection.

This allows the kernel to boot with ethernet working as it initializes
the ethernet ports with SGMII instead of defaulting to RGMII routines.

Tested on the utm8 from Rhino Labs with a CN7130.

Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Acked-by: David Daney <david.daney@cavium.com>
Cc: janne.huttunen@nokia.com
Cc: aaro.koskinen@nokia.com
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/12376/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Zubair Lutfullah Kakakhel and committed by
Ralf Baechle
885872b7 04cc89d1

+43
+43
arch/mips/cavium-octeon/executive/cvmx-helper.c
··· 87 87 return 9; 88 88 if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN52XX)) 89 89 return 4; 90 + if (OCTEON_IS_MODEL(OCTEON_CN7XXX)) 91 + return 5; 90 92 else 91 93 return 3; 92 94 } ··· 262 260 } 263 261 264 262 /** 263 + * @INTERNAL 264 + * Return interface mode for CN7XXX. 265 + */ 266 + static cvmx_helper_interface_mode_t __cvmx_get_mode_cn7xxx(int interface) 267 + { 268 + union cvmx_gmxx_inf_mode mode; 269 + 270 + mode.u64 = cvmx_read_csr(CVMX_GMXX_INF_MODE(interface)); 271 + 272 + switch (interface) { 273 + case 0: 274 + case 1: 275 + switch (mode.cn68xx.mode) { 276 + case 0: 277 + return CVMX_HELPER_INTERFACE_MODE_DISABLED; 278 + case 1: 279 + case 2: 280 + return CVMX_HELPER_INTERFACE_MODE_SGMII; 281 + case 3: 282 + return CVMX_HELPER_INTERFACE_MODE_XAUI; 283 + default: 284 + return CVMX_HELPER_INTERFACE_MODE_SGMII; 285 + } 286 + case 2: 287 + return CVMX_HELPER_INTERFACE_MODE_NPI; 288 + case 3: 289 + return CVMX_HELPER_INTERFACE_MODE_LOOP; 290 + case 4: 291 + return CVMX_HELPER_INTERFACE_MODE_RGMII; 292 + default: 293 + return CVMX_HELPER_INTERFACE_MODE_DISABLED; 294 + } 295 + } 296 + 297 + /** 265 298 * Get the operating mode of an interface. Depending on the Octeon 266 299 * chip and configuration, this function returns an enumeration 267 300 * of the type of packet I/O supported by an interface. ··· 313 276 if (interface < 0 || 314 277 interface >= cvmx_helper_get_number_of_interfaces()) 315 278 return CVMX_HELPER_INTERFACE_MODE_DISABLED; 279 + 280 + /* 281 + * OCTEON III models 282 + */ 283 + if (OCTEON_IS_MODEL(OCTEON_CN7XXX)) 284 + return __cvmx_get_mode_cn7xxx(interface); 316 285 317 286 /* 318 287 * Octeon II models