Michael Trimarchi | ebc8300 | 2008-12-31 10:32:41 +0100 | [diff] [blame] | 1 | /*- |
| 2 | * Copyright (c) 2007-2008, Juniper Networks, Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License as |
| 7 | * published by the Free Software Foundation version 2 of |
| 8 | * the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 18 | * MA 02111-1307 USA |
| 19 | */ |
| 20 | |
| 21 | #include <common.h> |
| 22 | #include <pci.h> |
| 23 | #include <usb.h> |
Jean-Christophe PLAGNIOL-VILLARD | 8f6bcf4 | 2009-04-03 12:46:58 +0200 | [diff] [blame] | 24 | |
| 25 | #include "ehci.h" |
Michael Trimarchi | ebc8300 | 2008-12-31 10:32:41 +0100 | [diff] [blame] | 26 | |
| 27 | #ifdef CONFIG_PCI_EHCI_DEVICE |
| 28 | static struct pci_device_id ehci_pci_ids[] = { |
| 29 | /* Please add supported PCI EHCI controller ids here */ |
Trübenbach, Ralf | d2c9188 | 2011-03-31 16:46:47 +0000 | [diff] [blame] | 30 | {0x1033, 0x00E0}, /* NEC */ |
Wolfgang Denk | e936628 | 2011-04-05 12:24:20 +0200 | [diff] [blame] | 31 | {0x10B9, 0x5239}, /* ULI1575 PCI EHCI module ids */ |
Trübenbach, Ralf | d2c9188 | 2011-03-31 16:46:47 +0000 | [diff] [blame] | 32 | {0x12D8, 0x400F}, /* Pericom */ |
Michael Trimarchi | ebc8300 | 2008-12-31 10:32:41 +0100 | [diff] [blame] | 33 | {0, 0} |
| 34 | }; |
| 35 | #endif |
| 36 | |
| 37 | /* |
| 38 | * Create the appropriate control structures to manage |
| 39 | * a new EHCI host controller. |
| 40 | */ |
Lucas Stach | 3494a4c | 2012-09-26 00:14:35 +0200 | [diff] [blame] | 41 | int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) |
Michael Trimarchi | ebc8300 | 2008-12-31 10:32:41 +0100 | [diff] [blame] | 42 | { |
| 43 | pci_dev_t pdev; |
Michael Trimarchi | ebc8300 | 2008-12-31 10:32:41 +0100 | [diff] [blame] | 44 | |
| 45 | pdev = pci_find_devices(ehci_pci_ids, CONFIG_PCI_EHCI_DEVICE); |
| 46 | if (pdev == -1) { |
| 47 | printf("EHCI host controller not found\n"); |
| 48 | return -1; |
| 49 | } |
| 50 | |
Lucas Stach | 3494a4c | 2012-09-26 00:14:35 +0200 | [diff] [blame] | 51 | *hccr = (struct ehci_hccr *)pci_map_bar(pdev, |
Zhao Chenhui | 20799c9 | 2011-04-19 10:47:05 +0800 | [diff] [blame] | 52 | PCI_BASE_ADDRESS_0, PCI_REGION_MEM); |
Lucas Stach | 3494a4c | 2012-09-26 00:14:35 +0200 | [diff] [blame] | 53 | *hcor = (struct ehci_hcor *)((uint32_t) *hccr + |
| 54 | HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase))); |
Michael Trimarchi | ebc8300 | 2008-12-31 10:32:41 +0100 | [diff] [blame] | 55 | |
Florian Fainelli | 17e648b | 2010-10-15 15:53:45 +0200 | [diff] [blame] | 56 | debug("EHCI-PCI init hccr 0x%x and hcor 0x%x hc_length %d\n", |
Lucas Stach | 3494a4c | 2012-09-26 00:14:35 +0200 | [diff] [blame] | 57 | (uint32_t)*hccr, (uint32_t)*hcor, |
| 58 | (uint32_t)HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase))); |
Florian Fainelli | 17e648b | 2010-10-15 15:53:45 +0200 | [diff] [blame] | 59 | |
Michael Trimarchi | ebc8300 | 2008-12-31 10:32:41 +0100 | [diff] [blame] | 60 | return 0; |
| 61 | } |
| 62 | |
| 63 | /* |
| 64 | * Destroy the appropriate control structures corresponding |
| 65 | * the the EHCI host controller. |
| 66 | */ |
Lucas Stach | 3494a4c | 2012-09-26 00:14:35 +0200 | [diff] [blame] | 67 | int ehci_hcd_stop(int index) |
Michael Trimarchi | ebc8300 | 2008-12-31 10:32:41 +0100 | [diff] [blame] | 68 | { |
| 69 | return 0; |
| 70 | } |