lkml.org 
[lkml]   [2012]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 6/7] pciehp: Add Disable/enable link functions
    Date
    Will use it during power off/on slots

    Signed-off-by: Yinghai Lu <yinghai.lu@oracle.com>
    ---
    drivers/pci/hotplug/pciehp_hpc.c | 36 ++++++++++++++++++++++++++++++++++++
    1 files changed, 36 insertions(+), 0 deletions(-)

    diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
    index ea54aef..fdab8a6 100644
    --- a/drivers/pci/hotplug/pciehp_hpc.c
    +++ b/drivers/pci/hotplug/pciehp_hpc.c
    @@ -352,6 +352,42 @@ int pciehp_check_link_status(struct controller *ctrl)
    return retval;
    }

    +static int __pciehp_link_set(struct controller *ctrl, bool enable)
    +{
    + u16 lnk_ctrl;
    + int retval = 0;
    +
    + retval = pciehp_readw(ctrl, PCI_EXP_LNKCTL, &lnk_ctrl);
    + if (retval) {
    + ctrl_err(ctrl, "Cannot read LNKCTRL register\n");
    + return retval;
    + }
    +
    + if (enable)
    + lnk_ctrl &= ~PCI_EXP_LNKCTL_LD;
    + else
    + lnk_ctrl |= PCI_EXP_LNKCTL_LD;
    +
    + retval = pciehp_writew(ctrl, PCI_EXP_LNKCTL, lnk_ctrl);
    + if (retval) {
    + ctrl_err(ctrl, "Cannot write LNKCTRL register\n");
    + return retval;
    + }
    + ctrl_dbg(ctrl, "%s: lnk_ctrl = %x\n", __func__, lnk_ctrl);
    +
    + return retval;
    +}
    +
    +static int pciehp_link_enable(struct controller *ctrl)
    +{
    + return __pciehp_link_set(ctrl, true);
    +}
    +
    +static int pciehp_link_disable(struct controller *ctrl)
    +{
    + return __pciehp_link_set(ctrl, false);
    +}
    +
    int pciehp_get_attention_status(struct slot *slot, u8 *status)
    {
    struct controller *ctrl = slot->ctrl;
    --
    1.7.7


    \
     
     \ /
      Last update: 2012-01-27 19:59    [W:0.020 / U:30.196 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site