Revert "ar71xx: Add support for Teltonika RUT900"

This reverts commit 224e5f5efa.

pepe2k pointed out that this was not ready to merge

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin 2017-05-18 15:31:26 +02:00
parent eee09bfe01
commit bad2f9c4dc
11 changed files with 1 additions and 525 deletions

View File

@ -423,9 +423,6 @@ get_status_led() {
tl-wdr6500-v2)
status_led="tp-link:white:system"
;;
tlt-rut900)
status_led="tlt:green:status"
;;
tube2h)
status_led="alfa:green:signal4"
;;

View File

@ -1154,9 +1154,6 @@ ar71xx_board_detect() {
*"TL-WR941ND")
name="tl-wr941nd"
;;
*"TLT-RUT900")
name="tlt-rut900"
;;
*"Tube2H")
name="tube2h"
;;

View File

@ -443,8 +443,7 @@ platform_check_image() {
tl-wr941nd-v5|\
tl-wr941nd-v6|\
tl-wr940n-v4|\
tl-wr941nd|\
tlt-rut900)
tl-wr941nd)
local magic_ver="0100"
case "$board" in

View File

@ -207,7 +207,6 @@ CONFIG_ATH79_MACH_TL_WR841N_V9=y
CONFIG_ATH79_MACH_TL_WR941ND=y
CONFIG_ATH79_MACH_TL_WR941ND_V6=y
CONFIG_ATH79_MACH_TL_WR940N_V4=y
CONFIG_ATH79_MACH_TLT_RUT900=y
CONFIG_ATH79_MACH_TUBE2H=y
CONFIG_ATH79_MACH_UBNT=y
CONFIG_ATH79_MACH_UBNT_UNIFIAC=y
@ -390,7 +389,6 @@ CONFIG_MTD_SPLIT_UIMAGE_FW=y
CONFIG_MTD_SPLIT_WRGG_FW=y
CONFIG_MTD_SPLIT_MINOR_FW=y
CONFIG_MTD_TPLINK_PARTS=y
CONFIG_MTD_TLT_PARTS=y
CONFIG_MYLOADER=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_PER_CPU_KM=y

View File

@ -2021,14 +2021,3 @@ config ATH79_MACH_TL_WPA8630
select ATH79_DEV_LEDS_GPIO
select ATH79_DEV_M25P80
select ATH79_DEV_WMAC
config ATH79_MACH_TLT_RUT900
bool "Teltonika RUT900 board support"
select SOC_AR934X
select ATH79_DEV_AP9X_PCI if PCI
select ATH79_DEV_ETH
select ATH79_DEV_GPIO_BUTTONS
select ATH79_DEV_LEDS_GPIO
select ATH79_DEV_M25P80
select ATH79_DEV_USB
select ATH79_DEV_WMAC

View File

@ -212,7 +212,6 @@ obj-$(CONFIG_ATH79_MACH_TL_WR841N_V9) += mach-tl-wr841n-v9.o
obj-$(CONFIG_ATH79_MACH_TL_WR941ND) += mach-tl-wr941nd.o
obj-$(CONFIG_ATH79_MACH_TL_WR941ND_V6) += mach-tl-wr941nd-v6.o
obj-$(CONFIG_ATH79_MACH_TL_WR940N_V4) += mach-tl-wr940n-v4.o
obj-$(CONFIG_ATH79_MACH_TLT_RUT900) += mach-tlt-rut900.o
obj-$(CONFIG_ATH79_MACH_TUBE2H) += mach-tube2h.o
obj-$(CONFIG_ATH79_MACH_UBNT) += mach-ubnt.o
obj-$(CONFIG_ATH79_MACH_UBNT_UNIFIAC) += mach-ubnt-unifiac.o

View File

