ARM: move reserve_lp[012] handling into affected machines
Subsystems (4)
RFC PATCH 1/1 ARM: move reserve_lp[012] handling into affected machines
arch/arm/kernel/setup.c contains code to reserve lp0/1/2 I/O ports for machines that can't possibly have these ports. This code is only used by netwinder and footbridge, and is small enough that it can just be moved into these machines. Do so to make the setup code more generic and the machine code more self-contained.
This patch is an RFC because I'm not sure if using .init_early is actually necessary. I did it to match the place the original code was called as closely as possible. Can anyone weigh in on this?
--- arch/arm/include/asm/mach/arch.h | 3 -- arch/arm/kernel/setup.c | 37 ------------------- arch/arm/mach-footbridge/netwinder-hw.c | 48 ++++++++++++++++++------- arch/arm/mach-rpc/riscpc.c | 30 ++++++++++++++-- 4 files changed, 63 insertions(+), 55 deletions(-)
arch/arm/include/asm/mach/arch.h +0 -3
@@ -37,9 +37,6 @@ struct machine_desc {unsigned int video_start;/* start of video RAM */ unsigned int video_end;/* end of video RAM */ - unsigned char reserve_lp0 :1; /* never has lp0 */ - unsigned char reserve_lp1 :1; /* never has lp1 */ - unsigned char reserve_lp2 :1; /* never has lp2 */enum reboot_mode reboot_mode;/* default restart mode */ unsigned l2c_aux_val;/* L2 cache aux value */ unsigned l2c_aux_mask;/* L2 cache aux mask */
arch/arm/kernel/setup.c +0 -37
@@ -8,7 +8,6 @@#include <linux/export.h> #include <linux/kernel.h> #include <linux/stddef.h> -#include <linux/ioport.h> #include <linux/delay.h> #include <linux/utsname.h> #include <linux/initrd.h>
@@ -185,31 +184,6 @@ static struct resource mem_res[] = {#define kernel_code mem_res[1]#define kernel_data mem_res[2] -static struct resource io_res[] = { - { - .name ="reserved" , - .start =0x3bc , - .end =0x3be , - .flags =IORESOURCE_IO |IORESOURCE_BUSY - }, - { - .name ="reserved" , - .start =0x378 , - .end =0x37f , - .flags =IORESOURCE_IO |IORESOURCE_BUSY - }, - { - .name ="reserved" , - .start =0x278 , - .end =0x27f , - .flags =IORESOURCE_IO |IORESOURCE_BUSY - } -}; - -#define lp0 io_res[0] -#define lp1 io_res[1] -#define lp2 io_res[2] -static const char *proc_arch[] = {"undefined/unknown" ,"3" ,
@@ -909,17 +883,6 @@ static void __init request_standard_resources(const struct machine_desc *mdesc) video_ram.end = mdesc->video_end;request_resource (&iomem_resource, &video_ram); } - -/* -* Some machines don't have the possibility of ever -* possessing lp0, lp1 or lp2 -*/ -if (mdesc->reserve_lp0) -request_resource (&ioport_resource, &lp0); -if (mdesc->reserve_lp1) -request_resource (&ioport_resource, &lp1); -if (mdesc->reserve_lp2) -request_resource (&ioport_resource, &lp2); }#if defined(CONFIG_VGA_CONSOLE )
arch/arm/mach-footbridge/netwinder-hw.c +35 -13
67 lines not on this page · raw message
arch/arm/mach-rpc/riscpc.c +28 -2
@@ -16,6 +16,7 @@#include <linux/serial_8250.h> #include <linux/ata_platform.h> #include <linux/io.h> +#include <linux/ioport.h> #include <linux/i2c.h> #include <linux/reboot.h>
@@ -185,6 +186,32 @@ static struct i2c_board_info i2c_rtc = { I2C_BOARD_INFO("pcf8583", 0x50) }; +/* The Risc PC never has lp0 or lp1 */ +static struct resource reserved_resources[] = { + { +/* lp0 */ + .name ="reserved" , + .start =0x3bc , + .end =0x3be , + .flags =IORESOURCE_IO |IORESOURCE_BUSY + }, + { +/* lp1 */ + .name ="reserved" , + .start =0x378 , + .end =0x37f , + .flags =IORESOURCE_IO |IORESOURCE_BUSY + }, +}; + +static void __init rpc_init_early (void ) +{ +int i; + +for (i =0 ; i <ARRAY_SIZE (reserved_resources); i++) +request_resource (&ioport_resource, &reserved_resources[i]); +} +static int __init rpc_init (void ) {i2c_register_board_info (0 , &i2c_rtc,1 );
@@ -208,8 +235,7 @@ void ioc_timer_init(void);MACHINE_START (RISCPC ,"Acorn-RiscPC" )/* Maintainer: Russell King */ .atag_offset = 0x100, - .reserve_lp0 = 1, - .reserve_lp1 = 1, + .init_early = rpc_init_early, .map_io = rpc_map_io, .nr_irqs = RPC_NR_IRQS, .init_irq = rpc_init_irq,
Signature · 1 line
2.43.0
Quoted 9 lines · Ethan Nelson-Moore
arch/arm/kernel/setup.ccontains code to reserve lp0/1/2 I/O ports for machines that can't possibly have these ports. This code is only used by netwinder and footbridge, and is small enough that it can just be moved into these machines. Do so to make the setup code more generic and the machine code more self-contained.This patch is an RFC because I'm not sure if using .init_early is actually necessary. I did it to match the place the original code was called as closely as possible. Can anyone weigh in on this?
Hi, everyone,
Gentle ping (+ cc Arnd, LinusW) - anyone have any thoughts on this?
I meant rpc and footbridge in the commit message - I'll fix it in a future revision.
Ethan
Quoted 8 lines · Ethan Nelson-Moore
Quoted 6 lines · Ethan Nelson-Moore
arch/arm/kernel/setup.ccontains code to reserve lp0/1/2 I/O ports for machines that can't possibly have these ports. This code is only used by netwinder and footbridge, and is small enough that it can just be moved into these machines. Do so to make the setup code more generic and the machine code more self-contained.
Quoted 7 lines
Quoted 3 lines
This patch is an RFC because I'm not sure if using .init_early is actually necessary. I did it to match the place the original code was called as closely as possible. Can anyone weigh in on this?
Hi, everyone,
Gentle ping (+ cc Arnd, LinusW) - anyone have any thoughts on this?
My general idea about this and the other patch for sparse IRQs was that I wanted to drag my Footbridge (NetWinder) out of the closet and boot with these patches to make sure they work.
I just haven't had time, and it got buried pretty deep in there I think...
Yours,
Linus Walleij