Xtensa improvements for 4.1:

- fix locking issues in ISS network driver;
 - document PIC and MX interrupt distributor device tree bindings;
 - add CY7C67300 USB controller support to XTFPGA.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVK2UPAAoJEFH5zJH4P6BEtdEQAJpThJvrVr+Wn0BkgnSZoA3I
 jRKhIwj+3c8XXcRRY+4T/hU+9Rh7+XhKjTy+u4Rbgbm5bhmvjvbwuDRS+czsa/RC
 r/FE874QZD5O8KLtdqkTkyRJ4XmKDQHbDUpTuk300xQeV53fFwa6EeOclVrmZMzz
 yBDaFG4rmPa7/4TTvbyLwloA355pbKuhAFT2ndRFFHty4KrfE/XZcKQk25ubgTak
 PYgBGfUpyZ0F7WZ92L8F3WYcud0p4PlYXelQDVVa5iJDLQGkyrJAzDx8e+URVI+E
 ym9SWVUD33kAhXwQ2i3vm7HEDD4JZJbMZQupWKHy6aqFeaXv31tU5KDOu0V3148O
 9ezrAU5Ciav9NGUDQ9318Rb3cJkYoPelHWE5QHEU60VOOt4UHw3wsBtcuCnUSODl
 BllotRHXYFoBsWcwOBgH1j36wsOGTKxn98wRdHvCLqD6vwneKCv8WRRNRU2N0jvB
 VTVL4AOPDLmoiwcqomcSXes16ZKU98fgvbSdaCqojDDtYpsj6bsrs67joPwp9+5j
 3HA3+47Hn4uaoFiDbs5N/oLgv+fFUY83o6LwxtAAufF2U92KZEX99zayQ0wB54+C
 U1KR8lmXJcl2KjDXY6tGmfyXrBCwxFk2/WqN43yvvLSxDtDUtDJAw3SHCtQG6Hcd
 HZFasgLoxxphwtuAkWny
 =sZxq
 -----END PGP SIGNATURE-----

Merge tag 'xtensa-for-next-20150413' of git://github.com/jcmvbkbc/linux-xtensa into for_next

Xtensa improvements for 4.1:

- fix locking issues in ISS network driver;
- document PIC and MX interrupt distributor device tree bindings;
- add CY7C67300 USB controller support to XTFPGA.

Signed-off-by: Chris Zankel <chris@zankel.net>
This commit is contained in:
Chris Zankel 2015-04-14 04:47:53 +00:00
commit 2ba9268dd6
5 changed files with 95 additions and 14 deletions

View File

@ -0,0 +1,18 @@
* Xtensa Interrupt Distributor and Programmable Interrupt Controller (MX)
Required properties:
- compatible: Should be "cdns,xtensa-mx".
Remaining properties have exact same meaning as in Xtensa PIC
(see cdns,xtensa-pic.txt).
Examples:
pic: pic {
compatible = "cdns,xtensa-mx";
/* one cell: internal irq number,
* two cells: second cell == 0: internal irq number
* second cell == 1: external irq number
*/
#interrupt-cells = <2>;
interrupt-controller;
};

View File

@ -0,0 +1,25 @@
* Xtensa built-in Programmable Interrupt Controller (PIC)
Required properties:
- compatible: Should be "cdns,xtensa-pic".
- interrupt-controller: Identifies the node as an interrupt controller.
- #interrupt-cells: The number of cells to define the interrupts.
It may be either 1 or 2.
When it's 1, the first cell is the internal IRQ number.
When it's 2, the first cell is the IRQ number, and the second cell
specifies whether it's internal (0) or external (1).
Periferals are usually connected to a fixed external IRQ, but for different
core variants it may be mapped to different internal IRQ.
IRQ sensitivity and priority are fixed for each core variant and may not be
changed at runtime.
Examples:
pic: pic {
compatible = "cdns,xtensa-pic";
/* one cell: internal irq number,
* two cells: second cell == 0: internal irq number
* second cell == 1: external irq number
*/
#interrupt-cells = <2>;
interrupt-controller;
};

View File

