summaryrefslogtreecommitdiff
path: root/target/linux/octeon/patches-3.10
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2013-08-04 13:54:32 +0000
committerJohn Crispin <john@openwrt.org>2013-08-04 13:54:32 +0000
commit3a2040ffee99053070cd3f0424f40f64ba6403c9 (patch)
tree1a67f8449ff8d10237125a4f2c80d61bff916dc2 /target/linux/octeon/patches-3.10
parent8a4726bca828860a140bef2e81cfcc653b440247 (diff)
downloadmtk-20170518-3a2040ffee99053070cd3f0424f40f64ba6403c9.zip
mtk-20170518-3a2040ffee99053070cd3f0424f40f64ba6403c9.tar.gz
mtk-20170518-3a2040ffee99053070cd3f0424f40f64ba6403c9.tar.bz2
octeon: add support for the octeon mips64 SoC
This is the SoC used be the ESR Lite made by ubnt.com Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 37684
Diffstat (limited to 'target/linux/octeon/patches-3.10')
-rw-r--r--target/linux/octeon/patches-3.10/0001-MIPS-Octeon-Fix-DT-pruning-bug-with-pip-ports.patch46
-rw-r--r--target/linux/octeon/patches-3.10/0002-MIPS-Octeon-Enable-interfaces-on-EdgeRouter-Lite.patch75
-rw-r--r--target/linux/octeon/patches-3.10/0003-staging-MIPS-add-Octeon-USB-HCD-support.patch87
-rw-r--r--target/linux/octeon/patches-3.10/0004-fix_hcd.patch115
4 files changed, 323 insertions, 0 deletions
diff --git a/target/linux/octeon/patches-3.10/0001-MIPS-Octeon-Fix-DT-pruning-bug-with-pip-ports.patch b/target/linux/octeon/patches-3.10/0001-MIPS-Octeon-Fix-DT-pruning-bug-with-pip-ports.patch
new file mode 100644
index 0000000..6f12700
--- /dev/null
+++ b/target/linux/octeon/patches-3.10/0001-MIPS-Octeon-Fix-DT-pruning-bug-with-pip-ports.patch
@@ -0,0 +1,46 @@
+From ab2bb148c5932712d2717a7f3a452846f07a660a Mon Sep 17 00:00:00 2001
+From: Faidon Liambotis <paravoid@debian.org>
+Date: Thu, 11 Jul 2013 21:08:09 +0000
+Subject: [PATCH] MIPS: Octeon: Fix DT pruning bug with pip ports
+
+During the pruning of the device tree octeon_fdt_pip_iface() is called
+for each PIP interface and every port up to the port count is removed
+from the device tree. However, the count was set to the return value of
+cvmx_helper_interface_enumerate() which doesn't actually return the
+count but just returns zero on success. This effectively removed *all*
+ports from the tree.
+
+Use cvmx_helper_ports_on_interface() instead to fix this. This
+successfully restores the 3 ports of my ERLite-3 and fixes the "kernel
+assigns random MAC addresses" issue.
+
+Signed-off-by: Faidon Liambotis <paravoid@debian.org>
+Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
+Acked-by: David Daney <david.daney@cavium.com>
+Cc: linux-mips@linux-mips.org
+Patchwork: https://patchwork.linux-mips.org/patch/5587/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/cavium-octeon/octeon-platform.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
+index 7b746e7..1830874 100644
+--- a/arch/mips/cavium-octeon/octeon-platform.c
++++ b/arch/mips/cavium-octeon/octeon-platform.c
+@@ -334,9 +334,10 @@ static void __init octeon_fdt_pip_iface(int pip, int idx, u64 *pmac)
+ char name_buffer[20];
+ int iface;
+ int p;
+- int count;
++ int count = 0;
+
+- count = cvmx_helper_interface_enumerate(idx);
++ if (cvmx_helper_interface_enumerate(idx) == 0)
++ count = cvmx_helper_ports_on_interface(idx);
+
+ snprintf(name_buffer, sizeof(name_buffer), "interface@%d", idx);
+ iface = fdt_subnode_offset(initial_boot_params, pip, name_buffer);
+--
+1.7.10.4
+
diff --git a/target/linux/octeon/patches-3.10/0002-MIPS-Octeon-Enable-interfaces-on-EdgeRouter-Lite.patch b/target/linux/octeon/patches-3.10/0002-MIPS-Octeon-Enable-interfaces-on-EdgeRouter-Lite.patch
new file mode 100644
index 0000000..030d1e2
--- /dev/null
+++ b/target/linux/octeon/patches-3.10/0002-MIPS-Octeon-Enable-interfaces-on-EdgeRouter-Lite.patch
@@ -0,0 +1,75 @@
+From a135a9b5d9683ace787c7d86f1e642d9acfacdde Mon Sep 17 00:00:00 2001
+From: Aaro Koskinen <aaro.koskinen@iki.fi>
+Date: Sun, 23 Jun 2013 20:38:44 +0000
+Subject: [PATCH] MIPS: Octeon: Enable interfaces on EdgeRouter Lite
+
+Enable interfaces on EdgeRouter Lite. Tested with cavium_octeon_defconfig
+and busybox shell. DHCP & ping works with eth0, eth1 and eth2.
+
+The board type "UBNT_E100" is taken from the sources of the vendor kernel
+shipped with the product.
+
+Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
+Acked-by: David Daney <david.daney@cavium.com>
+Cc: linux-mips@linux-mips.org
+Patchwork: https://patchwork.linux-mips.org/patch/5546/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/cavium-octeon/executive/cvmx-helper-board.c | 13 +++++++++++++
+ arch/mips/include/asm/octeon/cvmx-bootinfo.h | 2 ++
+ 2 files changed, 15 insertions(+)
+
+diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
+index 7c64977..0a1283c 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)
+ return ipd_port - 16 + 4;
+ else
+ return -1;
++ case CVMX_BOARD_TYPE_UBNT_E100:
++ if (ipd_port >= 0 && ipd_port <= 2)
++ return 7 - ipd_port;
++ else
++ return -1;
+ }
+
+ /* Some unknown board. Somebody forgot to update this function... */
+@@ -706,6 +711,14 @@ int __cvmx_helper_board_hardware_enable(int interface)
+ }
+ }
+ }
++ } else if (cvmx_sysinfo_get()->board_type ==
++ CVMX_BOARD_TYPE_UBNT_E100) {
++ cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(0, interface), 0);
++ cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(0, interface), 0x10);
++ cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(1, interface), 0);
++ cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(1, interface), 0x10);
++ cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(2, interface), 0);
++ cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(2, interface), 0x10);
+ }
+ return 0;
+ }
+diff --git a/arch/mips/include/asm/octeon/cvmx-bootinfo.h b/arch/mips/include/asm/octeon/cvmx-bootinfo.h
+index 284fa8d..7b7818d 100644
+--- a/arch/mips/include/asm/octeon/cvmx-bootinfo.h
++++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h
+@@ -227,6 +227,7 @@ enum cvmx_board_types_enum {
+ * use any numbers in this range.
+ */
+ CVMX_BOARD_TYPE_CUST_PRIVATE_MIN = 20001,
++ CVMX_BOARD_TYPE_UBNT_E100 = 20002,
+ CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 30000,
+
+ /* The remaining range is reserved for future use. */
+@@ -325,6 +326,7 @@ static inline const char *cvmx_board_type_to_string(enum
+
+ /* Customer private range */
+ ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MIN)
++ ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_UBNT_E100)
+ ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX)
+ }
+ return "Unsupported Board";
+--
+1.7.10.4
+
diff --git a/target/linux/octeon/patches-3.10/0003-staging-MIPS-add-Octeon-USB-HCD-support.patch b/target/linux/octeon/patches-3.10/0003-staging-MIPS-add-Octeon-USB-HCD-support.patch
new file mode 100644
index 0000000..260dc1b
--- /dev/null
+++ b/target/linux/octeon/patches-3.10/0003-staging-MIPS-add-Octeon-USB-HCD-support.patch
@@ -0,0 +1,87 @@
+From b164935b38d64557a32892e7aa45e213e9d11ea8 Mon Sep 17 00:00:00 2001
+From: Aaro Koskinen <aaro.koskinen@iki.fi>
+Date: Sat, 1 Jun 2013 21:42:58 +0300
+Subject: [PATCH] staging: MIPS: add Octeon USB HCD support
+
+Add support for Octeon USB HCD. Tested on EdgeRouter Lite with USB
+mass storage.
+
+The driver has been extracted from GPL sources of EdgeRouter Lite firmware
+(based on Linux 2.6.32.13). Some minor fixes and cleanups have been done
+to make it work with 3.10-rc3.
+
+$ uname -a
+Linux (none) 3.10.0-rc3-edge-00005-g86cb5bc #41 SMP PREEMPT Sat Jun 1 20:41:46 EEST 2013 mips64 GNU/Linux
+$ modprobe octeon-usb
+[ 37.971683] octeon_usb: module is from the staging directory, the quality is unknown, you have been warned.
+[ 37.983649] OcteonUSB: Detected 1 ports
+[ 37.999360] OcteonUSB OcteonUSB.0: Octeon Host Controller
+[ 38.004847] OcteonUSB OcteonUSB.0: new USB bus registered, assigned bus number 1
+[ 38.012332] OcteonUSB OcteonUSB.0: irq 122, io mem 0x00000000
+[ 38.019970] hub 1-0:1.0: USB hub found
+[ 38.023851] hub 1-0:1.0: 1 port detected
+[ 38.028101] OcteonUSB: Registered HCD for port 0 on irq 122
+[ 38.391443] usb 1-1: new high-speed USB device number 2 using OcteonUSB
+[ 38.586922] usb-storage 1-1:1.0: USB Mass Storage device detected
+[ 38.597375] scsi0 : usb-storage 1-1:1.0
+[ 39.604111] scsi 0:0:0:0: Direct-Access USB DISK 2.0 PMAP PQ: 0 ANSI: 4
+[ 39.619113] sd 0:0:0:0: [sda] 7579008 512-byte logical blocks: (3.88 GB/3.61 GiB)
+[ 39.630696] sd 0:0:0:0: [sda] Write Protect is off
+[ 39.635945] sd 0:0:0:0: [sda] No Caching mode page present
+[ 39.641464] sd 0:0:0:0: [sda] Assuming drive cache: write through
+[ 39.651341] sd 0:0:0:0: [sda] No Caching mode page present
+[ 39.656917] sd 0:0:0:0: [sda] Assuming drive cache: write through
+[ 39.664296] sda: sda1 sda2
+[ 39.675574] sd 0:0:0:0: [sda] No Caching mode page present
+[ 39.681093] sd 0:0:0:0: [sda] Assuming drive cache: write through
+[ 39.687223] sd 0:0:0:0: [sda] Attached SCSI removable disk
+
+Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
+Cc: David Daney <ddaney.cavm@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/staging/Kconfig | 2 +
+ drivers/staging/Makefile | 1 +
+ drivers/staging/octeon-usb/Kconfig | 10 +
+ drivers/staging/octeon-usb/Makefile | 3 +
+ drivers/staging/octeon-usb/TODO | 11 +
+ drivers/staging/octeon-usb/cvmx-usb.c | 3344 ++++++++++++++++++++++++++
+ drivers/staging/octeon-usb/cvmx-usb.h | 1085 +++++++++
+ drivers/staging/octeon-usb/cvmx-usbcx-defs.h | 3086 ++++++++++++++++++++++++
+ drivers/staging/octeon-usb/cvmx-usbnx-defs.h | 1596 ++++++++++++
+ drivers/staging/octeon-usb/octeon-hcd.c | 854 +++++++
+ 10 files changed, 9992 insertions(+)
+ create mode 100644 drivers/staging/octeon-usb/Kconfig
+ create mode 100644 drivers/staging/octeon-usb/Makefile
+ create mode 100644 drivers/staging/octeon-usb/TODO
+ create mode 100644 drivers/staging/octeon-usb/cvmx-usb.c
+ create mode 100644 drivers/staging/octeon-usb/cvmx-usb.h
+ create mode 100644 drivers/staging/octeon-usb/cvmx-usbcx-defs.h
+ create mode 100644 drivers/staging/octeon-usb/cvmx-usbnx-defs.h
+ create mode 100644 drivers/staging/octeon-usb/octeon-hcd.c
+
+diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
+index 4464f26..f64b662 100644
+--- a/drivers/staging/Kconfig
++++ b/drivers/staging/Kconfig
+@@ -62,6 +62,8 @@ source "drivers/staging/line6/Kconfig"
+
+ source "drivers/staging/octeon/Kconfig"
+
++source "drivers/staging/octeon-usb/Kconfig"
++
+ source "drivers/staging/serqt_usb2/Kconfig"
+
+ source "drivers/staging/vt6655/Kconfig"
+diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
+index f689b9d..1fb58a1 100644
+--- a/drivers/staging/Makefile
++++ b/drivers/staging/Makefile
+@@ -25,6 +25,7 @@ obj-$(CONFIG_LINE6_USB) += line6/
+ obj-$(CONFIG_NETLOGIC_XLR_NET) += netlogic/
+ obj-$(CONFIG_USB_SERIAL_QUATECH2) += serqt_usb2/
+ obj-$(CONFIG_OCTEON_ETHERNET) += octeon/
++obj-$(CONFIG_OCTEON_USB) += octeon-usb/
+ obj-$(CONFIG_VT6655) += vt6655/
+ obj-$(CONFIG_VT6656) += vt6656/
+ obj-$(CONFIG_VME_BUS) += vme/
diff --git a/target/linux/octeon/patches-3.10/0004-fix_hcd.patch b/target/linux/octeon/patches-3.10/0004-fix_hcd.patch
new file mode 100644
index 0000000..e8cadbf
--- /dev/null
+++ b/target/linux/octeon/patches-3.10/0004-fix_hcd.patch
@@ -0,0 +1,115 @@
+Index: linux-3.10/drivers/staging/octeon-usb/octeon-hcd.c
+===================================================================
+--- linux-3.10.orig/drivers/staging/octeon-usb/octeon-hcd.c 2013-08-03 16:11:44.269610286 +0200
++++ linux-3.10/drivers/staging/octeon-usb/octeon-hcd.c 2013-08-04 13:18:54.011421971 +0200
+@@ -673,8 +673,9 @@
+ };
+
+
+-static int octeon_usb_driver_probe(struct device *dev)
++static int octeon_usb_driver_probe(struct platform_device *pdev)
+ {
++ struct device *dev = &pdev->dev;
+ int status;
+ int usb_num = to_platform_device(dev)->id;
+ int irq = platform_get_irq(to_platform_device(dev), 0);
+@@ -728,8 +729,9 @@
+ return 0;
+ }
+
+-static int octeon_usb_driver_remove(struct device *dev)
++static int octeon_usb_driver_remove(struct platform_device *pdev)
+ {
++ struct device *dev = &pdev->dev;
+ int status;
+ struct usb_hcd *hcd = dev_get_drvdata(dev);
+ struct octeon_hcd *priv = hcd_to_octeon(hcd);
+@@ -748,30 +750,35 @@
+ return 0;
+ }
+
+-static struct device_driver octeon_usb_driver = {
+- .name = "OcteonUSB",
+- .bus = &platform_bus_type,
++static struct platform_driver octeon_usb_driver = {
++ .driver = {
++ .name = "OcteonUSB",
++ .owner = THIS_MODULE,
++ },
+ .probe = octeon_usb_driver_probe,
+ .remove = octeon_usb_driver_remove,
+ };
+
++static struct resource octeon_usb_resources = {
++ .start = OCTEON_IRQ_USB0,
++ .end = OCTEON_IRQ_USB0,
++ .flags = IORESOURCE_IRQ,
++};
++
++static struct platform_device octeon_usb_device = {
++ .name = "OcteonUSB",
++ .id = 0,
++ .resource = &octeon_usb_resources,
++ .num_resources = 1,
++};
+
+-#define MAX_USB_PORTS 10
+-static struct platform_device *pdev_glob[MAX_USB_PORTS];
+-static int octeon_usb_registered;
+ static int __init octeon_usb_module_init(void)
+ {
+ int num_devices = cvmx_usb_get_num_ports();
+- int device;
+
+ if (usb_disabled() || num_devices == 0)
+ return -ENODEV;
+
+- if (driver_register(&octeon_usb_driver))
+- return -ENOMEM;
+-
+- octeon_usb_registered = 1;
+-
+ /*
+ * Only cn52XX and cn56XX have DWC_OTG USB hardware and the
+ * IOB priority registers. Under heavy network load USB
+@@ -792,37 +799,14 @@
+ cvmx_write_csr(CVMX_IOB_N2C_L2C_PRI_CNT, pri_cnt.u64);
+ }
+
+- for (device = 0; device < num_devices; device++) {
+- struct resource irq_resource;
+- struct platform_device *pdev;
+- memset(&irq_resource, 0, sizeof(irq_resource));
+- irq_resource.start = (device == 0) ? OCTEON_IRQ_USB0 : OCTEON_IRQ_USB1;
+- irq_resource.end = irq_resource.start;
+- irq_resource.flags = IORESOURCE_IRQ;
+- pdev = platform_device_register_simple((char *)octeon_usb_driver. name, device, &irq_resource, 1);
+- if (IS_ERR(pdev)) {
+- driver_unregister(&octeon_usb_driver);
+- octeon_usb_registered = 0;
+- return PTR_ERR(pdev);
+- }
+- if (device < MAX_USB_PORTS)
+- pdev_glob[device] = pdev;
++ platform_device_register(&octeon_usb_device);
+
+- }
+- return 0;
++ return platform_driver_register(&octeon_usb_driver);
+ }
+
+ static void __exit octeon_usb_module_cleanup(void)
+ {
+- int i;
+-
+- for (i = 0; i < MAX_USB_PORTS; i++)
+- if (pdev_glob[i]) {
+- platform_device_unregister(pdev_glob[i]);
+- pdev_glob[i] = NULL;
+- }
+- if (octeon_usb_registered)
+- driver_unregister(&octeon_usb_driver);
++ platform_driver_unregister(&octeon_usb_driver);
+ }
+
+ MODULE_LICENSE("GPL");