On 30.05.2010 19:42, Michael Karcher wrote:
> Also modifies nvidia_mcp_gpio_set to cope with multiple MCP55 chips on
> the same board, like on the Tyan S2915-E.
>   

Thanks a lot for tracking this down!


> Signed-off-by: Michael Karcher <[email protected]>
>   

Acked-by: Carl-Daniel Hailfinger <[email protected]>

Please see the comments below.

> ---
>  board_enable.c |   43 +++++++++++++++++++++++++++++++++++--------
>  1 files changed, 35 insertions(+), 8 deletions(-)
>
> diff --git a/board_enable.c b/board_enable.c
> index b5eb63f..497cfd9 100644
> --- a/board_enable.c
> +++ b/board_enable.c
> @@ -552,6 +552,7 @@ static int nvidia_mcp_gpio_set(int gpio, int raise)
>  {
>       struct pci_dev *dev;
>       uint16_t base;
> +     uint16_t devclass;
>       uint8_t tmp;
>  
>       if ((gpio < 0) || (gpio >= 0x40)) {
> @@ -566,17 +567,33 @@ static int nvidia_mcp_gpio_set(int gpio, int raise)
>       case 0x0050: /* MCP04 */
>       case 0x0060: /* MCP2 */
>               break;
> -     default:
> -         /* Newer MCPs use the SMBus Controller */
> -         dev = pci_dev_find_vendorclass(0x10DE, 0x0C05);
> -         switch (dev->device_id) {
> -         case 0x0264: /* MCP51 */
> +     case 0x0260: /* MCP51 */
> +     case 0x0364: /* MCP55 */
> +             /* find SMBus controller on *this* southbridge */
> +             /* The infamous Tyan S2915-E has two south bridges; they are
> +                easily told apart from each other by the class of the 
> +                LPC bridge, but have the same SMBus bridge IDs */
> +             if (dev->func != 0) {
> +                     msg_perr("MCP LCP bridge at unexpected function"
> +                              " number %d\n", dev->func);
> +                     return -1;
> +             }
> +
> +             dev = pci_get_dev(pacc, dev->domain, dev->bus, dev->dev, 1);
> +             if (!dev) {
> +                     msg_perr("MCP SMBus controller could not be found\n");
> +                     return -1;
> +             }
> +             devclass = pci_read_word(dev, 0x0a);
>   

PCI_CLASS_DEVICE instead of 0x0a would be appreciated.


> +             if (devclass != 0x0C05) {
> +                     msg_perr("Unexpected device class %04x for SMBus"
> +                              " controller\n", devclass);
> +                     return -1;
> +             }
>               break;
> -         default:
> +     default:
>               msg_perr("\nERROR: no NVIDIA LPC/SMBus controller found.\n");
>               return -1;
> -         }
> -         break;
>       }
>  
>       base = pci_read_long(dev, 0x64) & 0x0000FF00; /* System control area */
> @@ -618,6 +635,15 @@ static int nvidia_mcp_gpio2_raise(const char *name)
>       return nvidia_mcp_gpio_set(0x02, 1);
>  }
>  
> +
> +/**
> + * Suited for HP xw9400 (Tyan S2915-E OEM): nVidia MCP55.
> + */
>   

Please add the comment about the two SMBus devices here as well in case
someone later changes the mcp GPIO code.


> +static int nvidia_mcp_gpio5_raise(const char *name)
> +{
> +     return nvidia_mcp_gpio_set(0x05, 1);
> +}
> +
>  /**
>   * Suited for Abit NF7-S: NVIDIA CK804.
>   */
>   

Regards,
Carl-Daniel

-- 
http://www.hailfinger.org/


_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to