commit: http://blackfin.uclinux.org/git/?p=linux-kernel;a=commitdiff;h=b3bb67c4db95bee887da675bfde2c0bd5803a994 branch: http://blackfin.uclinux.org/git/?p=linux-kernel;a=shortlog;h=refs/heads/trunk
request pint bank to avoid conflict set target coreid for sec irq line cleanup icc peripheral array Signed-off-by: Steven Miao <[email protected]> --- arch/blackfin/include/asm/irq_handler.h | 3 + arch/blackfin/mach-bf561/icc.c | 10 ---- arch/blackfin/mach-bf609/icc.c | 36 ------------ arch/blackfin/mach-common/ints-priority.c | 25 ++++++++- drivers/staging/icc/core/protocol.c | 83 ++++++++++++++++++---------- 5 files changed, 79 insertions(+), 78 deletions(-) diff --git a/arch/blackfin/include/asm/irq_handler.h b/arch/blackfin/include/asm/irq_handler.h index 4fbf835..60b97a6 100644 --- a/arch/blackfin/include/asm/irq_handler.h +++ b/arch/blackfin/include/asm/irq_handler.h @@ -63,4 +63,7 @@ struct irq_desc; extern void bfin_demux_mac_status_irq(unsigned int, struct irq_desc *); extern void bfin_demux_gpio_irq(unsigned int, struct irq_desc *); +#ifdef CONFIG_ICC +extern int icc_irq_set_affinity(unsigned int irq, const struct cpumask *mask); +#endif #endif diff --git a/arch/blackfin/mach-bf561/icc.c b/arch/blackfin/mach-bf561/icc.c index 69ac4e7..0580179 100644 --- a/arch/blackfin/mach-bf561/icc.c +++ b/arch/blackfin/mach-bf561/icc.c @@ -4,16 +4,6 @@ #include <linux/delay.h> #include <asm/icc.h> -struct icc_peri_resource icc_peri_array[] = { - {"bfin-spi.0", NULL, 0}, - {"bfin-ppi.0", NULL, 0}, - {"bfin-ppi.1", NULL, 0}, - {"bfin-sport.0", NULL, 0}, - {"bfin-sport.1", NULL, 0}, - {"bfin-uart.0", NULL, 0}, - {"bfin-timer.0", NULL, 0}, -}; - void platform_send_ipi(cpumask_t callmap, int irq) { unsigned int cpu; diff --git a/arch/blackfin/mach-bf609/icc.c b/arch/blackfin/mach-bf609/icc.c index 33e08cb..271ba50 100644 --- a/arch/blackfin/mach-bf609/icc.c +++ b/arch/blackfin/mach-bf609/icc.c @@ -5,42 +5,6 @@ #include <mach/pm.h> #include <asm/icc.h> -struct icc_peri_resource icc_peri_array[] = { - {"cnt.0", NULL, 0}, - {"bfin-sdh.0", NULL, 0}, - {"bfin_can.0", NULL, 0}, - {"bfin-linkport.0", NULL, 0}, - {"bfin-linkport.1", NULL, 0}, - {"bfin-linkport.2", NULL, 0}, - {"bfin-linkport.3", NULL, 0}, - {"bfin-timer.0", NULL, 0}, - {"bfin-timer.1", NULL, 0}, - {"bfin-timer.2", NULL, 0}, - {"bfin-timer.3", NULL, 0}, - {"bfin-timer.4", NULL, 0}, - {"bfin-timer.5", NULL, 0}, - {"bfin-timer.6", NULL, 0}, - {"bfin-timer.7", NULL, 0}, - {"bfin-crc.0", NULL, 0}, - {"bfin-crc.1", NULL, 0}, - {"i2c-bfin-twi.0", NULL, 0}, - {"i2c-bfin-twi.1", NULL, 0}, - {"bfin-uart.0", NULL, 0}, - {"bfin-uart.1", NULL, 0}, - {"physmap-flash.0", NULL, 0}, - {"stmmaceth.0", NULL, 0}, - {"stmmaceth.1", NULL, 0}, - {"bfin-spi.0", NULL, 0}, - {"bfin-spi.1", NULL, 0}, - {"bfin-sport.0", NULL, 0}, - {"bfin-sport.1", NULL, 0}, - {"bfin-sport.2", NULL, 0}, - {"bfin-ppi.0", NULL, 0}, - {"bfin-ppi.1", NULL, 0}, - {"bfin-dma.0", NULL, 0}, - {"musb-blackfin.0", NULL, 0}, -}; - void platform_send_ipi_cpu(unsigned int cpu, int irq) { BUG_ON(cpu >= 2); diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c index 96d4e7a..9fd9644 100644 --- a/arch/blackfin/mach-common/ints-priority.c +++ b/arch/blackfin/mach-common/ints-priority.c @@ -337,9 +337,8 @@ static void bfin_sec_set_ssi_coreid(unsigned int sid, unsigned int coreid) uint32_t reg_sctl = bfin_read_SEC_SCTL(sid); reg_sctl &= ((uint32_t)~SEC_SCTL_CTG); - bfin_write_SEC_SCTL(sid, reg_sctl | ((coreid << 24) & SEC_SCTL_CTG)); - pr_debug("sid %d %08x %08x\n", sid, bfin_read_SEC_SCTL(sid), reg_sctl | ((coreid << 24) & SEC_SCTL_CTG)); + bfin_write_SEC_SCTL(sid, reg_sctl | ((coreid << 24) & SEC_SCTL_CTG)); hard_local_irq_restore(flags); } @@ -531,6 +530,28 @@ void handle_core_fault(unsigned int irq, struct irq_desc *desc) } #endif /* SEC_GCTL */ +#ifdef CONFIG_ICC +int icc_irq_set_affinity(unsigned int irq, const struct cpumask *mask) +{ + unsigned long flags = hard_local_irq_save(); +# ifdef CONFIG_BF561 + unsigned mask_bank = BFIN_SYSIRQ(irq) / 32; + unsigned mask_bit = BFIN_SYSIRQ(irq) % 32; + if (cpumask_test_cpu(0, mask)) + bfin_write_SIC_IMASK(mask_bank, + bfin_read_SIC_IMASK(mask_bank) | + (1 << mask_bit)); + if (cpumask_test_cpu(1, mask)) + bfin_write_SICB_IMASK(mask_bank, + bfin_read_SICB_IMASK(mask_bank) | + (1 << mask_bit)); +# elif CONFIG_BF60x + bfin_sec_set_ssi_coreid(BFIN_SYSIRQ(irq), cpumask_any_but(mask, 0)); +# endif + hard_local_irq_restore(flags); +} +#endif + static struct irq_chip bfin_core_irqchip = { .name = "CORE", .irq_mask = bfin_core_mask_irq, diff --git a/drivers/staging/icc/core/protocol.c b/drivers/staging/icc/core/protocol.c index 563b42e..ecb5ee8 100644 --- a/drivers/staging/icc/core/protocol.c +++ b/drivers/staging/icc/core/protocol.c @@ -25,6 +25,7 @@ #include <asm/icc.h> #include <asm/dma.h> #include <asm/portmux.h> +#include <asm/irq_handler.h> #define DRIVER_NAME "icc" @@ -1224,26 +1225,6 @@ unsigned int icc_poll(struct file *file, poll_table *wait) return mask; } -int icc_request_dev_name(const char *name, struct platform_device **saved_pdev) -{ - struct device *d; - struct platform_device *pdev; - - d = bus_find_device_by_name(&platform_bus_type, NULL, name); - if (d == NULL) { - sm_debug("no device found\n"); - return -ENODEV; - } else { - - pdev = to_platform_device(d); - - if (saved_pdev) - *saved_pdev = pdev; - } - - return 0; -} - int res_manage_request_peri(resources_t *data) { unsigned short *peri_list = (unsigned short *)data->resources_array; @@ -1274,19 +1255,60 @@ void res_manage_free_gpio(uint16_t subid) gpio_free(subid); } -int res_manage_request_irq(uint16_t subid) +static irqreturn_t coreb_resource_manage_dummy(int irq, void *dev_id) { - if (can_request_irq(subid, 0)) - return 0; - disable_irq(subid); + return 1; +} + +int res_manage_request_irq(uint16_t subid, unsigned int cpu) +{ + int i, n; + int ret; + unsigned int bank, bank_base; + + if (((subid - IRQ_PINT0) >= 0) && ((subid - IRQ_PINT0) < NR_PINT_SYS_IRQS)) { + bank = subid - IRQ_PINT0; + bank_base = GPIO_IRQ_BASE + (bank << 4); + for (i = 0; i < GPIO_BANKSIZE; i++) { + ret = request_irq(bank_base + i, + coreb_resource_manage_dummy, + 0, "coreb dummy", NULL); + if (ret) { + n = i; + for (i = 0; i < n; i++) + free_irq(bank_base + i, NULL); + return ret; + } + } + icc_irq_set_affinity(IRQ_PINT0 + bank, cpumask_of(cpu)); + } else { + ret = request_irq(subid, coreb_resource_manage_dummy, + 0, "coreb dummy", NULL); + if (ret) { + sm_debug("Fail to request IRQ\n"); + return ret; + } + icc_irq_set_affinity(subid, cpumask_of(cpu)); + } + return 0; } void res_manage_free_irq(uint16_t subid) { - if (can_request_irq(subid, 0)) - return; - enable_irq(subid); + int i, n; + unsigned int bank, bank_base; + + if (((subid - IRQ_PINT0) >= 0) && ((subid - IRQ_PINT0) < NR_PINT_SYS_IRQS)) { + bank = subid - IRQ_PINT0; + bank_base = GPIO_IRQ_BASE + (bank << 4); + for (i = 0; i < GPIO_BANKSIZE; i++) + free_irq(bank_base + i, NULL); + icc_irq_set_affinity(IRQ_PINT0 + bank, cpumask_of(0)); + } else { + free_irq(subid, NULL); + icc_irq_set_affinity(subid, cpumask_of(0)); + } } int res_manage_request_dma(uint16_t subid) @@ -1299,7 +1321,8 @@ void res_manage_free_dma(uint16_t subid) free_dma(subid); } -int res_manage_request(uint16_t id, resources_t *data) +int res_manage_request(uint16_t id, resources_t *data, + struct sm_icc_desc *icc_info) { int ret = 0; uint16_t type, subid; @@ -1314,7 +1337,7 @@ int res_manage_request(uint16_t id, resources_t *data) ret = res_manage_request_gpio(subid); break; case RESMGR_TYPE_SYS_IRQ: - ret = res_manage_request_irq(subid); + ret = res_manage_request_irq(subid, icc_info->peer_cpu); break; case RESMGR_TYPE_DMA: ret = res_manage_request_dma(subid); @@ -1622,7 +1645,7 @@ static int sm_resouce_manage_recvmsg(struct sm_msg *msg, struct sm_session *sess switch (msg->type) { case SM_RES_MGR_REQUEST: - ret = res_manage_request((uint16_t)msg->payload, (resources_t *)msg->length); + ret = res_manage_request((uint16_t)msg->payload, (resources_t *)msg->length, icc_info); if (ret) sm_send_control_msg(session, msg->src_ep, icc_info->peer_cpu, 0, 0, SM_RES_MGR_REQUEST_FAIL);
_______________________________________________ Linux-kernel-commits mailing list [email protected] https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits
