Re: PCIE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Roland Dreier wrote:
>  > If i uncomment the saa716x_read or write, what i get is a solid freeze
>  > on module load. If i leave it commented out, the module loads fine.
> 
> That sounds like a typical bug during driver development... you're
> probably wedging the hardware by doing the wrong access.
> 
> I didn't see the source for saa716x_read or write in the code you
> posted, so it's hard to say if there's a problem with them.
> 

Attaching saa716x_read/write in saa716x_priv.h

> Is your interrupt handler getting called?  Is the device generating
> interrupts?

It looks so, from the logs. The only problem is i can't disable the
interrupts, if i write "0" to 0x500, the interrupt/enable register, it
gives me a solid freeze. If i read from the handler, commenting out the
disable interrupts in init, that read also gives me a solid freeze. This
lead me to think that there could be some problem with the MMIO block
access.


May 23 03:25:48 manu-04 kernel: [  383.602737] saa716x_pci_init: found a
Twinhan VP-6090 device
May 23 03:25:48 manu-04 kernel: [  383.602764] ACPI: PCI Interrupt
0000:06:00.0[A] -> GSI 16 (level, low) -> IRQ 16
May 23 03:25:48 manu-04 kernel: [  383.603020]      SAA7160/1/2 Rev 1
[1822:0027], irq: 16, latency: 0
May 23 03:25:48 manu-04 kernel: [  383.603024]      memory: 0x32200000,
mmio: 0xe046e000
May 23 03:25:48 manu-04 kernel: [  383.610761] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.624056] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.637348] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.650650] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.663951] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.677253] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.690554] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.703858] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.717156] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.730459] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.743760] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.757064] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.770364] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.783665] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.796966] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.810269] === Interrupts[0010] [] ==
May 23 03:25:48 manu-04 kernel: [  383.823569] === Interrupts[0010] [] ==


> 
>  > That part is then fine. Does MSI require any special tinkering ?
> 
> Just pci_enable_msi() as usual.

Thanks


Regards,
Manu

#ifndef __SAA716x_PRIV_H
#define __SAA716x_PRIV_H

#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/sched.h>
#include <linux/mutex.h>
#include "dvbdev.h"
#include "dvb_demux.h"
#include "dmxdev.h"
#include "dvb_frontend.h"
#include "dvb_net.h"

#define SAA716x_ERROR			0
#define SAA716x_NOTICE			1
#define SAA716x_INFO			2
#define SAA716x_DEBUG			3

#define dprintk(x, y, z, format, arg...) do {							\
	if (z) {										\
		if ((x > SAA716x_ERROR) && (x > y))						\
			printk(KERN_ERR "%s (%d): " format "\n", __func__, saa716x->num, ##arg);\
		else if ((x > SAA716x_NOTICE) && (x > y))					\
			printk(KERN_ERR "%s (%d): " format "\n", __func__, saa716x->num, ##arg);\
		else if ((x > SAA716x_INFO) && (x > y))						\
			printk(KERN_ERR "%s (%d): " format "\n", __func__, saa716x->num, ##arg);\
		else if ((x > SAA716x_DEBUG) && (x > y))					\
			printk(KERN_ERR "%s (%d): " format "\n", __func__, saa716x->num, ##arg);\
	} else {										\
		if (x > y)									\
			printk(format, ##arg);							\
	}											\
} while (0);


#define MAKE_ENTRY(subven, subdev, configptr) {			\
		.vendor		= 0x1131,			\
		.device		= 0x7162,			\
		.subvendor	= (subven),			\
		.subdevice	= (subdev),			\
		.driver_data	= (unsigned long) (configptr)	\
}

#define saa716x_write(dat, addr)	writel((dat), (saa716x->mmio)+(addr))
#define saa716x_read(addr)		readl((saa716x->mmio)+(addr))

struct saa716x;

typedef int (*saa716x_load_config_t)(struct saa716x *saa716x);

struct saa716x_hwconfig {
	char 			*model_name;
	char			*dev_type;
	saa716x_load_config_t	load_config;
};

struct saa716x_dma {
	struct tasklet_struct 	dma_tasklet;
};

struct saa716x_dvb {
	struct dvb_adapter	adapter;
	struct dvb_frontend	*fe;
	struct dvb_demux	demux;
	struct dmxdev		dmxdev;
	struct dmx_frontend	fe_hw;
	struct dmx_frontend	fe_mem;
	struct dvb_net		dvbnet;
};

struct saa716x_i2c {
	struct device		*dev;
	struct i2c_adapter	adapter;
	wait_queue_head_t	i2c_queue;
};

struct saa716x {
	/* dev priv */
	unsigned int		verbose;
	unsigned int 		num;
	struct saa716x_hwconfig	*hwconfig;

	/* PCI */
	struct pci_dev		*pdev;
	void __iomem		*mmio;
	unsigned int		irq;

	/* I2C */
	struct saa716x_i2c	i2c_adapter_a;
	struct saa716x_i2c	i2c_adapter_b;

	/* DMA */
	struct saa716x_dma	dma_device_a;
	struct saa716x_dma	dma_device_b;

	/* DVB */
	struct saa716x_dvb	dvb_device_a;
	struct saa716x_dvb	dvb_device_b;
};

extern void saa716x_i2c_disable(struct saa716x *saa716x);
extern void saa716x_i2c_enable(struct saa716x *saa716x);

extern int saa716x_pcie_init(struct saa716x *saa716x);
extern void saa716x_pcie_exit(struct saa716x *saa716x);

#endif //__SAA716x_PRIV_H

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux