From patchwork Mon Oct 12 15:20:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 54794 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id EDB0D23001 for ; Mon, 12 Oct 2015 15:11:55 +0000 (UTC) Received: by lbcao8 with SMTP id ao8sf70957611lbc.1 for ; Mon, 12 Oct 2015 08:11:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=6iv40m0Qzxco0XZqXcAIo493lA/2xvj0uP/Nf9Wl4VU=; b=PtTu+ZG5bdOLL3aE+ubqP5MkqY22RZfWv/15aGbAIg725Vz5cWksM1QP+HUmIltrPY yqqn+x/vIPdGThD9/BSQlD/RbvWYJn7dUj66176snOucb4QOlAz0hVvayw658xpl3UNR LUkXHSGRJpnDTJXoLfADULwHV4awvOLpEAtyQw8qAkm8YJuUYpEDlN9uHOZdARUzPrdN Ji4jCGEYhH+LhQj/QZQvXMUqqY3gCrUaHiGqwH/ItgMoW22udMvw20BHMzD94QML97xM dSi9hEcWd1j8ZoNwBKUr78qNTFUhAoSJWXmFRaz91m2BgNDdIn3rEse3pSpOMR29dgOa NGfA== X-Gm-Message-State: ALoCoQkmELPEnw8JzFkdaub0L6J5wB2SsL6/QTvDFKfI0ZmnceRDy5UZl4aEj+T0XZl0TN86SFAa X-Received: by 10.112.144.99 with SMTP id sl3mr5690004lbb.12.1444662714929; Mon, 12 Oct 2015 08:11:54 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.86.70 with SMTP id k67ls573243lfb.43.gmail; Mon, 12 Oct 2015 08:11:54 -0700 (PDT) X-Received: by 10.112.133.42 with SMTP id oz10mr12820685lbb.62.1444662714793; Mon, 12 Oct 2015 08:11:54 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id c70si11554908lfe.21.2015.10.12.08.11.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2015 08:11:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbbk10 with SMTP id k10so33974695lbb.0 for ; Mon, 12 Oct 2015 08:11:54 -0700 (PDT) X-Received: by 10.25.40.130 with SMTP id o124mr8102932lfo.41.1444662714679; Mon, 12 Oct 2015 08:11:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1602763lbq; Mon, 12 Oct 2015 08:11:53 -0700 (PDT) X-Received: by 10.60.46.168 with SMTP id w8mr17203734oem.82.1444662712545; Mon, 12 Oct 2015 08:11:52 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r184si9022185oie.119.2015.10.12.08.11.52; Mon, 12 Oct 2015 08:11:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751534AbbJLPLu (ORCPT + 7 others); Mon, 12 Oct 2015 11:11:50 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:13616 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751073AbbJLPLt (ORCPT ); Mon, 12 Oct 2015 11:11:49 -0400 Received: from 172.24.1.51 (EHLO szxeml432-hub.china.huawei.com) ([172.24.1.51]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CUB61518; Mon, 12 Oct 2015 23:05:11 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by szxeml432-hub.china.huawei.com (10.82.67.209) with Microsoft SMTP Server id 14.3.235.1; Mon, 12 Oct 2015 23:05:01 +0800 From: John Garry To: CC: , , , , , , , , , John Garry Subject: [PATCH 07/25] scsi: hisi_sas: add ioremap for device HW Date: Mon, 12 Oct 2015 23:20:19 +0800 Message-ID: <1444663237-238302-8-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444663237-238302-1-git-send-email-john.garry@huawei.com> References: <1444663237-238302-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.garry@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This includes registers for core SAS controllers and also SAS control registers. Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 2 ++ drivers/scsi/hisi_sas/hisi_sas_init.c | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index 929c513..5f72d98 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -69,6 +69,8 @@ struct hisi_hba { struct platform_device *pdev; + void __iomem *regs; + void __iomem *ctrl_regs; u8 sas_addr[SAS_ADDR_SIZE]; diff --git a/drivers/scsi/hisi_sas/hisi_sas_init.c b/drivers/scsi/hisi_sas/hisi_sas_init.c index 38b9ed2..8f1e856 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_init.c +++ b/drivers/scsi/hisi_sas/hisi_sas_init.c @@ -195,6 +195,28 @@ static void hisi_sas_free(struct hisi_hba *hisi_hba) hisi_hba->sata_breakpoint_dma); } +int hisi_sas_ioremap(struct hisi_hba *hisi_hba) +{ + struct platform_device *pdev = hisi_hba->pdev; + struct device *dev = &pdev->dev; + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + hisi_hba->regs = devm_ioremap(dev, + res->start, + resource_size(res)); + if (!hisi_hba->regs) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + hisi_hba->ctrl_regs = devm_ioremap(dev, + res->start, + resource_size(res)); + if (!hisi_hba->ctrl_regs) + return -ENOMEM; + + return 0; +} static const struct of_device_id sas_of_match[] = { { .compatible = "hisilicon,sas-controller-v1",}, @@ -241,6 +263,9 @@ static struct hisi_hba *hisi_sas_hba_alloc( hisi_hba->shost = shost; + if (hisi_sas_ioremap(hisi_hba)) + goto err_out; + if (hisi_sas_alloc(hisi_hba, shost)) { hisi_sas_free(hisi_hba); goto err_out;