@ -349,8 +349,8 @@ static void iss_net_timer(unsigned long priv)
{ {
struct iss_net_private *lp = (struct iss_net_private *)priv; struct iss_net_private *lp = (struct iss_net_private *)priv;
spin_lock(&lp->lock);
iss_net_poll(); iss_net_poll();
spin_lock(&lp->lock);
mod_timer(&lp->timer, jiffies + lp->timer_val); mod_timer(&lp->timer, jiffies + lp->timer_val);
spin_unlock(&lp->lock); spin_unlock(&lp->lock);
} }
@ -361,7 +361,7 @@ static int iss_net_open(struct net_device *dev)
struct iss_net_private *lp = netdev_priv(dev); struct iss_net_private *lp = netdev_priv(dev);
int err; int err;
spin_lock(&lp->lock); spin_lock_bh(&lp->lock);
err = lp->tp.open(lp); err = lp->tp.open(lp);
if (err < 0) if (err < 0)
@ -376,9 +376,11 @@ static int iss_net_open(struct net_device *dev)
while ((err = iss_net_rx(dev)) > 0) while ((err = iss_net_rx(dev)) > 0)
; ;
spin_lock(&opened_lock); spin_unlock_bh(&lp->lock);
spin_lock_bh(&opened_lock);
list_add(&lp->opened_list, &opened); list_add(&lp->opened_list, &opened);
spin_unlock(&opened_lock); spin_unlock_bh(&opened_lock);
spin_lock_bh(&lp->lock);
init_timer(&lp->timer); init_timer(&lp->timer);
lp->timer_val = ISS_NET_TIMER_VALUE; lp->timer_val = ISS_NET_TIMER_VALUE;
@ -387,7 +389,7 @@ static int iss_net_open(struct net_device *dev)
mod_timer(&lp->timer, jiffies + lp->timer_val); mod_timer(&lp->timer, jiffies + lp->timer_val);
out: out:
spin_unlock(&lp->lock); spin_unlock_bh(&lp->lock);
return err; return err;
} }
@ -395,7 +397,7 @@ static int iss_net_close(struct net_device *dev)
{ {
struct iss_net_private *lp = netdev_priv(dev); struct iss_net_private *lp = netdev_priv(dev);
netif_stop_queue(dev); netif_stop_queue(dev);
spin_lock(&lp->lock); spin_lock_bh(&lp->lock);
spin_lock(&opened_lock); spin_lock(&opened_lock);
list_del(&opened); list_del(&opened);
@ -405,18 +407,17 @@ static int iss_net_close(struct net_device *dev)
lp->tp.close(lp); lp->tp.close(lp);
spin_unlock(&lp->lock); spin_unlock_bh(&lp->lock);
return 0; return 0;
} }
static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev) static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct iss_net_private *lp = netdev_priv(dev); struct iss_net_private *lp = netdev_priv(dev);
unsigned long flags;
int len; int len;
netif_stop_queue(dev); netif_stop_queue(dev);
spin_lock_irqsave(&lp->lock, flags); spin_lock_bh(&lp->lock);
len = lp->tp.write(lp, &skb); len = lp->tp.write(lp, &skb);
@ -438,7 +439,7 @@ static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
pr_err("%s: %s failed(%d)\n", dev->name, __func__, len); pr_err("%s: %s failed(%d)\n", dev->name, __func__, len);
} }
spin_unlock_irqrestore(&lp->lock, flags); spin_unlock_bh(&lp->lock);
dev_kfree_skb(skb); dev_kfree_skb(skb);
return NETDEV_TX_OK; return NETDEV_TX_OK;
@ -466,9 +467,9 @@ static int iss_net_set_mac(struct net_device *dev, void *addr)
if (!is_valid_ether_addr(hwaddr->sa_data)) if (!is_valid_ether_addr(hwaddr->sa_data))
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
spin_lock(&lp->lock); spin_lock_bh(&lp->lock);
memcpy(dev->dev_addr, hwaddr->sa_data, ETH_ALEN); memcpy(dev->dev_addr, hwaddr->sa_data, ETH_ALEN);
spin_unlock(&lp->lock); spin_unlock_bh(&lp->lock);
return 0; return 0;
} }
@ -520,11 +521,11 @@ static int iss_net_configure(int index, char *init)
*lp = (struct iss_net_private) { *lp = (struct iss_net_private) {
.device_list = LIST_HEAD_INIT(lp->device_list), .device_list = LIST_HEAD_INIT(lp->device_list),
.opened_list = LIST_HEAD_INIT(lp->opened_list), .opened_list = LIST_HEAD_INIT(lp->opened_list),
.lock = __SPIN_LOCK_UNLOCKED(lp.lock),
.dev = dev, .dev = dev,
.index = index, .index = index,
}; };
spin_lock_init(&lp->lock);
/* /*
* If this name ends up conflicting with an existing registered * If this name ends up conflicting with an existing registered
* netdevice, that is OK, register_netdev{,ice}() will notice this * netdevice, that is OK, register_netdev{,ice}() will notice this

View File

@ -59,4 +59,7 @@
/* 5*rx buffs + 5*tx buffs */ /* 5*rx buffs + 5*tx buffs */
#define OETH_SRAMBUFF_SIZE (5 * 0x600 + 5 * 0x600) #define OETH_SRAMBUFF_SIZE (5 * 0x600 + 5 * 0x600)
#define C67X00_PADDR (XCHAL_KIO_PADDR + 0x0D0D0000)
#define C67X00_SIZE 0x10
#define C67X00_IRQ 5
#endif /* __XTENSA_XTAVNET_HARDWARE_H */ #endif /* __XTENSA_XTAVNET_HARDWARE_H */

View File

@ -189,6 +189,7 @@ void __init platform_calibrate_ccount(void)
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/if.h> #include <linux/if.h>
#include <net/ethoc.h> #include <net/ethoc.h>
#include <linux/usb/c67x00.h>
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
* Ethernet -- OpenCores Ethernet MAC (ethoc driver) * Ethernet -- OpenCores Ethernet MAC (ethoc driver)
@ -232,6 +233,38 @@ static struct platform_device ethoc_device = {
}, },
}; };
/*----------------------------------------------------------------------------
* USB Host/Device -- Cypress CY7C67300
*/
static struct resource c67x00_res[] = {
[0] = { /* register space */
.start = C67X00_PADDR,
.end = C67X00_PADDR + C67X00_SIZE - 1,
.flags = IORESOURCE_MEM,
},
[1] = { /* IRQ number */
.start = C67X00_IRQ,
.end = C67X00_IRQ,
.flags = IORESOURCE_IRQ,
},
};
static struct c67x00_platform_data c67x00_pdata = {
.sie_config = C67X00_SIE1_HOST | C67X00_SIE2_UNUSED,
.hpi_regstep = 4,
};
static struct platform_device c67x00_device = {
.name = "c67x00",
.id = -1,
.num_resources = ARRAY_SIZE(c67x00_res),
.resource = c67x00_res,
.dev = {
.platform_data = &c67x00_pdata,
},
};
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
* UART * UART
*/ */
@ -268,6 +301,7 @@ static struct platform_device xtavnet_uart = {
/* platform devices */ /* platform devices */
static struct platform_device *platform_devices[] __initdata = { static struct platform_device *platform_devices[] __initdata = {
&ethoc_device, &ethoc_device,
&c67x00_device,
&xtavnet_uart, &xtavnet_uart,
}; };