@ -1,260 +0,0 @@
/*
* TELTONIKA TLT-RUT900 board support
*
* Copyright (C) 2014 Teltonika
*
* 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/phy.h>
#include <linux/gpio.h>
#include <linux/platform_device.h>
#include <linux/ath9k_platform.h>
#include <linux/ar8216_platform.h>
#include <linux/mmc/host.h>
#include <linux/spi/spi.h>
#include <linux/spi/mmc_spi.h>
#include <asm/mach-ath79/ar71xx_regs.h>
#include "common.h"
#include "dev-eth.h"
#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#include "dev-m25p80.h"
#include "dev-spi.h"
#include "dev-usb.h"
#include "dev-wmac.h"
#include "machtypes.h"
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <linux/i2c-gpio.h>
/* I2C interface */
#define rut900_GPIO_SDA 17
#define rut900_GPIO_SCK 16
#define RUT900_GPIO_LED_BAR0 48
#define RUT900_GPIO_LED_BAR1 49
#define RUT900_GPIO_LED_BAR2 50
#define RUT900_GPIO_LED_BAR3 51
#define RUT900_GPIO_LED_BAR4 52
#define RUT900_GPIO_LED_ST_GRE 54
#define RUT900_GPIO_LED_ST_RED 53
//#define RUT900_GPIO_LED_WAN 18
#define RUT900_GPIO_LED_LAN1 14
#define RUT900_GPIO_LED_LAN2 13
#define RUT900_GPIO_LED_LAN3 22
#define RUT900_GPIO_LED_WAN 1
#define RUT900_GPIO_EXTERNAL_LNA0 2
//#define RUT900_GPIO_EXTERNAL_LNA1 3
#define RUT900_GPIO_BTN_RESET 15
#define RUT900_GPIO_BTN_EXPANDER 4
#define RUT900_GPIO_BTN_TEST 58
#define RUT900_GPIO_MMC_CS 3
//#define RUT900_GPIO_EXPANDER_POWER 11
#define RUT900_KEYS_POLL_INTERVAL 20 /* msecs */
#define RUT900_KEYS_DEBOUNCE_INTERVAL (3 * RUT900_KEYS_POLL_INTERVAL)
#define RUT900_KEYS_DEBOUNCE_INTERVAL_DIN 20
#define RUT900_MAC0_OFFSET 0
#define RUT900_MAC1_OFFSET 6
#define RUT900_WMAC_CALDATA_OFFSET 0x1000
#define RUT900_PCIE_CALDATA_OFFSET 0x5000
static struct i2c_gpio_platform_data rut900_i2c_device_platdata = {
.sda_pin = rut900_GPIO_SDA,
.scl_pin = rut900_GPIO_SCK,
.udelay = 10,
};
static struct platform_device rut900_i2c_device = {
.name = "i2c-gpio",
.id = 0,
.num_resources = 0,
.resource = NULL,
.dev = {
.platform_data = &rut900_i2c_device_platdata,
},
};
static struct i2c_board_info rut900_i2c_devs[] __initdata = {
{
I2C_BOARD_INFO("pca9539", 0x74),
},
{
I2C_BOARD_INFO("mcp3221", 0x4D),
},
};
static void rut900_i2c_init(void)
{
/* The gpio interface */
platform_device_register(&rut900_i2c_device);
/* I2C devices */
i2c_register_board_info(0, rut900_i2c_devs, ARRAY_SIZE(rut900_i2c_devs));
}
//Flash partitions are calcutated in drivers/mtd/tltpart.c
static const char *rut900_part_probes[] = {
"tlt",
NULL,
};
static struct flash_platform_data rut900_flash_data = {
.part_probes = rut900_part_probes,
};
static struct gpio_led rut900_leds_gpio[] __initdata = {
{
.name = "tlt:green:signal_bar0",
.gpio = RUT900_GPIO_LED_BAR0,
.active_low = 0,
},
{
.name = "tlt:green:signal_bar1",
.gpio = RUT900_GPIO_LED_BAR1,
.active_low = 0,
},
{
.name = "tlt:green:signal_bar2",
.gpio = RUT900_GPIO_LED_BAR2,
.active_low = 0,
},
{
.name = "tlt:green:signal_bar3",
.gpio = RUT900_GPIO_LED_BAR3,
.active_low = 0,
},
{
.name = "tlt:green:signal_bar4",
.gpio = RUT900_GPIO_LED_BAR4,
.active_low = 0,
},
{
.name = "tlt:green:status",
.gpio = RUT900_GPIO_LED_ST_GRE,
.active_low = 0,
},
{
.name = "tlt:red:status",
.gpio = RUT900_GPIO_LED_ST_RED,
.active_low = 0,
},
};
static struct gpio_keys_button rut900_gpio_keys[] __initdata = {
{
.desc = "Reset button",
.type = EV_KEY,
.code = KEY_RESTART,
.debounce_interval = RUT900_KEYS_DEBOUNCE_INTERVAL,
.gpio = RUT900_GPIO_BTN_RESET,
.active_low = 1,
},
{
.desc = "Expander interrupt",
.type = EV_KEY,
.code = KEY_RFKILL,
.debounce_interval = RUT900_KEYS_DEBOUNCE_INTERVAL_DIN,
.gpio = RUT900_GPIO_BTN_EXPANDER,
},
};
static struct spi_board_info ath79_spi_info[] = {
{
.bus_num = 0,
.chip_select = 0,
.max_speed_hz = 25000000,
.modalias = "m25p80",
.platform_data = &rut900_flash_data,
},
{
.bus_num = 0,
.chip_select = 1,
.max_speed_hz = 25000000,
.modalias = "mmc_spi",
}
};
static struct ath79_spi_platform_data ath79_spi_data = {
.bus_num = 0,
.num_chipselect = 2,
};
static void __init rut900_setup(void)
{
u8 *mac = (u8 *) KSEG1ADDR(0x1f020000);
u8 *art = (u8 *) KSEG1ADDR(0x1f030000);
u8 tmpmac[ETH_ALEN];
ath79_register_spi(&ath79_spi_data, ath79_spi_info, 2);
ath79_register_leds_gpio(-1, ARRAY_SIZE(rut900_leds_gpio),
rut900_leds_gpio);
ath79_register_gpio_keys_polled(-1, RUT900_KEYS_POLL_INTERVAL,
ARRAY_SIZE(rut900_gpio_keys),
rut900_gpio_keys);
ath79_wmac_set_ext_lna_gpio(0, RUT900_GPIO_EXTERNAL_LNA0);
ath79_init_mac(tmpmac, mac, 2);
ath79_register_wmac(art + RUT900_WMAC_CALDATA_OFFSET, tmpmac);
ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE);
ath79_register_mdio(1, 0x0);
/* LAN */
ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
/* GMAC1 is connected to the internal switch */
ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
ath79_register_eth(1);
/* WAN */
ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
/* GMAC0 is connected to the PHY4 of the internal switch */
ath79_switch_data.phy4_mii_en = 1;
ath79_switch_data.phy_poll_mask = BIT(4);
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
ath79_eth0_data.phy_mask = BIT(4);
ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
ath79_register_eth(0);
ath79_register_usb();
ath79_gpio_output_select(RUT900_GPIO_LED_LAN1,
AR934X_GPIO_OUT_LED_LINK3);
ath79_gpio_output_select(RUT900_GPIO_LED_LAN2,
AR934X_GPIO_OUT_LED_LINK2);
ath79_gpio_output_select(RUT900_GPIO_LED_LAN3,
AR934X_GPIO_OUT_LED_LINK1);
ath79_gpio_output_select(RUT900_GPIO_LED_WAN,
AR934X_GPIO_OUT_LED_LINK4);
//SPI CS1
ath79_gpio_output_select(RUT900_GPIO_MMC_CS,
7);
//HS UART
ath79_gpio_output_select(18, 79);
/* Init I2C interface */
rut900_i2c_init();
}
MIPS_MACHINE(ATH79_MACH_TLT_RUT900, "TLT-RUT900",
"TELTONIKA TLT-RUT900",
rut900_setup);

