mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-08 10:23:47 +08:00
Merge Official Source
This commit is contained in:
commit
d776038286
@ -16,6 +16,7 @@ menu "Target Images"
|
||||
prompt "Compression"
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_apm821xx
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ar71xx
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ath79_mikrotik
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_lantiq
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips
|
||||
|
@ -391,6 +391,23 @@ endef
|
||||
$(eval $(call KernelPackage,mmc))
|
||||
|
||||
|
||||
define KernelPackage/mvsdio
|
||||
SUBMENU:=$(OTHER_MENU)
|
||||
TITLE:=Marvell MMC/SD/SDIO host driver
|
||||
DEPENDS:=+kmod-mmc @TARGET_kirkwood
|
||||
KCONFIG:= CONFIG_MMC_MVSDIO
|
||||
FILES:= \
|
||||
$(LINUX_DIR)/drivers/mmc/host/mvsdio.ko
|
||||
AUTOLOAD:=$(call AutoProbe,mvsdio,1)
|
||||
endef
|
||||
|
||||
define KernelPackage/mvsdio/description
|
||||
Kernel support for the Marvell SDIO host driver.
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,mvsdio))
|
||||
|
||||
|
||||
define KernelPackage/sdhci
|
||||
SUBMENU:=$(OTHER_MENU)
|
||||
TITLE:=Secure Digital Host Controller Interface support
|
||||
|
180
target/linux/ath79/dts/ar7100_mikrotik_routerboard-4xx.dtsi
Normal file
180
target/linux/ath79/dts/ar7100_mikrotik_routerboard-4xx.dtsi
Normal file
@ -0,0 +1,180 @@
|
||||
// SPDX-License-Identifier: GPL-1.0-or-later OR MIT
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
|
||||
#include "ar7100.dtsi"
|
||||
|
||||
/ {
|
||||
aliases {
|
||||
led-boot = &led_user;
|
||||
led-failsafe = &led_user;
|
||||
led-running = &led_user;
|
||||
};
|
||||
|
||||
chosen {
|
||||
bootargs = "console=ttyS0,115200";
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
led_user: user {
|
||||
label = "mikrotik:yellow:user";
|
||||
gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
|
||||
default-state = "on";
|
||||
};
|
||||
|
||||
led1 {
|
||||
label = "mikrotik:green:led1";
|
||||
gpios = <&cpld_gpio 0 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
led2 {
|
||||
label = "mikrotik:green:led2";
|
||||
gpios = <&cpld_gpio 2 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
led3 {
|
||||
label = "mikrotik:green:led3";
|
||||
gpios = <&cpld_gpio 1 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
led4 {
|
||||
label = "mikrotik:green:led4";
|
||||
gpios = <&cpld_gpio 3 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
led5 {
|
||||
label = "mikrotik:green:led5";
|
||||
gpios = <&cpld_gpio 8 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&uart {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpio {
|
||||
ngpios = <31>;
|
||||
gpio-line-names =
|
||||
"", "", "", "", "LED", "RDY", "", "MDC",
|
||||
"MDIO", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "";
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&spi {
|
||||
status = "okay";
|
||||
|
||||
compatible = "mikrotik,rb4xx-spi";
|
||||
|
||||
flash@0 {
|
||||
compatible = "pm25lv512", "jedec,spi-nor";
|
||||
|
||||
reg = <0>;
|
||||
spi-max-frequency = <25000000>;
|
||||
|
||||
partitions {
|
||||
compatible = "mikrotik,routerboot-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "routerboot1";
|
||||
reg = <0x0 0x0>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
hard_config {
|
||||
label = "hard_config";
|
||||
read-only;
|
||||
};
|
||||
|
||||
bios {
|
||||
label = "bios";
|
||||
size = <0x1000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
routerboot2 {
|
||||
label = "routerboot2";
|
||||
read-only;
|
||||
};
|
||||
|
||||
soft_config {
|
||||
label = "soft_config";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
cpld@1 {
|
||||
compatible = "mikrotik,rb4xx-cpld";
|
||||
|
||||
reg = <1>;
|
||||
spi-max-frequency = <25000000>;
|
||||
|
||||
cpld_gpio: gpio {
|
||||
compatible = "mikrotik,rb4xx-gpio";
|
||||
|
||||
base = <32>;
|
||||
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
gpio-line-names =
|
||||
"LED1", "LED2", "LED3", "LED4",
|
||||
"FAN", "ALE", "CLE", "nCE",
|
||||
"LED5";
|
||||
};
|
||||
|
||||
nand {
|
||||
compatible = "mikrotik,rb4xx-nand";
|
||||
|
||||
gpios = <&cpld_gpio 5 GPIO_ACTIVE_HIGH>, // ALE
|
||||
<&cpld_gpio 6 GPIO_ACTIVE_HIGH>, // CLE
|
||||
<&cpld_gpio 7 GPIO_ACTIVE_HIGH>, // nCE
|
||||
<&gpio 5 GPIO_ACTIVE_HIGH>; // RDY
|
||||
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "booter";
|
||||
reg = <0x0000000 0x0040000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@40000 {
|
||||
label = "kernel";
|
||||
reg = <0x0040000 0x0800000>;
|
||||
};
|
||||
|
||||
partition@840000 {
|
||||
label = "ubi";
|
||||
reg = <0x0840000 0x77c0000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
ð0 {
|
||||
status = "okay";
|
||||
|
||||
phy-handle = <&phy0>;
|
||||
};
|
||||
|
||||
&mdio0 {
|
||||
status = "okay";
|
||||
|
||||
phy0: ethernet-phy@0 {
|
||||
reg = <0>;
|
||||
};
|
||||
};
|
53
target/linux/ath79/dts/ar7161_mikrotik_routerboard-493g.dts
Normal file
53
target/linux/ath79/dts/ar7161_mikrotik_routerboard-493g.dts
Normal file
@ -0,0 +1,53 @@
|
||||
// SPDX-License-Identifier: GPL-1.0-or-later OR MIT
|
||||
/dts-v1/;
|
||||
|
||||
#include "ar7100_mikrotik_routerboard-4xx.dtsi"
|
||||
|
||||
/ {
|
||||
compatible = "mikrotik,routerboard-493g", "qca,ar7161";
|
||||
model = "MikroTik RouterBOARD 493G";
|
||||
|
||||
aliases {
|
||||
mdio-gpio0 = &mdio_gpio0;
|
||||
};
|
||||
};
|
||||
|
||||
&spi {
|
||||
sdcard: mmc-slot@2 {
|
||||
compatible = "mmc-spi-slot";
|
||||
|
||||
reg = <2>;
|
||||
spi-max-frequency = <25000000>;
|
||||
};
|
||||
};
|
||||
|
||||
ð1 {
|
||||
status = "okay";
|
||||
|
||||
phy-handle = <&gpio_phy0>;
|
||||
|
||||
mdio_gpio0: mdio-gpio {
|
||||
compatible = "virtual,mdio-gpio";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
gpios = <&gpio 7 GPIO_ACTIVE_HIGH>, // MDC
|
||||
<&gpio 8 GPIO_ACTIVE_HIGH>; // MDIO
|
||||
|
||||
gpio_phy0: ethernet-phy@0 {
|
||||
reg = <0>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&usb_phy {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb2 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb1 {
|
||||
status = "okay";
|
||||
};
|
172
target/linux/ath79/files/drivers/gpio/gpio-rb4xx.c
Normal file
172
target/linux/ath79/files/drivers/gpio/gpio-rb4xx.c
Normal file
@ -0,0 +1,172 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* GPIO driver for the MikroTik RouterBoard 4xx series
|
||||
*
|
||||
* Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
|
||||
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
|
||||
* Copyright (C) 2015 Bert Vermeulen <bert@biot.com>
|
||||
* Copyright (C) 2020 Christopher Hill <ch6574@gmail.com>
|
||||
*
|
||||
* This file was based on the driver for Linux 2.6.22 published by
|
||||
* MikroTik for their RouterBoard 4xx series devices.
|
||||
*
|
||||
* N.B. driver probe reports "DMA mask not set" warnings which are
|
||||
* an artifact of using a platform_driver as an MFD device child.
|
||||
* See conversation here https://lkml.org/lkml/2020/4/28/675
|
||||
*/
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/gpio/driver.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_device.h>
|
||||
|
||||
#include <mfd/rb4xx-cpld.h>
|
||||
|
||||
struct rb4xx_gpio {
|
||||
struct rb4xx_cpld *cpld;
|
||||
struct device *dev;
|
||||
|
||||
struct gpio_chip chip;
|
||||
struct mutex lock;
|
||||
u16 values; /* bitfield of GPIO 0-8 current values */
|
||||
};
|
||||
|
||||
static int rb4xx_gpio_cpld_set(struct rb4xx_gpio *gpio, unsigned int offset,
|
||||
int value)
|
||||
{
|
||||
struct rb4xx_cpld *cpld = gpio->cpld;
|
||||
u16 values;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&gpio->lock);
|
||||
values = gpio->values;
|
||||
|
||||
if (value)
|
||||
values |= BIT(offset);
|
||||
else
|
||||
values &= ~(BIT(offset));
|
||||
|
||||
if (values == gpio->values) {
|
||||
ret = 0;
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
if (offset < 8) {
|
||||
ret = cpld->gpio_set_0_7(cpld, values & 0xff);
|
||||
} else if (offset == 8) {
|
||||
ret = cpld->gpio_set_8(cpld, values >> 8);
|
||||
}
|
||||
|
||||
if(likely(!ret))
|
||||
gpio->values = values;
|
||||
|
||||
unlock:
|
||||
mutex_unlock(&gpio->lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rb4xx_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
|
||||
{
|
||||
return 0; /* All 9 GPIOs are out */
|
||||
}
|
||||
|
||||
static int rb4xx_gpio_direction_input(struct gpio_chip *chip,
|
||||
unsigned int offset)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static int rb4xx_gpio_direction_output(struct gpio_chip *chip,
|
||||
unsigned int offset, int value)
|
||||
{
|
||||
return rb4xx_gpio_cpld_set(gpiochip_get_data(chip), offset, value);
|
||||
}
|
||||
|
||||
static int rb4xx_gpio_get(struct gpio_chip *chip, unsigned int offset)
|
||||
{
|
||||
struct rb4xx_gpio *gpio = gpiochip_get_data(chip);
|
||||
int ret;
|
||||
|
||||
mutex_lock(&gpio->lock);
|
||||
ret = (gpio->values >> offset) & 0x1;
|
||||
mutex_unlock(&gpio->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void rb4xx_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||
int value)
|
||||
{
|
||||
rb4xx_gpio_cpld_set(gpiochip_get_data(chip), offset, value);
|
||||
}
|
||||
|
||||
static int rb4xx_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device *parent = dev->parent;
|
||||
struct rb4xx_gpio *gpio;
|
||||
u32 val;
|
||||
|
||||
if (!parent)
|
||||
return -ENODEV;
|
||||
|
||||
gpio = devm_kzalloc(dev, sizeof(*gpio), GFP_KERNEL);
|
||||
if (!gpio)
|
||||
return -ENOMEM;
|
||||
|
||||
platform_set_drvdata(pdev, gpio);
|
||||
gpio->cpld = dev_get_drvdata(parent);
|
||||
gpio->dev = dev;
|
||||
gpio->values = 0;
|
||||
mutex_init(&gpio->lock);
|
||||
|
||||
gpio->chip.label = "rb4xx-gpio";
|
||||
gpio->chip.parent = dev;
|
||||
gpio->chip.owner = THIS_MODULE;
|
||||
gpio->chip.get_direction = rb4xx_gpio_get_direction;
|
||||
gpio->chip.direction_input = rb4xx_gpio_direction_input;
|
||||
gpio->chip.direction_output = rb4xx_gpio_direction_output;
|
||||
gpio->chip.get = rb4xx_gpio_get;
|
||||
gpio->chip.set = rb4xx_gpio_set;
|
||||
gpio->chip.ngpio = 9;
|
||||
gpio->chip.base = -1;
|
||||
gpio->chip.can_sleep = 1;
|
||||
|
||||
if (!of_property_read_u32(dev->of_node, "base", &val))
|
||||
gpio->chip.base = val;
|
||||
|
||||
return gpiochip_add_data(&gpio->chip, gpio);
|
||||
}
|
||||
|
||||
static int rb4xx_gpio_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct rb4xx_gpio *gpio = platform_get_drvdata(pdev);
|
||||
|
||||
gpiochip_remove(&gpio->chip);
|
||||
mutex_destroy(&gpio->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct platform_device_id rb4xx_gpio_id_table[] = {
|
||||
{ "mikrotik,rb4xx-gpio", },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, rb4xx_gpio_id_table);
|
||||
|
||||
static struct platform_driver rb4xx_gpio_driver = {
|
||||
.probe = rb4xx_gpio_probe,
|
||||
.remove = rb4xx_gpio_remove,
|
||||
.id_table = rb4xx_gpio_id_table,
|
||||
.driver = {
|
||||
.name = "rb4xx-gpio",
|
||||
},
|
||||
};
|
||||
|
||||
module_platform_driver(rb4xx_gpio_driver);
|
||||
|
||||
MODULE_DESCRIPTION("Mikrotik RB4xx GPIO driver");
|
||||
MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
|
||||
MODULE_AUTHOR("Imre Kaloz <kaloz@openwrt.org>");
|
||||
MODULE_AUTHOR("Bert Vermeulen <bert@biot.com>");
|
||||
MODULE_AUTHOR("Christopher Hill <ch6574@gmail.com");
|
||||
MODULE_LICENSE("GPL v2");
|
182
target/linux/ath79/files/drivers/mfd/rb4xx-cpld.c
Normal file
182
target/linux/ath79/files/drivers/mfd/rb4xx-cpld.c
Normal file
@ -0,0 +1,182 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* CPLD driver for the MikroTik RouterBoard 4xx series
|
||||
*
|
||||
* This driver provides access to a CPLD that interfaces between the SoC SPI bus
|
||||
* and other devices. Behind the CPLD there is a NAND flash chip and five LEDs.
|
||||
*
|
||||
* The CPLD supports SPI two-wire mode, in which two bits are transferred per
|
||||
* SPI clock cycle. The second bit is transmitted with the SoC's CS2 pin.
|
||||
*
|
||||
* The CPLD also acts as a GPIO expander.
|
||||
*
|
||||
* Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
|
||||
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
|
||||
* Copyright (C) 2015 Bert Vermeulen <bert@biot.com>
|
||||
* Copyright (C) 2020 Christopher Hill <ch6574@gmail.com>
|
||||
*
|
||||
* This file was based on the driver for Linux 2.6.22 published by
|
||||
* MikroTik for their RouterBoard 4xx series devices.
|
||||
*/
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_platform.h>
|
||||
|
||||
#include <mfd/rb4xx-cpld.h>
|
||||
|
||||
/* CPLD commands */
|
||||
#define CPLD_CMD_WRITE_NAND 0x08 /* send cmd, n x send data, send idle */
|
||||
#define CPLD_CMD_WRITE_CFG 0x09 /* send cmd, n x send cfg */
|
||||
#define CPLD_CMD_READ_NAND 0x0a /* send cmd, send idle, n x read data */
|
||||
#define CPLD_CMD_READ_FAST 0x0b /* send cmd, 4 x idle, n x read data */
|
||||
#define CPLD_CMD_GPIO8_HIGH 0x0c /* send cmd */
|
||||
#define CPLD_CMD_GPIO8_LOW 0x0d /* send cmd */
|
||||
|
||||
static int rb4xx_cpld_write_nand(struct rb4xx_cpld *cpld, const void *tx_buf,
|
||||
unsigned int len)
|
||||
{
|
||||
struct spi_message m;
|
||||
static const u8 cmd = CPLD_CMD_WRITE_NAND;
|
||||
struct spi_transfer t[3] = {
|
||||
{
|
||||
.tx_buf = &cmd,
|
||||
.len = sizeof(cmd),
|
||||
}, {
|
||||
.tx_buf = tx_buf,
|
||||
.len = len,
|
||||
.tx_nbits = SPI_NBITS_DUAL,
|
||||
}, {
|
||||
.len = 1,
|
||||
.tx_nbits = SPI_NBITS_DUAL,
|
||||
},
|
||||
};
|
||||
|
||||
spi_message_init(&m);
|
||||
spi_message_add_tail(&t[0], &m);
|
||||
spi_message_add_tail(&t[1], &m);
|
||||
spi_message_add_tail(&t[2], &m);
|
||||
return spi_sync(cpld->spi, &m);
|
||||
}
|
||||
|
||||
static int rb4xx_cpld_read_nand(struct rb4xx_cpld *cpld, void *rx_buf,
|
||||
unsigned int len)
|
||||
{
|
||||
struct spi_message m;
|
||||
static const u8 cmd[2] = {
|
||||
CPLD_CMD_READ_NAND, 0
|
||||
};
|
||||
struct spi_transfer t[2] = {
|
||||
{
|
||||
.tx_buf = &cmd,
|
||||
.len = sizeof(cmd),
|
||||
}, {
|
||||
.rx_buf = rx_buf,
|
||||
.len = len,
|
||||
},
|
||||
};
|
||||
|
||||
spi_message_init(&m);
|
||||
spi_message_add_tail(&t[0], &m);
|
||||
spi_message_add_tail(&t[1], &m);
|
||||
return spi_sync(cpld->spi, &m);
|
||||
}
|
||||
|
||||
static int rb4xx_cpld_cmd(struct rb4xx_cpld *cpld, const void *tx_buf,
|
||||
unsigned int len)
|
||||
{
|
||||
struct spi_message m;
|
||||
struct spi_transfer t = {
|
||||
.tx_buf = tx_buf,
|
||||
.len = len,
|
||||
};
|
||||
|
||||
spi_message_init(&m);
|
||||
spi_message_add_tail(&t, &m);
|
||||
return spi_sync(cpld->spi, &m);
|
||||
}
|
||||
|
||||
static int rb4xx_cpld_gpio_set_0_7(struct rb4xx_cpld *cpld, u8 values)
|
||||
{
|
||||
/* GPIO 0-7 change can be sent via command + bitfield */
|
||||
u8 cmd[2] = {
|
||||
CPLD_CMD_WRITE_CFG, values
|
||||
};
|
||||
return rb4xx_cpld_cmd(cpld, &cmd, 2);
|
||||
}
|
||||
|
||||
static int rb4xx_cpld_gpio_set_8(struct rb4xx_cpld *cpld, u8 value)
|
||||
{
|
||||
/* GPIO 8 uses dedicated high/low commands */
|
||||
u8 cmd = CPLD_CMD_GPIO8_HIGH | !!(value);
|
||||
return rb4xx_cpld_cmd(cpld, &cmd, 1);
|
||||
}
|
||||
|
||||
static const struct mfd_cell rb4xx_cpld_cells[] = {
|
||||
{
|
||||
.name = "mikrotik,rb4xx-gpio",
|
||||
.of_compatible = "mikrotik,rb4xx-gpio",
|
||||
}, {
|
||||
.name = "mikrotik,rb4xx-nand",
|
||||
.of_compatible = "mikrotik,rb4xx-nand",
|
||||
},
|
||||
};
|
||||
|
||||
static int rb4xx_cpld_probe(struct spi_device *spi)
|
||||
{
|
||||
struct device *dev = &spi->dev;
|
||||
struct rb4xx_cpld *cpld;
|
||||
int ret;
|
||||
|
||||
cpld = devm_kzalloc(dev, sizeof(*cpld), GFP_KERNEL);
|
||||
if (!cpld)
|
||||
return -ENOMEM;
|
||||
|
||||
dev_set_drvdata(dev, cpld);
|
||||
|
||||
cpld->spi = spi;
|
||||
cpld->write_nand = rb4xx_cpld_write_nand;
|
||||
cpld->read_nand = rb4xx_cpld_read_nand;
|
||||
cpld->gpio_set_0_7 = rb4xx_cpld_gpio_set_0_7;
|
||||
cpld->gpio_set_8 = rb4xx_cpld_gpio_set_8;
|
||||
|
||||
spi->mode = SPI_MODE_0 | SPI_TX_DUAL;
|
||||
ret = spi_setup(spi);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
|
||||
rb4xx_cpld_cells,
|
||||
ARRAY_SIZE(rb4xx_cpld_cells),
|
||||
NULL, 0, NULL);
|
||||
}
|
||||
|
||||
static int rb4xx_cpld_remove(struct spi_device *spi)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id rb4xx_cpld_dt_match[] = {
|
||||
{ .compatible = "mikrotik,rb4xx-cpld", },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, rb4xx_cpld_dt_match);
|
||||
|
||||
static struct spi_driver rb4xx_cpld_driver = {
|
||||
.probe = rb4xx_cpld_probe,
|
||||
.remove = rb4xx_cpld_remove,
|
||||
.driver = {
|
||||
.name = "rb4xx-cpld",
|
||||
.bus = &spi_bus_type,
|
||||
.of_match_table = of_match_ptr(rb4xx_cpld_dt_match),
|
||||
},
|
||||
};
|
||||
|
||||
module_spi_driver(rb4xx_cpld_driver);
|
||||
|
||||
MODULE_DESCRIPTION("Mikrotik RB4xx CPLD driver");
|
||||
MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
|
||||
MODULE_AUTHOR("Imre Kaloz <kaloz@openwrt.org>");
|
||||
MODULE_AUTHOR("Bert Vermeulen <bert@biot.com>");
|
||||
MODULE_AUTHOR("Christopher Hill <ch6574@gmail.com");
|
||||
MODULE_LICENSE("GPL v2");
|
297
target/linux/ath79/files/drivers/mtd/nand/raw/nand_rb4xx.c
Normal file
297
target/linux/ath79/files/drivers/mtd/nand/raw/nand_rb4xx.c
Normal file
@ -0,0 +1,297 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* NAND driver for the MikroTik RouterBoard 4xx series
|
||||
*
|
||||
* Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
|
||||
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
|
||||
* Copyright (C) 2015 Bert Vermeulen <bert@biot.com>
|
||||
* Copyright (C) 2020 Christopher Hill <ch6574@gmail.com>
|
||||
*
|
||||
* This file was based on the driver for Linux 2.6.22 published by
|
||||
* MikroTik for their RouterBoard 4xx series devices.
|
||||
*
|
||||
* N.B. driver probe reports "DMA mask not set" warnings which are
|
||||
* an artifact of using a platform_driver as an MFD device child.
|
||||
* See conversation here https://lkml.org/lkml/2020/4/28/675
|
||||
*/
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#include <mfd/rb4xx-cpld.h>
|
||||
|
||||
struct rb4xx_nand {
|
||||
struct rb4xx_cpld *cpld;
|
||||
struct device *dev;
|
||||
|
||||
struct nand_chip chip;
|
||||
struct gpio_desc *ale;
|
||||
struct gpio_desc *cle;
|
||||
struct gpio_desc *nce;
|
||||
struct gpio_desc *rdy;
|
||||
};
|
||||
|
||||
static int rb4xx_ooblayout_ecc(struct mtd_info *mtd, int section,
|
||||
struct mtd_oob_region *oobregion)
|
||||
{
|
||||
switch (section) {
|
||||
case 0:
|
||||
oobregion->offset = 8;
|
||||
oobregion->length = 3;
|
||||
return 0;
|
||||
case 1:
|
||||
oobregion->offset = 13;
|
||||
oobregion->length = 3;
|
||||
return 0;
|
||||
default:
|
||||
return -ERANGE;
|
||||
}
|
||||
}
|
||||
|
||||
static int rb4xx_ooblayout_free(struct mtd_info *mtd, int section,
|
||||
struct mtd_oob_region *oobregion)
|
||||
{
|
||||
switch (section) {
|
||||
case 0:
|
||||
oobregion->offset = 0;
|
||||
oobregion->length = 4;
|
||||
return 0;
|
||||
case 1:
|
||||
oobregion->offset = 4;
|
||||
oobregion->length = 1;
|
||||
return 0;
|
||||
case 2:
|
||||
oobregion->offset = 6;
|
||||
oobregion->length = 2;
|
||||
return 0;
|
||||
case 3:
|
||||
oobregion->offset = 11;
|
||||
oobregion->length = 2;
|
||||
return 0;
|
||||
default:
|
||||
return -ERANGE;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct mtd_ooblayout_ops rb4xx_nand_ecclayout_ops = {
|
||||
.ecc = rb4xx_ooblayout_ecc,
|
||||
.free = rb4xx_ooblayout_free,
|
||||
};
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0)
|
||||
static uint8_t rb4xx_nand_read_byte(struct mtd_info *mtd)
|
||||
{
|
||||
struct rb4xx_nand *nand = mtd->priv;
|
||||
#else
|
||||
static u8 rb4xx_nand_read_byte(struct nand_chip *chip)
|
||||
{
|
||||
struct rb4xx_nand *nand = chip->priv;
|
||||
#endif
|
||||
struct rb4xx_cpld *cpld = nand->cpld;
|
||||
u8 data;
|
||||
int ret;
|
||||
|
||||
ret = cpld->read_nand(cpld, &data, 1);
|
||||
if (unlikely(ret))
|
||||
return 0xff;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0)
|
||||
static void rb4xx_nand_write_buf(struct mtd_info *mtd, const uint8_t *buf,
|
||||
int len)
|
||||
{
|
||||
struct rb4xx_nand *nand = mtd->priv;
|
||||
#else
|
||||
static void rb4xx_nand_write_buf(struct nand_chip *chip, const u8 *buf, int len)
|
||||
{
|
||||
struct rb4xx_nand *nand = chip->priv;
|
||||
#endif
|
||||
struct rb4xx_cpld *cpld = nand->cpld;
|
||||
|
||||
cpld->write_nand(cpld, buf, len);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0)
|
||||
static void rb4xx_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
|
||||
{
|
||||
struct rb4xx_nand *nand = mtd->priv;
|
||||
#else
|
||||
static void rb4xx_nand_read_buf(struct nand_chip *chip, u8 *buf, int len)
|
||||
{
|
||||
struct rb4xx_nand *nand = chip->priv;
|
||||
#endif
|
||||
struct rb4xx_cpld *cpld = nand->cpld;
|
||||
|
||||
cpld->read_nand(cpld, buf, len);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0)
|
||||
static void rb4xx_nand_cmd_ctrl(struct mtd_info *mtd, int dat, unsigned int ctrl)
|
||||
{
|
||||
struct rb4xx_nand *nand = mtd->priv;
|
||||
#else
|
||||
static void rb4xx_nand_cmd_ctrl(struct nand_chip *chip, int dat,
|
||||
unsigned int ctrl)
|
||||
{
|
||||
struct rb4xx_nand *nand = chip->priv;
|
||||
#endif
|
||||
struct rb4xx_cpld *cpld = nand->cpld;
|
||||
u8 data = dat;
|
||||
|
||||
if (ctrl & NAND_CTRL_CHANGE) {
|
||||
gpiod_set_value_cansleep(nand->cle, !!(ctrl & NAND_CLE));
|
||||
gpiod_set_value_cansleep(nand->ale, !!(ctrl & NAND_ALE));
|
||||
gpiod_set_value_cansleep(nand->nce, !(ctrl & NAND_NCE));
|
||||
}
|
||||
|
||||
if (dat != NAND_CMD_NONE)
|
||||
cpld->write_nand(cpld, &data, 1);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0)
|
||||
static int rb4xx_nand_dev_ready(struct mtd_info *mtd)
|
||||
{
|
||||
struct rb4xx_nand *nand = mtd->priv;
|
||||
#else
|
||||
static int rb4xx_nand_dev_ready(struct nand_chip *chip)
|
||||
{
|
||||
struct rb4xx_nand *nand = chip->priv;
|
||||
#endif
|
||||
|
||||
return gpiod_get_value_cansleep(nand->rdy);
|
||||
}
|
||||
|
||||
static int rb4xx_nand_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device *parent = dev->parent;
|
||||
struct rb4xx_nand *nand;
|
||||
struct mtd_info *mtd;
|
||||
int ret;
|
||||
|
||||
if (!parent)
|
||||
return -ENODEV;
|
||||
|
||||
nand = devm_kzalloc(dev, sizeof(*nand), GFP_KERNEL);
|
||||
if (!nand)
|
||||
return -ENOMEM;
|
||||
|
||||
platform_set_drvdata(pdev, nand);
|
||||
nand->cpld = dev_get_drvdata(parent);
|
||||
nand->dev = dev;
|
||||
|
||||
nand->ale = devm_gpiod_get_index(dev, NULL, 0, GPIOD_OUT_LOW);
|
||||
if (IS_ERR(nand->ale))
|
||||
dev_err(dev, "missing gpio ALE: %ld\n", PTR_ERR(nand->ale));
|
||||
|
||||
nand->cle = devm_gpiod_get_index(dev, NULL, 1, GPIOD_OUT_LOW);
|
||||
if (IS_ERR(nand->cle))
|
||||
dev_err(dev, "missing gpio CLE: %ld\n", PTR_ERR(nand->cle));
|
||||
|
||||
nand->nce = devm_gpiod_get_index(dev, NULL, 2, GPIOD_OUT_LOW);
|
||||
if (IS_ERR(nand->nce))
|
||||
dev_err(dev, "missing gpio nCE: %ld\n", PTR_ERR(nand->nce));
|
||||
|
||||
nand->rdy = devm_gpiod_get_index(dev, NULL, 3, GPIOD_IN);
|
||||
if (IS_ERR(nand->rdy))
|
||||
dev_err(dev, "missing gpio RDY: %ld\n", PTR_ERR(nand->rdy));
|
||||
|
||||
if (IS_ERR(nand->ale) || IS_ERR(nand->cle) ||
|
||||
IS_ERR(nand->nce) || IS_ERR(nand->rdy))
|
||||
return -ENOENT;
|
||||
|
||||
gpiod_set_consumer_name(nand->ale, "mikrotik:nand:ALE");
|
||||
gpiod_set_consumer_name(nand->cle, "mikrotik:nand:CLE");
|
||||
gpiod_set_consumer_name(nand->nce, "mikrotik:nand:nCE");
|
||||
gpiod_set_consumer_name(nand->rdy, "mikrotik:nand:RDY");
|
||||
|
||||
mtd = nand_to_mtd(&nand->chip);
|
||||
mtd->priv = nand;
|
||||
mtd->owner = THIS_MODULE;
|
||||
mtd->dev.parent = dev;
|
||||
mtd_set_of_node(mtd, dev->of_node);
|
||||
|
||||
if (mtd->writesize == 512)
|
||||
mtd_set_ooblayout(mtd, &rb4xx_nand_ecclayout_ops);
|
||||
|
||||
nand->chip.ecc.mode = NAND_ECC_SOFT;
|
||||
nand->chip.ecc.algo = NAND_ECC_HAMMING;
|
||||
nand->chip.options = NAND_NO_SUBPAGE_WRITE;
|
||||
nand->chip.priv = nand;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0)
|
||||
nand->chip.read_byte = rb4xx_nand_read_byte;
|
||||
nand->chip.write_buf = rb4xx_nand_write_buf;
|
||||
nand->chip.read_buf = rb4xx_nand_read_buf;
|
||||
nand->chip.cmd_ctrl = rb4xx_nand_cmd_ctrl;
|
||||
nand->chip.dev_ready = rb4xx_nand_dev_ready;
|
||||
nand->chip.chip_delay = 25;
|
||||
|
||||
ret = nand_scan(mtd, 1);
|
||||
#else
|
||||
nand->chip.legacy.read_byte = rb4xx_nand_read_byte;
|
||||
nand->chip.legacy.write_buf = rb4xx_nand_write_buf;
|
||||
nand->chip.legacy.read_buf = rb4xx_nand_read_buf;
|
||||
nand->chip.legacy.cmd_ctrl = rb4xx_nand_cmd_ctrl;
|
||||
nand->chip.legacy.dev_ready = rb4xx_nand_dev_ready;
|
||||
nand->chip.legacy.chip_delay = 25;
|
||||
|
||||
ret = nand_scan(&nand->chip, 1);
|
||||
#endif
|
||||
if (ret)
|
||||
return -ENXIO;
|
||||
|
||||
ret = mtd_device_register(mtd, NULL, 0);
|
||||
if (ret) {
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0)
|
||||
nand_release(mtd);
|
||||
#else
|
||||
nand_release(&nand->chip);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rb4xx_nand_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct rb4xx_nand *nand = platform_get_drvdata(pdev);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0)
|
||||
nand_release(nand_to_mtd(&nand->chip));
|
||||
#else
|
||||
nand_release(&nand->chip);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct platform_device_id rb4xx_nand_id_table[] = {
|
||||
{ "mikrotik,rb4xx-nand", },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, rb4xx_nand_id_table);
|
||||
|
||||
static struct platform_driver rb4xx_nand_driver = {
|
||||
.probe = rb4xx_nand_probe,
|
||||
.remove = rb4xx_nand_remove,
|
||||
.id_table = rb4xx_nand_id_table,
|
||||
.driver = {
|
||||
.name = "rb4xx-nand",
|
||||
},
|
||||
};
|
||||
|
||||
module_platform_driver(rb4xx_nand_driver);
|
||||
|
||||
MODULE_DESCRIPTION("Mikrotik RB4xx NAND driver");
|
||||
MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
|
||||
MODULE_AUTHOR("Imre Kaloz <kaloz@openwrt.org>");
|
||||
MODULE_AUTHOR("Bert Vermeulen <bert@biot.com>");
|
||||
MODULE_AUTHOR("Christopher Hill <ch6574@gmail.com");
|
||||
MODULE_LICENSE("GPL v2");
|
@ -688,6 +688,8 @@ static void ath79_mii0_ctrl_set_if(struct ag71xx *ag)
|
||||
break;
|
||||
case PHY_INTERFACE_MODE_RGMII:
|
||||
case PHY_INTERFACE_MODE_RGMII_ID:
|
||||
case PHY_INTERFACE_MODE_RGMII_RXID:
|
||||
case PHY_INTERFACE_MODE_RGMII_TXID:
|
||||
mii_if = AR71XX_MII0_CTRL_IF_RGMII;
|
||||
break;
|
||||
case PHY_INTERFACE_MODE_RMII:
|
||||
@ -711,6 +713,8 @@ static void ath79_mii1_ctrl_set_if(struct ag71xx *ag)
|
||||
break;
|
||||
case PHY_INTERFACE_MODE_RGMII:
|
||||
case PHY_INTERFACE_MODE_RGMII_ID:
|
||||
case PHY_INTERFACE_MODE_RGMII_RXID:
|
||||
case PHY_INTERFACE_MODE_RGMII_TXID:
|
||||
mii_if = AR71XX_MII1_CTRL_IF_RGMII;
|
||||
break;
|
||||
default:
|
||||
|
25
target/linux/ath79/files/include/mfd/rb4xx-cpld.h
Normal file
25
target/linux/ath79/files/include/mfd/rb4xx-cpld.h
Normal file
@ -0,0 +1,25 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* CPLD driver for the MikroTik RouterBoard 4xx series
|
||||
*
|
||||
* Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
|
||||
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
|
||||
* Copyright (C) 2015 Bert Vermeulen <bert@biot.com>
|
||||
* Copyright (C) 2020 Christopher Hill <ch6574@gmail.com>
|
||||
*
|
||||
* This file was based on the driver for Linux 2.6.22 published by
|
||||
* MikroTik for their RouterBoard 4xx series devices.
|
||||
*/
|
||||
#include <linux/spi/spi.h>
|
||||
|
||||
struct rb4xx_cpld {
|
||||
struct spi_device *spi;
|
||||
|
||||
int (*write_nand)(struct rb4xx_cpld *self, const void *tx_buf,
|
||||
unsigned int len);
|
||||
int (*read_nand)(struct rb4xx_cpld *self, void *rx_buf,
|
||||
unsigned int len);
|
||||
|
||||
int (*gpio_set_0_7)(struct rb4xx_cpld *self, u8 values);
|
||||
int (*gpio_set_8)(struct rb4xx_cpld *self, u8 value);
|
||||
};
|
@ -1,5 +1,16 @@
|
||||
include ./common-mikrotik.mk
|
||||
|
||||
define Device/mikrotik_routerboard-493g
|
||||
$(Device/mikrotik)
|
||||
SOC := ar7161
|
||||
DEVICE_MODEL := RouterBOARD 493G
|
||||
IMAGE/sysupgrade.bin = append-kernel | kernel2minor -s 2048 -e -c | \
|
||||
sysupgrade-tar kernel=$$$$@ | append-metadata
|
||||
DEVICE_PACKAGES += kmod-usb-ohci kmod-usb2 nand-utils
|
||||
SUPPORTED_DEVICES += rb-493g
|
||||
endef
|
||||
TARGET_DEVICES += mikrotik_routerboard-493g
|
||||
|
||||
define Device/mikrotik_routerboard-922uags-5hpacd
|
||||
$(Device/mikrotik)
|
||||
SOC := qca9558
|
||||
|
@ -8,6 +8,13 @@ ath79_setup_interfaces()
|
||||
local board="$1"
|
||||
|
||||
case "$board" in
|
||||
mikrotik,routerboard-493g)
|
||||
ucidef_set_interfaces_lan_wan "eth0.1 eth1.1" "eth0.2"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan:4" "2:lan:1" "3:lan:3" "4:lan:2" "5:wan"
|
||||
ucidef_add_switch "switch1" \
|
||||
"0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
|
||||
;;
|
||||
mikrotik,routerboard-922uags-5hpacd|\
|
||||
mikrotik,routerboard-wap-g-5hact2hnd)
|
||||
ucidef_set_interface_lan "eth0"
|
||||
|
@ -31,6 +31,7 @@ platform_do_upgrade() {
|
||||
local board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
mikrotik,routerboard-493g|\
|
||||
mikrotik,routerboard-922uags-5hpacd)
|
||||
platform_do_upgrade_mikrotik_nand "$1"
|
||||
;;
|
||||
|
@ -2,16 +2,20 @@ CONFIG_AT803X_PHY=y
|
||||
CONFIG_CRC16=y
|
||||
CONFIG_CRYPTO_DEFLATE=y
|
||||
CONFIG_GPIO_LATCH=y
|
||||
CONFIG_GPIO_RB4XX=y
|
||||
CONFIG_GPIO_WATCHDOG=y
|
||||
CONFIG_GPIO_WATCHDOG_ARCH_INITCALL=y
|
||||
CONFIG_LEDS_RESET=y
|
||||
CONFIG_LZO_DECOMPRESS=y
|
||||
CONFIG_MDIO_GPIO=y
|
||||
CONFIG_MFD_RB4XX_CPLD=y
|
||||
CONFIG_MIKROTIK=y
|
||||
CONFIG_MIKROTIK_RB_SYSFS=y
|
||||
CONFIG_MTD_NAND=y
|
||||
CONFIG_MTD_NAND_AR934X=y
|
||||
CONFIG_MTD_NAND_CORE=y
|
||||
CONFIG_MTD_NAND_ECC=y
|
||||
CONFIG_MTD_NAND_RB4XX=y
|
||||
CONFIG_MTD_RAW_NAND=y
|
||||
CONFIG_MTD_ROUTERBOOT_PARTS=y
|
||||
CONFIG_MTD_SPI_NAND=y
|
||||
@ -24,10 +28,12 @@ CONFIG_MTD_UBI_BEB_LIMIT=20
|
||||
# CONFIG_MTD_UBI_FASTMAP is not set
|
||||
# CONFIG_MTD_UBI_GLUEBI is not set
|
||||
CONFIG_NET_SWITCHDEV=y
|
||||
CONFIG_PCI_AR71XX=y
|
||||
CONFIG_PHY_AR7100_USB=y
|
||||
CONFIG_PHY_AR7200_USB=y
|
||||
CONFIG_REGULATOR=y
|
||||
CONFIG_REGULATOR_FIXED_VOLTAGE=y
|
||||
CONFIG_SPI_RB4XX=y
|
||||
CONFIG_UBIFS_FS=y
|
||||
CONFIG_UBIFS_FS_ADVANCED_COMPR=y
|
||||
CONFIG_UBIFS_FS_LZO=y
|
||||
|
69
target/linux/ath79/patches-4.19/920-mikrotik-rb4xx.patch
Normal file
69
target/linux/ath79/patches-4.19/920-mikrotik-rb4xx.patch
Normal file
@ -0,0 +1,69 @@
|
||||
--- a/drivers/mfd/Kconfig
|
||||
+++ b/drivers/mfd/Kconfig
|
||||
@@ -1899,5 +1899,13 @@ config RAVE_SP_CORE
|
||||
Select this to get support for the Supervisory Processor
|
||||
device found on several devices in RAVE line of hardware.
|
||||
|
||||
+config MFD_RB4XX_CPLD
|
||||
+ tristate "CPLD driver for Mikrotik RB4xx series boards
|
||||
+ select MFD_CORE
|
||||
+ depends on ATH79 || COMPILE_TEST
|
||||
+ help
|
||||
+ Enables support for the CPLD chip (NAND & GPIO) on Mikrotik
|
||||
+ Routerboard RB4xx series.
|
||||
+
|
||||
endmenu
|
||||
endif
|
||||
--- a/drivers/mfd/Makefile
|
||||
+++ b/drivers/mfd/Makefile
|
||||
@@ -241,3 +241,4 @@ obj-$(CONFIG_MFD_SC27XX_PMIC) += sprd-sc
|
||||
obj-$(CONFIG_RAVE_SP_CORE) += rave-sp.o
|
||||
obj-$(CONFIG_MFD_ROHM_BD718XX) += rohm-bd718x7.o
|
||||
|
||||
+obj-$(CONFIG_MFD_RB4XX_CPLD) += rb4xx-cpld.o
|
||||
--- a/drivers/gpio/Kconfig
|
||||
+++ b/drivers/gpio/Kconfig
|
||||
@@ -1371,6 +1371,12 @@ config GPIO_XRA1403
|
||||
help
|
||||
GPIO driver for EXAR XRA1403 16-bit SPI-based GPIO expander.
|
||||
|
||||
+config GPIO_RB4XX
|
||||
+ tristate "GPIO expander for Mikrotik RB4xx series boards"
|
||||
+ depends on MFD_RB4XX_CPLD
|
||||
+ help
|
||||
+ GPIO driver for Mikrotik Routerboard RB4xx series.
|
||||
+
|
||||
endmenu
|
||||
|
||||
menu "USB GPIO expanders"
|
||||
--- a/drivers/gpio/Makefile
|
||||
+++ b/drivers/gpio/Makefile
|
||||
@@ -159,3 +159,4 @@ obj-$(CONFIG_GPIO_ZEVIO) += gpio-zevio.o
|
||||
obj-$(CONFIG_GPIO_ZYNQ) += gpio-zynq.o
|
||||
obj-$(CONFIG_GPIO_ZX) += gpio-zx.o
|
||||
obj-$(CONFIG_GPIO_LOONGSON1) += gpio-loongson1.o
|
||||
+obj-$(CONFIG_GPIO_RB4XX) += gpio-rb4xx.o
|
||||
--- a/drivers/mtd/nand/raw/Kconfig
|
||||
+++ b/drivers/mtd/nand/raw/Kconfig
|
||||
@@ -569,4 +569,11 @@ config MTD_NAND_AR934X
|
||||
Enables support for NAND controller on Qualcomm Atheros SoCs.
|
||||
This controller is found on AR934x and QCA955x SoCs.
|
||||
|
||||
+config MTD_NAND_RB4XX
|
||||
+ tristate "Support for NAND driver for Mikrotik RB4xx series boards"
|
||||
+ depends on MFD_RB4XX_CPLD
|
||||
+ help
|
||||
+ Enables support for the NAND flash chip on Mikrotik Routerboard
|
||||
+ RB4xx series.
|
||||
+
|
||||
endif # MTD_NAND
|
||||
--- a/drivers/mtd/nand/raw/Makefile
|
||||
+++ b/drivers/mtd/nand/raw/Makefile
|
||||
@@ -58,6 +58,7 @@ obj-$(CONFIG_MTD_NAND_QCOM) += qcom_nan
|
||||
obj-$(CONFIG_MTD_NAND_MTK) += mtk_ecc.o mtk_nand.o
|
||||
obj-$(CONFIG_MTD_NAND_TEGRA) += tegra_nand.o
|
||||
obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nand.o
|
||||
+obj-$(CONFIG_MTD_NAND_RB4XX) += nand_rb4xx.o
|
||||
|
||||
nand-objs := nand_base.o nand_bbt.o nand_timings.o nand_ids.o
|
||||
nand-objs += nand_amd.o
|
72
target/linux/ath79/patches-5.4/920-mikrotik-rb4xx.patch
Normal file
72
target/linux/ath79/patches-5.4/920-mikrotik-rb4xx.patch
Normal file
@ -0,0 +1,72 @@
|
||||
--- a/drivers/mfd/Kconfig
|
||||
+++ b/drivers/mfd/Kconfig
|
||||
@@ -2012,5 +2012,13 @@ config RAVE_SP_CORE
|
||||
Select this to get support for the Supervisory Processor
|
||||
device found on several devices in RAVE line of hardware.
|
||||
|
||||
+config MFD_RB4XX_CPLD
|
||||
+ tristate "CPLD driver for Mikrotik RB4xx series boards
|
||||
+ select MFD_CORE
|
||||
+ depends on ATH79 || COMPILE_TEST
|
||||
+ help
|
||||
+ Enables support for the CPLD chip (NAND & GPIO) on Mikrotik
|
||||
+ Routerboard RB4xx series.
|
||||
+
|
||||
endmenu
|
||||
endif
|
||||
--- a/drivers/mfd/Makefile
|
||||
+++ b/drivers/mfd/Makefile
|
||||
@@ -256,3 +256,4 @@ obj-$(CONFIG_MFD_ROHM_BD70528) += rohm-b
|
||||
obj-$(CONFIG_MFD_ROHM_BD718XX) += rohm-bd718x7.o
|
||||
obj-$(CONFIG_MFD_STMFX) += stmfx.o
|
||||
|
||||
+obj-$(CONFIG_MFD_RB4XX_CPLD) += rb4xx-cpld.o
|
||||
--- a/drivers/gpio/Kconfig
|
||||
+++ b/drivers/gpio/Kconfig
|
||||
@@ -1406,6 +1406,12 @@ config GPIO_SODAVILLE
|
||||
help
|
||||
Say Y here to support Intel Sodaville GPIO.
|
||||
|
||||
+config GPIO_RB4XX
|
||||
+ tristate "GPIO expander for Mikrotik RB4xx series boards"
|
||||
+ depends on MFD_RB4XX_CPLD
|
||||
+ help
|
||||
+ GPIO driver for Mikrotik Routerboard RB4xx series.
|
||||
+
|
||||
endmenu
|
||||
|
||||
menu "SPI GPIO expanders"
|
||||
--- a/drivers/gpio/Makefile
|
||||
+++ b/drivers/gpio/Makefile
|
||||
@@ -113,6 +113,7 @@ obj-$(CONFIG_GPIO_PL061) += gpio-pl061.
|
||||
obj-$(CONFIG_GPIO_PMIC_EIC_SPRD) += gpio-pmic-eic-sprd.o
|
||||
obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o
|
||||
obj-$(CONFIG_GPIO_RASPBERRYPI_EXP) += gpio-raspberrypi-exp.o
|
||||
+obj-$(CONFIG_GPIO_RB4XX) += gpio-rb4xx.o
|
||||
obj-$(CONFIG_GPIO_RC5T583) += gpio-rc5t583.o
|
||||
obj-$(CONFIG_GPIO_RCAR) += gpio-rcar.o
|
||||
obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o
|
||||
--- a/drivers/mtd/nand/raw/Kconfig
|
||||
+++ b/drivers/mtd/nand/raw/Kconfig
|
||||
@@ -552,4 +552,11 @@ config MTD_NAND_AR934X
|
||||
Enables support for NAND controller on Qualcomm Atheros SoCs.
|
||||
This controller is found on AR934x and QCA955x SoCs.
|
||||
|
||||
+config MTD_NAND_RB4XX
|
||||
+ tristate "Support for NAND driver for Mikrotik RB4xx series boards"
|
||||
+ depends on MFD_RB4XX_CPLD
|
||||
+ help
|
||||
+ Enables support for the NAND flash chip on Mikrotik Routerboard
|
||||
+ RB4xx series.
|
||||
+
|
||||
endif # MTD_RAW_NAND
|
||||
--- a/drivers/mtd/nand/raw/Makefile
|
||||
+++ b/drivers/mtd/nand/raw/Makefile
|
||||
@@ -58,6 +58,7 @@ obj-$(CONFIG_MTD_NAND_TEGRA) += tegra_n
|
||||
obj-$(CONFIG_MTD_NAND_STM32_FMC2) += stm32_fmc2_nand.o
|
||||
obj-$(CONFIG_MTD_NAND_MESON) += meson_nand.o
|
||||
obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nand.o
|
||||
+obj-$(CONFIG_MTD_NAND_RB4XX) += nand_rb4xx.o
|
||||
|
||||
nand-objs := nand_base.o nand_legacy.o nand_bbt.o nand_timings.o nand_ids.o
|
||||
nand-objs += nand_onfi.o
|
@ -101,19 +101,19 @@
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
cfe@0 {
|
||||
partition@0 {
|
||||
label = "CFE";
|
||||
reg = <0x000000 0x020000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
linux@10000 {
|
||||
partition@20000 {
|
||||
label = "linux";
|
||||
reg = <0x010000 0xfc0000>;
|
||||
reg = <0x020000 0xfc0000>;
|
||||
compatible = "brcm,bcm963xx-imagetag";
|
||||
};
|
||||
|
||||
nvram@7f0000 {
|
||||
partition@fe0000 {
|
||||
label = "nvram";
|
||||
reg = <0xfe0000 0x020000>;
|
||||
};
|
||||
|
@ -0,0 +1,50 @@
|
||||
From: Christopher Hill <ch6574@gmail.com>
|
||||
To: Mark Brown <broonie@kernel.org>
|
||||
Cc: Christopher Hill <ch6574@gmail.com>, linux-spi@vger.kernel.org,
|
||||
linux-kernel@vger.kernel.org
|
||||
Subject: [PATCH 1/3] spi: rb4xx: null pointer bug fix
|
||||
Date: Thu, 21 May 2020 14:36:29 -0400
|
||||
Message-Id: <20200521183631.37806-1-ch6574@gmail.com>
|
||||
X-Mailer: git-send-email 2.25.1
|
||||
MIME-Version: 1.0
|
||||
Sender: linux-spi-owner@vger.kernel.org
|
||||
Precedence: bulk
|
||||
List-ID: <linux-spi.vger.kernel.org>
|
||||
X-Mailing-List: linux-spi@vger.kernel.org
|
||||
|
||||
This patch fixes a null pointer bug in the spi driver spi-rb4xx.c by
|
||||
moving the private data initialization to earlier in probe
|
||||
|
||||
Signed-off-by: Christopher Hill <ch6574@gmail.com>
|
||||
---
|
||||
drivers/spi/spi-rb4xx.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c
|
||||
index 4c9620e0d18c..17e1a77dc132 100644
|
||||
--- a/drivers/spi/spi-rb4xx.c
|
||||
+++ b/drivers/spi/spi-rb4xx.c
|
||||
@@ -158,6 +158,11 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
|
||||
master->transfer_one = rb4xx_transfer_one;
|
||||
master->set_cs = rb4xx_set_cs;
|
||||
|
||||
+ rbspi = spi_master_get_devdata(master);
|
||||
+ rbspi->base = spi_base;
|
||||
+ rbspi->clk = ahb_clk;
|
||||
+ platform_set_drvdata(pdev, rbspi);
|
||||
+
|
||||
err = devm_spi_register_master(&pdev->dev, master);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "failed to register SPI master\n");
|
||||
@@ -168,11 +173,6 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
- rbspi = spi_master_get_devdata(master);
|
||||
- rbspi->base = spi_base;
|
||||
- rbspi->clk = ahb_clk;
|
||||
- platform_set_drvdata(pdev, rbspi);
|
||||
-
|
||||
/* Enable SPI */
|
||||
rb4xx_write(rbspi, AR71XX_SPI_REG_FS, AR71XX_SPI_FS_GPIO);
|
||||
|
@ -0,0 +1,62 @@
|
||||
From: Christopher Hill <ch6574@gmail.com>
|
||||
To: Mark Brown <broonie@kernel.org>
|
||||
Cc: Christopher Hill <ch6574@gmail.com>, linux-spi@vger.kernel.org,
|
||||
linux-kernel@vger.kernel.org
|
||||
Subject: [PATCH 2/3] spi: rb4xx: update driver to be device tree aware
|
||||
Date: Thu, 21 May 2020 14:36:30 -0400
|
||||
Message-Id: <20200521183631.37806-2-ch6574@gmail.com>
|
||||
X-Mailer: git-send-email 2.25.1
|
||||
In-Reply-To: <20200521183631.37806-1-ch6574@gmail.com>
|
||||
References: <20200521183631.37806-1-ch6574@gmail.com>
|
||||
MIME-Version: 1.0
|
||||
Sender: linux-spi-owner@vger.kernel.org
|
||||
Precedence: bulk
|
||||
List-ID: <linux-spi.vger.kernel.org>
|
||||
X-Mailing-List: linux-spi@vger.kernel.org
|
||||
|
||||
This patch updates the spi driver spi-rb4xx.c to be device tree aware
|
||||
|
||||
Signed-off-by: Christopher Hill <ch6574@gmail.com>
|
||||
---
|
||||
drivers/spi/spi-rb4xx.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c
|
||||
index 17e1a77dc132..8aa51beb4ff3 100644
|
||||
--- a/drivers/spi/spi-rb4xx.c
|
||||
+++ b/drivers/spi/spi-rb4xx.c
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/spi/spi.h>
|
||||
+#include <linux/of.h>
|
||||
|
||||
#include <asm/mach-ath79/ar71xx_regs.h>
|
||||
|
||||
@@ -150,6 +151,7 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(ahb_clk))
|
||||
return PTR_ERR(ahb_clk);
|
||||
|
||||
+ master->dev.of_node = pdev->dev.of_node;
|
||||
master->bus_num = 0;
|
||||
master->num_chipselect = 3;
|
||||
master->mode_bits = SPI_TX_DUAL;
|
||||
@@ -188,11 +190,18 @@ static int rb4xx_spi_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static const struct of_device_id rb4xx_spi_dt_match[] = {
|
||||
+ { .compatible = "mikrotik,rb4xx-spi" },
|
||||
+ { },
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rb4xx_spi_dt_match);
|
||||
+
|
||||
static struct platform_driver rb4xx_spi_drv = {
|
||||
.probe = rb4xx_spi_probe,
|
||||
.remove = rb4xx_spi_remove,
|
||||
.driver = {
|
||||
.name = "rb4xx-spi",
|
||||
+ .of_match_table = of_match_ptr(rb4xx_spi_dt_match),
|
||||
},
|
||||
};
|
||||
|
@ -0,0 +1,50 @@
|
||||
From: Christopher Hill <ch6574@gmail.com>
|
||||
To: Mark Brown <broonie@kernel.org>
|
||||
Cc: Christopher Hill <ch6574@gmail.com>, linux-spi@vger.kernel.org,
|
||||
linux-kernel@vger.kernel.org
|
||||
Subject: [PATCH 1/3] spi: rb4xx: null pointer bug fix
|
||||
Date: Thu, 21 May 2020 14:36:29 -0400
|
||||
Message-Id: <20200521183631.37806-1-ch6574@gmail.com>
|
||||
X-Mailer: git-send-email 2.25.1
|
||||
MIME-Version: 1.0
|
||||
Sender: linux-spi-owner@vger.kernel.org
|
||||
Precedence: bulk
|
||||
List-ID: <linux-spi.vger.kernel.org>
|
||||
X-Mailing-List: linux-spi@vger.kernel.org
|
||||
|
||||
This patch fixes a null pointer bug in the spi driver spi-rb4xx.c by
|
||||
moving the private data initialization to earlier in probe
|
||||
|
||||
Signed-off-by: Christopher Hill <ch6574@gmail.com>
|
||||
---
|
||||
drivers/spi/spi-rb4xx.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c
|
||||
index 4c9620e0d18c..17e1a77dc132 100644
|
||||
--- a/drivers/spi/spi-rb4xx.c
|
||||
+++ b/drivers/spi/spi-rb4xx.c
|
||||
@@ -158,6 +158,11 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
|
||||
master->transfer_one = rb4xx_transfer_one;
|
||||
master->set_cs = rb4xx_set_cs;
|
||||
|
||||
+ rbspi = spi_master_get_devdata(master);
|
||||
+ rbspi->base = spi_base;
|
||||
+ rbspi->clk = ahb_clk;
|
||||
+ platform_set_drvdata(pdev, rbspi);
|
||||
+
|
||||
err = devm_spi_register_master(&pdev->dev, master);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "failed to register SPI master\n");
|
||||
@@ -168,11 +173,6 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
- rbspi = spi_master_get_devdata(master);
|
||||
- rbspi->base = spi_base;
|
||||
- rbspi->clk = ahb_clk;
|
||||
- platform_set_drvdata(pdev, rbspi);
|
||||
-
|
||||
/* Enable SPI */
|
||||
rb4xx_write(rbspi, AR71XX_SPI_REG_FS, AR71XX_SPI_FS_GPIO);
|
||||
|
@ -0,0 +1,62 @@
|
||||
From: Christopher Hill <ch6574@gmail.com>
|
||||
To: Mark Brown <broonie@kernel.org>
|
||||
Cc: Christopher Hill <ch6574@gmail.com>, linux-spi@vger.kernel.org,
|
||||
linux-kernel@vger.kernel.org
|
||||
Subject: [PATCH 2/3] spi: rb4xx: update driver to be device tree aware
|
||||
Date: Thu, 21 May 2020 14:36:30 -0400
|
||||
Message-Id: <20200521183631.37806-2-ch6574@gmail.com>
|
||||
X-Mailer: git-send-email 2.25.1
|
||||
In-Reply-To: <20200521183631.37806-1-ch6574@gmail.com>
|
||||
References: <20200521183631.37806-1-ch6574@gmail.com>
|
||||
MIME-Version: 1.0
|
||||
Sender: linux-spi-owner@vger.kernel.org
|
||||
Precedence: bulk
|
||||
List-ID: <linux-spi.vger.kernel.org>
|
||||
X-Mailing-List: linux-spi@vger.kernel.org
|
||||
|
||||
This patch updates the spi driver spi-rb4xx.c to be device tree aware
|
||||
|
||||
Signed-off-by: Christopher Hill <ch6574@gmail.com>
|
||||
---
|
||||
drivers/spi/spi-rb4xx.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c
|
||||
index 17e1a77dc132..8aa51beb4ff3 100644
|
||||
--- a/drivers/spi/spi-rb4xx.c
|
||||
+++ b/drivers/spi/spi-rb4xx.c
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/spi/spi.h>
|
||||
+#include <linux/of.h>
|
||||
|
||||
#include <asm/mach-ath79/ar71xx_regs.h>
|
||||
|
||||
@@ -150,6 +151,7 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(ahb_clk))
|
||||
return PTR_ERR(ahb_clk);
|
||||
|
||||
+ master->dev.of_node = pdev->dev.of_node;
|
||||
master->bus_num = 0;
|
||||
master->num_chipselect = 3;
|
||||
master->mode_bits = SPI_TX_DUAL;
|
||||
@@ -188,11 +190,18 @@ static int rb4xx_spi_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static const struct of_device_id rb4xx_spi_dt_match[] = {
|
||||
+ { .compatible = "mikrotik,rb4xx-spi" },
|
||||
+ { },
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rb4xx_spi_dt_match);
|
||||
+
|
||||
static struct platform_driver rb4xx_spi_drv = {
|
||||
.probe = rb4xx_spi_probe,
|
||||
.remove = rb4xx_spi_remove,
|
||||
.driver = {
|
||||
.name = "rb4xx-spi",
|
||||
+ .of_match_table = of_match_ptr(rb4xx_spi_dt_match),
|
||||
},
|
||||
};
|
||||
|
@ -350,6 +350,7 @@ CONFIG_ATAGS_PROC=y
|
||||
# CONFIG_ATA_ACPI is not set
|
||||
CONFIG_ATA_BMDMA=y
|
||||
# CONFIG_ATA_GENERIC is not set
|
||||
# CONFIG_ATA_LEDS is not set
|
||||
# CONFIG_ATA_NONSTANDARD is not set
|
||||
# CONFIG_ATA_OVER_ETH is not set
|
||||
# CONFIG_ATA_PIIX is not set
|
||||
@ -5225,6 +5226,7 @@ CONFIG_USB_DEFAULT_PERSIST=y
|
||||
# CONFIG_USB_DYNAMIC_MINORS is not set
|
||||
# CONFIG_USB_EG20T is not set
|
||||
# CONFIG_USB_EHCI_ATH79 is not set
|
||||
# CONFIG_USB_EHCI_HCD is not set
|
||||
# CONFIG_USB_EHCI_HCD_AT91 is not set
|
||||
# CONFIG_USB_EHCI_HCD_OMAP is not set
|
||||
# CONFIG_USB_EHCI_HCD_PPC_OF is not set
|
||||
|
@ -359,6 +359,7 @@ CONFIG_ATAGS_PROC=y
|
||||
# CONFIG_ATA_ACPI is not set
|
||||
CONFIG_ATA_BMDMA=y
|
||||
# CONFIG_ATA_GENERIC is not set
|
||||
# CONFIG_ATA_LEDS is not set
|
||||
# CONFIG_ATA_NONSTANDARD is not set
|
||||
# CONFIG_ATA_OVER_ETH is not set
|
||||
# CONFIG_ATA_PIIX is not set
|
||||
@ -5502,6 +5503,7 @@ CONFIG_USB_DEFAULT_PERSIST=y
|
||||
# CONFIG_USB_DYNAMIC_MINORS is not set
|
||||
# CONFIG_USB_EG20T is not set
|
||||
# CONFIG_USB_EHCI_ATH79 is not set
|
||||
# CONFIG_USB_EHCI_HCD is not set
|
||||
# CONFIG_USB_EHCI_HCD_AT91 is not set
|
||||
# CONFIG_USB_EHCI_HCD_OMAP is not set
|
||||
# CONFIG_USB_EHCI_HCD_PPC_OF is not set
|
||||
|
@ -399,6 +399,7 @@ CONFIG_ATAGS_PROC=y
|
||||
# CONFIG_ATA_ACPI is not set
|
||||
CONFIG_ATA_BMDMA=y
|
||||
# CONFIG_ATA_GENERIC is not set
|
||||
# CONFIG_ATA_LEDS is not set
|
||||
# CONFIG_ATA_NONSTANDARD is not set
|
||||
# CONFIG_ATA_OVER_ETH is not set
|
||||
# CONFIG_ATA_PIIX is not set
|
||||
@ -5877,6 +5878,7 @@ CONFIG_USB_DEFAULT_PERSIST=y
|
||||
# CONFIG_USB_EG20T is not set
|
||||
# CONFIG_USB_EHCI_ATH79 is not set
|
||||
# CONFIG_USB_EHCI_FSL is not set
|
||||
# CONFIG_USB_EHCI_HCD is not set
|
||||
# CONFIG_USB_EHCI_HCD_AT91 is not set
|
||||
# CONFIG_USB_EHCI_HCD_OMAP is not set
|
||||
# CONFIG_USB_EHCI_HCD_PPC_OF is not set
|
||||
|
@ -48,7 +48,8 @@ define Device/DniImage
|
||||
NETGEAR_HW_ID :=
|
||||
IMAGES := factory.img sysupgrade.bin
|
||||
IMAGE/factory.img := append-kernel | pad-offset 64k 64 | append-uImage-fakehdr filesystem | append-rootfs | pad-rootfs | netgear-dni
|
||||
IMAGE/sysupgrade.bin := append-kernel | pad-offset 64k 64 | append-uImage-fakehdr filesystem | append-rootfs | pad-rootfs | append-metadata
|
||||
IMAGE/sysupgrade.bin := append-kernel | pad-offset 64k 64 | append-uImage-fakehdr filesystem | \
|
||||
append-rootfs | pad-rootfs | append-metadata | check-size
|
||||
endef
|
||||
|
||||
define Build/append-rootfshdr
|
||||
@ -215,7 +216,7 @@ define Device/avm_fritzbox-4040
|
||||
UBOOT_PARTITION_SIZE := 524288
|
||||
IMAGES = eva.bin sysupgrade.bin
|
||||
IMAGE/eva.bin := append-uboot | pad-to $$$$(UBOOT_PARTITION_SIZE) | append-kernel | append-rootfs | pad-rootfs
|
||||
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
|
||||
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size
|
||||
DEVICE_PACKAGES := fritz-tffs fritz-caldata
|
||||
endef
|
||||
TARGET_DEVICES += avm_fritzbox-4040
|
||||
@ -527,6 +528,7 @@ define Device/netgear_ex61x0v2
|
||||
DEVICE_DTS_CONFIG := config@4
|
||||
NETGEAR_BOARD_ID := EX6150v2series
|
||||
NETGEAR_HW_ID := 29765285+16+0+128+2x2
|
||||
IMAGE_SIZE := 14400k
|
||||
SOC := qcom-ipq4018
|
||||
endef
|
||||
|
||||
@ -687,6 +689,7 @@ define Device/zyxel_nbg6617
|
||||
DEVICE_VENDOR := ZyXEL
|
||||
DEVICE_MODEL := NBG6617
|
||||
SOC := qcom-ipq4018
|
||||
KERNEL_SIZE := 4096k
|
||||
ROOTFS_SIZE := 24960k
|
||||
RAS_BOARD := NBG6617
|
||||
RAS_ROOTFS_SIZE := 19840k
|
||||
@ -709,8 +712,9 @@ define Device/zyxel_wre6606
|
||||
DEVICE_MODEL := WRE6606
|
||||
DEVICE_DTS_CONFIG := config@4
|
||||
SOC := qcom-ipq4018
|
||||
IMAGE_SIZE := 13184k
|
||||
IMAGES := sysupgrade.bin
|
||||
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
|
||||
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size
|
||||
DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers
|
||||
endef
|
||||
TARGET_DEVICES += zyxel_wre6606
|
||||
|
@ -18,6 +18,6 @@ include $(INCLUDE_DIR)/target.mk
|
||||
|
||||
KERNELNAME:=zImage dtbs
|
||||
|
||||
DEFAULT_PACKAGES += uboot-envtools
|
||||
DEFAULT_PACKAGES += uboot-envtools kmod-usb2
|
||||
|
||||
$(eval $(call BuildTarget))
|
||||
|
@ -16,16 +16,6 @@ case "$board" in
|
||||
"linksys,viper")
|
||||
ucidef_set_led_default "pulse" "pulse" "viper:white:pulse" "1"
|
||||
;;
|
||||
"zyxel,nsa310b")
|
||||
ucidef_set_led_usbhost "usb" "USB" "nsa310:green:usb"
|
||||
ucidef_set_led_ataport "hdd" "HDD" "nsa310:green:hdd" "1"
|
||||
ucidef_set_led_ataport "esata" "eSata" "nsa310:green:esata" "2"
|
||||
;;
|
||||
"zyxel,nsa325")
|
||||
ucidef_set_led_usbhost "usb" "USB" "nsa325:green:usb"
|
||||
ucidef_set_led_ataport "hdd1" "HDD1" "nsa325:green:hdd1" "1"
|
||||
ucidef_set_led_ataport "hdd2" "HDD2" "nsa325:green:hdd2" "2"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
@ -44,7 +44,6 @@ CONFIG_ARM=y
|
||||
# CONFIG_ARMADA_THERMAL is not set
|
||||
CONFIG_ARM_APPENDED_DTB=y
|
||||
CONFIG_ARM_ATAG_DTB_COMPAT=y
|
||||
# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND is not set
|
||||
CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y
|
||||
CONFIG_ARM_HAS_SG_CHAIN=y
|
||||
# CONFIG_ARM_KIRKWOOD_CPUIDLE is not set
|
||||
@ -71,14 +70,12 @@ CONFIG_COMMON_CLK=y
|
||||
CONFIG_COMPAT_32BIT_TIME=y
|
||||
CONFIG_CPU_32v5=y
|
||||
CONFIG_CPU_ABRT_EV5T=y
|
||||
# CONFIG_CPU_BIG_ENDIAN is not set
|
||||
CONFIG_CPU_CACHE_VIVT=y
|
||||
CONFIG_CPU_COPY_FEROCEON=y
|
||||
CONFIG_CPU_CP15=y
|
||||
CONFIG_CPU_CP15_MMU=y
|
||||
CONFIG_CPU_FEROCEON=y
|
||||
# CONFIG_CPU_FEROCEON_OLD_ID is not set
|
||||
# CONFIG_CPU_ICACHE_DISABLE is not set
|
||||
CONFIG_CPU_IDLE=y
|
||||
CONFIG_CPU_IDLE_GOV_LADDER=y
|
||||
CONFIG_CPU_PABRT_LEGACY=y
|
||||
@ -112,7 +109,6 @@ CONFIG_DEBUG_UART_8250_SHIFT=2
|
||||
CONFIG_DEBUG_UART_PHYS=0xf1012000
|
||||
CONFIG_DEBUG_UART_VIRT=0xfed12000
|
||||
CONFIG_DEBUG_UNCOMPRESS=y
|
||||
# CONFIG_DEBUG_USER is not set
|
||||
# CONFIG_DLCI is not set
|
||||
CONFIG_DMA_REMAP=y
|
||||
CONFIG_DNOTIFY=y
|
||||
@ -120,12 +116,9 @@ CONFIG_DTC=y
|
||||
# CONFIG_EARLY_PRINTK is not set
|
||||
CONFIG_EDAC_ATOMIC_SCRUB=y
|
||||
CONFIG_EDAC_SUPPORT=y
|
||||
CONFIG_EXT4_FS=y
|
||||
CONFIG_FIXED_PHY=y
|
||||
CONFIG_FIX_EARLYCON_MEM=y
|
||||
CONFIG_FORCE_PCI=y
|
||||
CONFIG_FS_IOMAP=y
|
||||
CONFIG_FS_MBCACHE=y
|
||||
CONFIG_FW_LOADER_PAGED_BUF=y
|
||||
CONFIG_GENERIC_ALLOCATOR=y
|
||||
CONFIG_GENERIC_ATOMIC64=y
|
||||
@ -148,6 +141,7 @@ CONFIG_GLOB=y
|
||||
CONFIG_GPIOLIB=y
|
||||
CONFIG_GPIO_MVEBU=y
|
||||
CONFIG_GPIO_SYSFS=y
|
||||
CONFIG_GRO_CELLS=y
|
||||
CONFIG_HANDLE_DOMAIN_IRQ=y
|
||||
CONFIG_HARDIRQS_SW_RESEND=y
|
||||
CONFIG_HAS_DMA=y
|
||||
@ -192,6 +186,8 @@ CONFIG_HAVE_UID16=y
|
||||
CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
|
||||
CONFIG_HW_RANDOM=y
|
||||
CONFIG_HW_RANDOM_OMAP=y
|
||||
CONFIG_HZ=100
|
||||
CONFIG_HZ_100=y
|
||||
CONFIG_HZ_FIXED=0
|
||||
CONFIG_HZ_PERIODIC=y
|
||||
CONFIG_I2C=y
|
||||
@ -204,7 +200,6 @@ CONFIG_IRQCHIP=y
|
||||
CONFIG_IRQ_DOMAIN=y
|
||||
CONFIG_IRQ_FORCED_THREADING=y
|
||||
CONFIG_IRQ_WORK=y
|
||||
CONFIG_JBD2=y
|
||||
CONFIG_KIRKWOOD_CLK=y
|
||||
CONFIG_KIRKWOOD_THERMAL=y
|
||||
CONFIG_LEDS_GPIO=y
|
||||
@ -221,10 +216,6 @@ CONFIG_MDIO_BUS=y
|
||||
CONFIG_MDIO_DEVICE=y
|
||||
CONFIG_MEMFD_CREATE=y
|
||||
CONFIG_MIGRATION=y
|
||||
CONFIG_MMC=y
|
||||
CONFIG_MMC_BLOCK=y
|
||||
CONFIG_MMC_MVSDIO=y
|
||||
# CONFIG_MMC_TIFM_SD is not set
|
||||
CONFIG_MODULES_USE_ELF_REL=y
|
||||
# CONFIG_MTD_CFI is not set
|
||||
CONFIG_MTD_CMDLINE_PARTS=y
|
||||
@ -258,7 +249,6 @@ CONFIG_NET_DSA_TAG_EDSA=y
|
||||
CONFIG_NET_SWITCHDEV=y
|
||||
CONFIG_NLS=y
|
||||
CONFIG_NVMEM=y
|
||||
# CONFIG_NVMEM_REBOOT_MODE is not set
|
||||
CONFIG_OF=y
|
||||
CONFIG_OF_ADDRESS=y
|
||||
CONFIG_OF_EARLY_FLATTREE=y
|
||||
@ -305,7 +295,7 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y
|
||||
CONFIG_RTC_CLASS=y
|
||||
CONFIG_RTC_DRV_MV=y
|
||||
CONFIG_RTC_I2C_AND_SPI=y
|
||||
CONFIG_SATA_MV=y
|
||||
CONFIG_RTC_MC146818_LIB=y
|
||||
CONFIG_SATA_PMP=y
|
||||
CONFIG_SCSI=y
|
||||
CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
|
||||
@ -343,15 +333,9 @@ CONFIG_UBIFS_FS_ZLIB=y
|
||||
# CONFIG_UBIFS_FS_ZSTD is not set
|
||||
CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
|
||||
CONFIG_UNWINDER_ARM=y
|
||||
# CONFIG_UNWINDER_FRAME_POINTER is not set
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_COMMON=y
|
||||
# CONFIG_USB_EHCI_FSL is not set
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
CONFIG_USB_EHCI_HCD_ORION=y
|
||||
# CONFIG_USB_EHCI_HCD_PLATFORM is not set
|
||||
CONFIG_USB_LED_TRIG=y
|
||||
CONFIG_USB_STORAGE=y
|
||||
CONFIG_USB_SUPPORT=y
|
||||
CONFIG_USE_OF=y
|
||||
# CONFIG_VFP is not set
|
||||
|
@ -101,6 +101,7 @@
|
||||
green-hdd {
|
||||
label = "nsa310:green:hdd";
|
||||
gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
|
||||
linux,default-trigger = "ata1";
|
||||
};
|
||||
|
||||
red-hdd {
|
||||
@ -111,6 +112,7 @@
|
||||
green-esata {
|
||||
label = "nsa310:green:esata";
|
||||
gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
|
||||
linux,default-trigger = "ata2";
|
||||
};
|
||||
|
||||
red-esata {
|
||||
@ -121,6 +123,7 @@
|
||||
green-usb {
|
||||
label = "nsa310:green:usb";
|
||||
gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
|
||||
linux,default-trigger = "usb-host";
|
||||
};
|
||||
|
||||
red-usb {
|
||||
|
@ -36,6 +36,7 @@ define Device/cisco_on100
|
||||
UBINIZE_OPTS := -E 5
|
||||
IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
|
||||
BOARD_NAME := on100
|
||||
DEVICE_PACKAGES := kmod-mvsdio
|
||||
endef
|
||||
TARGET_DEVICES += cisco_on100
|
||||
|
||||
@ -50,7 +51,7 @@ define Device/cloudengines_pogoplugv4
|
||||
DEVICE_VENDOR := Cloud Engines
|
||||
DEVICE_MODEL := Pogoplug V4
|
||||
DEVICE_DTS := kirkwood-pogoplug-series-4
|
||||
DEVICE_PACKAGES := kmod-usb3
|
||||
DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-mvsdio kmod-usb3
|
||||
endef
|
||||
TARGET_DEVICES += cloudengines_pogoplugv4
|
||||
|
||||
@ -65,7 +66,8 @@ define Device/iom_ix2-200
|
||||
DEVICE_VENDOR := Iomega
|
||||
DEVICE_MODEL := StorCenter ix2-200
|
||||
DEVICE_DTS := kirkwood-iomega_ix2_200
|
||||
DEVICE_PACKAGES := kmod-gpio-button-hotplug kmod-hwmon-lm63
|
||||
DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
|
||||
kmod-gpio-button-hotplug kmod-hwmon-lm63
|
||||
PAGESIZE := 512
|
||||
SUBPAGESIZE := 256
|
||||
BLOCKSIZE := 16k
|
||||
@ -90,7 +92,6 @@ define Device/linksys_audi
|
||||
UBINIZE_OPTS := -E 5
|
||||
IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
|
||||
BOARD_NAME := linksys-audi
|
||||
DEFAULT := n
|
||||
endef
|
||||
TARGET_DEVICES += linksys_audi
|
||||
|
||||
@ -110,6 +111,7 @@ define Device/raidsonic_ib-nas62x0
|
||||
DEVICE_VENDOR := RaidSonic
|
||||
DEVICE_MODEL := ICY BOX IB-NAS62x0
|
||||
BOARD_NAME := ib62x0
|
||||
DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4
|
||||
endef
|
||||
TARGET_DEVICES += raidsonic_ib-nas62x0
|
||||
|
||||
@ -124,6 +126,7 @@ define Device/seagate_goflexnet
|
||||
DEVICE_VENDOR := Seagate
|
||||
DEVICE_MODEL := GoFlexNet
|
||||
BOARD_NAME := goflexnet
|
||||
DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4
|
||||
endef
|
||||
TARGET_DEVICES += seagate_goflexnet
|
||||
|
||||
@ -131,13 +134,15 @@ define Device/seagate_goflexhome
|
||||
DEVICE_VENDOR := Seagate
|
||||
DEVICE_MODEL := GoFlexHome
|
||||
BOARD_NAME := goflexhome
|
||||
DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4
|
||||
endef
|
||||
TARGET_DEVICES += seagate_goflexhome
|
||||
|
||||
define Device/zyxel_nsa310b
|
||||
DEVICE_VENDOR := ZyXEL
|
||||
DEVICE_MODEL := NSA310b
|
||||
DEVICE_PACKAGES := kmod-r8169 kmod-gpio-button-hotplug kmod-hwmon-lm85
|
||||
DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-r8169 kmod-fs-ext4 \
|
||||
kmod-gpio-button-hotplug kmod-hwmon-lm85
|
||||
BOARD_NAME := nsa310b
|
||||
endef
|
||||
TARGET_DEVICES += zyxel_nsa310b
|
||||
@ -146,7 +151,8 @@ define Device/zyxel_nsa325
|
||||
DEVICE_VENDOR := ZyXEL
|
||||
DEVICE_MODEL := NSA325
|
||||
DEVICE_VARIANT := v1/v2
|
||||
DEVICE_PACKAGES := kmod-gpio-button-hotplug kmod-rtc-pcf8563 kmod-usb3
|
||||
DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
|
||||
kmod-gpio-button-hotplug kmod-rtc-pcf8563 kmod-usb3
|
||||
BOARD_NAME := nsa325
|
||||
endef
|
||||
TARGET_DEVICES += zyxel_nsa325
|
||||
|
@ -14,7 +14,7 @@
|
||||
memory {
|
||||
device_type = "memory";
|
||||
reg = <0x00000000 0x20000000>;
|
||||
@@ -162,11 +169,12 @@
|
||||
@@ -162,17 +169,19 @@
|
||||
&pmx_led_hdd1_green &pmx_led_hdd1_red>;
|
||||
pinctrl-names = "default";
|
||||
|
||||
@ -29,3 +29,26 @@
|
||||
label = "nsa325:orange:sys";
|
||||
gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
green-hdd1 {
|
||||
label = "nsa325:green:hdd1";
|
||||
gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
|
||||
+ linux,default-trigger = "ata1";
|
||||
};
|
||||
red-hdd1 {
|
||||
label = "nsa325:red:hdd1";
|
||||
@@ -181,6 +190,7 @@
|
||||
green-hdd2 {
|
||||
label = "nsa325:green:hdd2";
|
||||
gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
|
||||
+ linux,default-trigger = "ata2";
|
||||
};
|
||||
red-hdd2 {
|
||||
label = "nsa325:red:hdd2";
|
||||
@@ -189,6 +199,7 @@
|
||||
green-usb {
|
||||
label = "nsa325:green:usb";
|
||||
gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
|
||||
+ linux,default-trigger = "usb-host";
|
||||
};
|
||||
green-copy {
|
||||
label = "nsa325:green:copy";
|
||||
|
@ -1,4 +1,5 @@
|
||||
uci -q get network.globals.packet_steering > /dev/null || {
|
||||
uci set network.globals='globals'
|
||||
uci set network.globals.packet_steering=1
|
||||
uci commit network
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user