Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3220555pxk; Mon, 5 Oct 2020 04:30:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCzeE6O4xN0MAKyEB8dXDTKe4YNkXCErXEu34133cEhkpJc+tA7Ih+9/dBLrFXnQ4yf/8Q X-Received: by 2002:a17:906:f28f:: with SMTP id gu15mr3192473ejb.291.1601897424765; Mon, 05 Oct 2020 04:30:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601897424; cv=none; d=google.com; s=arc-20160816; b=MIgMBq29ZgHGFV8WUo3YSDdItdKGOYs4nPrIr1W86ypTK/nLXxcVKFyX9v3/t0wHNw jBhrSi7kCsbAoP6EfJZyCfJG/KcGSXoF8whpKcoMe78aqaK8il7dl44yiawnpwhE8p0/ w4ESP7/niAduRV1/WHSUvp5tX8tmhZ9uBj1tYpbkF4zbT0rGleBn+tLc4oDlq3XkMP8J RJwYtkxRHfOAWepyStEGlyH3UzXILYWs8uh9GqTD1THJmb5q6p44+hNNyrM+W076Q4TY x+mdit7QrZY+MY/UGzT5Pi5uLa+tSwU2FboIAdn7eYmYcXBU6cZB4+/KVC0huBOz/+sb qRvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:to:from; bh=8oO8Zgr4MdIIOWb5NNvB4ee9gbdREcou/Cia7msI+vc=; b=YN5xnEHGQKzM2wXlqlh/CzAcyySmNpqgEBWtL17MYmJVWTXRgPdPVgyhP7GP9BYsp3 q4lPNz7O/zcaByH0/maHckbqvLrUg8F8wQxPgu2UvsXpXMvVrPHy2R4adbZQ9vxuWF4N VPVkj5zrrmmCVJyn8uW7aV3pHIJV2WoGJbVwmv+G2m7peZVF2HefJVptoMKKNTtEaHra 6xUfWPZSQHSZYhsq68LTcwoIOI7nb8wh+eXaYexd8uQ9LFoVXqKolSWZ7qvvuZETnYSY U+kURnw+lSY8CRsipdMhqFONzxoGpzdcRLdnT+4JFc0eu9JTn6U4G/pmGM8JFPeeoYri SpPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x21si6839203edv.520.2020.10.05.04.30.01; Mon, 05 Oct 2020 04:30:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725981AbgJEL2v (ORCPT + 99 others); Mon, 5 Oct 2020 07:28:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:43334 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725891AbgJEL2v (ORCPT ); Mon, 5 Oct 2020 07:28:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4F68CAC8B; Mon, 5 Oct 2020 11:28:49 +0000 (UTC) From: Thomas Bogendoerfer To: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] MIPS: alchemy: Share prom_init implementation Date: Mon, 5 Oct 2020 13:28:45 +0200 Message-Id: <20201005112846.66430-1-tsbogend@alpha.franken.de> X-Mailer: git-send-email 2.16.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All boards have the same prom_init() function. Move it to common code and delete the duplicates. Signed-off-by: Thomas Bogendoerfer --- arch/mips/alchemy/board-gpr.c | 17 ----------------- arch/mips/alchemy/board-mtx1.c | 17 ----------------- arch/mips/alchemy/board-xxs1500.c | 18 ------------------ arch/mips/alchemy/common/prom.c | 20 ++++++++++++++++++++ arch/mips/alchemy/devboards/platform.c | 17 ----------------- 5 files changed, 20 insertions(+), 69 deletions(-) diff --git a/arch/mips/alchemy/board-gpr.c b/arch/mips/alchemy/board-gpr.c index 6c47318946e4..f587c40b6d00 100644 --- a/arch/mips/alchemy/board-gpr.c +++ b/arch/mips/alchemy/board-gpr.c @@ -31,23 +31,6 @@ const char *get_system_type(void) return "GPR"; } -void __init prom_init(void) -{ - unsigned char *memsize_str; - unsigned long memsize; - - prom_argc = fw_arg0; - prom_argv = (char **)fw_arg1; - prom_envp = (char **)fw_arg2; - - prom_init_cmdline(); - - memsize_str = prom_getenv("memsize"); - if (!memsize_str || kstrtoul(memsize_str, 0, &memsize)) - memsize = 0x04000000; - add_memory_region(0, memsize, BOOT_MEM_RAM); -} - void prom_putchar(char c) { alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); diff --git a/arch/mips/alchemy/board-mtx1.c b/arch/mips/alchemy/board-mtx1.c index 23093535399f..68ea57511629 100644 --- a/arch/mips/alchemy/board-mtx1.c +++ b/arch/mips/alchemy/board-mtx1.c @@ -30,23 +30,6 @@ const char *get_system_type(void) return "MTX-1"; } -void __init prom_init(void) -{ - unsigned char *memsize_str; - unsigned long memsize; - - prom_argc = fw_arg0; - prom_argv = (char **)fw_arg1; - prom_envp = (char **)fw_arg2; - - prom_init_cmdline(); - - memsize_str = prom_getenv("memsize"); - if (!memsize_str || kstrtoul(memsize_str, 0, &memsize)) - memsize = 0x04000000; - add_memory_region(0, memsize, BOOT_MEM_RAM); -} - void prom_putchar(char c) { alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); diff --git a/arch/mips/alchemy/board-xxs1500.c b/arch/mips/alchemy/board-xxs1500.c index c67dfe1f4997..b184baa4e56a 100644 --- a/arch/mips/alchemy/board-xxs1500.c +++ b/arch/mips/alchemy/board-xxs1500.c @@ -25,24 +25,6 @@ const char *get_system_type(void) return "XXS1500"; } -void __init prom_init(void) -{ - unsigned char *memsize_str; - unsigned long memsize; - - prom_argc = fw_arg0; - prom_argv = (char **)fw_arg1; - prom_envp = (char **)fw_arg2; - - prom_init_cmdline(); - - memsize_str = prom_getenv("memsize"); - if (!memsize_str || kstrtoul(memsize_str, 0, &memsize)) - memsize = 0x04000000; - - add_memory_region(0, memsize, BOOT_MEM_RAM); -} - void prom_putchar(char c) { alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); diff --git a/arch/mips/alchemy/common/prom.c b/arch/mips/alchemy/common/prom.c index af312b5e33f6..cfa203064d3c 100644 --- a/arch/mips/alchemy/common/prom.c +++ b/arch/mips/alchemy/common/prom.c @@ -34,6 +34,8 @@ */ #include +#include +#include #include #include @@ -76,6 +78,24 @@ char *prom_getenv(char *envname) return NULL; } +void __init prom_init(void) +{ + unsigned char *memsize_str; + unsigned long memsize; + + prom_argc = (int)fw_arg0; + prom_argv = (char **)fw_arg1; + prom_envp = (char **)fw_arg2; + + prom_init_cmdline(); + + memsize_str = prom_getenv("memsize"); + if (!memsize_str || kstrtoul(memsize_str, 0, &memsize)) + memsize = SZ_64M; /* minimum memsize is 64MB RAM */ + + add_memory_region(0, memsize, BOOT_MEM_RAM); +} + static inline unsigned char str2hexnum(unsigned char c) { if (c >= '0' && c <= '9') diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/devboards/platform.c index 8d4b65c3268a..754bdd2ca630 100644 --- a/arch/mips/alchemy/devboards/platform.c +++ b/arch/mips/alchemy/devboards/platform.c @@ -20,23 +20,6 @@ #include -void __init prom_init(void) -{ - unsigned char *memsize_str; - unsigned long memsize; - - prom_argc = (int)fw_arg0; - prom_argv = (char **)fw_arg1; - prom_envp = (char **)fw_arg2; - - prom_init_cmdline(); - memsize_str = prom_getenv("memsize"); - if (!memsize_str || kstrtoul(memsize_str, 0, &memsize)) - memsize = 64 << 20; /* all devboards have at least 64MB RAM */ - - add_memory_region(0, memsize, BOOT_MEM_RAM); -} - void prom_putchar(char c) { if (alchemy_get_cputype() == ALCHEMY_CPU_AU1300) -- 2.16.4