mirror of https://github.com/hak5/openwrt.git
parent
ad76366d7d
commit
3a75777e86
|
@ -104,7 +104,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
+
|
+
|
||||||
+#define PMAC_HD_CTL_AS (1 << 19)
|
+#define PMAC_HD_CTL_AS (1 << 19)
|
||||||
+#define PMAC_HD_CTL_RXSH (1 << 22)
|
+#define PMAC_HD_CTL_RXSH (1 << 22)
|
||||||
+
|
|
||||||
+/* Switch Enable (0=disable, 1=enable) */
|
+/* Switch Enable (0=disable, 1=enable) */
|
||||||
+#define GCTL0_SE 0x80000000
|
+#define GCTL0_SE 0x80000000
|
||||||
+/* Disable MDIO auto polling (0=disable, 1=enable) */
|
+/* Disable MDIO auto polling (0=disable, 1=enable) */
|
||||||
|
@ -124,7 +124,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
+#define MDIO_XR9_REG_OFFSET 0
|
+#define MDIO_XR9_REG_OFFSET 0
|
||||||
+#define MDIO_XR9_ADDR_OFFSET 5
|
+#define MDIO_XR9_ADDR_OFFSET 5
|
||||||
+#define MDIO_XR9_WR_OFFSET 16
|
+#define MDIO_XR9_WR_OFFSET 16
|
||||||
|
+
|
||||||
+#define LTQ_DMA_ETOP ((of_machine_is_compatible("lantiq,ase")) ? \
|
+#define LTQ_DMA_ETOP ((of_machine_is_compatible("lantiq,ase")) ? \
|
||||||
+ (INT_NUM_IM3_IRL0) : (INT_NUM_IM2_IRL0))
|
+ (INT_NUM_IM3_IRL0) : (INT_NUM_IM2_IRL0))
|
||||||
+
|
+
|
||||||
|
@ -333,7 +333,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
|
|
||||||
- ltq_pmu_enable(PMU_PPE);
|
- ltq_pmu_enable(PMU_PPE);
|
||||||
+ clk_enable(priv->clk_ppe);
|
+ clk_enable(priv->clk_ppe);
|
||||||
+
|
|
||||||
|
- switch (priv->pldata->mii_mode) {
|
||||||
+ if (of_machine_is_compatible("lantiq,ar9")) {
|
+ if (of_machine_is_compatible("lantiq,ar9")) {
|
||||||
+ ltq_etop_gbit_init(dev);
|
+ ltq_etop_gbit_init(dev);
|
||||||
+ /* force the etops link to the gbit to MII */
|
+ /* force the etops link to the gbit to MII */
|
||||||
|
@ -342,8 +343,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
+ ltq_etop_w32_mask(MDIO_CFG_MASK, 0, LTQ_ETOP_MDIO_CFG);
|
+ ltq_etop_w32_mask(MDIO_CFG_MASK, 0, LTQ_ETOP_MDIO_CFG);
|
||||||
+ ltq_etop_w32_mask(MAC_CFG_MASK, MAC_CFG_CGEN | MAC_CFG_DUPLEX |
|
+ ltq_etop_w32_mask(MAC_CFG_MASK, MAC_CFG_CGEN | MAC_CFG_DUPLEX |
|
||||||
+ MAC_CFG_SPEED | MAC_CFG_LINK, LTQ_ETOP_MAC_CFG);
|
+ MAC_CFG_SPEED | MAC_CFG_LINK, LTQ_ETOP_MAC_CFG);
|
||||||
|
+
|
||||||
- switch (priv->pldata->mii_mode) {
|
|
||||||
+ switch (mii_mode) {
|
+ switch (mii_mode) {
|
||||||
case PHY_INTERFACE_MODE_RMII:
|
case PHY_INTERFACE_MODE_RMII:
|
||||||
- ltq_etop_w32_mask(ETOP_MII_MASK,
|
- ltq_etop_w32_mask(ETOP_MII_MASK,
|
||||||
|
@ -382,7 +382,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
- ltq_etop_w32(PPE32_CGEN, LQ_PPE32_ENET_MAC_CFG);
|
- ltq_etop_w32(PPE32_CGEN, LQ_PPE32_ENET_MAC_CFG);
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
+
|
|
||||||
|
- ltq_dma_init_port(DMA_PORT_ETOP);
|
||||||
+static int
|
+static int
|
||||||
+ltq_etop_dma_init(struct net_device *dev)
|
+ltq_etop_dma_init(struct net_device *dev)
|
||||||
+{
|
+{
|
||||||
|
@ -391,14 +392,21 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
+ int rx = priv->rx_irq - LTQ_DMA_ETOP;
|
+ int rx = priv->rx_irq - LTQ_DMA_ETOP;
|
||||||
+ int err;
|
+ int err;
|
||||||
|
|
||||||
ltq_dma_init_port(DMA_PORT_ETOP);
|
|
||||||
|
|
||||||
- for (i = 0; i < MAX_DMA_CHAN; i++) {
|
- for (i = 0; i < MAX_DMA_CHAN; i++) {
|
||||||
- int irq = LTQ_DMA_CH0_INT + i;
|
- int irq = LTQ_DMA_CH0_INT + i;
|
||||||
- struct ltq_etop_chan *ch = &priv->ch[i];
|
- struct ltq_etop_chan *ch = &priv->ch[i];
|
||||||
-
|
+ ltq_dma_init_port(DMA_PORT_ETOP);
|
||||||
|
|
||||||
- ch->idx = ch->dma.nr = i;
|
- ch->idx = ch->dma.nr = i;
|
||||||
-
|
+ priv->txch.dma.nr = tx;
|
||||||
|
+ ltq_dma_alloc_tx(&priv->txch.dma);
|
||||||
|
+ err = request_irq(priv->tx_irq, ltq_etop_dma_irq, 0, "eth_tx", priv);
|
||||||
|
+ if (err) {
|
||||||
|
+ netdev_err(dev, "failed to allocate tx irq\n");
|
||||||
|
+ goto err_out;
|
||||||
|
+ }
|
||||||
|
+ priv->txch.dma.irq = priv->tx_irq;
|
||||||
|
|
||||||
- if (IS_TX(i)) {
|
- if (IS_TX(i)) {
|
||||||
- ltq_dma_alloc_tx(&ch->dma);
|
- ltq_dma_alloc_tx(&ch->dma);
|
||||||
- request_irq(irq, ltq_etop_dma_irq, 0, "etop_tx", priv);
|
- request_irq(irq, ltq_etop_dma_irq, 0, "etop_tx", priv);
|
||||||
|
@ -410,15 +418,6 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
- return -ENOMEM;
|
- return -ENOMEM;
|
||||||
- ch->dma.desc = 0;
|
- ch->dma.desc = 0;
|
||||||
- request_irq(irq, ltq_etop_dma_irq, 0, "etop_rx", priv);
|
- request_irq(irq, ltq_etop_dma_irq, 0, "etop_rx", priv);
|
||||||
+ priv->txch.dma.nr = tx;
|
|
||||||
+ ltq_dma_alloc_tx(&priv->txch.dma);
|
|
||||||
+ err = request_irq(priv->tx_irq, ltq_etop_dma_irq, 0, "eth_tx", priv);
|
|
||||||
+ if (err) {
|
|
||||||
+ netdev_err(dev, "failed to allocate tx irq\n");
|
|
||||||
+ goto err_out;
|
|
||||||
+ }
|
|
||||||
+ priv->txch.dma.irq = priv->tx_irq;
|
|
||||||
+
|
|
||||||
+ priv->rxch.dma.nr = rx;
|
+ priv->rxch.dma.nr = rx;
|
||||||
+ ltq_dma_alloc_rx(&priv->rxch.dma);
|
+ ltq_dma_alloc_rx(&priv->rxch.dma);
|
||||||
+ for (priv->rxch.dma.desc = 0; priv->rxch.dma.desc < LTQ_DESC_NUM;
|
+ for (priv->rxch.dma.desc = 0; priv->rxch.dma.desc < LTQ_DESC_NUM;
|
||||||
|
@ -656,12 +655,6 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
- phy_stop(priv->phydev);
|
- phy_stop(priv->phydev);
|
||||||
- for (i = 0; i < MAX_DMA_CHAN; i++) {
|
- for (i = 0; i < MAX_DMA_CHAN; i++) {
|
||||||
- struct ltq_etop_chan *ch = &priv->ch[i];
|
- struct ltq_etop_chan *ch = &priv->ch[i];
|
||||||
-
|
|
||||||
- if (!IS_RX(i) && !IS_TX(i))
|
|
||||||
- continue;
|
|
||||||
- napi_disable(&ch->napi);
|
|
||||||
- ltq_dma_close(&ch->dma);
|
|
||||||
- }
|
|
||||||
+ if (priv->phydev)
|
+ if (priv->phydev)
|
||||||
+ phy_stop(priv->phydev);
|
+ phy_stop(priv->phydev);
|
||||||
+ napi_disable(&priv->txch.napi);
|
+ napi_disable(&priv->txch.napi);
|
||||||
|
@ -671,7 +664,12 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
+ ltq_dma_close(&priv->txch.dma);
|
+ ltq_dma_close(&priv->txch.dma);
|
||||||
+ ltq_dma_close(&priv->rxch.dma);
|
+ ltq_dma_close(&priv->rxch.dma);
|
||||||
+ spin_unlock_irqrestore(&priv->lock, flags);
|
+ spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
+
|
|
||||||
|
- if (!IS_RX(i) && !IS_TX(i))
|
||||||
|
- continue;
|
||||||
|
- napi_disable(&ch->napi);
|
||||||
|
- ltq_dma_close(&ch->dma);
|
||||||
|
- }
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -791,7 +789,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
@@ -733,30 +943,61 @@ ltq_etop_probe(struct platform_device *p
|
@@ -733,31 +943,62 @@ ltq_etop_probe(struct platform_device *p
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,10 +823,19 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
priv->pdev = pdev;
|
priv->pdev = pdev;
|
||||||
- priv->pldata = dev_get_platdata(&pdev->dev);
|
- priv->pldata = dev_get_platdata(&pdev->dev);
|
||||||
priv->netdev = dev;
|
priv->netdev = dev;
|
||||||
|
- spin_lock_init(&priv->lock);
|
||||||
+ priv->tx_irq = irqres[0].start;
|
+ priv->tx_irq = irqres[0].start;
|
||||||
+ priv->rx_irq = irqres[1].start;
|
+ priv->rx_irq = irqres[1].start;
|
||||||
+ priv->mii_mode = of_get_phy_mode(pdev->dev.of_node);
|
+ priv->mii_mode = of_get_phy_mode(pdev->dev.of_node);
|
||||||
+
|
|
||||||
|
- for (i = 0; i < MAX_DMA_CHAN; i++) {
|
||||||
|
- if (IS_TX(i))
|
||||||
|
- netif_napi_add(dev, &priv->ch[i].napi,
|
||||||
|
- ltq_etop_poll_tx, 8);
|
||||||
|
- else if (IS_RX(i))
|
||||||
|
- netif_napi_add(dev, &priv->ch[i].napi,
|
||||||
|
- ltq_etop_poll_rx, 32);
|
||||||
|
- priv->ch[i].netdev = dev;
|
||||||
+ mac = of_get_mac_address(pdev->dev.of_node);
|
+ mac = of_get_mac_address(pdev->dev.of_node);
|
||||||
+ if (mac)
|
+ if (mac)
|
||||||
+ memcpy(priv->mac, mac, ETH_ALEN);
|
+ memcpy(priv->mac, mac, ETH_ALEN);
|
||||||
|
@ -848,26 +855,18 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
+ priv->clk_ephycgu = clk_get(&pdev->dev, "ephycgu");
|
+ priv->clk_ephycgu = clk_get(&pdev->dev, "ephycgu");
|
||||||
+ if (IS_ERR(priv->clk_ephycgu))
|
+ if (IS_ERR(priv->clk_ephycgu))
|
||||||
+ return PTR_ERR(priv->clk_ephycgu);
|
+ return PTR_ERR(priv->clk_ephycgu);
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
spin_lock_init(&priv->lock);
|
|
||||||
|
|
||||||
- for (i = 0; i < MAX_DMA_CHAN; i++) {
|
+ spin_lock_init(&priv->lock);
|
||||||
- if (IS_TX(i))
|
+
|
||||||
- netif_napi_add(dev, &priv->ch[i].napi,
|
|
||||||
- ltq_etop_poll_tx, 8);
|
|
||||||
- else if (IS_RX(i))
|
|
||||||
- netif_napi_add(dev, &priv->ch[i].napi,
|
|
||||||
- ltq_etop_poll_rx, 32);
|
|
||||||
- priv->ch[i].netdev = dev;
|
|
||||||
- }
|
|
||||||
+ netif_napi_add(dev, &priv->txch.napi, ltq_etop_poll_tx, 8);
|
+ netif_napi_add(dev, &priv->txch.napi, ltq_etop_poll_tx, 8);
|
||||||
+ netif_napi_add(dev, &priv->rxch.napi, ltq_etop_poll_rx, 32);
|
+ netif_napi_add(dev, &priv->rxch.napi, ltq_etop_poll_rx, 32);
|
||||||
+ priv->txch.netdev = dev;
|
+ priv->txch.netdev = dev;
|
||||||
+ priv->rxch.netdev = dev;
|
+ priv->rxch.netdev = dev;
|
||||||
|
+
|
||||||
err = register_netdev(dev);
|
err = register_netdev(dev);
|
||||||
if (err)
|
if (err)
|
||||||
|
goto err_free;
|
||||||
@@ -785,31 +1026,22 @@ ltq_etop_remove(struct platform_device *
|
@@ -785,31 +1026,22 @@ ltq_etop_remove(struct platform_device *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
|
|
||||||
#include "gpiolib.h"
|
#include "gpiolib.h"
|
||||||
|
|
||||||
@@ -450,3 +452,73 @@
|
@@ -450,3 +452,73 @@ void of_gpiochip_remove(struct gpio_chip
|
||||||
gpiochip_remove_pin_ranges(chip);
|
gpiochip_remove_pin_ranges(chip);
|
||||||
of_node_put(chip->of_node);
|
of_node_put(chip->of_node);
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
+#endif
|
+#endif
|
||||||
--- a/include/asm-generic/gpio.h
|
--- a/include/asm-generic/gpio.h
|
||||||
+++ b/include/asm-generic/gpio.h
|
+++ b/include/asm-generic/gpio.h
|
||||||
@@ -122,6 +122,12 @@
|
@@ -122,6 +122,12 @@ static inline int gpio_export(unsigned g
|
||||||
return gpiod_export(gpio_to_desc(gpio), direction_may_change);
|
return gpiod_export(gpio_to_desc(gpio), direction_may_change);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
{
|
{
|
||||||
--- a/include/linux/gpio/consumer.h
|
--- a/include/linux/gpio/consumer.h
|
||||||
+++ b/include/linux/gpio/consumer.h
|
+++ b/include/linux/gpio/consumer.h
|
||||||
@@ -427,6 +427,7 @@
|
@@ -427,6 +427,7 @@ static inline struct gpio_desc *devm_get
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS)
|
#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS)
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
|
int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
|
||||||
int gpiod_export_link(struct device *dev, const char *name,
|
int gpiod_export_link(struct device *dev, const char *name,
|
||||||
struct gpio_desc *desc);
|
struct gpio_desc *desc);
|
||||||
@@ -434,6 +435,13 @@
|
@@ -434,6 +435,13 @@ void gpiod_unexport(struct gpio_desc *de
|
||||||
|
|
||||||
#else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
|
#else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
{
|
{
|
||||||
--- a/drivers/gpio/gpiolib-sysfs.c
|
--- a/drivers/gpio/gpiolib-sysfs.c
|
||||||
+++ b/drivers/gpio/gpiolib-sysfs.c
|
+++ b/drivers/gpio/gpiolib-sysfs.c
|
||||||
@@ -544,7 +544,7 @@
|
@@ -544,7 +544,7 @@ static struct class gpio_class = {
|
||||||
*
|
*
|
||||||
* Returns zero on success, else an error.
|
* Returns zero on success, else an error.
|
||||||
*/
|
*/
|
||||||
|
@ -146,7 +146,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
{
|
{
|
||||||
struct gpio_chip *chip;
|
struct gpio_chip *chip;
|
||||||
struct gpiod_data *data;
|
struct gpiod_data *data;
|
||||||
@@ -604,6 +604,8 @@
|
@@ -604,6 +604,8 @@ int gpiod_export(struct gpio_desc *desc,
|
||||||
offset = gpio_chip_hwgpio(desc);
|
offset = gpio_chip_hwgpio(desc);
|
||||||
if (chip->names && chip->names[offset])
|
if (chip->names && chip->names[offset])
|
||||||
ioname = chip->names[offset];
|
ioname = chip->names[offset];
|
||||||
|
@ -155,7 +155,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
|
|
||||||
dev = device_create_with_groups(&gpio_class, chip->dev,
|
dev = device_create_with_groups(&gpio_class, chip->dev,
|
||||||
MKDEV(0, 0), data, gpio_groups,
|
MKDEV(0, 0), data, gpio_groups,
|
||||||
@@ -625,6 +627,12 @@
|
@@ -625,6 +627,12 @@ err_unlock:
|
||||||
gpiod_dbg(desc, "%s: status %d\n", __func__, status);
|
gpiod_dbg(desc, "%s: status %d\n", __func__, status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
+#endif /* _PCI_ATH_FIXUP */
|
+#endif /* _PCI_ATH_FIXUP */
|
||||||
--- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
|
--- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
|
||||||
+++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
|
+++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
|
||||||
@@ -104,5 +104,8 @@
|
@@ -104,5 +104,8 @@ int xrx200_gphy_boot(struct device *dev,
|
||||||
extern void ltq_pmu_enable(unsigned int module);
|
extern void ltq_pmu_enable(unsigned int module);
|
||||||
extern void ltq_pmu_disable(unsigned int module);
|
extern void ltq_pmu_disable(unsigned int module);
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
#endif /* _LTQ_XWAY_H__ */
|
#endif /* _LTQ_XWAY_H__ */
|
||||||
--- a/arch/mips/lantiq/xway/Makefile
|
--- a/arch/mips/lantiq/xway/Makefile
|
||||||
+++ b/arch/mips/lantiq/xway/Makefile
|
+++ b/arch/mips/lantiq/xway/Makefile
|
||||||
@@ -2,4 +2,7 @@
|
@@ -2,4 +2,7 @@ obj-y := prom.o sysctrl.o clk.o reset.o
|
||||||
|
|
||||||
obj-y += vmmc.o tffs.o
|
obj-y += vmmc.o tffs.o
|
||||||
|
|
||||||
|
@ -624,7 +624,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
+device_initcall(of_ralink_eeprom_init);
|
+device_initcall(of_ralink_eeprom_init);
|
||||||
--- a/drivers/net/ethernet/lantiq_etop.c
|
--- a/drivers/net/ethernet/lantiq_etop.c
|
||||||
+++ b/drivers/net/ethernet/lantiq_etop.c
|
+++ b/drivers/net/ethernet/lantiq_etop.c
|
||||||
@@ -840,7 +840,11 @@
|
@@ -840,7 +840,11 @@ ltq_etop_init(struct net_device *dev)
|
||||||
if (err)
|
if (err)
|
||||||
goto err_hw;
|
goto err_hw;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||||
arch/mips/include/asm/io.h | 2 +-
|
arch/mips/include/asm/io.h | 2 +-
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
|
|
||||||
index d10fd80..d42eac9 100644
|
|
||||||
--- a/arch/mips/include/asm/io.h
|
--- a/arch/mips/include/asm/io.h
|
||||||
+++ b/arch/mips/include/asm/io.h
|
+++ b/arch/mips/include/asm/io.h
|
||||||
@@ -50,7 +50,7 @@
|
@@ -50,7 +50,7 @@
|
||||||
|
@ -23,6 +21,3 @@ index d10fd80..d42eac9 100644
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* On MIPS I/O ports are memory mapped, so we access them using normal
|
* On MIPS I/O ports are memory mapped, so we access them using normal
|
||||||
--
|
|
||||||
1.7.10.4
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
--- a/arch/mips/lantiq/irq.c
|
--- a/arch/mips/lantiq/irq.c
|
||||||
+++ b/arch/mips/lantiq/irq.c
|
+++ b/arch/mips/lantiq/irq.c
|
||||||
@@ -67,7 +67,7 @@
|
@@ -67,7 +67,7 @@ int gic_present;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int exin_avail;
|
static int exin_avail;
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
static void __iomem *ltq_icu_membase[MAX_IM];
|
static void __iomem *ltq_icu_membase[MAX_IM];
|
||||||
static void __iomem *ltq_eiu_membase;
|
static void __iomem *ltq_eiu_membase;
|
||||||
static struct irq_domain *ltq_domain;
|
static struct irq_domain *ltq_domain;
|
||||||
@@ -76,7 +76,7 @@
|
@@ -76,7 +76,7 @@ static int ltq_perfcount_irq;
|
||||||
int ltq_eiu_get_irq(int exin)
|
int ltq_eiu_get_irq(int exin)
|
||||||
{
|
{
|
||||||
if (exin < exin_avail)
|
if (exin < exin_avail)
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@
|
@@ -128,7 +128,7 @@ static int ltq_eiu_settype(struct irq_da
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < MAX_EIU; i++) {
|
for (i = 0; i < MAX_EIU; i++) {
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
int val = 0;
|
int val = 0;
|
||||||
int edge = 0;
|
int edge = 0;
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@
|
@@ -176,7 +176,7 @@ static unsigned int ltq_startup_eiu_irq(
|
||||||
|
|
||||||
ltq_enable_irq(d);
|
ltq_enable_irq(d);
|
||||||
for (i = 0; i < MAX_EIU; i++) {
|
for (i = 0; i < MAX_EIU; i++) {
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
/* by default we are low level triggered */
|
/* by default we are low level triggered */
|
||||||
ltq_eiu_settype(d, IRQF_TRIGGER_LOW);
|
ltq_eiu_settype(d, IRQF_TRIGGER_LOW);
|
||||||
/* clear all pending */
|
/* clear all pending */
|
||||||
@@ -198,7 +198,7 @@
|
@@ -198,7 +198,7 @@ static void ltq_shutdown_eiu_irq(struct
|
||||||
|
|
||||||
ltq_disable_irq(d);
|
ltq_disable_irq(d);
|
||||||
for (i = 0; i < MAX_EIU; i++) {
|
for (i = 0; i < MAX_EIU; i++) {
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
/* disable */
|
/* disable */
|
||||||
ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) & ~BIT(i),
|
ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) & ~BIT(i),
|
||||||
LTQ_EIU_EXIN_INEN);
|
LTQ_EIU_EXIN_INEN);
|
||||||
@@ -343,10 +343,10 @@
|
@@ -343,10 +343,10 @@ static int icu_map(struct irq_domain *d,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < exin_avail; i++)
|
for (i = 0; i < exin_avail; i++)
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -441,14 +441,14 @@
|
@@ -441,14 +441,14 @@ int __init icu_of_init(struct device_nod
|
||||||
eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway");
|
eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway");
|
||||||
if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) {
|
if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) {
|
||||||
/* find out how many external irq sources we have */
|
/* find out how many external irq sources we have */
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
- if (!ltq_mtd->res) {
|
- if (!ltq_mtd->res) {
|
||||||
- dev_err(&pdev->dev, "failed to get memory resource\n");
|
- dev_err(&pdev->dev, "failed to get memory resource\n");
|
||||||
- return -ENOENT;
|
- return -ENOENT;
|
||||||
|
- }
|
||||||
+ for (i = 0; i < pdev->num_resources; i++) {
|
+ for (i = 0; i < pdev->num_resources; i++) {
|
||||||
+ printk(KERN_NOTICE "lantiq nor flash device: %.8llx at %.8llx\n",
|
+ printk(KERN_NOTICE "lantiq nor flash device: %.8llx at %.8llx\n",
|
||||||
+ (unsigned long long)resource_size(&pdev->resource[i]),
|
+ (unsigned long long)resource_size(&pdev->resource[i]),
|
||||||
|
@ -94,14 +95,27 @@
|
||||||
+ dev_err(&pdev->dev, "Could not reserve memory region\n");
|
+ dev_err(&pdev->dev, "Could not reserve memory region\n");
|
||||||
+ return -ENOMEM;
|
+ return -ENOMEM;
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
|
- ltq_mtd->map = devm_kzalloc(&pdev->dev, sizeof(struct map_info),
|
||||||
|
- GFP_KERNEL);
|
||||||
|
- if (!ltq_mtd->map)
|
||||||
|
- return -ENOMEM;
|
||||||
+ ltq_mtd->map[i].name = ltq_map_name;
|
+ ltq_mtd->map[i].name = ltq_map_name;
|
||||||
+ ltq_mtd->map[i].bankwidth = 2;
|
+ ltq_mtd->map[i].bankwidth = 2;
|
||||||
+ ltq_mtd->map[i].read = ltq_read16;
|
+ ltq_mtd->map[i].read = ltq_read16;
|
||||||
+ ltq_mtd->map[i].write = ltq_write16;
|
+ ltq_mtd->map[i].write = ltq_write16;
|
||||||
+ ltq_mtd->map[i].copy_from = ltq_copy_from;
|
+ ltq_mtd->map[i].copy_from = ltq_copy_from;
|
||||||
+ ltq_mtd->map[i].copy_to = ltq_copy_to;
|
+ ltq_mtd->map[i].copy_to = ltq_copy_to;
|
||||||
+
|
|
||||||
|
- if (of_find_property(pdev->dev.of_node, "lantiq,noxip", NULL))
|
||||||
|
- ltq_mtd->map->phys = NO_XIP;
|
||||||
|
- else
|
||||||
|
- ltq_mtd->map->phys = ltq_mtd->res->start;
|
||||||
|
- ltq_mtd->res->start;
|
||||||
|
- ltq_mtd->map->size = resource_size(ltq_mtd->res);
|
||||||
|
- ltq_mtd->map->virt = devm_ioremap_resource(&pdev->dev, ltq_mtd->res);
|
||||||
|
- if (IS_ERR(ltq_mtd->map->virt))
|
||||||
|
- return PTR_ERR(ltq_mtd->map->virt);
|
||||||
+ if (of_find_property(pdev->dev.of_node, "lantiq,noxip", NULL))
|
+ if (of_find_property(pdev->dev.of_node, "lantiq,noxip", NULL))
|
||||||
+ ltq_mtd->map[i].phys = NO_XIP;
|
+ ltq_mtd->map[i].phys = NO_XIP;
|
||||||
+ else
|
+ else
|
||||||
|
@ -111,18 +125,30 @@
|
||||||
+ ltq_mtd->map[i].size);
|
+ ltq_mtd->map[i].size);
|
||||||
+ if (IS_ERR(ltq_mtd->map[i].virt))
|
+ if (IS_ERR(ltq_mtd->map[i].virt))
|
||||||
+ return PTR_ERR(ltq_mtd->map[i].virt);
|
+ return PTR_ERR(ltq_mtd->map[i].virt);
|
||||||
+
|
|
||||||
|
- ltq_mtd->map->name = ltq_map_name;
|
||||||
|
- ltq_mtd->map->bankwidth = 2;
|
||||||
|
- ltq_mtd->map->read = ltq_read16;
|
||||||
|
- ltq_mtd->map->write = ltq_write16;
|
||||||
|
- ltq_mtd->map->copy_from = ltq_copy_from;
|
||||||
|
- ltq_mtd->map->copy_to = ltq_copy_to;
|
||||||
+ if (ltq_mtd->map[i].virt == NULL) {
|
+ if (ltq_mtd->map[i].virt == NULL) {
|
||||||
+ dev_err(&pdev->dev, "Failed to ioremap flash region\n");
|
+ dev_err(&pdev->dev, "Failed to ioremap flash region\n");
|
||||||
+ err = PTR_ERR(ltq_mtd->map[i].virt);
|
+ err = PTR_ERR(ltq_mtd->map[i].virt);
|
||||||
+ goto err_out;
|
+ goto err_out;
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
|
- ltq_mtd->map->map_priv_1 = LTQ_NOR_PROBING;
|
||||||
|
- ltq_mtd->mtd = do_map_probe("cfi_probe", ltq_mtd->map);
|
||||||
|
- ltq_mtd->map->map_priv_1 = LTQ_NOR_NORMAL;
|
||||||
+ ltq_mtd->map[i].map_priv_1 = LTQ_NOR_PROBING;
|
+ ltq_mtd->map[i].map_priv_1 = LTQ_NOR_PROBING;
|
||||||
+ for (type = rom_probe_types; !ltq_mtd->mtd[i] && *type; type++)
|
+ for (type = rom_probe_types; !ltq_mtd->mtd[i] && *type; type++)
|
||||||
+ ltq_mtd->mtd[i] = do_map_probe(*type, <q_mtd->map[i]);
|
+ ltq_mtd->mtd[i] = do_map_probe(*type, <q_mtd->map[i]);
|
||||||
+ ltq_mtd->map[i].map_priv_1 = LTQ_NOR_NORMAL;
|
+ ltq_mtd->map[i].map_priv_1 = LTQ_NOR_NORMAL;
|
||||||
+
|
|
||||||
|
- if (!ltq_mtd->mtd) {
|
||||||
|
- dev_err(&pdev->dev, "probing failed\n");
|
||||||
|
- return -ENXIO;
|
||||||
+ if (!ltq_mtd->mtd[i]) {
|
+ if (!ltq_mtd->mtd[i]) {
|
||||||
+ dev_err(&pdev->dev, "probing failed\n");
|
+ dev_err(&pdev->dev, "probing failed\n");
|
||||||
+ return -ENXIO;
|
+ return -ENXIO;
|
||||||
|
@ -138,10 +164,7 @@
|
||||||
+ cfi->addr_unlock2 ^= 1;
|
+ cfi->addr_unlock2 ^= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
- ltq_mtd->map = devm_kzalloc(&pdev->dev, sizeof(struct map_info),
|
- ltq_mtd->mtd->dev.parent = &pdev->dev;
|
||||||
- GFP_KERNEL);
|
|
||||||
- if (!ltq_mtd->map)
|
|
||||||
- return -ENOMEM;
|
|
||||||
+ if (devices_found == 1) {
|
+ if (devices_found == 1) {
|
||||||
+ ltq_mtd->cmtd = ltq_mtd->mtd[0];
|
+ ltq_mtd->cmtd = ltq_mtd->mtd[0];
|
||||||
+ } else if (devices_found > 1) {
|
+ } else if (devices_found > 1) {
|
||||||
|
@ -153,34 +176,6 @@
|
||||||
+ err = -ENXIO;
|
+ err = -ENXIO;
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
- if (of_find_property(pdev->dev.of_node, "lantiq,noxip", NULL))
|
|
||||||
- ltq_mtd->map->phys = NO_XIP;
|
|
||||||
- else
|
|
||||||
- ltq_mtd->map->phys = ltq_mtd->res->start;
|
|
||||||
- ltq_mtd->res->start;
|
|
||||||
- ltq_mtd->map->size = resource_size(ltq_mtd->res);
|
|
||||||
- ltq_mtd->map->virt = devm_ioremap_resource(&pdev->dev, ltq_mtd->res);
|
|
||||||
- if (IS_ERR(ltq_mtd->map->virt))
|
|
||||||
- return PTR_ERR(ltq_mtd->map->virt);
|
|
||||||
-
|
|
||||||
- ltq_mtd->map->name = ltq_map_name;
|
|
||||||
- ltq_mtd->map->bankwidth = 2;
|
|
||||||
- ltq_mtd->map->read = ltq_read16;
|
|
||||||
- ltq_mtd->map->write = ltq_write16;
|
|
||||||
- ltq_mtd->map->copy_from = ltq_copy_from;
|
|
||||||
- ltq_mtd->map->copy_to = ltq_copy_to;
|
|
||||||
-
|
|
||||||
- ltq_mtd->map->map_priv_1 = LTQ_NOR_PROBING;
|
|
||||||
- ltq_mtd->mtd = do_map_probe("cfi_probe", ltq_mtd->map);
|
|
||||||
- ltq_mtd->map->map_priv_1 = LTQ_NOR_NORMAL;
|
|
||||||
-
|
|
||||||
- if (!ltq_mtd->mtd) {
|
|
||||||
- dev_err(&pdev->dev, "probing failed\n");
|
|
||||||
- return -ENXIO;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- ltq_mtd->mtd->dev.parent = &pdev->dev;
|
|
||||||
-
|
|
||||||
- cfi = ltq_mtd->map->fldrv_priv;
|
- cfi = ltq_mtd->map->fldrv_priv;
|
||||||
- cfi->addr_unlock1 ^= 1;
|
- cfi->addr_unlock1 ^= 1;
|
||||||
- cfi->addr_unlock2 ^= 1;
|
- cfi->addr_unlock2 ^= 1;
|
||||||
|
|
Loading…
Reference in New Issue