| .. | .. |
|---|
| 186 | 186 | { |
|---|
| 187 | 187 | struct pci_dev *pci_dev = cobalt->pci_dev; |
|---|
| 188 | 188 | struct pci_dev *pci_bus_dev = cobalt->pci_dev->bus->self; |
|---|
| 189 | | - int offset; |
|---|
| 190 | | - int bus_offset; |
|---|
| 191 | 189 | u32 capa; |
|---|
| 192 | 190 | u16 stat, ctrl; |
|---|
| 193 | 191 | |
|---|
| 194 | | - offset = pci_find_capability(pci_dev, PCI_CAP_ID_EXP); |
|---|
| 195 | | - bus_offset = pci_find_capability(pci_bus_dev, PCI_CAP_ID_EXP); |
|---|
| 196 | | - if (!offset || !bus_offset) |
|---|
| 192 | + if (!pci_is_pcie(pci_dev) || !pci_is_pcie(pci_bus_dev)) |
|---|
| 197 | 193 | return; |
|---|
| 198 | 194 | |
|---|
| 199 | 195 | /* Device */ |
|---|
| 200 | | - pci_read_config_dword(pci_dev, offset + PCI_EXP_DEVCAP, &capa); |
|---|
| 201 | | - pci_read_config_word(pci_dev, offset + PCI_EXP_DEVCTL, &ctrl); |
|---|
| 202 | | - pci_read_config_word(pci_dev, offset + PCI_EXP_DEVSTA, &stat); |
|---|
| 196 | + pcie_capability_read_dword(pci_dev, PCI_EXP_DEVCAP, &capa); |
|---|
| 197 | + pcie_capability_read_word(pci_dev, PCI_EXP_DEVCTL, &ctrl); |
|---|
| 198 | + pcie_capability_read_word(pci_dev, PCI_EXP_DEVSTA, &stat); |
|---|
| 203 | 199 | cobalt_info("PCIe device capability 0x%08x: Max payload %d\n", |
|---|
| 204 | 200 | capa, get_payload_size(capa & PCI_EXP_DEVCAP_PAYLOAD)); |
|---|
| 205 | 201 | cobalt_info("PCIe device control 0x%04x: Max payload %d. Max read request %d\n", |
|---|
| .. | .. |
|---|
| 209 | 205 | cobalt_info("PCIe device status 0x%04x\n", stat); |
|---|
| 210 | 206 | |
|---|
| 211 | 207 | /* Link */ |
|---|
| 212 | | - pci_read_config_dword(pci_dev, offset + PCI_EXP_LNKCAP, &capa); |
|---|
| 213 | | - pci_read_config_word(pci_dev, offset + PCI_EXP_LNKCTL, &ctrl); |
|---|
| 214 | | - pci_read_config_word(pci_dev, offset + PCI_EXP_LNKSTA, &stat); |
|---|
| 208 | + pcie_capability_read_dword(pci_dev, PCI_EXP_LNKCAP, &capa); |
|---|
| 209 | + pcie_capability_read_word(pci_dev, PCI_EXP_LNKCTL, &ctrl); |
|---|
| 210 | + pcie_capability_read_word(pci_dev, PCI_EXP_LNKSTA, &stat); |
|---|
| 215 | 211 | cobalt_info("PCIe link capability 0x%08x: %s per lane and %u lanes\n", |
|---|
| 216 | 212 | capa, get_link_speed(capa), |
|---|
| 217 | 213 | (capa & PCI_EXP_LNKCAP_MLW) >> 4); |
|---|
| .. | .. |
|---|
| 221 | 217 | (stat & PCI_EXP_LNKSTA_NLW) >> 4); |
|---|
| 222 | 218 | |
|---|
| 223 | 219 | /* Bus */ |
|---|
| 224 | | - pci_read_config_dword(pci_bus_dev, bus_offset + PCI_EXP_LNKCAP, &capa); |
|---|
| 220 | + pcie_capability_read_dword(pci_bus_dev, PCI_EXP_LNKCAP, &capa); |
|---|
| 225 | 221 | cobalt_info("PCIe bus link capability 0x%08x: %s per lane and %u lanes\n", |
|---|
| 226 | 222 | capa, get_link_speed(capa), |
|---|
| 227 | 223 | (capa & PCI_EXP_LNKCAP_MLW) >> 4); |
|---|
| 228 | 224 | |
|---|
| 229 | 225 | /* Slot */ |
|---|
| 230 | | - pci_read_config_dword(pci_dev, offset + PCI_EXP_SLTCAP, &capa); |
|---|
| 231 | | - pci_read_config_word(pci_dev, offset + PCI_EXP_SLTCTL, &ctrl); |
|---|
| 232 | | - pci_read_config_word(pci_dev, offset + PCI_EXP_SLTSTA, &stat); |
|---|
| 226 | + pcie_capability_read_dword(pci_dev, PCI_EXP_SLTCAP, &capa); |
|---|
| 227 | + pcie_capability_read_word(pci_dev, PCI_EXP_SLTCTL, &ctrl); |
|---|
| 228 | + pcie_capability_read_word(pci_dev, PCI_EXP_SLTSTA, &stat); |
|---|
| 233 | 229 | cobalt_info("PCIe slot capability 0x%08x\n", capa); |
|---|
| 234 | 230 | cobalt_info("PCIe slot control 0x%04x\n", ctrl); |
|---|
| 235 | 231 | cobalt_info("PCIe slot status 0x%04x\n", stat); |
|---|
| .. | .. |
|---|
| 238 | 234 | static unsigned pcie_link_get_lanes(struct cobalt *cobalt) |
|---|
| 239 | 235 | { |
|---|
| 240 | 236 | struct pci_dev *pci_dev = cobalt->pci_dev; |
|---|
| 241 | | - unsigned offset; |
|---|
| 242 | 237 | u16 link; |
|---|
| 243 | 238 | |
|---|
| 244 | | - offset = pci_find_capability(pci_dev, PCI_CAP_ID_EXP); |
|---|
| 245 | | - if (!offset) |
|---|
| 239 | + if (!pci_is_pcie(pci_dev)) |
|---|
| 246 | 240 | return 0; |
|---|
| 247 | | - pci_read_config_word(pci_dev, offset + PCI_EXP_LNKSTA, &link); |
|---|
| 241 | + pcie_capability_read_word(pci_dev, PCI_EXP_LNKSTA, &link); |
|---|
| 248 | 242 | return (link & PCI_EXP_LNKSTA_NLW) >> 4; |
|---|
| 249 | 243 | } |
|---|
| 250 | 244 | |
|---|
| 251 | 245 | static unsigned pcie_bus_link_get_lanes(struct cobalt *cobalt) |
|---|
| 252 | 246 | { |
|---|
| 253 | 247 | struct pci_dev *pci_dev = cobalt->pci_dev->bus->self; |
|---|
| 254 | | - unsigned offset; |
|---|
| 255 | 248 | u32 link; |
|---|
| 256 | 249 | |
|---|
| 257 | | - offset = pci_find_capability(pci_dev, PCI_CAP_ID_EXP); |
|---|
| 258 | | - if (!offset) |
|---|
| 250 | + if (!pci_is_pcie(pci_dev)) |
|---|
| 259 | 251 | return 0; |
|---|
| 260 | | - pci_read_config_dword(pci_dev, offset + PCI_EXP_LNKCAP, &link); |
|---|
| 252 | + pcie_capability_read_dword(pci_dev, PCI_EXP_LNKCAP, &link); |
|---|
| 261 | 253 | return (link & PCI_EXP_LNKCAP_MLW) >> 4; |
|---|
| 262 | 254 | } |
|---|
| 263 | 255 | |
|---|
| .. | .. |
|---|
| 592 | 584 | .cec_clk = 12000000, |
|---|
| 593 | 585 | }; |
|---|
| 594 | 586 | static struct i2c_board_info adv7511_info = { |
|---|
| 595 | | - .type = "adv7511", |
|---|
| 587 | + .type = "adv7511-v4l2", |
|---|
| 596 | 588 | .addr = 0x39, /* 0x39 or 0x3d */ |
|---|
| 597 | 589 | .platform_data = &adv7511_pdata, |
|---|
| 598 | 590 | }; |
|---|