diff options
Diffstat (limited to 'arch/powerpc/sysdev/qe_lib')
| -rw-r--r-- | arch/powerpc/sysdev/qe_lib/qe.c | 61 | ||||
| -rw-r--r-- | arch/powerpc/sysdev/qe_lib/qe_ic.c | 8 | 
2 files changed, 46 insertions, 23 deletions
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index 464271bea6c..149393c02c3 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c @@ -27,6 +27,8 @@  #include <linux/delay.h>  #include <linux/ioport.h>  #include <linux/crc32.h> +#include <linux/mod_devicetable.h> +#include <linux/of_platform.h>  #include <asm/irq.h>  #include <asm/page.h>  #include <asm/pgtable.h> @@ -65,19 +67,6 @@ static unsigned int qe_num_of_snum;  static phys_addr_t qebase = -1; -int qe_alive_during_sleep(void) -{ -	static int ret = -1; - -	if (ret != -1) -		return ret; - -	ret = !of_find_compatible_node(NULL, NULL, "fsl,mpc8569-pmc"); - -	return ret; -} -EXPORT_SYMBOL(qe_alive_during_sleep); -  phys_addr_t get_qe_base(void)  {  	struct device_node *qe; @@ -104,7 +93,7 @@ phys_addr_t get_qe_base(void)  EXPORT_SYMBOL(get_qe_base); -void __init qe_reset(void) +void qe_reset(void)  {  	if (qe_immr == NULL)  		qe_immr = ioremap(get_qe_base(), QE_IMMAP_SIZE); @@ -330,16 +319,18 @@ EXPORT_SYMBOL(qe_put_snum);  static int qe_sdma_init(void)  {  	struct sdma __iomem *sdma = &qe_immr->sdma; -	unsigned long sdma_buf_offset; +	static unsigned long sdma_buf_offset = (unsigned long)-ENOMEM;  	if (!sdma)  		return -ENODEV;  	/* allocate 2 internal temporary buffers (512 bytes size each) for  	 * the SDMA */ - 	sdma_buf_offset = qe_muram_alloc(512 * 2, 4096); -	if (IS_ERR_VALUE(sdma_buf_offset)) -		return -ENOMEM; +	if (IS_ERR_VALUE(sdma_buf_offset)) { +		sdma_buf_offset = qe_muram_alloc(512 * 2, 4096); +		if (IS_ERR_VALUE(sdma_buf_offset)) +			return -ENOMEM; +	}  	out_be32(&sdma->sdebcr, (u32) sdma_buf_offset & QE_SDEBCR_BA_MASK);   	out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK | @@ -349,7 +340,7 @@ static int qe_sdma_init(void)  }  /* The maximum number of RISCs we support */ -#define MAX_QE_RISC     2 +#define MAX_QE_RISC     4  /* Firmware information stored here for qe_get_firmware_info() */  static struct qe_firmware_info qe_firmware_info; @@ -658,3 +649,35 @@ unsigned int qe_get_num_of_snums(void)  	return num_of_snums;  }  EXPORT_SYMBOL(qe_get_num_of_snums); + +#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx) +static int qe_resume(struct of_device *ofdev) +{ +	if (!qe_alive_during_sleep()) +		qe_reset(); +	return 0; +} + +static int qe_probe(struct of_device *ofdev, const struct of_device_id *id) +{ +	return 0; +} + +static const struct of_device_id qe_ids[] = { +	{ .compatible = "fsl,qe", }, +	{ }, +}; + +static struct of_platform_driver qe_driver = { +	.driver.name = "fsl-qe", +	.match_table = qe_ids, +	.probe = qe_probe, +	.resume = qe_resume, +}; + +static int __init qe_drv_init(void) +{ +	return of_register_platform_driver(&qe_driver); +} +device_initcall(qe_drv_init); +#endif /* defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx) */ diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c index 3faa42e03a8..2acc928d192 100644 --- a/arch/powerpc/sysdev/qe_lib/qe_ic.c +++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c @@ -189,7 +189,7 @@ static inline void qe_ic_write(volatile __be32  __iomem * base, unsigned int reg  static inline struct qe_ic *qe_ic_from_irq(unsigned int virq)  { -	return irq_desc[virq].chip_data; +	return irq_to_desc(virq)->chip_data;  }  #define virq_to_hw(virq)	((unsigned int)irq_map[virq].hwirq) @@ -237,7 +237,7 @@ static void qe_ic_mask_irq(unsigned int virq)  }  static struct irq_chip qe_ic_irq_chip = { -	.typename = " QEIC  ", +	.name = " QEIC  ",  	.unmask = qe_ic_unmask_irq,  	.mask = qe_ic_mask_irq,  	.mask_ack = qe_ic_mask_irq, @@ -263,7 +263,7 @@ static int qe_ic_host_map(struct irq_host *h, unsigned int virq,  	chip = &qe_ic->hc_irq;  	set_irq_chip_data(virq, qe_ic); -	get_irq_desc(virq)->status |= IRQ_LEVEL; +	irq_to_desc(virq)->status |= IRQ_LEVEL;  	set_irq_chip_and_handler(virq, chip, handle_level_irq); @@ -271,7 +271,7 @@ static int qe_ic_host_map(struct irq_host *h, unsigned int virq,  }  static int qe_ic_host_xlate(struct irq_host *h, struct device_node *ct, -			    u32 * intspec, unsigned int intsize, +			    const u32 * intspec, unsigned int intsize,  			    irq_hw_number_t * out_hwirq,  			    unsigned int *out_flags)  {  | 
