embedded.c (3cecdda3f169f22f324f78fd544beee68e3cc6a4) | embedded.c (aab547ce0d1493d400b6468c521a0137cd8c1edf) |
---|---|
1/* 2 * Sonics Silicon Backplane 3 * Embedded systems support code 4 * 5 * Copyright 2005-2008, Broadcom Corporation 6 * Copyright 2006-2008, Michael Buesch <mb@bu3sch.de> 7 * 8 * Licensed under the GNU/GPL. See COPYING for details. 9 */ 10 11#include <linux/ssb/ssb.h> 12#include <linux/ssb/ssb_embedded.h> | 1/* 2 * Sonics Silicon Backplane 3 * Embedded systems support code 4 * 5 * Copyright 2005-2008, Broadcom Corporation 6 * Copyright 2006-2008, Michael Buesch <mb@bu3sch.de> 7 * 8 * Licensed under the GNU/GPL. See COPYING for details. 9 */ 10 11#include <linux/ssb/ssb.h> 12#include <linux/ssb/ssb_embedded.h> |
13#include <linux/ssb/ssb_driver_pci.h> 14#include <linux/ssb/ssb_driver_gige.h> 15#include <linux/pci.h> |
|
13 14#include "ssb_private.h" 15 16 17int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks) 18{ 19 if (ssb_chipco_available(&bus->chipco)) { 20 ssb_chipco_watchdog_timer_set(&bus->chipco, ticks); --- 104 unchanged lines hidden (view full) --- 125 res = ssb_extif_gpio_polarity(&bus->extif, mask, value); 126 else 127 SSB_WARN_ON(1); 128 spin_unlock_irqrestore(&bus->gpio_lock, flags); 129 130 return res; 131} 132EXPORT_SYMBOL(ssb_gpio_polarity); | 16 17#include "ssb_private.h" 18 19 20int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks) 21{ 22 if (ssb_chipco_available(&bus->chipco)) { 23 ssb_chipco_watchdog_timer_set(&bus->chipco, ticks); --- 104 unchanged lines hidden (view full) --- 128 res = ssb_extif_gpio_polarity(&bus->extif, mask, value); 129 else 130 SSB_WARN_ON(1); 131 spin_unlock_irqrestore(&bus->gpio_lock, flags); 132 133 return res; 134} 135EXPORT_SYMBOL(ssb_gpio_polarity); |
136 137#ifdef CONFIG_SSB_DRIVER_GIGE 138static int gige_pci_init_callback(struct ssb_bus *bus, unsigned long data) 139{ 140 struct pci_dev *pdev = (struct pci_dev *)data; 141 struct ssb_device *dev; 142 unsigned int i; 143 int res; 144 145 for (i = 0; i < bus->nr_devices; i++) { 146 dev = &(bus->devices[i]); 147 if (dev->id.coreid != SSB_DEV_ETHERNET_GBIT) 148 continue; 149 if (!dev->dev || 150 !dev->dev->driver || 151 !device_is_registered(dev->dev)) 152 continue; 153 res = ssb_gige_pcibios_plat_dev_init(dev, pdev); 154 if (res >= 0) 155 return res; 156 } 157 158 return -ENODEV; 159} 160#endif /* CONFIG_SSB_DRIVER_GIGE */ 161 162int ssb_pcibios_plat_dev_init(struct pci_dev *dev) 163{ 164 int err; 165 166 err = ssb_pcicore_plat_dev_init(dev); 167 if (!err) 168 return 0; 169#ifdef CONFIG_SSB_DRIVER_GIGE 170 err = ssb_for_each_bus_call((unsigned long)dev, gige_pci_init_callback); 171 if (err >= 0) 172 return err; 173#endif 174 /* This is not a PCI device on any SSB device. */ 175 176 return -ENODEV; 177} 178 179#ifdef CONFIG_SSB_DRIVER_GIGE 180static int gige_map_irq_callback(struct ssb_bus *bus, unsigned long data) 181{ 182 const struct pci_dev *pdev = (const struct pci_dev *)data; 183 struct ssb_device *dev; 184 unsigned int i; 185 int res; 186 187 for (i = 0; i < bus->nr_devices; i++) { 188 dev = &(bus->devices[i]); 189 if (dev->id.coreid != SSB_DEV_ETHERNET_GBIT) 190 continue; 191 if (!dev->dev || 192 !dev->dev->driver || 193 !device_is_registered(dev->dev)) 194 continue; 195 res = ssb_gige_map_irq(dev, pdev); 196 if (res >= 0) 197 return res; 198 } 199 200 return -ENODEV; 201} 202#endif /* CONFIG_SSB_DRIVER_GIGE */ 203 204int ssb_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 205{ 206 int res; 207 208 /* Check if this PCI device is a device on a SSB bus or device 209 * and return the IRQ number for it. */ 210 211 res = ssb_pcicore_pcibios_map_irq(dev, slot, pin); 212 if (res >= 0) 213 return res; 214#ifdef CONFIG_SSB_DRIVER_GIGE 215 res = ssb_for_each_bus_call((unsigned long)dev, gige_map_irq_callback); 216 if (res >= 0) 217 return res; 218#endif 219 /* This is not a PCI device on any SSB device. */ 220 221 return -ENODEV; 222} |
|