--- /dev/null
+From 35d017947401d9f449a7e55e52506744e0c62577 Mon Sep 17 00:00:00 2001
+From: Mathias Kresin <dev@kresin.me>
+Date: Wed, 22 Aug 2018 22:38:06 +0200
+Subject: [PATCH] MIPS: ralink: Add rt3352 SPI_CS1 pinmux
+
+The rt3352 has a pin that can be used as second spi chip select,
+watchdog reset or GPIO. The pinmux setup was missing the definition of
+said pin.
+
+The pin is configured via the same bit on rt5350, so reuse the existing
+macro.
+
+Signed-off-by: Mathias Kresin <dev@kresin.me>
+Signed-off-by: Paul Burton <paul.burton@mips.com>
+Patchwork: https://patchwork.linux-mips.org/patch/20301/
+Cc: John Crispin <john@phrozen.org>
+Cc: Ralf Baechle <ralf@linux-mips.org>
+Cc: James Hogan <jhogan@kernel.org>
+Cc: linux-mips@linux-mips.org
+Cc: linux-kernel@vger.kernel.org
+---
+ arch/mips/ralink/rt305x.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/arch/mips/ralink/rt305x.c
++++ b/arch/mips/ralink/rt305x.c
+@@ -49,6 +49,10 @@ static struct rt2880_pmx_func rgmii_func
+ static struct rt2880_pmx_func rt3352_lna_func[] = { FUNC("lna", 0, 36, 2) };
+ static struct rt2880_pmx_func rt3352_pa_func[] = { FUNC("pa", 0, 38, 2) };
+ static struct rt2880_pmx_func rt3352_led_func[] = { FUNC("led", 0, 40, 5) };
++static struct rt2880_pmx_func rt3352_cs1_func[] = {
++ FUNC("spi_cs1", 0, 45, 1),
++ FUNC("wdg_cs1", 1, 45, 1),
++};
+
+ static struct rt2880_pmx_group rt3050_pinmux_data[] = {
+ GRP("i2c", i2c_func, 1, RT305X_GPIO_MODE_I2C),
+@@ -75,6 +79,7 @@ static struct rt2880_pmx_group rt3352_pi
+ GRP("lna", rt3352_lna_func, 1, RT3352_GPIO_MODE_LNA),
+ GRP("pa", rt3352_pa_func, 1, RT3352_GPIO_MODE_PA),
+ GRP("led", rt3352_led_func, 1, RT5350_GPIO_MODE_PHY_LED),
++ GRP("spi_cs1", rt3352_cs1_func, 2, RT5350_GPIO_MODE_SPI_CS1),
+ { 0 }
+ };
+
#include "gpiolib.h"
-@@ -507,3 +509,69 @@ void of_gpiochip_remove(struct gpio_chip
+@@ -507,3 +509,66 @@ void of_gpiochip_remove(struct gpio_chip
gpiochip_remove_pin_ranges(chip);
of_node_put(chip->of_node);
}
#include <linux/usb/hcd.h>
#include <linux/usb/ch11.h>
-@@ -5171,6 +5172,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hso
+@@ -5200,6 +5201,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hso
retval = -ENOMEM;
spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK);
return ret;
-@@ -1175,7 +1227,7 @@ static const struct flash_info spi_nor_i
+@@ -1176,7 +1228,7 @@ static const struct flash_info spi_nor_i
{ "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) },
{ "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) },
{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },
{ "w25m512jv", INFO(0xef7119, 0, 64 * 1024, 1024,
SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ) },
-@@ -1235,6 +1287,9 @@ static int spi_nor_read(struct mtd_info
+@@ -1236,6 +1288,9 @@ static int spi_nor_read(struct mtd_info
if (ret)
return ret;
while (len) {
loff_t addr = from;
-@@ -1259,6 +1314,18 @@ static int spi_nor_read(struct mtd_info
+@@ -1260,6 +1315,18 @@ static int spi_nor_read(struct mtd_info
ret = 0;
read_err:
spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ);
return ret;
}
-@@ -1360,6 +1427,10 @@ static int spi_nor_write(struct mtd_info
+@@ -1361,6 +1428,10 @@ static int spi_nor_write(struct mtd_info
if (ret)
return ret;
for (i = 0; i < len; ) {
ssize_t written;
loff_t addr = to + i;
-@@ -1400,6 +1471,7 @@ static int spi_nor_write(struct mtd_info
+@@ -1401,6 +1472,7 @@ static int spi_nor_write(struct mtd_info
}
write_err:
spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE);
return ret;
}
-@@ -2816,8 +2888,10 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -2817,8 +2889,10 @@ int spi_nor_scan(struct spi_nor *nor, co
} else if (mtd->size > 0x1000000) {
/* enable 4-byte addressing if the device exceeds 16MiB */
nor->addr_width = 4;
/*
* Write status register 1 byte
* Returns negative if error occurred.
-@@ -2888,9 +2897,16 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -2889,9 +2898,16 @@ int spi_nor_scan(struct spi_nor *nor, co
} else if (mtd->size > 0x1000000) {
/* enable 4-byte addressing if the device exceeds 16MiB */
nor->addr_width = 4;
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1059,6 +1059,11 @@ static const struct flash_info spi_nor_i
+@@ -1060,6 +1060,11 @@ static const struct flash_info spi_nor_i
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
},
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1098,7 +1098,7 @@ static const struct flash_info spi_nor_i
+@@ -1099,7 +1099,7 @@ static const struct flash_info spi_nor_i
{ "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_4B_OPCODES) },
{ "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) },