aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/patches-4.4/001-4.15-03-tty-bcm63xx_uart-use-refclk-for-the-expected-clock-n.patch
Commit message (Expand)AuthorAgeFilesLines
* brcm63xx: register serial through device treeJonas Gorski2017-12-161-1/+1
* brcm63xx: add clkdev lookup supportJonas Gorski2017-12-161-0/+26
id='n48' href='#n48'>48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
From 5ed5b5e9614fa5b02da699ab565af76c7e63d64d Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jogo@openwrt.org>
Date: Mon, 7 Jan 2013 17:45:39 +0100
Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices

---
 arch/mips/bcm63xx/Makefile                         |    2 +-
 arch/mips/bcm63xx/boards/board_bcm963xx.c          |   17 ++++-
 arch/mips/bcm63xx/dev-flash.c                      |    2 +-
 arch/mips/bcm63xx/pci-rt2x00-fixup.c               |   71 ++++++++++++++++++++
 .../include/asm/mach-bcm63xx/bcm63xx_dev_flash.h   |    2 +-
 .../mips/include/asm/mach-bcm63xx/board_bcm963xx.h |    9 ++-
 .../include/asm/mach-bcm63xx/pci_rt2x00_fixup.h    |    9 +++
 7 files changed, 104 insertions(+), 8 deletions(-)
 create mode 100644 arch/mips/bcm63xx/pci-rt2x00-fixup.c
 create mode 100644 arch/mips/include/asm/mach-bcm63xx/pci_rt2x00_fixup.h

--- a/arch/mips/bcm63xx/Makefile
+++ b/arch/mips/bcm63xx/Makefile
@@ -2,7 +2,7 @@ obj-y		+= clk.o cpu.o cs.o gpio.o irq.o
 		   setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \
 		   dev-pcmcia.o dev-rng.o \
 		   dev-wdt.o dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o \
-		   pci-ath9k-fixup.o usb-common.o sprom.o
+		   pci-ath9k-fixup.o pci-rt2x00-fixup.o usb-common.o sprom.o
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 
 obj-y		+= boards/
--- a/arch/mips/bcm63xx/boards/board_common.c
+++ b/arch/mips/bcm63xx/boards/board_common.c
@@ -33,6 +33,7 @@
 #include <bcm63xx_dev_usb_usbd.h>
 #include <board_bcm963xx.h>
 #include <pci_ath9k_fixup.h>
+#include <pci_rt2x00_fixup.h>
 
 #include "board_common.h"
 
@@ -248,9 +249,19 @@ int __init board_register_devices(void)
 	}
 
 	/* register any fixups */
-	for (i = 0; i < board.has_caldata; i++)
-		pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset,
-			board.caldata[i].endian_check, board.caldata[i].led_pin, board.caldata[i].led_active_high);
+	for (i = 0; i < board.has_caldata; i++) {
+		switch (board.caldata[i].vendor) {
+		case PCI_VENDOR_ID_ATHEROS:
+			pci_enable_ath9k_fixup(board.caldata[i].slot,
+				board.caldata[i].caldata_offset, board.caldata[i].endian_check,
+				board.caldata[i].led_pin, board.caldata[i].led_active_high);
+			break;
+		case PCI_VENDOR_ID_RALINK:
+			pci_enable_rt2x00_fixup(board.caldata[i].slot,
+				board.caldata[i].eeprom);
+			break;
+		}
+	}
 
 	return 0;
 }
--- /dev/null
+++ b/arch/mips/bcm63xx/pci-rt2x00-fixup.c
@@ -0,0 +1,72 @@
+/*
+ *  Broadcom BCM63XX RT2x00 EEPROM fixup helper.
+ *
+ *  Copyright (C) 2012 Álvaro Fernández Rojas <noltari@gmail.com>
+ *
+ *  Based on
+ *
+ *  Broadcom BCM63XX Ath9k EEPROM fixup helper.
+ *
+ *  Copyright (C) 2012 Jonas Gorski <jonas.gorski@gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#include <linux/if_ether.h>
+#include <linux/pci.h>
+#include <linux/platform_device.h>
+#include <linux/rt2x00_platform.h>
+
+#include <bcm63xx_nvram.h>
+#include <pci_rt2x00_fixup.h>
+
+struct rt2x00_fixup {
+	unsigned slot;
+	u8 mac[ETH_ALEN];
+	struct rt2x00_platform_data pdata;
+};
+
+static int rt2x00_num_fixups;
+static struct rt2x00_fixup rt2x00_fixups[2] = {
+	{
+		.slot = 255,
+	},
+	{
+		.slot = 255,
+	},
+};
+
+static void rt2x00_pci_fixup(struct pci_dev *dev)
+{
+	unsigned i;
+	struct rt2x00_platform_data *pdata = NULL;
+
+	for (i = 0; i < rt2x00_num_fixups; i++) {
+		if (rt2x00_fixups[i].slot != PCI_SLOT(dev->devfn))
+			continue;
+
+		pdata = &rt2x00_fixups[i].pdata;
+		break;
+	}
+
+	dev->dev.platform_data = pdata;
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_RALINK, PCI_ANY_ID, rt2x00_pci_fixup);
+
+void __init pci_enable_rt2x00_fixup(unsigned slot, char* eeprom)
+{
+	if (rt2x00_num_fixups >= ARRAY_SIZE(rt2x00_fixups))
+		return;
+
+	rt2x00_fixups[rt2x00_num_fixups].slot = slot;
+	rt2x00_fixups[rt2x00_num_fixups].pdata.eeprom_file_name = kstrdup(eeprom, GFP_KERNEL);
+
+	if (bcm63xx_nvram_get_mac_address(rt2x00_fixups[rt2x00_num_fixups].mac))
+		return;
+
+	rt2x00_fixups[rt2x00_num_fixups].pdata.mac_address = rt2x00_fixups[rt2x00_num_fixups].mac;
+	rt2x00_num_fixups++;
+}
+
--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
@@ -10,6 +10,7 @@
 #include <bcm63xx_dev_dsp.h>
 #include <bcm63xx_fallback_sprom.h>
 #include <pci_ath9k_fixup.h>
+#include <pci_rt2x00_fixup.h>
 
 /*
  * flash mapping
@@ -17,12 +18,16 @@
 #define BCM963XX_CFE_VERSION_OFFSET	0x570
 #define BCM963XX_NVRAM_OFFSET		0x580
 
-struct ath9k_caldata {
+struct bcm63xx_caldata {
+	unsigned int	vendor;
 	unsigned int	slot;
 	u32		caldata_offset;
+	/* Atheros */
 	unsigned int	endian_check:1;
 	int		led_pin;
 	bool		led_active_high;
+	/* Ralink */
+	char*		eeprom;
 };
 
 /*
@@ -46,7 +51,7 @@ struct board_info {
 	unsigned int	has_caldata:2;
 
 	/* wifi calibration data config */
-	struct ath9k_caldata caldata[2];
+	struct bcm63xx_caldata caldata[2];
 
 	/* ethernet config */
 	struct bcm63xx_enet_platform_data enet0;
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/pci_rt2x00_fixup.h
@@ -0,0 +1,9 @@
+#ifndef _PCI_RT2X00_FIXUP
+#define _PCI_RT2X00_FIXUP
+
+#define PCI_VENDOR_ID_RALINK 0x1814
+
+void pci_enable_rt2x00_fixup(unsigned slot, char* eeprom) __init;
+
+#endif /* _PCI_RT2X00_FIXUP */
+