From patchwork Sun May 27 13:55:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 10429375 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C8B5F60249 for ; Sun, 27 May 2018 13:56:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B736A28C73 for ; Sun, 27 May 2018 13:56:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABD4928C7E; Sun, 27 May 2018 13:56:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 494DF28C78 for ; Sun, 27 May 2018 13:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=N+bX1j5h8pMi6J8Sc87mfpeRfVKtzsLCCC9qRv0I9Ls=; b=SLt dUel7mnqkj0AsQqvR4JjtGNbU9iKuA/FmQAJ2YpL5W/F6ER3S1rvoAjSYo+kafKEKssp2FptMOYFt T+dOJvB+79asNyTtyXplTuve8To3yCtZqpwU6WwlkgKdoSpfXjetmrgoQhDPWsMGzF5xlA9Ue3Crw gv0Ki+o8m7tKBX1IG4XzTsuOGwPIMbSOe4OPrcHsWHaS2iR9nvrEfRQ7jNdk/mGxzcgjAnoTwtk2b 02FLV6XFlxUDFJG7LRvENyfkFIq6XH/izjUe2woTADtx8gZHtofbG5uKp21Iz/iqwykSBbh0INQsz Z4i0oUWIGub7JOyfufZ/KfMZalTt0vg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fMw9T-0002IV-N9; Sun, 27 May 2018 13:56:03 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fMw9Q-0002GR-NN for linux-arm-kernel@lists.infradead.org; Sun, 27 May 2018 13:56:02 +0000 Received: by mail-wr0-x242.google.com with SMTP id l41-v6so16259930wre.7 for ; Sun, 27 May 2018 06:55:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=2CHSHjj+z5Fm/a8Z0Di8aQ+UP23lseK52xtCCh+ImVM=; b=ZCyuj4M4L6mZq8ef7HVSg/Gq2vrEktUbYCBlnssoasjHEywL4K9UTFtdUXleRQU40q UabsDuL6FbKPGRuNy1VYN/HrbFeEC9u+Ao60vjkrc0g1JjMRzr0Fud2aDkuznFsnDPiL RLUH6n/U/Q+S5R9AvA7wM1FtfUfiUDQmSSsT60t184ldCLmlBxB0183noiiJdiWE9RF9 ATVYTW5gvJw3ekgb3H4I0UClWlp98k0Uktc971q93JXIkZ9dDtGe//ISiWpvjUYoNE2D HffzvzEx8QZbmKrQdvwItXxMc/kB4ijheHlORWblPs7Wht74/20FbdzDLdNnPeAjusIr gBiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2CHSHjj+z5Fm/a8Z0Di8aQ+UP23lseK52xtCCh+ImVM=; b=NH2KoHi26PNqZrmZ36Rg+V2JVrqHytb4/lPAutjn5m4nFStxYHmKOeZyGiGDDVOsi/ KKnhYa8tjCWufoXuJUcdmGL5T3iADbbhp4j7XBhxj53YYh2SZaorGh2DUicc0B/Wxrsp Jui2LUYFPQwDgGM/qcw2wtzM5acEvn/ezo4ldz64ayiym2JbhVk6YnsAElgNnJSi9LHi 2ppzQMN5A6okCUN7h3InDljymzvd8eYQ+DmJ2fv4As+F+kNEfGZjR92cX/4l+ylOr3nY 2A+F7DxRqHcO/1r+fgjV6JfCWvXnOjCikxjKR7/IyN4G2cuaWaWCadXLELah8jWNzRaZ Cvzw== X-Gm-Message-State: ALKqPweW2pr//NmBZKilV7eH+QlQ5+7ZH7UeuKuZcH44a6RMG0ohcaVc tNU93fi1/BKIzLAX9xTvvlk= X-Google-Smtp-Source: ADUXVKJxu9RSxltLAsKytS789Ql1jqE1L7cjYxz4x01FWQarj1L1WU49MFndfVz2uT0INxos0b/xPA== X-Received: by 2002:a19:db0c:: with SMTP id s12-v6mr5375537lfg.109.1527429348537; Sun, 27 May 2018 06:55:48 -0700 (PDT) Received: from localhost.localdomain (apn-31-0-67-177.dynamic.gprs.plus.pl. [31.0.67.177]) by smtp.gmail.com with ESMTPSA id n63-v6sm1411502lfb.46.2018.05.27.06.55.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 May 2018 06:55:47 -0700 (PDT) From: Janusz Krzysztofik To: Tony Lindgren Subject: [PATCH 1/2] ARM: OMAP1: ams-delta: refactor late_init() Date: Sun, 27 May 2018 15:55:47 +0200 Message-Id: <20180527135548.7904-1-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180527_065600_779261_7991531D X-CRM114-Status: GOOD ( 15.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-omap@vger.kernel.org, Janusz Krzysztofik , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Aaro Koskinen MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Before the board level GPIO handling is converted from GPIO numbers to GPIO descriptors, split late_init() into functional blocks and move them to separate functions. While being at it, drop machine type check from late_init() - the function is now called from the board init_late callback so there is no need for yet another applicability check. Signed-off-by: Janusz Krzysztofik --- arch/arm/mach-omap1/board-ams-delta.c | 55 +++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 80f54cb54276..cdba8decc532 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -643,19 +643,19 @@ static struct platform_device ams_delta_modem_device = { }, }; -static int __init late_init(void) +static int __init ams_delta_gpio_init(void) { int err; - if (!machine_is_ams_delta()) - return -ENODEV; - err = gpio_request_array(latch_gpios, ARRAY_SIZE(latch_gpios)); - if (err) { + if (err) pr_err("Couldn't take over latch1/latch2 GPIO pins\n"); - return err; - } + return err; +} + +static void __init ams_delta_late_devices(void) +{ platform_add_devices(late_devices, ARRAY_SIZE(late_devices)); /* @@ -666,12 +666,23 @@ static int __init late_init(void) ams_delta_nand_gpio_table.dev_id = dev_name(&ams_delta_nand_device.dev); gpiod_add_lookup_tables(late_gpio_tables, ARRAY_SIZE(late_gpio_tables)); +} + +static int __init modem_nreset_init(void) +{ + int err; err = platform_device_register(&modem_nreset_device); - if (err) { + if (err) pr_err("Couldn't register the modem regulator device\n"); - return err; - } + + return err; +} + + +static int __init ams_delta_modem_init(void) +{ + int err; omap_cfg_reg(M14_1510_GPIO2); ams_delta_modem_ports[0].irq = @@ -692,7 +703,28 @@ static int __init late_init(void) err = platform_device_register(&ams_delta_modem_device); if (err) - goto gpio_free; + gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ); + + return err; +} + +static int __init late_init(void) +{ + int err; + + err = ams_delta_gpio_init(); + if (err) + return err; + + ams_delta_late_devices(); + + err = modem_nreset_init(); + if (err) + return err; + + err = ams_delta_modem_init(); + if (err) + return err; /* * Once the modem device is registered, the modem_nreset @@ -708,7 +740,6 @@ static int __init late_init(void) unregister: platform_device_unregister(&ams_delta_modem_device); -gpio_free: gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ); return err; }