aboutsummaryrefslogtreecommitdiffstats
path: root/package/boot/uboot-lantiq/patches/0020-net-switchlib-add-driver-for-Lantiq-PSB697X-switch-f.patch
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2014-04-12 21:21:14 +0000
committerJohn Crispin <john@openwrt.org>2014-04-12 21:21:14 +0000
commit1246dce0b31d3b950e04ab3a6fd466f289510c7c (patch)
tree5a8031c749e5208b4e979aad0f54ebb7841670b3 /package/boot/uboot-lantiq/patches/0020-net-switchlib-add-driver-for-Lantiq-PSB697X-switch-f.patch
parent22916814e3621dd807b0d89485ba3c60cfdf7c10 (diff)
downloadupstream-1246dce0b31d3b950e04ab3a6fd466f289510c7c.tar.gz
upstream-1246dce0b31d3b950e04ab3a6fd466f289510c7c.tar.bz2
upstream-1246dce0b31d3b950e04ab3a6fd466f289510c7c.zip
uboot-lantiq: update to v2013.10
Patches created from tree: git@github.com:danielschwierzeck/u-boot-lantiq.git v2013.10..u-boot-lantiq-v2013.10-openwrt4 Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> SVN-Revision: 40482
Diffstat (limited to 'package/boot/uboot-lantiq/patches/0020-net-switchlib-add-driver-for-Lantiq-PSB697X-switch-f.patch')
-rw-r--r--package/boot/uboot-lantiq/patches/0020-net-switchlib-add-driver-for-Lantiq-PSB697X-switch-f.patch162
1 files changed, 0 insertions, 162 deletions
diff --git a/package/boot/uboot-lantiq/patches/0020-net-switchlib-add-driver-for-Lantiq-PSB697X-switch-f.patch b/package/boot/uboot-lantiq/patches/0020-net-switchlib-add-driver-for-Lantiq-PSB697X-switch-f.patch
deleted file mode 100644
index c017e0fb03..0000000000
--- a/package/boot/uboot-lantiq/patches/0020-net-switchlib-add-driver-for-Lantiq-PSB697X-switch-f.patch
+++ /dev/null
@@ -1,162 +0,0 @@
-From b8c666eda693906488637c414db9db35b6760e4a Mon Sep 17 00:00:00 2001
-From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
-Date: Wed, 29 Aug 2012 22:08:15 +0200
-Subject: net: switchlib: add driver for Lantiq PSB697X switch family
-
-Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
-
---- a/drivers/net/switch/Makefile
-+++ b/drivers/net/switch/Makefile
-@@ -11,6 +11,7 @@ include $(TOPDIR)/config.mk
- LIB := $(obj)libswitch.o
-
- COBJS-$(CONFIG_SWITCH_MULTI) += switch.o
-+COBJS-$(CONFIG_SWITCH_PSB697X) += psb697x.o
-
- COBJS := $(COBJS-y)
- SRCS := $(COBJS:.o=.c)
---- /dev/null
-+++ b/drivers/net/switch/psb697x.c
-@@ -0,0 +1,119 @@
-+/*
-+ * Copyright (C) 2011-2012 Daniel Schwierzeck, daniel.schwierzeck@gmail.com
-+ *
-+ * This file is released under the terms of GPL v2 and any later version.
-+ * See the file COPYING in the root directory of the source tree for details.
-+ */
-+
-+#include <common.h>
-+#include <malloc.h>
-+#include <switch.h>
-+#include <miiphy.h>
-+
-+#define PSB697X_CHIPID1 0x2599
-+#define PSB697X_PORT_COUNT 7
-+
-+#define PSB697X_PORT_BASE(p) (p * 0x20)
-+#define PSB697X_REG_PS(p) (PSB697X_PORT_BASE(p) + 0x00)
-+#define PSB697X_REG_PBC(p) (PSB697X_PORT_BASE(p) + 0x01)
-+#define PSB697X_REG_PEC(p) (PSB697X_PORT_BASE(p) + 0x02)
-+
-+#define PSB697X_REG_SGC1 0x0E0 /* Switch Global Control Register 1 */
-+#define PSB697X_REG_SGC2 0x0E1 /* Switch Global Control Register 2 */
-+#define PSB697X_REG_CMH 0x0E2 /* CPU Port & Mirror Control */
-+#define PSB697X_REG_MIICR 0x0F5 /* MII Port Control */
-+#define PSB697X_REG_CI0 0x100 /* Chip Identifier 0 */
-+#define PSB697X_REG_CI1 0x101 /* Chip Identifier 1 */
-+#define PSB697X_REG_MIIAC 0x120 /* MII Indirect Access Control */
-+#define PSB697X_REG_MIIWD 0x121 /* MII Indirect Write Data */
-+#define PSB697X_REG_MIIRD 0x122 /* MII Indirect Read Data */
-+
-+#define PSB697X_REG_PORT_FLP (1 << 2) /* Force link up */
-+#define PSB697X_REG_PORT_FLD (1 << 1) /* Force link down */
-+
-+#define PSB697X_REG_SGC2_SE (1 << 15) /* Switch enable */
-+
-+#define PSB697X_REG_CMH_CPN_MASK 0x7
-+#define PSB697X_REG_CMH_CPN_SHIFT 5
-+
-+
-+static inline int psb697x_mii_read(struct mii_dev *bus, u16 reg)
-+{
-+ int ret;
-+
-+ ret = bus->read(bus, (reg >> 5) & 0x1f, MDIO_DEVAD_NONE, reg & 0x1f);
-+
-+ return ret;
-+}
-+
-+static inline int psb697x_mii_write(struct mii_dev *bus, u16 reg, u16 val)
-+{
-+ int ret;
-+
-+ ret = bus->write(bus, (reg >> 5) & 0x1f, MDIO_DEVAD_NONE,
-+ reg & 0x1f, val);
-+
-+ return ret;
-+}
-+
-+static int psb697x_probe(struct switch_device *dev)
-+{
-+ struct mii_dev *bus = dev->bus;
-+ int ci1;
-+
-+ ci1 = psb697x_mii_read(bus, PSB697X_REG_CI1);
-+
-+ if (ci1 == PSB697X_CHIPID1)
-+ return 0;
-+
-+ return 1;
-+}
-+
-+static void psb697x_setup(struct switch_device *dev)
-+{
-+ struct mii_dev *bus = dev->bus;
-+ int i, state;
-+
-+ /* Enable switch */
-+ psb697x_mii_write(bus, PSB697X_REG_SGC2, PSB697X_REG_SGC2_SE);
-+
-+ /*
-+ * Force 100 Mbps as default value for CPU ports 5 and 6 to get
-+ * full speed.
-+ */
-+ psb697x_mii_write(bus, PSB697X_REG_MIICR, 0x0773);
-+
-+ for (i = 0; i < PSB697X_PORT_COUNT; i++) {
-+ state = dev->port_mask & (1 << i);
-+
-+ /*
-+ * Software workaround from Errata Sheet:
-+ * Force link down and reset internal PHY, keep that state
-+ * for all unconnected ports and disable force link down
-+ * for all connected ports
-+ */
-+ psb697x_mii_write(bus, PSB697X_REG_PBC(i),
-+ PSB697X_REG_PORT_FLD);
-+
-+ if (i == dev->cpu_port)
-+ /* Force link up for CPU port */
-+ psb697x_mii_write(bus, PSB697X_REG_PBC(i),
-+ PSB697X_REG_PORT_FLP);
-+ else if (state)
-+ /* Disable force link down for active LAN ports */
-+ psb697x_mii_write(bus, PSB697X_REG_PBC(i), 0);
-+ }
-+}
-+
-+static struct switch_driver psb697x_drv = {
-+ .name = "psb697x",
-+};
-+
-+void switch_psb697x_init(void)
-+{
-+ /* For archs with manual relocation */
-+ psb697x_drv.probe = psb697x_probe;
-+ psb697x_drv.setup = psb697x_setup;
-+
-+ switch_driver_register(&psb697x_drv);
-+}
---- a/drivers/net/switch/switch.c
-+++ b/drivers/net/switch/switch.c
-@@ -18,6 +18,10 @@ void switch_init(void)
- INIT_LIST_HEAD(&switch_drivers);
- INIT_LIST_HEAD(&switch_devices);
-
-+#if defined(CONFIG_SWITCH_PSB697X)
-+ switch_psb697x_init();
-+#endif
-+
- board_switch_init();
- }
-
---- a/include/switch.h
-+++ b/include/switch.h
-@@ -90,6 +90,7 @@ static inline void switch_setup(struct s
- }
-
- /* Init functions for supported Switch drivers */
-+extern void switch_psb697x_init(void);
-
- #endif /* __SWITCH_H */
-