3737#define GPIO_IO_SIZE 64
3838#define GPIO_IO_SIZE_CENTERTON 128
3939
40+ /* Intel Quark X1000 GPIO IRQ Number */
41+ #define GPIO_IRQ_QUARK_X1000 9
42+
4043#define WDTBASE 0x84
4144#define WDT_IO_SIZE 64
4245
4346enum sch_chipsets {
4447 LPC_SCH = 0 , /* Intel Poulsbo SCH */
4548 LPC_ITC , /* Intel Tunnel Creek */
4649 LPC_CENTERTON , /* Intel Centerton */
50+ LPC_QUARK_X1000 , /* Intel Quark X1000 */
4751};
4852
4953struct lpc_sch_info {
5054 unsigned int io_size_smbus ;
5155 unsigned int io_size_gpio ;
5256 unsigned int io_size_wdt ;
57+ int irq_gpio ;
5358};
5459
5560static struct lpc_sch_info sch_chipset_info [] = {
5661 [LPC_SCH ] = {
5762 .io_size_smbus = SMBUS_IO_SIZE ,
5863 .io_size_gpio = GPIO_IO_SIZE ,
64+ .irq_gpio = -1 ,
5965 },
6066 [LPC_ITC ] = {
6167 .io_size_smbus = SMBUS_IO_SIZE ,
6268 .io_size_gpio = GPIO_IO_SIZE ,
6369 .io_size_wdt = WDT_IO_SIZE ,
70+ .irq_gpio = -1 ,
6471 },
6572 [LPC_CENTERTON ] = {
6673 .io_size_smbus = SMBUS_IO_SIZE ,
6774 .io_size_gpio = GPIO_IO_SIZE_CENTERTON ,
6875 .io_size_wdt = WDT_IO_SIZE ,
76+ .irq_gpio = -1 ,
77+ },
78+ [LPC_QUARK_X1000 ] = {
79+ .io_size_gpio = GPIO_IO_SIZE ,
80+ .irq_gpio = GPIO_IRQ_QUARK_X1000 ,
6981 },
7082};
7183
7284static const struct pci_device_id lpc_sch_ids [] = {
7385 { PCI_VDEVICE (INTEL , PCI_DEVICE_ID_INTEL_SCH_LPC ), LPC_SCH },
7486 { PCI_VDEVICE (INTEL , PCI_DEVICE_ID_INTEL_ITC_LPC ), LPC_ITC },
7587 { PCI_VDEVICE (INTEL , PCI_DEVICE_ID_INTEL_CENTERTON_ILB ), LPC_CENTERTON },
88+ { PCI_VDEVICE (INTEL , PCI_DEVICE_ID_INTEL_QUARK_X1000_ILB ), LPC_QUARK_X1000 },
7689 { 0 , }
7790};
7891MODULE_DEVICE_TABLE (pci , lpc_sch_ids );
@@ -110,13 +123,13 @@ static int lpc_sch_get_io(struct pci_dev *pdev, int where, const char *name,
110123}
111124
112125static int lpc_sch_populate_cell (struct pci_dev * pdev , int where ,
113- const char * name , int size , int id ,
114- struct mfd_cell * cell )
126+ const char * name , int size , int irq ,
127+ int id , struct mfd_cell * cell )
115128{
116129 struct resource * res ;
117130 int ret ;
118131
119- res = devm_kzalloc (& pdev -> dev , sizeof (* res ), GFP_KERNEL );
132+ res = devm_kcalloc (& pdev -> dev , 2 , sizeof (* res ), GFP_KERNEL );
120133 if (!res )
121134 return - ENOMEM ;
122135
@@ -132,6 +145,18 @@ static int lpc_sch_populate_cell(struct pci_dev *pdev, int where,
132145 cell -> ignore_resource_conflicts = true;
133146 cell -> id = id ;
134147
148+ /* Check if we need to add an IRQ resource */
149+ if (irq < 0 )
150+ return 0 ;
151+
152+ res ++ ;
153+
154+ res -> start = irq ;
155+ res -> end = irq ;
156+ res -> flags = IORESOURCE_IRQ ;
157+
158+ cell -> num_resources ++ ;
159+
135160 return 0 ;
136161}
137162
@@ -143,23 +168,23 @@ static int lpc_sch_probe(struct pci_dev *dev, const struct pci_device_id *id)
143168 int ret ;
144169
145170 ret = lpc_sch_populate_cell (dev , SMBASE , "isch_smbus" ,
146- info -> io_size_smbus ,
171+ info -> io_size_smbus , -1 ,
147172 id -> device , & lpc_sch_cells [cells ]);
148173 if (ret < 0 )
149174 return ret ;
150175 if (ret == 0 )
151176 cells ++ ;
152177
153178 ret = lpc_sch_populate_cell (dev , GPIOBASE , "sch_gpio" ,
154- info -> io_size_gpio ,
179+ info -> io_size_gpio , info -> irq_gpio ,
155180 id -> device , & lpc_sch_cells [cells ]);
156181 if (ret < 0 )
157182 return ret ;
158183 if (ret == 0 )
159184 cells ++ ;
160185
161186 ret = lpc_sch_populate_cell (dev , WDTBASE , "ie6xx_wdt" ,
162- info -> io_size_wdt ,
187+ info -> io_size_wdt , -1 ,
163188 id -> device , & lpc_sch_cells [cells ]);
164189 if (ret < 0 )
165190 return ret ;
0 commit comments