View File

@ -259,7 +259,6 @@ enum ath79_mach_type {
ATH79_MACH_TL_WR941ND_V5, /* TP-LINK TL-WR941ND v5 */
ATH79_MACH_TL_WR941ND_V6, /* TP-LINK TL-WR941ND v6 */
ATH79_MACH_TL_WR940N_V4, /* TP-LINK TL-WR940N v4 */
ATH79_MACH_TLT_RUT900, /* Teltonika RUT900 */
ATH79_MACH_TUBE2H, /* Alfa Network Tube2H */
ATH79_MACH_UBNT_AIRGW, /* Ubiquiti AirGateway */
ATH79_MACH_UBNT_AIRGWP, /* Ubiquiti AirGateway Pro */

View File

@ -1,206 +0,0 @@
/*
* Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
*
* 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/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/magic.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#define TLT_NUM_PARTS 7
#define TLT_HEADER_V1 0x01000000
#define MD5SUM_LEN 16
#define TLT_UBOOT_LEN 0x20000
#define TLT_CONFIG_LEN 0x10000
#define TLT_ART_LEN 0x10000
#define EVENTLOG_LEN 0x90000
struct tlt_fw_header {
uint32_t version; /* header version */
char vendor_name[24];
char fw_version[36];
uint32_t hw_id; /* hardware id */
uint32_t hw_rev; /* hardware revision */
uint32_t unk1;
uint8_t md5sum1[MD5SUM_LEN];
uint32_t unk2;
uint8_t md5sum2[MD5SUM_LEN];
uint32_t unk3;
uint32_t kernel_la; /* kernel load address */
uint32_t kernel_ep; /* kernel entry point */
uint32_t fw_length; /* total length of the firmware */
uint32_t kernel_ofs; /* kernel data offset */
uint32_t kernel_len; /* kernel data length */
uint32_t rootfs_ofs; /* rootfs data offset */
uint32_t rootfs_len; /* rootfs data length */
uint32_t boot_ofs; /* bootloader data offset */
uint32_t boot_len; /* bootloader data length */
uint8_t pad[360];
} __attribute__ ((packed));
static struct tlt_fw_header *
tlt_read_header(struct mtd_info *mtd, size_t offset)
{
struct tlt_fw_header *header;
size_t header_len;
size_t retlen;
int ret;
u32 t;
header = vmalloc(sizeof(*header));
if (!header)
goto err;
header_len = sizeof(struct tlt_fw_header);
ret = mtd_read(mtd, offset, header_len, &retlen,
(unsigned char *) header);
if (ret)
goto err_free_header;
if (retlen != header_len)
goto err_free_header;
/* sanity checks */
t = be32_to_cpu(header->version);
if (t != TLT_HEADER_V1)
goto err_free_header;
t = be32_to_cpu(header->kernel_ofs);
if (t != header_len)
goto err_free_header;
return header;
err_free_header:
vfree(header);
err:
return NULL;
}
static int tlt_check_rootfs_magic(struct mtd_info *mtd, size_t offset)
{
u32 magic;
size_t retlen;
int ret;
ret = mtd_read(mtd, offset, sizeof(magic), &retlen,
(unsigned char *) &magic);
if (ret)
return ret;
if (retlen != sizeof(magic))
return -EIO;
if (le32_to_cpu(magic) != SQUASHFS_MAGIC &&
magic != 0x19852003)
return -EINVAL;
return 0;
}
static int tlt_parse_partitions(struct mtd_info *master,
struct mtd_partition **pparts,
struct mtd_part_parser_data *data)
{
struct mtd_partition *parts;
struct tlt_fw_header *header;
int nr_parts;
size_t kernel_offset;
size_t rootfs_offset;
size_t squashfs_offset;
int ret;
nr_parts = TLT_NUM_PARTS;
parts = kzalloc(nr_parts * sizeof(struct mtd_partition), GFP_KERNEL);
if (!parts) {
ret = -ENOMEM;
goto err;
}
kernel_offset = TLT_UBOOT_LEN + TLT_CONFIG_LEN + TLT_ART_LEN;
header = tlt_read_header(master, kernel_offset);
if (!header) {
pr_notice("%s: no TP-Link header found\n", master->name);
ret = -ENODEV;
goto err_free_parts;
}
squashfs_offset = kernel_offset + sizeof(struct tlt_fw_header) +
be32_to_cpu(header->kernel_len);
ret = tlt_check_rootfs_magic(master, squashfs_offset);
if (ret == 0)
rootfs_offset = squashfs_offset;
else
rootfs_offset = kernel_offset + be32_to_cpu(header->rootfs_ofs);
vfree(header);
parts[0].name = "u-boot";
parts[0].offset = 0;
parts[0].size = TLT_UBOOT_LEN;
parts[0].mask_flags = MTD_WRITEABLE;
parts[1].name = "config";
parts[1].offset = TLT_UBOOT_LEN;
parts[1].size = TLT_CONFIG_LEN;
parts[2].name = "art";
parts[2].offset = TLT_UBOOT_LEN + TLT_CONFIG_LEN;
parts[2].size = TLT_ART_LEN;
parts[2].mask_flags = MTD_WRITEABLE;
parts[3].name = "kernel";
parts[3].offset = kernel_offset;
parts[3].size = rootfs_offset - kernel_offset;
parts[4].name = "rootfs";
parts[4].offset = rootfs_offset;
parts[4].size = master->size - rootfs_offset - EVENTLOG_LEN;
parts[5].name = "firmware";
parts[5].offset = kernel_offset;
parts[5].size = master->size - kernel_offset - EVENTLOG_LEN;
parts[6].name = "event-log";
parts[6].offset = master->size - EVENTLOG_LEN;
parts[6].size = EVENTLOG_LEN;
*pparts = parts;
return nr_parts;
err_free_parts:
kfree(parts);
err:
*pparts = NULL;
return ret;
}
static struct mtd_part_parser tlt_parser = {
.owner = THIS_MODULE,
.parse_fn = tlt_parse_partitions,
.name = "tlt",
};
static int __init tlt_parser_init(void)
{
register_mtd_parser(&tlt_parser);
return 0;
}
module_init(tlt_parser_init);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");

View File

@ -1084,14 +1084,3 @@ define Device/tl-wa7210n-v2
CONSOLE := ttyATH0,115200
endef
TARGET_DEVICES += tl-wa7210n-v2
define Device/tlt-rut900
$(Device/tplink-16mlzma)
DEVICE_TITLE := Teltonika RUT900
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev
BOARDNAME := TLT-RUT900
DEVICE_PROFILE := TLTRUT900
TPLINK_HWID := 0x35000001
CONSOLE := ttyS0,115200
endef
TARGET_DEVICES += tlt-rut900

View File

@ -1,25 +0,0 @@
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -202,6 +202,12 @@ config MTD_TPLINK_PARTS
---help---
TBD.
+config MTD_TLT_PARTS
+ tristate "Teltonika RUT900 partitioning support"
+ depends on ATH79
+ ---help---
+ Teltonika RUT900 partitioning support
+
comment "User Modules And Translation Layers"
#
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47
obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o
obj-$(CONFIG_MTD_TPLINK_PARTS) += tplinkpart.o
obj-$(CONFIG_MTD_CYBERTAN_PARTS) += cybertan_part.o
+obj-$(CONFIG_MTD_TLT_PARTS) += tltpart.o
# 'Users' - code which presents functionality to userspace.
obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o