1/*  *********************************************************************
2    *  Broadcom Common Firmware Environment (CFE)
3    *
4    *  HT1000 Bridge Support			File: dev_bcm5780_ht1000.c
5    *
6    *********************************************************************
7    *
8    *  Copyright 2002,2003
9    *  Broadcom Corporation. All rights reserved.
10    *
11    *  This software is furnished under license and may be used and
12    *  copied only in accordance with the following terms and
13    *  conditions.  Subject to these conditions, you may download,
14    *  copy, install, use, modify and distribute modified or unmodified
15    *  copies of this software in source and/or binary form.  No title
16    *  or ownership is transferred hereby.
17    *
18    *  1) Any source code used, modified or distributed must reproduce
19    *     and retain this copyright notice and list of conditions
20    *     as they appear in the source file.
21    *
22    *  2) No right is granted to use any trade name, trademark, or
23    *     logo of Broadcom Corporation.  The "Broadcom Corporation"
24    *     name may not be used to endorse or promote products derived
25    *     from this software without the prior written permission of
26    *     Broadcom Corporation.
27    *
28    *  3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
29    *     IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
30    *     WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
31    *     PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
32    *     SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
33    *     PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
34    *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35    *     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
36    *     GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
37    *     BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
38    *     OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
39    *     TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
40    *     THE POSSIBILITY OF SUCH DAMAGE.
41    ********************************************************************* */
42
43#include "cfe.h"
44#include "lib_types.h"
45#include "lib_physio.h"
46
47#include "pcireg.h"
48#include "pcivar.h"
49#include "pci_internal.h"
50
51void bcm5780devs_enable_preset(pcitag_t tag);
52
53/* BCM5780 (HT1000) specific definitions */
54
55/* BCM5780 specific registers */
56
57/* BCM5780 configuration registers */
58
59#define BCM5780_HOST_CFG_FEATURE_ENABLE0      0x0064
60#define BCM5780_H0ST_FE0_USB_ENABLE           (1 <<  8)
61#define BCM5780_H0ST_FE0_IDE_ENABLE           (1 << 14)
62
63#define BCM5780_HOST_CFG_FEATURE_ENABLE2      0x0084
64#define BCM5780_H0ST_FE2_SATA_ENABLE          (1 << 0)
65
66
67void bcm5780devs_enable_preset(pcitag_t tag)
68{
69    pcireg_t ctrl;
70
71
72    printf("BCM5780 (HT1000) PCI bridge discovered.  Enabling devices...\n");
73    /*
74     * Enable BCM5780 - HT1000 devices supported under CFE
75     */
76    ctrl = pci_conf_read(tag, BCM5780_HOST_CFG_FEATURE_ENABLE0);
77    /* Enable Single Channel IDE support */
78    ctrl |= BCM5780_H0ST_FE0_IDE_ENABLE;
79    /* Enable USB support */
80    ctrl |= BCM5780_H0ST_FE0_USB_ENABLE;
81    pci_conf_write(tag, BCM5780_HOST_CFG_FEATURE_ENABLE0, ctrl);
82    ctrl = pci_conf_read(tag, BCM5780_HOST_CFG_FEATURE_ENABLE0);   /* push */
83
84
85    ctrl = pci_conf_read(tag, BCM5780_HOST_CFG_FEATURE_ENABLE2);
86    /* Enable Frodo SATA support */
87    ctrl |= BCM5780_H0ST_FE2_SATA_ENABLE;
88    pci_conf_write(tag, BCM5780_HOST_CFG_FEATURE_ENABLE2, ctrl);
89    ctrl = pci_conf_read(tag, BCM5780_HOST_CFG_FEATURE_ENABLE2);   /* push */
90}
91
92