aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/cavium-octeon
diff options
context:
space:
mode:
authorDavid Daney <david.daney@cavium.com>2013-12-03 14:46:51 -0500
committerRalf Baechle <ralf@linux-mips.org>2014-01-23 07:02:35 -0500
commitd617f9e9b80632e5206f0a88b7b25ef39bd2612b (patch)
tree404e8004b810eeec04861136971c7ae9c57ba530 /arch/mips/cavium-octeon
parent23a91de41cd996f927efa2ca0805e882426eefb4 (diff)
MIPS: OCTEON: Supply OCTEON+ USB nodes in internal device trees.
This will be needed by the next patch to use said nodes for probing via the device tree. Signed-off-by: David Daney <david.daney@cavium.com> Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: John Crispin <blogic@openwrt.org> Patchwork: http://patchwork.linux-mips.org/patch/6185/
Diffstat (limited to 'arch/mips/cavium-octeon')
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper-board.c27
-rw-r--r--arch/mips/cavium-octeon/octeon-platform.c32
-rw-r--r--arch/mips/cavium-octeon/octeon_3xxx.dts19
3 files changed, 78 insertions, 0 deletions
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
index 0a1283ce47f5..b764df64be40 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
@@ -722,3 +722,30 @@ int __cvmx_helper_board_hardware_enable(int interface)
722 } 722 }
723 return 0; 723 return 0;
724} 724}
725
726/**
727 * Get the clock type used for the USB block based on board type.
728 * Used by the USB code for auto configuration of clock type.
729 *
730 * Return USB clock type enumeration
731 */
732enum cvmx_helper_board_usb_clock_types __cvmx_helper_board_usb_get_clock_type(void)
733{
734 switch (cvmx_sysinfo_get()->board_type) {
735 case CVMX_BOARD_TYPE_BBGW_REF:
736 case CVMX_BOARD_TYPE_LANAI2_A:
737 case CVMX_BOARD_TYPE_LANAI2_U:
738 case CVMX_BOARD_TYPE_LANAI2_G:
739 case CVMX_BOARD_TYPE_NIC10E_66:
740 case CVMX_BOARD_TYPE_UBNT_E100:
741 return USB_CLOCK_TYPE_CRYSTAL_12;
742 case CVMX_BOARD_TYPE_NIC10E:
743 return USB_CLOCK_TYPE_REF_12;
744 default:
745 break;
746 }
747 /* Most boards except NIC10e use a 12MHz crystal */
748 if (OCTEON_IS_MODEL(OCTEON_FAM_2))
749 return USB_CLOCK_TYPE_CRYSTAL_12;
750 return USB_CLOCK_TYPE_REF_48;
751}
diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index f68c75ab8ece..6df0f4d8f197 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -171,6 +171,7 @@ device_initcall(octeon_ohci_device_init);
171static struct of_device_id __initdata octeon_ids[] = { 171static struct of_device_id __initdata octeon_ids[] = {
172 { .compatible = "simple-bus", }, 172 { .compatible = "simple-bus", },
173 { .compatible = "cavium,octeon-6335-uctl", }, 173 { .compatible = "cavium,octeon-6335-uctl", },
174 { .compatible = "cavium,octeon-5750-usbn", },
174 { .compatible = "cavium,octeon-3860-bootbus", }, 175 { .compatible = "cavium,octeon-3860-bootbus", },
175 { .compatible = "cavium,mdio-mux", }, 176 { .compatible = "cavium,mdio-mux", },
176 { .compatible = "gpio-leds", }, 177 { .compatible = "gpio-leds", },
@@ -682,6 +683,37 @@ end_led:
682 } 683 }
683 } 684 }
684 685
686 /* DWC2 USB */
687 alias_prop = fdt_getprop(initial_boot_params, aliases,
688 "usbn", NULL);
689 if (alias_prop) {
690 int usbn = fdt_path_offset(initial_boot_params, alias_prop);
691
692 if (usbn >= 0 && (current_cpu_type() == CPU_CAVIUM_OCTEON2 ||
693 !octeon_has_feature(OCTEON_FEATURE_USB))) {
694 pr_debug("Deleting usbn\n");
695 fdt_nop_node(initial_boot_params, usbn);
696 fdt_nop_property(initial_boot_params, aliases, "usbn");
697 } else {
698 __be32 new_f[1];
699 enum cvmx_helper_board_usb_clock_types c;
700 c = __cvmx_helper_board_usb_get_clock_type();
701 switch (c) {
702 case USB_CLOCK_TYPE_REF_48:
703 new_f[0] = cpu_to_be32(48000000);
704 fdt_setprop_inplace(initial_boot_params, usbn,
705 "refclk-frequency", new_f, sizeof(new_f));
706 /* Fall through ...*/
707 case USB_CLOCK_TYPE_REF_12:
708 /* Missing "refclk-type" defaults to external. */
709 fdt_nop_property(initial_boot_params, usbn, "refclk-type");
710 break;
711 default:
712 break;
713 }
714 }
715 }
716
685 return 0; 717 return 0;
686} 718}
687 719
diff --git a/arch/mips/cavium-octeon/octeon_3xxx.dts b/arch/mips/cavium-octeon/octeon_3xxx.dts
index 88cb42d4cc49..fa33115bde33 100644
--- a/arch/mips/cavium-octeon/octeon_3xxx.dts
+++ b/arch/mips/cavium-octeon/octeon_3xxx.dts
@@ -550,6 +550,24 @@
550 big-endian-regs; 550 big-endian-regs;
551 }; 551 };
552 }; 552 };
553
554 usbn: usbn@1180068000000 {
555 compatible = "cavium,octeon-5750-usbn";
556 reg = <0x11800 0x68000000 0x0 0x1000>;
557 ranges; /* Direct mapping */
558 #address-cells = <2>;
559 #size-cells = <2>;
560 /* 12MHz, 24MHz and 48MHz allowed */
561 refclk-frequency = <12000000>;
562 /* Either "crystal" or "external" */
563 refclk-type = "crystal";
564
565 usbc@16f0010000000 {
566 compatible = "cavium,octeon-5750-usbc";
567 reg = <0x16f00 0x10000000 0x0 0x80000>;
568 interrupts = <0 56>;
569 };
570 };
553 }; 571 };
554 572
555 aliases { 573 aliases {
@@ -566,6 +584,7 @@
566 flash0 = &flash0; 584 flash0 = &flash0;
567 cf0 = &cf0; 585 cf0 = &cf0;
568 uctl = &uctl; 586 uctl = &uctl;
587 usbn = &usbn;
569 led0 = &led0; 588 led0 = &led0;
570 }; 589 };
571 }; 590 };