diff options
Diffstat (limited to 'arch/arm/boards')
52 files changed, 1195 insertions, 1795 deletions
diff --git a/arch/arm/boards/a9m2410/a9m2410.c b/arch/arm/boards/a9m2410/a9m2410.c index 8cbaec59e3..44ac44bcbc 100644 --- a/arch/arm/boards/a9m2410/a9m2410.c +++ b/arch/arm/boards/a9m2410/a9m2410.c @@ -35,44 +35,14 @@ #include <mach/s3c24x0-iomap.h> #include <mach/s3c24x0-nand.h> -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "ram", - .map_base = CS6_BASE, - .platform_data = &ram_pdata, -}; - // {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, 0}, static struct s3c24x0_nand_platform_data nand_info = { .nand_timing = CALC_NFCONF_TIMING(A9M2410_TACLS, A9M2410_TWRPH0, A9M2410_TWRPH1) }; -static struct device_d nand_dev = { - .id = -1, - .name = "s3c24x0_nand", - .map_base = S3C24X0_NAND_BASE, - .platform_data = &nand_info, -}; - -/* - * SMSC 91C111 network controller on the baseboard - * connected to CS line 1 and interrupt line - * GPIO3, data width is 32 bit - */ -static struct device_d network_dev = { - .id = -1, - .name = "smc91c111", - .map_base = CS1_BASE + 0x300, - .size = 16, -}; - -static int a9m2410_devices_init(void) +static int a9m2410_mem_init(void) { + resource_size_t size = 0; uint32_t reg; /* @@ -83,25 +53,25 @@ static int a9m2410_devices_init(void) switch (reg &= 0x7) { case 0: - sdram_dev.size = 32 * 1024 * 1024; + size = 32 * 1024 * 1024; break; case 1: - sdram_dev.size = 64 * 1024 * 1024; + size = 64 * 1024 * 1024; break; case 2: - sdram_dev.size = 128 * 1024 * 1024; + size = 128 * 1024 * 1024; break; case 4: - sdram_dev.size = 2 * 1024 * 1024; + size = 2 * 1024 * 1024; break; case 5: - sdram_dev.size = 4 * 1024 * 1024; + size = 4 * 1024 * 1024; break; case 6: - sdram_dev.size = 8 * 1024 * 1024; + size = 8 * 1024 * 1024; break; case 7: - sdram_dev.size = 16 * 1024 * 1024; + size = 16 * 1024 * 1024; break; } @@ -130,6 +100,16 @@ static int a9m2410_devices_init(void) */ writel(0x40140, MISCCR); + arm_add_mem_device("ram0", CS6_BASE, size); + + return 0; +} +mem_initcall(a9m2410_mem_init); + +static int a9m2410_devices_init(void) +{ + uint32_t reg; + /* ----------- configure the access to the outer space ---------- */ reg = readl(BWSCON); @@ -151,9 +131,15 @@ static int a9m2410_devices_init(void) writel(reg, MISCCR); /* ----------- the devices the boot loader should work with -------- */ - register_device(&nand_dev); - register_device(&sdram_dev); - register_device(&network_dev); + add_generic_device("s3c24x0_nand", -1, NULL, S3C24X0_NAND_BASE, 0, + IORESOURCE_MEM, &nand_info); + /* + * SMSC 91C111 network controller on the baseboard + * connected to CS line 1 and interrupt line + * GPIO3, data width is 32 bit + */ + add_generic_device("smc91c111", -1, NULL, CS1_BASE + 0x300, 16, + IORESOURCE_MEM, NULL); #ifdef CONFIG_NAND /* ----------- add some vital partitions -------- */ @@ -164,8 +150,7 @@ static int a9m2410_devices_init(void) dev_add_bb_dev("env_raw", "env0"); #endif - armlinux_add_dram(&sdram_dev); - armlinux_set_bootparams((void *)sdram_dev.map_base + 0x100); + armlinux_set_bootparams((void*)CS6_BASE + 0x100); armlinux_set_architecture(MACH_TYPE_A9M2410); return 0; @@ -180,16 +165,10 @@ void __bare_init nand_boot(void) } #endif -static struct device_d a9m2410_serial_device = { - .id = -1, - .name = "s3c24x0_serial", - .map_base = UART1_BASE, - .size = UART1_SIZE, -}; - static int a9m2410_console_init(void) { - register_device(&a9m2410_serial_device); + add_generic_device("s3c24x0_serial", -1, NULL, UART1_BASE, UART1_SIZE, + IORESOURCE_MEM, NULL); return 0; } diff --git a/arch/arm/boards/a9m2440/a9m2440.c b/arch/arm/boards/a9m2440/a9m2440.c index 39b52761c5..89c9cdf57e 100644 --- a/arch/arm/boards/a9m2440/a9m2440.c +++ b/arch/arm/boards/a9m2440/a9m2440.c @@ -38,41 +38,10 @@ #include "baseboards.h" -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = CS6_BASE, - .platform_data = &ram_pdata, -}; - static struct s3c24x0_nand_platform_data nand_info = { .nand_timing = CALC_NFCONF_TIMING(A9M2440_TACLS, A9M2440_TWRPH0, A9M2440_TWRPH1) }; -static struct device_d nand_dev = { - .id = -1, - .name = "s3c24x0_nand", - .map_base = S3C24X0_NAND_BASE, - .platform_data = &nand_info, -}; - -/* - * cs8900 network controller onboard - * Connected to CS line 5 + A24 and interrupt line EINT9, - * data width is 16 bit - */ -static struct device_d network_dev = { - .id = -1, - .name = "cs8900", - .map_base = CS5_BASE + (1 << 24) + 0x300, - .size = 16, -}; - static int a9m2440_check_for_ram(uint32_t addr) { uint32_t tmp1, tmp2; @@ -103,10 +72,8 @@ static void a9m2440_disable_second_sdram_bank(void) writel(readl(MISCCR) | (1 << 18), MISCCR); /* disable clock */ } -static int a9m2440_devices_init(void) +static int a9m2440_mem_init(void) { - uint32_t reg; - /* * The special SDRAM setup code for this machine will always enable * both SDRAM banks. But the second SDRAM device may not exists! @@ -136,7 +103,15 @@ static int a9m2440_devices_init(void) break; } - sdram_dev.size = s3c24x0_get_memory_size(); + arm_add_mem_device("ram0", CS6_BASE, s3c24x0_get_memory_size()); + + return 0; +} +mem_initcall(a9m2440_mem_init); + +static int a9m2440_devices_init(void) +{ + uint32_t reg; /* ----------- configure the access to the outer space ---------- */ reg = readl(BWSCON); @@ -158,9 +133,15 @@ static int a9m2440_devices_init(void) writel(reg, MISCCR); /* ----------- the devices the boot loader should work with -------- */ - register_device(&nand_dev); - register_device(&sdram_dev); - register_device(&network_dev); + add_generic_device("s3c24x0_nand", -1, NULL, S3C24X0_NAND_BASE, 0, + IORESOURCE_MEM, &nand_info); + /* + * cs8900 network controller onboard + * Connected to CS line 5 + A24 and interrupt line EINT9, + * data width is 16 bit + */ + add_generic_device("cs8900", -1, NULL, CS5_BASE + (1 << 24) + 0x300, 16, + IORESOURCE_MEM, NULL); #ifdef CONFIG_NAND /* ----------- add some vital partitions -------- */ @@ -170,8 +151,7 @@ static int a9m2440_devices_init(void) devfs_add_partition("nand0", 0x40000, 0x20000, PARTITION_FIXED, "env_raw"); dev_add_bb_dev("env_raw", "env0"); #endif - armlinux_add_dram(&sdram_dev); - armlinux_set_bootparams((void *)sdram_dev.map_base + 0x100); + armlinux_set_bootparams((void*)CS6_BASE + 0x100); armlinux_set_architecture(MACH_TYPE_A9M2440); return 0; @@ -186,16 +166,10 @@ void __bare_init nand_boot(void) } #endif -static struct device_d a9m2440_serial_device = { - .id = -1, - .name = "s3c24x0_serial", - .map_base = UART1_BASE, - .size = UART1_SIZE, -}; - static int a9m2440_console_init(void) { - register_device(&a9m2440_serial_device); + add_generic_device("s3c24x0_serial", -1, NULL, UART1_BASE, UART1_SIZE, + IORESOURCE_MEM, NULL); return 0; } diff --git a/arch/arm/boards/at91rm9200ek/init.c b/arch/arm/boards/at91rm9200ek/init.c index a449326d5c..cff7ede4d3 100644 --- a/arch/arm/boards/at91rm9200ek/init.c +++ b/arch/arm/boards/at91rm9200ek/init.c @@ -34,17 +34,19 @@ #include <mach/gpio.h> #include <mach/io.h> -static struct device_d cfi_dev = { - .id = 0, - .name = "cfi_flash", - .map_base = AT91_CHIPSELECT_0, -}; - static struct at91_ether_platform_data ether_pdata = { .flags = AT91SAM_ETHER_RMII, .phy_addr = 0, }; +static int at91rm9200ek_mem_init(void) +{ + at91_add_device_sdram(64 * 1024 * 1024); + + return 0; +} +mem_initcall(at91rm9200ek_mem_init); + static int at91rm9200ek_devices_init(void) { /* @@ -53,9 +55,9 @@ static int at91rm9200ek_devices_init(void) */ at91_set_gpio_output(AT91_PIN_PA23, 1); - at91_add_device_sdram(64 * 1024 * 1024); at91_add_device_eth(ðer_pdata); - register_device(&cfi_dev); + + add_cfi_flash_device(0, AT91_CHIPSELECT_0, 0, 0); #if defined(CONFIG_DRIVER_CFI) || defined(CONFIG_DRIVER_CFI_OLD) devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self"); diff --git a/arch/arm/boards/at91sam9260ek/init.c b/arch/arm/boards/at91sam9260ek/init.c index 966dd2fd30..861e8980a5 100644 --- a/arch/arm/boards/at91sam9260ek/init.c +++ b/arch/arm/boards/at91sam9260ek/init.c @@ -141,13 +141,20 @@ static void at91sam9260ek_phy_reset(void) AT91_RSTC_URSTEN); } +static int at91sam9260ek_mem_init(void) +{ + at91_add_device_sdram(64 * 1024 * 1024); + + return 0; +} +mem_initcall(at91sam9260ek_mem_init); + static int at91sam9260ek_devices_init(void) { ek_add_device_nand(); at91sam9260ek_phy_reset(); at91_add_device_eth(&macb_pdata); - at91_add_device_sdram(64 * 1024 * 1024); armlinux_set_bootparams((void *)(AT91_CHIPSELECT_1 + 0x100)); ek_set_board_type(); diff --git a/arch/arm/boards/at91sam9261ek/init.c b/arch/arm/boards/at91sam9261ek/init.c index b1388e183a..69111a0099 100644 --- a/arch/arm/boards/at91sam9261ek/init.c +++ b/arch/arm/boards/at91sam9261ek/init.c @@ -89,20 +89,9 @@ static void ek_add_device_nand(void) */ #if defined(CONFIG_DRIVER_NET_DM9000) static struct dm9000_platform_data dm9000_data = { - .iobase = AT91_CHIPSELECT_2, - .iodata = AT91_CHIPSELECT_2 + 4, - .buswidth = DM9000_WIDTH_16, .srom = 0, }; -static struct device_d dm9000_dev = { - .id = 0, - .name = "dm9000", - .map_base = AT91_CHIPSELECT_2, - .size = 8, - .platform_data = &dm9000_data, -}; - /* * SMC timings for the DM9000. * Note: These timings were calculated for MASTER_CLOCK = 100000000 according to the DM9000 timings. @@ -136,16 +125,24 @@ static void __init ek_add_device_dm9000(void) /* Configure Interrupt pin as input, no pull-up */ at91_set_gpio_input(AT91_PIN_PC11, 0); - register_device(&dm9000_dev); + add_dm9000_device(0, AT91_CHIPSELECT_2, AT91_CHIPSELECT_2 + 4, + IORESOURCE_MEM_16BIT, &dm9000_data); } #else static void __init ek_add_device_dm9000(void) {} #endif /* CONFIG_DRIVER_NET_DM9000 */ +static int at91sam9261ek_mem_init(void) +{ + at91_add_device_sdram(64 * 1024 * 1024); + + return 0; +} +mem_initcall(at91sam9261ek_mem_init); + static int at91sam9261ek_devices_init(void) { - at91_add_device_sdram(64 * 1024 * 1024); ek_add_device_nand(); ek_add_device_dm9000(); diff --git a/arch/arm/boards/at91sam9263ek/init.c b/arch/arm/boards/at91sam9263ek/init.c index 9a763b3cad..46f3a7ede2 100644 --- a/arch/arm/boards/at91sam9263ek/init.c +++ b/arch/arm/boards/at91sam9263ek/init.c @@ -87,13 +87,6 @@ static void ek_add_device_nand(void) at91_add_device_nand(&nand_pdata); } -static struct device_d cfi_dev = { - .id = -1, - .name = "cfi_flash", - .map_base = AT91_CHIPSELECT_0, - .size = 8 * 1024 * 1024, -}; - static struct at91_ether_platform_data macb_pdata = { .flags = AT91SAM_ETHER_RMII, .phy_addr = 0, @@ -114,6 +107,14 @@ static void ek_add_device_mci(void) static void ek_add_device_mci(void) {} #endif +static int at91sam9263ek_mem_init(void) +{ + at91_add_device_sdram(64 * 1024 * 1024); + + return 0; +} +mem_initcall(at91sam9263ek_mem_init); + static int at91sam9263ek_devices_init(void) { /* @@ -124,10 +125,9 @@ static int at91sam9263ek_devices_init(void) at91_set_gpio_output(AT91_PIN_PB27, 1); at91_set_gpio_value(AT91_PIN_PB27, 1); /* 1- enable, 0 - disable */ - at91_add_device_sdram(64 * 1024 * 1024); ek_add_device_nand(); at91_add_device_eth(&macb_pdata); - register_device(&cfi_dev); + add_cfi_flash_device(0, AT91_CHIPSELECT_0, 8 * 1024 * 1024, 0); ek_add_device_mci(); #if defined(CONFIG_DRIVER_CFI) || defined(CONFIG_DRIVER_CFI_OLD) diff --git a/arch/arm/boards/at91sam9m10g45ek/init.c b/arch/arm/boards/at91sam9m10g45ek/init.c index 8cdcb8d626..ba7c2fff48 100644 --- a/arch/arm/boards/at91sam9m10g45ek/init.c +++ b/arch/arm/boards/at91sam9m10g45ek/init.c @@ -126,10 +126,16 @@ static void ek_add_device_mci(void) static void ek_add_device_mci(void) {} #endif +static int at91sam9m10g45ek_mem_init(void) +{ + at91_add_device_sdram(128 * 1024 * 1024); + + return 0; +} +mem_initcall(at91sam9m10g45ek_mem_init); static int at91sam9m10g45ek_devices_init(void) { - at91_add_device_sdram(128 * 1024 * 1024); ek_add_device_nand(); at91_add_device_eth(&macb_pdata); ek_add_device_mci(); diff --git a/arch/arm/boards/chumby_falconwing/falconwing.c b/arch/arm/boards/chumby_falconwing/falconwing.c index 15ca11b7a4..1c66eb231a 100644 --- a/arch/arm/boards/chumby_falconwing/falconwing.c +++ b/arch/arm/boards/chumby_falconwing/falconwing.c @@ -34,30 +34,11 @@ #include <mach/fb.h> #include <mach/usb.h> -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = IMX_MEMORY_BASE, - .size = 64 * 1024 * 1024, - .platform_data = &ram_pdata, -}; - static struct mxs_mci_platform_data mci_pdata = { .caps = MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz, .voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */ }; -static struct device_d mci_dev = { - .name = "mxs_mci", - .map_base = IMX_SSP1_BASE, - .platform_data = &mci_pdata, -}; - #define GPIO_LCD_RESET 50 #define GPIO_LCD_BACKLIGHT 60 @@ -111,13 +92,6 @@ static struct imx_fb_platformdata fb_mode = { .fixed_screen_size = MAX_FB_SIZE, }; -static struct device_d ldcif_dev = { - .name = "stmfb", - .map_base = IMX_FB_BASE, - .size = 4096, - .platform_data = &fb_mode, -}; - static const uint32_t pad_setup[] = { /* may be not required as already done by the bootlet code */ #if 0 @@ -287,22 +261,13 @@ static const uint32_t pad_setup[] = { GPMI_RDY3_GPIO | GPIO_IN | PULLUP(1), }; -#ifdef CONFIG_MMU -static int falconwing_mmu_init(void) +static int falconwing_mem_init(void) { - mmu_init(); - - arm_create_section(0x40000000, 0x40000000, 64, PMD_SECT_DEF_CACHED); - arm_create_section(0x50000000, 0x40000000, 64, PMD_SECT_DEF_UNCACHED); - - setup_dma_coherent(0x10000000); - - mmu_enable(); + arm_add_mem_device("ram0", IMX_MEMORY_BASE, 64 * 1024 * 1024); return 0; } -postcore_initcall(falconwing_mmu_init); -#endif +mem_initcall(falconwing_mem_init); /** * Try to register an environment storage on the attached MCI card @@ -340,20 +305,6 @@ static int register_persistant_environment(void) return devfs_add_partition("disk0.1", 0, cdev->size, DEVFS_PARTITION_FIXED, "env0"); } -static struct ehci_platform_data chumby_usb_pdata = { - .flags = EHCI_HAS_TT, - .hccr_offset = 0x100, - .hcor_offset = 0x140, -}; - -static struct device_d usb_dev = { - .name = "ehci", - .id = -1, - .map_base = IMX_USB_BASE, - .size = 0x200, - .platform_data = &chumby_usb_pdata, -}; - #define GPIO_USB_HUB_RESET 29 #define GPIO_USB_HUB_POWER 26 @@ -366,7 +317,8 @@ static void falconwing_init_usb(void) gpio_direction_output(GPIO_USB_HUB_RESET, 1); imx_usb_phy_enable(); - register_device(&usb_dev); + + add_generic_usb_ehci_device(-1, IMX_USB_BASE, NULL); } static int falconwing_devices_init(void) @@ -377,17 +329,17 @@ static int falconwing_devices_init(void) for (i = 0; i < ARRAY_SIZE(pad_setup); i++) imx_gpio_mode(pad_setup[i]); - register_device(&sdram_dev); imx_set_ioclk(480000000); /* enable IOCLK to run at the PLL frequency */ /* run the SSP unit clock at 100,000 kHz */ imx_set_sspclk(0, 100000000, 1); - register_device(&mci_dev); - register_device(&ldcif_dev); + add_generic_device("mxs_mci", 0, NULL, IMX_SSP1_BASE, 0, + IORESOURCE_MEM, &mci_pdata); + add_generic_device("stmfb", 0, NULL, IMX_FB_BASE, 4096, + IORESOURCE_MEM, &fb_mode); falconwing_init_usb(); - armlinux_add_dram(&sdram_dev); - armlinux_set_bootparams((void*)(sdram_dev.map_base + 0x100)); + armlinux_set_bootparams((void *)IMX_MEMORY_BASE + 0x100); armlinux_set_architecture(MACH_TYPE_CHUMBY); rc = register_persistant_environment(); @@ -399,15 +351,12 @@ static int falconwing_devices_init(void) device_initcall(falconwing_devices_init); -static struct device_d falconwing_serial_device = { - .name = "stm_serial", - .map_base = IMX_DBGUART_BASE, - .size = 8192, -}; - static int falconwing_console_init(void) { - return register_device(&falconwing_serial_device); + add_generic_device("stm_serial", 0, NULL, IMX_DBGUART_BASE, 8192, + IORESOURCE_MEM, NULL); + + return 0; } console_initcall(falconwing_console_init); diff --git a/arch/arm/boards/edb93xx/edb93xx.c b/arch/arm/boards/edb93xx/edb93xx.c index 0f127b5c5e..3e4e0b04a0 100644 --- a/arch/arm/boards/edb93xx/edb93xx.c +++ b/arch/arm/boards/edb93xx/edb93xx.c @@ -34,83 +34,30 @@ #define DEVCFG_U1EN (1 << 18) -/* - * Up to 32MiB NOR type flash, connected to - * CS line 6, data width is 16 bit - */ -static struct device_d cfi_dev = { - .id = -1, - .name = "cfi_flash", - .map_base = 0x60000000, - .size = EDB93XX_CFI_FLASH_SIZE, -}; - -static struct memory_platform_data ram_dev_pdata0 = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram0_dev = { - .id = -1, - .name = "mem", - .map_base = CONFIG_EP93XX_SDRAM_BANK0_BASE, - .size = CONFIG_EP93XX_SDRAM_BANK0_SIZE, - .platform_data = &ram_dev_pdata0, -}; - +static int ep93xx_mem_init(void) +{ + arm_add_mem_device("ram0", CONFIG_EP93XX_SDRAM_BANK0_BASE, + CONFIG_EP93XX_SDRAM_BANK0_SIZE); #if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 2) -static struct memory_platform_data ram_dev_pdata1 = { - .name = "ram1", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram1_dev = { - .id = -1, - .name = "mem", - .map_base = CONFIG_EP93XX_SDRAM_BANK1_BASE, - .size = CONFIG_EP93XX_SDRAM_BANK1_SIZE, - .platform_data = &ram_dev_pdata1, -}; + arm_add_mem_device("ram1", CONFIG_EP93XX_SDRAM_BANK1_BASE, + CONFIG_EP93XX_SDRAM_BANK1_SIZE); #endif - #if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 3) -static struct memory_platform_data ram_dev_pdata2 = { - .name = "ram2", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram2_dev = { - .id = -1, - .name = "mem", - .map_base = CONFIG_EP93XX_SDRAM_BANK2_BASE, - .size = CONFIG_EP93XX_SDRAM_BANK2_SIZE, - .platform_data = &ram_dev_pdata2, -}; + arm_add_mem_device("ram2", CONFIG_EP93XX_SDRAM_BANK2_BASE, + CONFIG_EP93XX_SDRAM_BANK2_SIZE); #endif - #if (CONFIG_EP93XX_SDRAM_NUM_BANKS == 4) -static struct memory_platform_data ram_dev_pdata3 = { - .name = "ram3", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram3_dev = { - .id = -1, - .name = "mem", - .map_base = CONFIG_EP93XX_SDRAM_BANK3_BASE, - .size = CONFIG_EP93XX_SDRAM_BANK3_SIZE, - .platform_data = &ram_dev_pdata3, -}; + arm_add_mem_device("ram3", CONFIG_EP93XX_SDRAM_BANK3_BASE, + CONFIG_EP93XX_SDRAM_BANK2_SIZE); #endif -static struct device_d eth_dev = { - .id = -1, - .name = "ep93xx_eth", -}; + return 0; +} +mem_initcall(ep93xx_mem_init); static int ep93xx_devices_init(void) { - register_device(&cfi_dev); + add_cfi_flash_device(-1, 0x60000000, EDB93XX_CFI_FLASH_SIZE, 0); /* * Create partitions that should be @@ -121,29 +68,11 @@ static int ep93xx_devices_init(void) protect_file("/dev/env0", 1); - register_device(&sdram0_dev); -#if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 2) - register_device(&sdram1_dev); -#endif -#if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 3) - register_device(&sdram2_dev); -#endif -#if (CONFIG_EP93XX_SDRAM_NUM_BANKS == 4) - register_device(&sdram3_dev); -#endif - - armlinux_add_dram(&sdram0_dev); -#if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 2) - armlinux_add_dram(&sdram1_dev); -#endif -#if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 3) - armlinux_add_dram(&sdram2_dev); -#endif -#if (CONFIG_EP93XX_SDRAM_NUM_BANKS == 4) - armlinux_add_dram(&sdram3_dev); -#endif - - register_device(ð_dev); + /* + * Up to 32MiB NOR type flash, connected to + * CS line 6, data width is 16 bit + */ + add_generic_device("ep93xx_eth", -1, NULL, 0, 0, IORESOURCE_MEM, NULL); armlinux_set_bootparams((void *)CONFIG_EP93XX_SDRAM_BANK0_BASE + 0x100); @@ -154,13 +83,6 @@ static int ep93xx_devices_init(void) device_initcall(ep93xx_devices_init); -static struct device_d edb93xx_serial_device = { - .id = -1, - .name = "pl010_serial", - .map_base = UART1_BASE, - .size = 4096, -}; - static int edb93xx_console_init(void) { struct syscon_regs *syscon = (struct syscon_regs *)SYSCON_BASE; @@ -179,7 +101,8 @@ static int edb93xx_console_init(void) writel(0xAA, &syscon->sysswlock); writel(value, &syscon->devicecfg); - register_device(&edb93xx_serial_device); + add_generic_device("pl010_serial", -1, NULL, UART1_BASE, 4096, + IORESOURCE_MEM, NULL); return 0; } diff --git a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c index f2b2523a4b..1c54202dfa 100644 --- a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +++ b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c @@ -37,6 +37,7 @@ #include <generated/mach-types.h> #include <mach/imx-nand.h> #include <mach/imxfb.h> +#include <mach/iim.h> #include <fec.h> #include <nand.h> #include <mach/imx-flash-header.h> @@ -90,19 +91,6 @@ static struct fec_platform_data fec_info = { .phy_addr = 1, }; -static struct memory_platform_data sdram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram0_dev = { - .id = -1, - .name = "mem", - .map_base = IMX_SDRAM_CS0, - .size = 64 * 1024 * 1024, - .platform_data = &sdram_pdata, -}; - struct imx_nand_platform_data nand_info = { .width = 1, .hw_ecc = 1, @@ -161,12 +149,6 @@ static void imx25_usb_init(void) writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8); } -static struct device_d usbh2_dev = { - .id = -1, - .name = "ehci", - .map_base = IMX_OTG_BASE + 0x400, - .size = 0x200, -}; #endif static struct fsl_usb2_platform_data usb_pdata = { @@ -174,30 +156,13 @@ static struct fsl_usb2_platform_data usb_pdata = { .phy_mode = FSL_USB2_PHY_UTMI, }; -static struct device_d usbotg_dev = { - .name = "fsl-udc", - .map_base = IMX_OTG_BASE, - .size = 0x200, - .platform_data = &usb_pdata, -}; - -#ifdef CONFIG_MMU -static void eukrea_cpuimx25_mmu_init(void) +static int eukrea_cpuimx25_mem_init(void) { - mmu_init(); - - arm_create_section(0x80000000, 0x80000000, 128, PMD_SECT_DEF_CACHED); - arm_create_section(0x90000000, 0x80000000, 128, PMD_SECT_DEF_UNCACHED); + arm_add_mem_device("ram0", IMX_SDRAM_CS0, 64 * 1024 * 1024); - setup_dma_coherent(0x10000000); - - mmu_enable(); -} -#else -static void eukrea_cpuimx25_mmu_init(void) -{ + return 0; } -#endif +mem_initcall(eukrea_cpuimx25_mem_init); static struct pad_desc eukrea_cpuimx25_pads[] = { MX25_PAD_FEC_MDC__FEC_MDC, @@ -255,13 +220,12 @@ static struct pad_desc eukrea_cpuimx25_pads[] = { static int eukrea_cpuimx25_devices_init(void) { - eukrea_cpuimx25_mmu_init(); - mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads, ARRAY_SIZE(eukrea_cpuimx25_pads)); led_gpio_register(&led0); + imx25_iim_register_fec_ethaddr(); imx25_add_fec(&fec_info); nand_info.width = 1; @@ -275,8 +239,6 @@ static int eukrea_cpuimx25_devices_init(void) PARTITION_FIXED, "env_raw"); dev_add_bb_dev("env_raw", "env0"); - register_device(&sdram0_dev); - /* enable LCD */ gpio_direction_output(26, 1); gpio_set_value(26, 1); @@ -291,11 +253,11 @@ static int eukrea_cpuimx25_devices_init(void) #ifdef CONFIG_USB imx25_usb_init(); - register_device(&usbh2_dev); + add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL); #endif - register_device(&usbotg_dev); + add_generic_device("fsl-udc", -1, NULL, IMX_OTG_BASE, 0x200, + IORESOURCE_MEM, &usb_pdata); - armlinux_add_dram(&sdram0_dev); armlinux_set_bootparams((void *)0x80000100); armlinux_set_architecture(MACH_TYPE_EUKREA_CPUIMX25); diff --git a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c index a7e99513df..a5aadac0d9 100644 --- a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c +++ b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c @@ -48,40 +48,12 @@ #include <mach/iomux-mx27.h> #include <mach/devices-imx27.h> -static struct device_d cfi_dev = { - .id = -1, - .name = "cfi_flash", - .map_base = 0xC0000000, - .size = 32 * 1024 * 1024, -}; -#ifdef CONFIG_EUKREA_CPUIMX27_NOR_64MB -static struct device_d cfi_dev1 = { - .id = -1, - .name = "cfi_flash", - .map_base = 0xC2000000, - .size = 32 * 1024 * 1024, -}; -#endif - -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - #if defined CONFIG_EUKREA_CPUIMX27_SDRAM_256MB #define SDRAM0 256 #elif defined CONFIG_EUKREA_CPUIMX27_SDRAM_128MB #define SDRAM0 128 #endif -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = 0xa0000000, - .size = SDRAM0 * 1024 * 1024, - .platform_data = &ram_pdata, -}; - static struct fec_platform_data fec_info = { .xcv_type = MII100, .phy_addr = 1, @@ -94,28 +66,9 @@ struct imx_nand_platform_data nand_info = { }; #ifdef CONFIG_DRIVER_SERIAL_NS16550 -unsigned int quad_uart_read(unsigned long base, unsigned char reg_idx) -{ - unsigned int reg_addr = (unsigned int)base; - reg_addr += reg_idx << 1; - return 0xff & readw(reg_addr); -} -EXPORT_SYMBOL(quad_uart_read); - -void quad_uart_write(unsigned int val, unsigned long base, - unsigned char reg_idx) -{ - unsigned int reg_addr = (unsigned int)base; - reg_addr += reg_idx << 1; - writew(0xff & val, reg_addr); -} -EXPORT_SYMBOL(quad_uart_write); - static struct NS16550_plat quad_uart_serial_plat = { .clock = 14745600, - .f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR, - .reg_read = quad_uart_read, - .reg_write = quad_uart_write, + .shift = 1, }; #ifdef CONFIG_EUKREA_CPUIMX27_QUART1 @@ -127,14 +80,6 @@ static struct NS16550_plat quad_uart_serial_plat = { #elif defined CONFIG_EUKREA_CPUIMX27_QUART4 #define QUART_OFFSET 0x1000000 #endif - -static struct device_d quad_uart_serial_device = { - .id = -1, - .name = "serial_ns16550", - .map_base = IMX_CS3_BASE + QUART_OFFSET, - .size = 0xF, - .platform_data = (void *)&quad_uart_serial_plat, -}; #endif static struct i2c_board_info i2c_devices[] = { @@ -143,23 +88,13 @@ static struct i2c_board_info i2c_devices[] = { }, }; -#ifdef CONFIG_MMU -static void eukrea_cpuimx27_mmu_init(void) +static int eukrea_cpuimx27_mem_init(void) { - mmu_init(); - - arm_create_section(0xa0000000, 0xa0000000, 128, PMD_SECT_DEF_CACHED); - arm_create_section(0xb0000000, 0xa0000000, 128, PMD_SECT_DEF_UNCACHED); - - setup_dma_coherent(0x10000000); + arm_add_mem_device("ram0", 0xa0000000, SDRAM0 * 1024 * 1024); - mmu_enable(); -} -#else -static void eukrea_cpuimx27_mmu_init(void) -{ + return 0; } -#endif +mem_initcall(eukrea_cpuimx27_mem_init); #ifdef CONFIG_DRIVER_VIDEO_IMX static struct imx_fb_videomode imxfb_mode = { @@ -185,14 +120,6 @@ static struct imx_fb_platform_data eukrea_cpuimx27_fb_data = { .lscr1 = 0x00120300, .dmacr = 0x00020010, }; - -static struct device_d imxfb_dev = { - .id = -1, - .name = "imxfb", - .map_base = 0x10021000, - .size = 0x1000, - .platform_data = &eukrea_cpuimx27_fb_data, -}; #endif static int eukrea_cpuimx27_devices_init(void) @@ -255,8 +182,6 @@ static int eukrea_cpuimx27_devices_init(void) #endif }; - eukrea_cpuimx27_mmu_init(); - /* configure 16 bit nor flash on cs0 */ CS0U = 0x00008F03; CS0L = 0xA0330D01; @@ -266,12 +191,11 @@ static int eukrea_cpuimx27_devices_init(void) for (i = 0; i < ARRAY_SIZE(mode); i++) imx_gpio_mode(mode[i]); - register_device(&cfi_dev); + add_cfi_flash_device(-1, 0xC0000000, 32 * 1024 * 1024, 0); #ifdef CONFIG_EUKREA_CPUIMX27_NOR_64MB - register_device(&cfi_dev1); + add_cfi_flash_device(-1, 0xC2000000, 32 * 1024 * 1024, 0); #endif imx27_add_nand(&nand_info); - register_device(&sdram_dev); PCCR0 |= PCCR0_I2C1_EN; i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices)); @@ -285,14 +209,13 @@ static int eukrea_cpuimx27_devices_init(void) printf("Using environment in %s Flash\n", envdev); #ifdef CONFIG_DRIVER_VIDEO_IMX - register_device(&imxfb_dev); + imx_add_fb((void *)0x10021000, &eukrea_cpuimx27_fb_data); gpio_direction_output(GPIO_PORTE | 5, 0); gpio_set_value(GPIO_PORTE | 5, 1); gpio_direction_output(GPIO_PORTA | 25, 0); gpio_set_value(GPIO_PORTA | 25, 1); #endif - armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0xa0000100); armlinux_set_architecture(MACH_TYPE_CPUIMX27); @@ -301,19 +224,10 @@ static int eukrea_cpuimx27_devices_init(void) device_initcall(eukrea_cpuimx27_devices_init); -#ifdef CONFIG_DRIVER_SERIAL_IMX -static struct device_d eukrea_cpuimx27_serial_device = { - .id = -1, - .name = "imx_serial", - .map_base = IMX_UART1_BASE, - .size = 4096, -}; -#endif - static int eukrea_cpuimx27_console_init(void) { #ifdef CONFIG_DRIVER_SERIAL_IMX - register_device(&eukrea_cpuimx27_serial_device); + imx_add_uart((void *)IMX_UART1_BASE, -1); #endif /* configure 8 bit UART on cs3 */ FMCR &= ~0x2; @@ -321,7 +235,8 @@ static int eukrea_cpuimx27_console_init(void) CS3L = 0x0D1D0D01; CS3A = 0x00D20000; #ifdef CONFIG_DRIVER_SERIAL_NS16550 - register_device(&quad_uart_serial_device); + add_ns16550_device(-1, IMX_CS3_BASE + QUART_OFFSET, 0xf, + IORESOURCE_MEM_16BIT, &quad_uart_serial_plat); #endif return 0; } diff --git a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c index f0eb088617..426445f59d 100644 --- a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c +++ b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c @@ -61,19 +61,6 @@ static struct fec_platform_data fec_info = { .phy_addr = 0x1F, }; -static struct memory_platform_data sdram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = IMX_SDRAM_CS0, - .size = 128 * 1024 * 1024, - .platform_data = &sdram_pdata, -}; - struct imx_nand_platform_data nand_info = { .width = 1, .hw_ecc = 1, @@ -130,46 +117,30 @@ static void imx35_usb_init(void) tmp = readl(IMX_OTG_BASE + 0x5a8); writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8); } - -static struct device_d usbh2_dev = { - .id = -1, - .name = "ehci", - .map_base = IMX_OTG_BASE + 0x400, - .size = 0x200, -}; #endif +#ifdef CONFIG_USB_GADGET static struct fsl_usb2_platform_data usb_pdata = { .operating_mode = FSL_USB2_DR_DEVICE, .phy_mode = FSL_USB2_PHY_UTMI, }; +#endif -static struct device_d usbotg_dev = { - .name = "fsl-udc", - .map_base = IMX_OTG_BASE, - .size = 0x200, - .platform_data = &usb_pdata, -}; - -#ifdef CONFIG_MMU -static int eukrea_cpuimx35_mmu_init(void) +static int eukrea_cpuimx35_mem_init(void) { - mmu_init(); + arm_add_mem_device("ram0", IMX_SDRAM_CS0, 128 * 1024 * 1024); - arm_create_section(0x80000000, 0x80000000, 128, PMD_SECT_DEF_CACHED); - arm_create_section(0x90000000, 0x80000000, 128, PMD_SECT_DEF_UNCACHED); - - setup_dma_coherent(0x10000000); - - mmu_enable(); + return 0; +} +mem_initcall(eukrea_cpuimx35_mem_init); -#ifdef CONFIG_CACHE_L2X0 +static int eukrea_cpuimx35_mmu_init(void) +{ l2x0_init((void __iomem *)0x30000000, 0x00030024, 0x00000000); -#endif + return 0; } -postcore_initcall(eukrea_cpuimx35_mmu_init); -#endif +postmmu_initcall(eukrea_cpuimx35_mmu_init); static int eukrea_cpuimx35_devices_init(void) { @@ -181,8 +152,6 @@ static int eukrea_cpuimx35_devices_init(void) dev_add_bb_dev("env_raw", "env0"); imx35_add_fec(&fec_info); - - register_device(&sdram_dev); imx35_add_fb(&ipu_fb_data); imx35_add_i2c0(NULL); @@ -190,15 +159,15 @@ static int eukrea_cpuimx35_devices_init(void) #ifdef CONFIG_USB imx35_usb_init(); - register_device(&usbh2_dev); + add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL); #endif #ifdef CONFIG_USB_GADGET /* Workaround ENGcm09152 */ tmp = readl(IMX_OTG_BASE + 0x608); writel(tmp | (1 << 23), IMX_OTG_BASE + 0x608); - register_device(&usbotg_dev); + add_generic_device("fsl-udc", -1, NULL, IMX_OTG_BASE, 0x200, + IORESOURCE_MEM, &usb_pdata); #endif - armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0x80000100); armlinux_set_architecture(MACH_TYPE_EUKREA_CPUIMX35); diff --git a/arch/arm/boards/eukrea_cpuimx51/eukrea_cpuimx51.c b/arch/arm/boards/eukrea_cpuimx51/eukrea_cpuimx51.c index 0847bb1da1..727db29241 100644 --- a/arch/arm/boards/eukrea_cpuimx51/eukrea_cpuimx51.c +++ b/arch/arm/boards/eukrea_cpuimx51/eukrea_cpuimx51.c @@ -42,19 +42,6 @@ #include <mach/iomux-mx51.h> #include <mach/devices-imx51.h> -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = 0x90000000, - .size = 256 * 1024 * 1024, - .platform_data = &ram_pdata, -}; - static struct fec_platform_data fec_info = { .xcv_type = MII100, }; @@ -106,35 +93,16 @@ static struct pad_desc eukrea_cpuimx51_pads[] = { #define GPIO_LAN8700_RESET (1 * 32 + 31) #define GPIO_LCD_BL (2 * 32 + 4) -#ifdef CONFIG_MMU -static void eukrea_cpuimx51_mmu_init(void) +static int eukrea_cpuimx51_mem_init(void) { - mmu_init(); + arm_add_mem_device("ram0", 0x90000000, 256 * 1024 * 1024); - arm_create_section(0x90000000, 0x90000000, 256, PMD_SECT_DEF_CACHED); - arm_create_section(0xa0000000, 0x90000000, 256, PMD_SECT_DEF_UNCACHED); - - setup_dma_coherent(0x10000000); - -#if TEXT_BASE & (0x100000 - 1) -#warning cannot create vector section. Adjust TEXT_BASE to a 1M boundary -#else - arm_create_section(0x0, TEXT_BASE, 1, PMD_SECT_DEF_UNCACHED); -#endif - - mmu_enable(); -} -#else -static void eukrea_cpuimx51_mmu_init(void) -{ + return 0; } -#endif +mem_initcall(eukrea_cpuimx51_mem_init); static int eukrea_cpuimx51_devices_init(void) { - eukrea_cpuimx51_mmu_init(); - - register_device(&sdram_dev); imx51_add_fec(&fec_info); #ifdef CONFIG_MCI_IMX_ESDHC imx51_add_mmc0(NULL); @@ -150,7 +118,6 @@ static int eukrea_cpuimx51_devices_init(void) gpio_set_value(GPIO_LAN8700_RESET, 1); gpio_direction_output(GPIO_LCD_BL, 0); - armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0x90000100); armlinux_set_architecture(MACH_TYPE_EUKREA_CPUIMX51SD); diff --git a/arch/arm/boards/eukrea_cpuimx51/lowlevel_init.S b/arch/arm/boards/eukrea_cpuimx51/lowlevel_init.S index 793104c7c2..0b3726f6d5 100644 --- a/arch/arm/boards/eukrea_cpuimx51/lowlevel_init.S +++ b/arch/arm/boards/eukrea_cpuimx51/lowlevel_init.S @@ -19,29 +19,29 @@ #include <config.h> #include <mach/imx-regs.h> -#include <mach/clock-imx51.h> +#include <mach/clock-imx51_53.h> #define ROM_SI_REV_OFFSET 0x48 .macro setup_pll pll, freq ldr r2, =\pll ldr r1, =0x00001232 - str r1, [r2, #MX51_PLL_DP_CTL] /* Set DPLL ON (set UPEN bit): BRMO=1 */ + str r1, [r2, #MX5_PLL_DP_CTL] /* Set DPLL ON (set UPEN bit): BRMO=1 */ mov r1, #0x2 - str r1, [r2, #MX51_PLL_DP_CONFIG] /* Enable auto-restart AREN bit */ + str r1, [r2, #MX5_PLL_DP_CONFIG] /* Enable auto-restart AREN bit */ - str r3, [r2, #MX51_PLL_DP_OP] - str r3, [r2, #MX51_PLL_DP_HFS_OP] + str r3, [r2, #MX5_PLL_DP_OP] + str r3, [r2, #MX5_PLL_DP_HFS_OP] - str r4, [r2, #MX51_PLL_DP_MFD] - str r4, [r2, #MX51_PLL_DP_HFS_MFD] + str r4, [r2, #MX5_PLL_DP_MFD] + str r4, [r2, #MX5_PLL_DP_HFS_MFD] - str r5, [r2, #MX51_PLL_DP_MFN] - str r5, [r2, #MX51_PLL_DP_HFS_MFN] + str r5, [r2, #MX5_PLL_DP_MFN] + str r5, [r2, #MX5_PLL_DP_HFS_MFN] ldr r1, =0x00001232 - str r1, [r2, #MX51_PLL_DP_CTL] -1: ldr r1, [r2, #MX51_PLL_DP_CTL] + str r1, [r2, #MX5_PLL_DP_CTL] +1: ldr r1, [r2, #MX5_PLL_DP_CTL] ands r1, r1, #0x1 beq 1b .endm @@ -80,67 +80,67 @@ board_init_lowlevel: /* Gate of clocks to the peripherals first */ ldr r1, =0x3FFFFFFF - str r1, [r0, #MX51_CCM_CCGR0] + str r1, [r0, #MX5_CCM_CCGR0] ldr r1, =0x0 - str r1, [r0, #MX51_CCM_CCGR1] - str r1, [r0, #MX51_CCM_CCGR2] - str r1, [r0, #MX51_CCM_CCGR3] + str r1, [r0, #MX5_CCM_CCGR1] + str r1, [r0, #MX5_CCM_CCGR2] + str r1, [r0, #MX5_CCM_CCGR3] ldr r1, =0x00030000 - str r1, [r0, #MX51_CCM_CCGR4] + str r1, [r0, #MX5_CCM_CCGR4] ldr r1, =0x00FFF030 - str r1, [r0, #MX51_CCM_CCGR5] + str r1, [r0, #MX5_CCM_CCGR5] ldr r1, =0x00000300 - str r1, [r0, #MX51_CCM_CCGR6] + str r1, [r0, #MX5_CCM_CCGR6] /* Disable IPU and HSC dividers */ mov r1, #0x60000 - str r1, [r0, #MX51_CCM_CCDR] + str r1, [r0, #MX5_CCM_CCDR] #ifdef IMX51_TO_2 /* Make sure to switch the DDR away from PLL 1 */ ldr r1, =0x19239145 - str r1, [r0, #MX51_CCM_CBCDR] + str r1, [r0, #MX5_CCM_CBCDR] /* make sure divider effective */ -1: ldr r1, [r0, #MX51_CCM_CDHIPR] +1: ldr r1, [r0, #MX5_CCM_CDHIPR] cmp r1, #0x0 bne 1b #endif /* Switch ARM to step clock */ mov r1, #0x4 - str r1, [r0, #MX51_CCM_CCSR] + str r1, [r0, #MX5_CCM_CCSR] - mov r3, #MX51_PLL_DP_OP_800 - mov r4, #MX51_PLL_DP_MFD_800 - mov r5, #MX51_PLL_DP_MFN_800 + mov r3, #MX5_PLL_DP_OP_800 + mov r4, #MX5_PLL_DP_MFD_800 + mov r5, #MX5_PLL_DP_MFN_800 setup_pll MX51_PLL1_BASE_ADDR - mov r3, #MX51_PLL_DP_OP_665 - mov r4, #MX51_PLL_DP_MFD_665 - mov r5, #MX51_PLL_DP_MFN_665 + mov r3, #MX5_PLL_DP_OP_665 + mov r4, #MX5_PLL_DP_MFD_665 + mov r5, #MX5_PLL_DP_MFN_665 setup_pll MX51_PLL3_BASE_ADDR /* Switch peripheral to PLL 3 */ ldr r1, =0x000010C0 - str r1, [r0, #MX51_CCM_CBCMR] + str r1, [r0, #MX5_CCM_CBCMR] ldr r1, =0x13239145 - str r1, [r0, #MX51_CCM_CBCDR] + str r1, [r0, #MX5_CCM_CBCDR] - mov r3, #MX51_PLL_DP_OP_665 - mov r4, #MX51_PLL_DP_MFD_665 - mov r5, #MX51_PLL_DP_MFN_665 + mov r3, #MX5_PLL_DP_OP_665 + mov r4, #MX5_PLL_DP_MFD_665 + mov r5, #MX5_PLL_DP_MFN_665 setup_pll MX51_PLL2_BASE_ADDR /* Switch peripheral to PLL2 */ ldr r1, =0x19239145 - str r1, [r0, #MX51_CCM_CBCDR] + str r1, [r0, #MX5_CCM_CBCDR] ldr r1, =0x000020C0 - str r1, [r0, #MX51_CCM_CBCMR] + str r1, [r0, #MX5_CCM_CBCMR] - mov r3, #MX51_PLL_DP_OP_216 - mov r4, #MX51_PLL_DP_MFD_216 - mov r5, #MX51_PLL_DP_MFN_216 + mov r3, #MX5_PLL_DP_OP_216 + mov r4, #MX5_PLL_DP_MFD_216 + mov r5, #MX5_PLL_DP_MFN_216 setup_pll MX51_PLL3_BASE_ADDR /* Set the platform clock dividers */ @@ -154,52 +154,52 @@ board_init_lowlevel: cmp r3, #0x10 movls r1, #0x1 movhi r1, #0 - str r1, [r0, #MX51_CCM_CACRR] + str r1, [r0, #MX5_CCM_CACRR] /* Switch ARM back to PLL 1 */ mov r1, #0 - str r1, [r0, #MX51_CCM_CCSR] + str r1, [r0, #MX5_CCM_CCSR] /* setup the rest */ /* Use lp_apm (24MHz) source for perclk */ #ifdef IMX51_TO_2 ldr r1, =0x000020C2 - str r1, [r0, #MX51_CCM_CBCMR] + str r1, [r0, #MX5_CCM_CBCMR] // ddr clock from PLL 1, all perclk dividers are 1 since using 24MHz ldr r1, =0x59239100 - str r1, [r0, #MX51_CCM_CBCDR] + str r1, [r0, #MX5_CCM_CBCDR] #else ldr r1, =0x0000E3C2 - str r1, [r0, #MX51_CCM_CBCMR] + str r1, [r0, #MX5_CCM_CBCMR] // emi=ahb, all perclk dividers are 1 since using 24MHz // DDR divider=6 to have 665/6=110MHz ldr r1, =0x013B9100 - str r1, [r0, #MX51_CCM_CBCDR] + str r1, [r0, #MX5_CCM_CBCDR] #endif /* Restore the default values in the Gate registers */ ldr r1, =0xFFFFFFFF - str r1, [r0, #MX51_CCM_CCGR0] - str r1, [r0, #MX51_CCM_CCGR1] - str r1, [r0, #MX51_CCM_CCGR2] - str r1, [r0, #MX51_CCM_CCGR3] - str r1, [r0, #MX51_CCM_CCGR4] - str r1, [r0, #MX51_CCM_CCGR5] - str r1, [r0, #MX51_CCM_CCGR6] + str r1, [r0, #MX5_CCM_CCGR0] + str r1, [r0, #MX5_CCM_CCGR1] + str r1, [r0, #MX5_CCM_CCGR2] + str r1, [r0, #MX5_CCM_CCGR3] + str r1, [r0, #MX5_CCM_CCGR4] + str r1, [r0, #MX5_CCM_CCGR5] + str r1, [r0, #MX5_CCM_CCGR6] /* Use PLL 2 for UART's, get 66.5MHz from it */ ldr r1, =0xA5A2A020 - str r1, [r0, #MX51_CCM_CSCMR1] + str r1, [r0, #MX5_CCM_CSCMR1] ldr r1, =0x00C30321 - str r1, [r0, #MX51_CCM_CSCDR1] + str r1, [r0, #MX5_CCM_CSCDR1] /* make sure divider effective */ - 1: ldr r1, [r0, #MX51_CCM_CDHIPR] + 1: ldr r1, [r0, #MX5_CCM_CDHIPR] cmp r1, #0x0 bne 1b mov r1, #0x0 - str r1, [r0, #MX51_CCM_CCDR] + str r1, [r0, #MX5_CCM_CCDR] writel(0x1, 0x73fa8074) ldr r0, =0x73f88000 diff --git a/arch/arm/boards/freescale-mx23-evk/mx23-evk.c b/arch/arm/boards/freescale-mx23-evk/mx23-evk.c index 1ce72be8d7..47f676919a 100644 --- a/arch/arm/boards/freescale-mx23-evk/mx23-evk.c +++ b/arch/arm/boards/freescale-mx23-evk/mx23-evk.c @@ -25,24 +25,17 @@ #include <generated/mach-types.h> #include <mach/imx-regs.h> -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .name = "mem", - .map_base = IMX_MEMORY_BASE, - .size = 32 * 1024 * 1024, - .platform_data = &ram_pdata, -}; +static int mx23_evk_mem_init(void) +{ + arm_add_mem_device("ram0", IMX_MEMORY_BASE, 32 * 1024 * 1024); + + return 0; +} +mem_initcall(mx23_evk_mem_init); static int mx23_evk_devices_init(void) { - register_device(&sdram_dev); - - armlinux_add_dram(&sdram_dev); - armlinux_set_bootparams((void*)(sdram_dev.map_base + 0x100)); + armlinux_set_bootparams((void*)IMX_MEMORY_BASE + 0x100); armlinux_set_architecture(MACH_TYPE_MX23EVK); return 0; @@ -50,15 +43,12 @@ static int mx23_evk_devices_init(void) device_initcall(mx23_evk_devices_init); -static struct device_d mx23_evk_serial_device = { - .name = "stm_serial", - .map_base = IMX_DBGUART_BASE, - .size = 8192, -}; - static int mx23_evk_console_init(void) { - return register_device(&mx23_evk_serial_device); + add_generic_device("stm_serial", 0, NULL, IMX_DBGUART_BASE, 8192, + IORESOURCE_MEM, NULL); + + return 0; } console_initcall(mx23_evk_console_init); diff --git a/arch/arm/boards/freescale-mx25-3-stack/3stack.c b/arch/arm/boards/freescale-mx25-3-stack/3stack.c index e3607f532a..979115d927 100644 --- a/arch/arm/boards/freescale-mx25-3-stack/3stack.c +++ b/arch/arm/boards/freescale-mx25-3-stack/3stack.c @@ -37,6 +37,7 @@ #include <mach/imx-flash-header.h> #include <mach/iomux-mx25.h> #include <mach/generic.h> +#include <mach/iim.h> #include <linux/err.h> #include <i2c/i2c.h> #include <mfd/mc34704.h> @@ -113,38 +114,6 @@ static struct fec_platform_data fec_info = { .phy_addr = 1, }; -static struct memory_platform_data sdram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram0_dev = { - .id = -1, - .name = "mem", - .map_base = IMX_SDRAM_CS0, -#if defined CONFIG_FREESCALE_MX25_3STACK_SDRAM_64MB_DDR2 - .size = 64 * 1024 * 1024, -#elif defined CONFIG_FREESCALE_MX25_3STACK_SDRAM_128MB_MDDR - .size = 128 * 1024 * 1024, -#else -#error "Unsupported SDRAM type" -#endif - .platform_data = &sdram_pdata, -}; - -static struct memory_platform_data sram_pdata = { - .name = "sram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sram0_dev = { - .id = -1, - .name = "mem", - .map_base = 0x78000000, - .size = 128 * 1024, - .platform_data = &sram_pdata, -}; - struct imx_nand_platform_data nand_info = { .width = 1, .hw_ecc = 1, @@ -169,13 +138,6 @@ static void imx25_usb_init(void) tmp = readl(IMX_OTG_BASE + 0x5a8); writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8); } - -static struct device_d usbh2_dev = { - .id = -1, - .name = "ehci", - .map_base = IMX_OTG_BASE + 0x400, - .size = 0x200, -}; #endif static struct i2c_board_info i2c_devices[] = { @@ -230,6 +192,22 @@ static int imx25_3ds_fec_init(void) } late_initcall(imx25_3ds_fec_init); +static int imx25_mem_init(void) +{ +#if defined CONFIG_FREESCALE_MX25_3STACK_SDRAM_64MB_DDR2 +#define SDRAM_SIZE 64 * 1024 * 1024 +#elif defined CONFIG_FREESCALE_MX25_3STACK_SDRAM_128MB_MDDR +#define SDRAM_SIZE 128 * 1024 * 1024 +#else +#error "Unsupported SDRAM type" +#endif + arm_add_mem_device("ram0", IMX_SDRAM_CS0, SDRAM_SIZE); + add_mem_device("sram0", 0x78000000, 128 * 1024, IORESOURCE_MEM_WRITEABLE); + + return 0; +} +mem_initcall(imx25_mem_init); + static int imx25_devices_init(void) { #ifdef CONFIG_USB @@ -237,9 +215,10 @@ static int imx25_devices_init(void) * the CPLD has to be initialized. */ imx25_usb_init(); - register_device(&usbh2_dev); + add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL); #endif + imx25_iim_register_fec_ethaddr(); imx25_add_fec(&fec_info); if (readl(IMX_CCM_BASE + CCM_RCSR) & (1 << 14)) @@ -253,13 +232,9 @@ static int imx25_devices_init(void) devfs_add_partition("nand0", 0x40000, 0x20000, PARTITION_FIXED, "env_raw"); dev_add_bb_dev("env_raw", "env0"); - register_device(&sdram0_dev); - register_device(&sram0_dev); - i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices)); imx25_add_i2c0(NULL); - armlinux_add_dram(&sdram0_dev); armlinux_set_bootparams((void *)0x80000100); armlinux_set_architecture(MACH_TYPE_MX25_3DS); armlinux_set_serial(imx_uid()); diff --git a/arch/arm/boards/freescale-mx35-3-stack/3stack.c b/arch/arm/boards/freescale-mx35-3-stack/3stack.c index 03960a4cbf..ab702650ab 100644 --- a/arch/arm/boards/freescale-mx35-3-stack/3stack.c +++ b/arch/arm/boards/freescale-mx35-3-stack/3stack.c @@ -59,43 +59,16 @@ #define MX35PDK_BOARD_REV_1 0 #define MX35PDK_BOARD_REV_2 1 -static struct device_d cfi_dev = { - .id = -1, - .name = "cfi_flash", - .map_base = IMX_CS0_BASE, - .size = 64 * 1024 * 1024, -}; - static struct fec_platform_data fec_info = { .xcv_type = MII100, .phy_addr = 0x1F, }; -static struct memory_platform_data sdram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = IMX_SDRAM_CS0, - .size = 128 * 1024 * 1024, - .platform_data = &sdram_pdata, -}; - struct imx_nand_platform_data nand_info = { .hw_ecc = 1, .flash_bbt = 1, }; -static struct device_d smc911x_dev = { - .id = -1, - .name = "smc911x", - .map_base = IMX_CS5_BASE, - .size = IMX_CS5_RANGE, -}; - static struct i2c_board_info i2c_devices[] = { { I2C_BOARD_INFO("mc13892-i2c", 0x08), @@ -104,12 +77,6 @@ static struct i2c_board_info i2c_devices[] = { }, }; -static struct device_d i2c_dev = { - .id = -1, - .name = "i2c-imx", - .map_base = IMX_I2C1_BASE, -}; - /* * Generic display, shipped with the PDK */ @@ -161,6 +128,13 @@ static void set_board_rev(int rev) imx35_3ds_system_rev = (imx35_3ds_system_rev & ~(0xF << 8)) | (rev & 0xF) << 8; } +static int f3s_mem_init(void) +{ + arm_add_mem_device("ram0", IMX_SDRAM_CS0, 124 * 1024 * 1024); + + return 0; +} +mem_initcall(f3s_mem_init); static int f3s_devices_init(void) { @@ -182,7 +156,7 @@ static int f3s_devices_init(void) * This platform supports NOR and NAND */ imx35_add_nand(&nand_info); - register_device(&cfi_dev); + add_cfi_flash_device(-1, IMX_CS0_BASE, 64 * 1024 * 1024, 0); switch ((reg >> 25) & 0x3) { case 0x01: /* NAND is the source */ @@ -202,17 +176,16 @@ static int f3s_devices_init(void) set_silicon_rev(imx_silicon_revision()); i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices)); - register_device(&i2c_dev); + imx35_add_i2c0(NULL); imx35_add_fec(&fec_info); - register_device(&smc911x_dev); + add_generic_device("smc911x", -1, NULL, IMX_CS5_BASE, IMX_CS5_RANGE, + IORESOURCE_MEM, NULL); imx35_add_mmc0(NULL); - register_device(&sdram_dev); imx35_add_fb(&ipu_fb_data); - armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0x80000100); armlinux_set_architecture(MACH_TYPE_MX35_3DS); diff --git a/arch/arm/boards/freescale-mx51-pdk/board.c b/arch/arm/boards/freescale-mx51-pdk/board.c index ee2fbee0e4..d6472df69f 100644 --- a/arch/arm/boards/freescale-mx51-pdk/board.c +++ b/arch/arm/boards/freescale-mx51-pdk/board.c @@ -19,7 +19,6 @@ */ #include <common.h> -#include <net.h> #include <init.h> #include <environment.h> #include <mach/imx-regs.h> @@ -40,19 +39,7 @@ #include <mach/generic.h> #include <mach/iomux-mx51.h> #include <mach/devices-imx51.h> - -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = 0x90000000, - .size = 512 * 1024 * 1024, - .platform_data = &ram_pdata, -}; +#include <mach/iim.h> static struct fec_platform_data fec_info = { .xcv_type = MII100, @@ -86,23 +73,13 @@ static struct pad_desc f3s_pads[] = { IOMUX_PAD(0x60C, 0x21C, 3, 0x0, 0, 0x85), /* FIXME: needed? */ }; -#ifdef CONFIG_MMU -static void babbage_mmu_init(void) +static int babbage_mem_init(void) { - mmu_init(); - - arm_create_section(0x90000000, 0x90000000, 512, PMD_SECT_DEF_CACHED); - arm_create_section(0xb0000000, 0x90000000, 512, PMD_SECT_DEF_UNCACHED); + arm_add_mem_device("ram0", 0x90000000, 512 * 1024 * 1024); - setup_dma_coherent(0x20000000); - - mmu_enable(); -} -#else -static void babbage_mmu_init(void) -{ + return 0; } -#endif +mem_initcall(babbage_mem_init); #define BABBAGE_ECSPI1_CS0 (3 * 32 + 24) static int spi_0_cs[] = {BABBAGE_ECSPI1_CS0}; @@ -240,9 +217,7 @@ static void babbage_power_init(void) static int f3s_devices_init(void) { - babbage_mmu_init(); - - register_device(&sdram_dev); + imx51_iim_register_fec_ethaddr(); imx51_add_fec(&fec_info); imx51_add_mmc0(NULL); @@ -252,7 +227,6 @@ static int f3s_devices_init(void) babbage_power_init(); - armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0x90000100); armlinux_set_architecture(MACH_TYPE_MX51_BABBAGE); diff --git a/arch/arm/boards/freescale-mx51-pdk/lowlevel_init.S b/arch/arm/boards/freescale-mx51-pdk/lowlevel_init.S index 793104c7c2..0b3726f6d5 100644 --- a/arch/arm/boards/freescale-mx51-pdk/lowlevel_init.S +++ b/arch/arm/boards/freescale-mx51-pdk/lowlevel_init.S @@ -19,29 +19,29 @@ #include <config.h> #include <mach/imx-regs.h> -#include <mach/clock-imx51.h> +#include <mach/clock-imx51_53.h> #define ROM_SI_REV_OFFSET 0x48 .macro setup_pll pll, freq ldr r2, =\pll ldr r1, =0x00001232 - str r1, [r2, #MX51_PLL_DP_CTL] /* Set DPLL ON (set UPEN bit): BRMO=1 */ + str r1, [r2, #MX5_PLL_DP_CTL] /* Set DPLL ON (set UPEN bit): BRMO=1 */ mov r1, #0x2 - str r1, [r2, #MX51_PLL_DP_CONFIG] /* Enable auto-restart AREN bit */ + str r1, [r2, #MX5_PLL_DP_CONFIG] /* Enable auto-restart AREN bit */ - str r3, [r2, #MX51_PLL_DP_OP] - str r3, [r2, #MX51_PLL_DP_HFS_OP] + str r3, [r2, #MX5_PLL_DP_OP] + str r3, [r2, #MX5_PLL_DP_HFS_OP] - str r4, [r2, #MX51_PLL_DP_MFD] - str r4, [r2, #MX51_PLL_DP_HFS_MFD] + str r4, [r2, #MX5_PLL_DP_MFD] + str r4, [r2, #MX5_PLL_DP_HFS_MFD] - str r5, [r2, #MX51_PLL_DP_MFN] - str r5, [r2, #MX51_PLL_DP_HFS_MFN] + str r5, [r2, #MX5_PLL_DP_MFN] + str r5, [r2, #MX5_PLL_DP_HFS_MFN] ldr r1, =0x00001232 - str r1, [r2, #MX51_PLL_DP_CTL] -1: ldr r1, [r2, #MX51_PLL_DP_CTL] + str r1, [r2, #MX5_PLL_DP_CTL] +1: ldr r1, [r2, #MX5_PLL_DP_CTL] ands r1, r1, #0x1 beq 1b .endm @@ -80,67 +80,67 @@ board_init_lowlevel: /* Gate of clocks to the peripherals first */ ldr r1, =0x3FFFFFFF - str r1, [r0, #MX51_CCM_CCGR0] + str r1, [r0, #MX5_CCM_CCGR0] ldr r1, =0x0 - str r1, [r0, #MX51_CCM_CCGR1] - str r1, [r0, #MX51_CCM_CCGR2] - str r1, [r0, #MX51_CCM_CCGR3] + str r1, [r0, #MX5_CCM_CCGR1] + str r1, [r0, #MX5_CCM_CCGR2] + str r1, [r0, #MX5_CCM_CCGR3] ldr r1, =0x00030000 - str r1, [r0, #MX51_CCM_CCGR4] + str r1, [r0, #MX5_CCM_CCGR4] ldr r1, =0x00FFF030 - str r1, [r0, #MX51_CCM_CCGR5] + str r1, [r0, #MX5_CCM_CCGR5] ldr r1, =0x00000300 - str r1, [r0, #MX51_CCM_CCGR6] + str r1, [r0, #MX5_CCM_CCGR6] /* Disable IPU and HSC dividers */ mov r1, #0x60000 - str r1, [r0, #MX51_CCM_CCDR] + str r1, [r0, #MX5_CCM_CCDR] #ifdef IMX51_TO_2 /* Make sure to switch the DDR away from PLL 1 */ ldr r1, =0x19239145 - str r1, [r0, #MX51_CCM_CBCDR] + str r1, [r0, #MX5_CCM_CBCDR] /* make sure divider effective */ -1: ldr r1, [r0, #MX51_CCM_CDHIPR] +1: ldr r1, [r0, #MX5_CCM_CDHIPR] cmp r1, #0x0 bne 1b #endif /* Switch ARM to step clock */ mov r1, #0x4 - str r1, [r0, #MX51_CCM_CCSR] + str r1, [r0, #MX5_CCM_CCSR] - mov r3, #MX51_PLL_DP_OP_800 - mov r4, #MX51_PLL_DP_MFD_800 - mov r5, #MX51_PLL_DP_MFN_800 + mov r3, #MX5_PLL_DP_OP_800 + mov r4, #MX5_PLL_DP_MFD_800 + mov r5, #MX5_PLL_DP_MFN_800 setup_pll MX51_PLL1_BASE_ADDR - mov r3, #MX51_PLL_DP_OP_665 - mov r4, #MX51_PLL_DP_MFD_665 - mov r5, #MX51_PLL_DP_MFN_665 + mov r3, #MX5_PLL_DP_OP_665 + mov r4, #MX5_PLL_DP_MFD_665 + mov r5, #MX5_PLL_DP_MFN_665 setup_pll MX51_PLL3_BASE_ADDR /* Switch peripheral to PLL 3 */ ldr r1, =0x000010C0 - str r1, [r0, #MX51_CCM_CBCMR] + str r1, [r0, #MX5_CCM_CBCMR] ldr r1, =0x13239145 - str r1, [r0, #MX51_CCM_CBCDR] + str r1, [r0, #MX5_CCM_CBCDR] - mov r3, #MX51_PLL_DP_OP_665 - mov r4, #MX51_PLL_DP_MFD_665 - mov r5, #MX51_PLL_DP_MFN_665 + mov r3, #MX5_PLL_DP_OP_665 + mov r4, #MX5_PLL_DP_MFD_665 + mov r5, #MX5_PLL_DP_MFN_665 setup_pll MX51_PLL2_BASE_ADDR /* Switch peripheral to PLL2 */ ldr r1, =0x19239145 - str r1, [r0, #MX51_CCM_CBCDR] + str r1, [r0, #MX5_CCM_CBCDR] ldr r1, =0x000020C0 - str r1, [r0, #MX51_CCM_CBCMR] + str r1, [r0, #MX5_CCM_CBCMR] - mov r3, #MX51_PLL_DP_OP_216 - mov r4, #MX51_PLL_DP_MFD_216 - mov r5, #MX51_PLL_DP_MFN_216 + mov r3, #MX5_PLL_DP_OP_216 + mov r4, #MX5_PLL_DP_MFD_216 + mov r5, #MX5_PLL_DP_MFN_216 setup_pll MX51_PLL3_BASE_ADDR /* Set the platform clock dividers */ @@ -154,52 +154,52 @@ board_init_lowlevel: cmp r3, #0x10 movls r1, #0x1 movhi r1, #0 - str r1, [r0, #MX51_CCM_CACRR] + str r1, [r0, #MX5_CCM_CACRR] /* Switch ARM back to PLL 1 */ mov r1, #0 - str r1, [r0, #MX51_CCM_CCSR] + str r1, [r0, #MX5_CCM_CCSR] /* setup the rest */ /* Use lp_apm (24MHz) source for perclk */ #ifdef IMX51_TO_2 ldr r1, =0x000020C2 - str r1, [r0, #MX51_CCM_CBCMR] + str r1, [r0, #MX5_CCM_CBCMR] // ddr clock from PLL 1, all perclk dividers are 1 since using 24MHz ldr r1, =0x59239100 - str r1, [r0, #MX51_CCM_CBCDR] + str r1, [r0, #MX5_CCM_CBCDR] #else ldr r1, =0x0000E3C2 - str r1, [r0, #MX51_CCM_CBCMR] + str r1, [r0, #MX5_CCM_CBCMR] // emi=ahb, all perclk dividers are 1 since using 24MHz // DDR divider=6 to have 665/6=110MHz ldr r1, =0x013B9100 - str r1, [r0, #MX51_CCM_CBCDR] + str r1, [r0, #MX5_CCM_CBCDR] #endif /* Restore the default values in the Gate registers */ ldr r1, =0xFFFFFFFF - str r1, [r0, #MX51_CCM_CCGR0] - str r1, [r0, #MX51_CCM_CCGR1] - str r1, [r0, #MX51_CCM_CCGR2] - str r1, [r0, #MX51_CCM_CCGR3] - str r1, [r0, #MX51_CCM_CCGR4] - str r1, [r0, #MX51_CCM_CCGR5] - str r1, [r0, #MX51_CCM_CCGR6] + str r1, [r0, #MX5_CCM_CCGR0] + str r1, [r0, #MX5_CCM_CCGR1] + str r1, [r0, #MX5_CCM_CCGR2] + str r1, [r0, #MX5_CCM_CCGR3] + str r1, [r0, #MX5_CCM_CCGR4] + str r1, [r0, #MX5_CCM_CCGR5] + str r1, [r0, #MX5_CCM_CCGR6] /* Use PLL 2 for UART's, get 66.5MHz from it */ ldr r1, =0xA5A2A020 - str r1, [r0, #MX51_CCM_CSCMR1] + str r1, [r0, #MX5_CCM_CSCMR1] ldr r1, =0x00C30321 - str r1, [r0, #MX51_CCM_CSCDR1] + str r1, [r0, #MX5_CCM_CSCDR1] /* make sure divider effective */ - 1: ldr r1, [r0, #MX51_CCM_CDHIPR] + 1: ldr r1, [r0, #MX5_CCM_CDHIPR] cmp r1, #0x0 bne 1b mov r1, #0x0 - str r1, [r0, #MX51_CCM_CCDR] + str r1, [r0, #MX5_CCM_CCDR] writel(0x1, 0x73fa8074) ldr r0, =0x73f88000 diff --git a/arch/arm/boards/freescale-mx53-loco/Makefile b/arch/arm/boards/freescale-mx53-loco/Makefile new file mode 100644 index 0000000000..8e0c87c96f --- /dev/null +++ b/arch/arm/boards/freescale-mx53-loco/Makefile @@ -0,0 +1,3 @@ +obj-y += lowlevel_init.o +obj-y += board.o +obj-y += flash_header.o diff --git a/arch/arm/boards/freescale-mx53-loco/board.c b/arch/arm/boards/freescale-mx53-loco/board.c new file mode 100644 index 0000000000..b5240f4f3a --- /dev/null +++ b/arch/arm/boards/freescale-mx53-loco/board.c @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2007 Sascha Hauer, Pengutronix + * Copyright (C) 2011 Marc Kleine-Budde <mkl@pengutronix.de> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <common.h> +#include <environment.h> +#include <fcntl.h> +#include <fec.h> +#include <fs.h> +#include <init.h> +#include <nand.h> +#include <net.h> +#include <partition.h> +#include <sizes.h> + +#include <generated/mach-types.h> + +#include <mach/imx-regs.h> +#include <mach/iomux-mx53.h> +#include <mach/devices-imx53.h> +#include <mach/generic.h> +#include <mach/gpio.h> +#include <mach/imx-nand.h> +#include <mach/iim.h> + +#include <asm/armlinux.h> +#include <asm/io.h> +#include <asm/mmu.h> + +static struct fec_platform_data fec_info = { + .xcv_type = RMII, +}; + +static struct pad_desc loco_pads[] = { + /* UART1 */ + MX53_PAD_CSI0_DAT10__UART1_TXD_MUX, + MX53_PAD_CSI0_DAT11__UART1_RXD_MUX, + + /* FEC */ + MX53_PAD_FEC_MDC__FEC_MDC, + MX53_PAD_FEC_MDIO__FEC_MDIO, + MX53_PAD_FEC_REF_CLK__FEC_TX_CLK, + MX53_PAD_FEC_RX_ER__FEC_RX_ER, + MX53_PAD_FEC_CRS_DV__FEC_RX_DV, + MX53_PAD_FEC_RXD1__FEC_RDATA_1, + MX53_PAD_FEC_RXD0__FEC_RDATA_0, + MX53_PAD_FEC_TX_EN__FEC_TX_EN, + MX53_PAD_FEC_TXD1__FEC_TDATA_1, + MX53_PAD_FEC_TXD0__FEC_TDATA_0, + /* FEC_nRST */ + MX53_PAD_PATA_DA_0__GPIO7_6, + + /* SD1 */ + MX53_PAD_SD1_CMD__ESDHC1_CMD, + MX53_PAD_SD1_CLK__ESDHC1_CLK, + MX53_PAD_SD1_DATA0__ESDHC1_DAT0, + MX53_PAD_SD1_DATA1__ESDHC1_DAT1, + MX53_PAD_SD1_DATA2__ESDHC1_DAT2, + MX53_PAD_SD1_DATA3__ESDHC1_DAT3, + /* SD1_CD */ + MX53_PAD_EIM_DA13__GPIO3_13, +}; + +static int loco_mem_init(void) +{ + arm_add_mem_device("ram0", 0x70000000, SZ_512M); + arm_add_mem_device("ram1", 0xb0000000, SZ_512M); + + return 0; +} +mem_initcall(loco_mem_init); + +#define LOCO_FEC_PHY_RST IMX_GPIO_NR(7, 6) + +static void loco_fec_reset(void) +{ + gpio_direction_output(LOCO_FEC_PHY_RST, 0); + mdelay(1); + gpio_set_value(LOCO_FEC_PHY_RST, 1); +} + +static int loco_devices_init(void) +{ + imx51_iim_register_fec_ethaddr(); + imx53_add_fec(&fec_info); + imx53_add_mmc0(NULL); + + loco_fec_reset(); + + armlinux_set_bootparams((void *)0x70000100); + armlinux_set_architecture(MACH_TYPE_MX53_LOCO); + + loco_fec_reset(); + + return 0; +} + +device_initcall(loco_devices_init); + +static int loco_part_init(void) +{ + devfs_add_partition("disk0", 0x00000, 0x40000, PARTITION_FIXED, "self0"); + devfs_add_partition("disk0", 0x40000, 0x20000, PARTITION_FIXED, "env0"); + + return 0; +} +late_initcall(loco_part_init); + +static int loco_console_init(void) +{ + mxc_iomux_v3_setup_multiple_pads(loco_pads, ARRAY_SIZE(loco_pads)); + + imx53_add_uart0(); + return 0; +} + +console_initcall(loco_console_init); diff --git a/arch/arm/boards/freescale-mx53-loco/config.h b/arch/arm/boards/freescale-mx53-loco/config.h new file mode 100644 index 0000000000..b7effe5d28 --- /dev/null +++ b/arch/arm/boards/freescale-mx53-loco/config.h @@ -0,0 +1,24 @@ +/** + * @file + * @brief Global defintions for the ARM i.MX51 based babbage board + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#endif /* __CONFIG_H */ diff --git a/arch/arm/boards/freescale-mx53-loco/env/config b/arch/arm/boards/freescale-mx53-loco/env/config new file mode 100644 index 0000000000..3659a629a9 --- /dev/null +++ b/arch/arm/boards/freescale-mx53-loco/env/config @@ -0,0 +1,51 @@ +#!/bin/sh + +machine=loco +eth0.serverip= +user= + +# use 'dhcp' to do dhcp in barebox and in kernel +# use 'none' if you want to skip kernel ip autoconfiguration +ip=dhcp + +# or set your networking parameters here +#eth0.ipaddr=a.b.c.d +#eth0.netmask=a.b.c.d +#eth0.gateway=a.b.c.d +#eth0.serverip=a.b.c.d + +# can be either 'nfs', 'tftp', 'nor' or 'nand' +kernel_loc=tftp +# can be either 'net', 'nor', 'nand' or 'initrd' +rootfs_loc=net + +# can be either 'jffs2' or 'ubifs' +rootfs_type=ubifs +rootfsimage=root-$machine.$rootfs_type + +# The image type of the kernel. Can be uimage, zimage, raw, or raw_lzo +kernelimage_type=zimage +kernelimage=zImage-$machine +#kernelimage_type=uimage +#kernelimage=uImage-$machine +#kernelimage_type=raw +#kernelimage=Image-$machine +#kernelimage_type=raw_lzo +#kernelimage=Image-$machine.lzo + +if [ -n $user ]; then + kernelimage="$user"-"$kernelimage" + nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine" + rootfsimage="$user"-"$rootfsimage" +else + nfsroot="$eth0.serverip:/path/to/nfs/root" +fi + +autoboot_timeout=3 + +bootargs="console=ttymxc0,115200" + +disk_parts="256k(barebox)ro,128k(bareboxenv),4M(kernel),-(root)" + +# set a fancy prompt (if support is compiled in) +PS1="\e[1;32mbarebox@\e[1;31m\h:\w\e[0m " diff --git a/arch/arm/boards/freescale-mx53-loco/flash_header.c b/arch/arm/boards/freescale-mx53-loco/flash_header.c new file mode 100644 index 0000000000..d6ff898711 --- /dev/null +++ b/arch/arm/boards/freescale-mx53-loco/flash_header.c @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2011 Marc Kleine-Budde <mkl@pengutronix.de> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <common.h> +#include <asm/byteorder.h> +#include <mach/imx-flash-header.h> + +void __naked __flash_header_start go(void) +{ + __asm__ __volatile__("b exception_vectors\n"); +} + +struct imx_dcd_v2_entry __dcd_entry_section dcd_entry[] = { + { .addr = cpu_to_be32(0x53fa8554), .val = cpu_to_be32(0x00300000), }, + { .addr = cpu_to_be32(0x53fa8558), .val = cpu_to_be32(0x00300040), }, + { .addr = cpu_to_be32(0x53fa8560), .val = cpu_to_be32(0x00300000), }, + { .addr = cpu_to_be32(0x53fa8564), .val = cpu_to_be32(0x00300040), }, + { .addr = cpu_to_be32(0x53fa8568), .val = cpu_to_be32(0x00300040), }, + { .addr = cpu_to_be32(0x53fa8570), .val = cpu_to_be32(0x00300000), }, + { .addr = cpu_to_be32(0x53fa8574), .val = cpu_to_be32(0x00300000), }, + { .addr = cpu_to_be32(0x53fa8578), .val = cpu_to_be32(0x00300000), }, + { .addr = cpu_to_be32(0x53fa857c), .val = cpu_to_be32(0x00300040), }, + { .addr = cpu_to_be32(0x53fa8580), .val = cpu_to_be32(0x00300040), }, + { .addr = cpu_to_be32(0x53fa8584), .val = cpu_to_be32(0x00300000), }, + { .addr = cpu_to_be32(0x53fa8588), .val = cpu_to_be32(0x00300000), }, + { .addr = cpu_to_be32(0x53fa8590), .val = cpu_to_be32(0x00300040), }, + { .addr = cpu_to_be32(0x53fa8594), .val = cpu_to_be32(0x00300000), }, + { .addr = cpu_to_be32(0x53fa86f0), .val = cpu_to_be32(0x00300000), }, + { .addr = cpu_to_be32(0x53fa86f4), .val = cpu_to_be32(0x00000000), }, + { .addr = cpu_to_be32(0x53fa86fc), .val = cpu_to_be32(0x00000000), }, + { .addr = cpu_to_be32(0x53fa8714), .val = cpu_to_be32(0x00000000), }, + { .addr = cpu_to_be32(0x53fa8718), .val = cpu_to_be32(0x00300000), }, + { .addr = cpu_to_be32(0x53fa871c), .val = cpu_to_be32(0x00300000), }, + { .addr = cpu_to_be32(0x53fa8720), .val = cpu_to_be32(0x00300000), }, + { .addr = cpu_to_be32(0x53fa8724), .val = cpu_to_be32(0x04000000), }, + { .addr = cpu_to_be32(0x53fa8728), .val = cpu_to_be32(0x00300000), }, + { .addr = cpu_to_be32(0x53fa872c), .val = cpu_to_be32(0x00300000), }, + { .addr = cpu_to_be32(0x63fd9088), .val = cpu_to_be32(0x35343535), }, + { .addr = cpu_to_be32(0x63fd9090), .val = cpu_to_be32(0x4d444c44), }, + { .addr = cpu_to_be32(0x63fd907c), .val = cpu_to_be32(0x01370138), }, + { .addr = cpu_to_be32(0x63fd9080), .val = cpu_to_be32(0x013b013c), }, + { .addr = cpu_to_be32(0x63fd9018), .val = cpu_to_be32(0x00011740), }, + { .addr = cpu_to_be32(0x63fd9000), .val = cpu_to_be32(0xc3190000), }, + { .addr = cpu_to_be32(0x63fd900c), .val = cpu_to_be32(0x9f5152e3), }, + { .addr = cpu_to_be32(0x63fd9010), .val = cpu_to_be32(0xb68e8a63), }, + { .addr = cpu_to_be32(0x63fd9014), .val = cpu_to_be32(0x01ff00db), }, + { .addr = cpu_to_be32(0x63fd902c), .val = cpu_to_be32(0x000026d2), }, + { .addr = cpu_to_be32(0x63fd9030), .val = cpu_to_be32(0x009f0e21), }, + { .addr = cpu_to_be32(0x63fd9008), .val = cpu_to_be32(0x12273030), }, + { .addr = cpu_to_be32(0x63fd9004), .val = cpu_to_be32(0x0002002d), }, + { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x00008032), }, + { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x00008033), }, + { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x00028031), }, + { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x092080b0), }, + { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x04008040), }, + { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x0000803a), }, + { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x0000803b), }, + { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x00028039), }, + { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x09208138), }, + { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x04008048), }, + { .addr = cpu_to_be32(0x63fd9020), .val = cpu_to_be32(0x00001800), }, + { .addr = cpu_to_be32(0x63fd9040), .val = cpu_to_be32(0x04b80003), }, + { .addr = cpu_to_be32(0x63fd9058), .val = cpu_to_be32(0x00022227), }, + { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x00000000), }, +}; + +#define APP_DEST CONFIG_TEXT_BASE + +struct imx_flash_header_v2 __flash_header_section flash_header = { + .header.tag = IVT_HEADER_TAG, + .header.length = cpu_to_be16(32), + .header.version = IVT_VERSION, + + .entry = APP_DEST + 0x1000, + .dcd_ptr = APP_DEST + 0x400 + offsetof(struct imx_flash_header_v2, dcd), + .boot_data_ptr = APP_DEST + 0x400 + offsetof(struct imx_flash_header_v2, boot_data), + .self = APP_DEST + 0x400, + + .boot_data.start = APP_DEST, + .boot_data.size = 0x40000, + + .dcd.header.tag = DCD_HEADER_TAG, + .dcd.header.length = cpu_to_be16(sizeof(struct imx_dcd) + sizeof(dcd_entry)), + .dcd.header.version = DCD_VERSION, + + .dcd.command.tag = DCD_COMMAND_WRITE_TAG, + .dcd.command.length = cpu_to_be16(sizeof(struct imx_dcd_command) + sizeof(dcd_entry)), + .dcd.command.param = DCD_COMMAND_WRITE_PARAM, +}; diff --git a/arch/arm/boards/freescale-mx53-loco/lowlevel_init.S b/arch/arm/boards/freescale-mx53-loco/lowlevel_init.S new file mode 100644 index 0000000000..44102c9b59 --- /dev/null +++ b/arch/arm/boards/freescale-mx53-loco/lowlevel_init.S @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2007 Guennadi Liakhovetski <lg@denx.de> + * Copyright (C) 2009 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <config.h> +#include <mach/imx-regs.h> +#include <mach/clock-imx51_53.h> + +/* + * L2CC Cache setup/invalidation/disable + */ +.macro init_l2cc + /* explicitly disable L2 cache */ + mrc 15, 0, r0, c1, c0, 1 + bic r0, r0, #0x2 + mcr 15, 0, r0, c1, c0, 1 + + /* reconfigure L2 cache aux control reg */ + mov r0, #0xC0 /* tag RAM */ + add r0, r0, #0x4 /* data RAM */ + orr r0, r0, #(1 << 24) /* disable write allocate delay */ + orr r0, r0, #(1 << 23) /* disable write allocate combine */ + orr r0, r0, #(1 << 22) /* disable write allocate */ + + cmp r3, #0x10 /* r3 contains the silicon rev */ + + /* disable write combine for TO 2 and lower revs */ + orrls r0, r0, #(1 << 25) + + mcr 15, 1, r0, c9, c0, 2 +.endm /* init_l2cc */ + +/* AIPS setup - Only setup MPROTx registers. + * The PACR default values are good.*/ +.macro init_aips + /* + * Set all MPROTx to be non-bufferable, trusted for R/W, + * not forced to user-mode. + */ + ldr r0, =MX53_AIPS1_BASE_ADDR + ldr r1, =0x77777777 + str r1, [r0, #0x0] + str r1, [r0, #0x4] + + ldr r0, =MX53_AIPS2_BASE_ADDR + str r1, [r0, #0x0] + str r1, [r0, #0x4] + /* + * Clear the on and off peripheral modules Supervisor Protect bit + * for SDMA to access them. Did not change the AIPS control registers + * (offset 0x20) access type + */ +.endm /* init_aips */ + +.macro setup_pll pll, freq + ldr r0, =\pll + ldr r1, =0x00001232 + str r1, [r0, #MX5_PLL_DP_CTL] /* Set DPLL ON (set UPEN bit): BRMO=1 */ + mov r1, #0x2 + str r1, [r0, #MX5_PLL_DP_CONFIG] /* Enable auto-restart AREN bit */ + + ldr r1, W_DP_OP_\freq + str r1, [r0, #MX5_PLL_DP_OP] + str r1, [r0, #MX5_PLL_DP_HFS_OP] + + ldr r1, W_DP_MFD_\freq + str r1, [r0, #MX5_PLL_DP_MFD] + str r1, [r0, #MX5_PLL_DP_HFS_MFD] + + ldr r1, W_DP_MFN_\freq + str r1, [r0, #MX5_PLL_DP_MFN] + str r1, [r0, #MX5_PLL_DP_HFS_MFN] + + ldr r1, =0x00001232 + str r1, [r0, #MX5_PLL_DP_CTL] +1: ldr r1, [r0, #MX5_PLL_DP_CTL] + ands r1, r1, #0x1 + beq 1b +.endm + +.macro init_clock + ldr r0, =MX53_CCM_BASE_ADDR + + + /* Switch ARM to step clock */ + mov r1, #0x4 + str r1, [r0, #MX5_CCM_CCSR] + + setup_pll MX53_PLL1_BASE_ADDR, 1000 + setup_pll MX53_PLL3_BASE_ADDR, 216 + + /* Set the platform clock dividers */ + ldr r0, =MX53_ARM_BASE_ADDR + ldr r1, =0x00000725 + str r1, [r0, #0x14] + + ldr r0, =MX53_CCM_BASE_ADDR + mov r1, #0 + str r1, [r0, #MX5_CCM_CACRR] + + /* Switch ARM back to PLL 1 */ + mov r1, #0 + str r1, [r0, #MX5_CCM_CCSR] + + + /* Restore the default values in the Gate registers */ + ldr r1, =0xFFFFFFFF + str r1, [r0, #MX5_CCM_CCGR0] + str r1, [r0, #MX5_CCM_CCGR1] + str r1, [r0, #MX5_CCM_CCGR2] + str r1, [r0, #MX5_CCM_CCGR3] + str r1, [r0, #MX5_CCM_CCGR4] + str r1, [r0, #MX5_CCM_CCGR5] + str r1, [r0, #MX5_CCM_CCGR6] +#if 0 + str r1, [r0, #MX5_CCM_CCGR7] +#endif + + ldr r1, [r0, #MX5_CCM_CSCDR1] + orr r1, r1, #0x3f + eor r1, r1, #0x3f + orr r1, r1, #0x21 + str r1, [r0, #MX5_CCM_CSCDR1] + /* make sure divider effective */ +1: ldr r1, [r0, #MX5_CCM_CDHIPR] + cmp r1, #0x0 + bne 1b + + mov r1, #0x0 + str r1, [r0, #MX5_CCM_CCDR] + + /* for cko - for ARM div by 8 */ + mov r1, #0x000A0000 + add r1, r1, #0x00000F0 + str r1, [r0, #MX5_CCM_CCOSR] +.endm + +.globl board_init_lowlevel +board_init_lowlevel: + mov r10, lr + + init_l2cc + init_aips + init_clock + + mov pc, r10 + +/* Board level setting value */ +W_DP_OP_1000: .word MX5_PLL_DP_OP_1000 +W_DP_MFD_1000: .word MX5_PLL_DP_MFD_1000 +W_DP_MFN_1000: .word MX5_PLL_DP_MFN_1000 +W_DP_OP_800: .word MX5_PLL_DP_OP_800 +W_DP_MFD_800: .word MX5_PLL_DP_MFD_800 +W_DP_MFN_800: .word MX5_PLL_DP_MFN_800 +W_DP_OP_665: .word MX5_PLL_DP_OP_665 +W_DP_MFD_665: .word MX5_PLL_DP_MFD_665 +W_DP_MFN_665: .word MX5_PLL_DP_MFN_665 +W_DP_OP_216: .word MX5_PLL_DP_OP_216 +W_DP_MFD_216: .word MX5_PLL_DP_MFD_216 +W_DP_MFN_216: .word MX5_PLL_DP_MFN_216 diff --git a/arch/arm/boards/freescale-mx53-loco/mx53-pdk.dox b/arch/arm/boards/freescale-mx53-loco/mx53-pdk.dox new file mode 100644 index 0000000000..3a2c84fc3f --- /dev/null +++ b/arch/arm/boards/freescale-mx53-loco/mx53-pdk.dox @@ -0,0 +1,4 @@ +/** @page board_loco Freescale i.MX53 PDK (Loco) Board + + +*/ diff --git a/arch/arm/boards/guf-cupid/board.c b/arch/arm/boards/guf-cupid/board.c index d04af78930..706707d0bb 100644 --- a/arch/arm/boards/guf-cupid/board.c +++ b/arch/arm/boards/guf-cupid/board.c @@ -43,44 +43,18 @@ #include <mach/imx-ipu-fb.h> #include <mach/imx-pll.h> #include <mach/iomux-mx35.h> +#include <mach/devices-imx35.h> static struct fec_platform_data fec_info = { .xcv_type = MII100, }; -static struct device_d fec_dev = { - .id = -1, - .name = "fec_imx", - .map_base = IMX_FEC_BASE, - .platform_data = &fec_info, -}; - -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram0_dev = { - .id = -1, - .name = "mem", - .map_base = IMX_SDRAM_CS0, - .size = 128 * 1024 * 1024, - .platform_data = &ram_pdata, -}; - struct imx_nand_platform_data nand_info = { .width = 1, .hw_ecc = 1, .flash_bbt = 1, }; -static struct device_d nand_dev = { - .id = -1, - .name = "imx_nand", - .map_base = IMX_NFC_BASE, - .platform_data = &nand_info, -}; - static struct fb_videomode guf_cupid_fb_mode = { /* 800x480 @ 70 Hz */ .name = "CPT CLAA070LC0JCT", @@ -122,38 +96,21 @@ static struct imx_ipu_fb_platform_data ipu_fb_data = { .enable = cupid_fb_enable, }; -static struct device_d imx_ipu_fb_dev = { - .id = -1, - .name = "imx-ipu-fb", - .map_base = 0x53fc0000, - .size = 0x1000, - .platform_data = &ipu_fb_data, -}; +static int cupid_mem_init(void) +{ + arm_add_mem_device("ram0", IMX_SDRAM_CS0, 128 * 1024 * 1024); -static struct device_d esdhc_dev = { - .name = "imx-esdhc", - .map_base = IMX_SDHC1_BASE, -}; + return 0; +} +mem_initcall(cupid_mem_init); -#ifdef CONFIG_MMU static int cupid_mmu_init(void) { - mmu_init(); - - arm_create_section(0x80000000, 0x80000000, 128, PMD_SECT_DEF_CACHED); - arm_create_section(0x90000000, 0x80000000, 128, PMD_SECT_DEF_UNCACHED); - - setup_dma_coherent(0x10000000); - - mmu_enable(); - -#ifdef CONFIG_CACHE_L2X0 l2x0_init((void __iomem *)0x30000000, 0x00030024, 0x00000000); -#endif + return 0; } -postcore_initcall(cupid_mmu_init); -#endif +postmmu_initcall(cupid_mmu_init); static int cupid_devices_init(void) { @@ -169,19 +126,17 @@ static int cupid_devices_init(void) else nand_info.width = 1; /* 8 bit */ - register_device(&fec_dev); - register_device(&nand_dev); + imx35_add_fec(&fec_info); + imx35_add_nand(&nand_info); devfs_add_partition("nand0", 0x00000, 0x40000, PARTITION_FIXED, "self_raw"); dev_add_bb_dev("self_raw", "self0"); devfs_add_partition("nand0", 0x40000, 0x80000, PARTITION_FIXED, "env_raw"); dev_add_bb_dev("env_raw", "env0"); - register_device(&sdram0_dev); - register_device(&imx_ipu_fb_dev); - register_device(&esdhc_dev); + imx35_add_fb(&ipu_fb_data); + imx35_add_mmc0(NULL); - armlinux_add_dram(&sdram0_dev); armlinux_set_bootparams((void *)0x80000100); armlinux_set_architecture(MACH_TYPE_GUF_CUPID); @@ -190,13 +145,6 @@ static int cupid_devices_init(void) device_initcall(cupid_devices_init); -static struct device_d cupid_serial_device = { - .id = -1, - .name = "imx_serial", - .map_base = IMX_UART1_BASE, - .size = 16 * 1024, -}; - static struct pad_desc cupid_pads[] = { /* UART1 */ MX35_PAD_CTS1__UART1_CTS, @@ -289,7 +237,8 @@ static int cupid_console_init(void) { mxc_iomux_v3_setup_multiple_pads(cupid_pads, ARRAY_SIZE(cupid_pads)); - register_device(&cupid_serial_device); + imx35_add_uart0(); + return 0; } diff --git a/arch/arm/boards/guf-neso/board.c b/arch/arm/boards/guf-neso/board.c index c4b2fa11d5..446b333f1f 100644 --- a/arch/arm/boards/guf-neso/board.c +++ b/arch/arm/boards/guf-neso/board.c @@ -54,19 +54,6 @@ #define LCD_POWER_GPIO (GPIO_PORTF + 18) #define BACKLIGHT_POWER_GPIO (GPIO_PORTE + 5) -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = 0xa0000000, - .size = 128 * 1024 * 1024, - .platform_data = &ram_pdata, -}; - static struct fec_platform_data fec_info = { .xcv_type = MII100, .phy_addr = 31, @@ -127,14 +114,6 @@ static struct imx_fb_platform_data neso_fb_data = { }; #ifdef CONFIG_USB - -static struct device_d usbh2_dev = { - .id = -1, - .name = "ehci", - .map_base = IMX_OTG_BASE + 0x400, - .size = 0x200, -}; - static void neso_usbh_init(void) { uint32_t temp; @@ -157,23 +136,13 @@ static void neso_usbh_init(void) } #endif -#ifdef CONFIG_MMU -static void neso_mmu_init(void) +static int neso_mem_init(void) { - mmu_init(); - - arm_create_section(0xa0000000, 0xa0000000, 128, PMD_SECT_DEF_CACHED); - arm_create_section(0xb0000000, 0xa0000000, 128, PMD_SECT_DEF_UNCACHED); + arm_add_mem_device("ram0", 0xa0000000, 128 * 1024 * 1024); - setup_dma_coherent(0x10000000); - - mmu_enable(); -} -#else -static void neso_mmu_init(void) -{ + return 0; } -#endif +mem_initcall(neso_mem_init); static int neso_devices_init(void) { @@ -301,20 +270,16 @@ static int neso_devices_init(void) gpio_direction_output(OTG_PHY_CS_GPIO, 1); gpio_direction_output(USBH2_PHY_CS_GPIO, 1); - - neso_mmu_init(); - /* initialize gpios */ for (i = 0; i < ARRAY_SIZE(mode); i++) imx_gpio_mode(mode[i]); imx27_add_nand(&nand_info); - register_device(&sdram_dev); imx27_add_fb(&neso_fb_data); #ifdef CONFIG_USB neso_usbh_init(); - register_device(&usbh2_dev); + add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL); #endif imx27_add_fec(&fec_info); @@ -325,7 +290,6 @@ static int neso_devices_init(void) devfs_add_partition("nand0", 0x40000, 0x80000, PARTITION_FIXED, "env_raw"); dev_add_bb_dev("env_raw", "env0"); - armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0xa0000100); armlinux_set_architecture(MACH_TYPE_NESO); diff --git a/arch/arm/boards/imx21ads/imx21ads.c b/arch/arm/boards/imx21ads/imx21ads.c index 394258154d..d58831e748 100644 --- a/arch/arm/boards/imx21ads/imx21ads.c +++ b/arch/arm/boards/imx21ads/imx21ads.c @@ -41,38 +41,11 @@ #define MX21ADS_IO_REG 0xCC800000 #define MX21ADS_IO_LCDON (1 << 9) -static struct device_d cfi_dev = { - .id = -1, - .name = "cfi_flash", - .map_base = 0xC8000000, - .size = 32 * 1024 * 1024, -}; - -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = 0xc0000000, - .size = 64 * 1024 * 1024, - .platform_data = &ram_pdata, -}; - struct imx_nand_platform_data nand_info = { .width = 1, .hw_ecc = 1, }; -static struct device_d cs8900_dev = { - .id = -1, - .name = "cs8900", - .map_base = IMX_CS1_BASE, - // IRQ is connected to UART3_RTS -}; - /* Sharp LQ035Q7DB02 QVGA display */ static struct imx_fb_videomode imx_fb_modedata = { .mode = { @@ -142,6 +115,14 @@ static int imx21ads_timing_init(void) core_initcall(imx21ads_timing_init); +static int mx21ads_mem_init(void) +{ + arm_add_mem_device("ram0", 0xc0000000, 64 * 1024 * 1024); + + return 0; +} +mem_initcall(mx21ads_mem_init); + static int mx21ads_devices_init(void) { int i; @@ -183,13 +164,12 @@ static int mx21ads_devices_init(void) for (i = 0; i < ARRAY_SIZE(mode); i++) imx_gpio_mode(mode[i]); - register_device(&cfi_dev); - register_device(&sdram_dev); + add_cfi_flash_device(-1, 0xC8000000, 32 * 1024 * 1024, 0); imx21_add_nand(&nand_info); - register_device(&cs8900_dev); + add_generic_device("cs8900", -1, NULL, IMX_CS1_BASE, 0x1000, + IORESOURCE_MEM, NULL); imx21_add_fb(&imx_fb_data); - armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0xc0000100); armlinux_set_architecture(MACH_TYPE_MX21ADS); diff --git a/arch/arm/boards/imx27ads/imx27ads.c b/arch/arm/boards/imx27ads/imx27ads.c index 0d433c12e8..da4260fa58 100644 --- a/arch/arm/boards/imx27ads/imx27ads.c +++ b/arch/arm/boards/imx27ads/imx27ads.c @@ -34,26 +34,6 @@ #include <mach/iomux-mx27.h> #include <mach/devices-imx27.h> -static struct device_d cfi_dev = { - .id = -1, - .name = "cfi_flash", - .map_base = 0xC0000000, - .size = 32 * 1024 * 1024, -}; - -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = 0xa0000000, - .size = 128 * 1024 * 1024, - .platform_data = &ram_pdata, -}; - static struct fec_platform_data fec_info = { .xcv_type = MII100, .phy_addr = 1, @@ -94,6 +74,14 @@ static int imx27ads_timing_init(void) core_initcall(imx27ads_timing_init); +static int mx27ads_mem_init(void) +{ + arm_add_mem_device("ram0", 0xa0000000, 128 * 1024 * 1024); + + return 0; +} +mem_initcall(mx27ads_mem_init); + static int mx27ads_devices_init(void) { int i; @@ -126,15 +114,13 @@ static int mx27ads_devices_init(void) for (i = 0; i < ARRAY_SIZE(mode); i++) imx_gpio_mode(mode[i]); - register_device(&cfi_dev); - register_device(&sdram_dev); - imx27_add_fec(&fec_info); + add_cfi_flash_device(-1, 0xC0000000, 32 * 1024 * 1024, 0); + imx27_add_fec(&fec_info); devfs_add_partition("nor0", 0x00000, 0x20000, PARTITION_FIXED, "self0"); devfs_add_partition("nor0", 0x20000, 0x20000, PARTITION_FIXED, "env0"); protect_file("/dev/env0", 1); - armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0xa0000100); armlinux_set_architecture(MACH_TYPE_MX27ADS); diff --git a/arch/arm/boards/karo-tx25/board.c b/arch/arm/boards/karo-tx25/board.c index c59a9faac4..22bc27a291 100644 --- a/arch/arm/boards/karo-tx25/board.c +++ b/arch/arm/boards/karo-tx25/board.c @@ -36,6 +36,7 @@ #include <nand.h> #include <mach/iomux-mx25.h> #include <mach/generic.h> +#include <mach/iim.h> #include <linux/err.h> #include <mach/devices-imx25.h> #include <asm/mmu.h> @@ -45,74 +46,22 @@ static struct fec_platform_data fec_info = { .phy_addr = 0x1f, }; -static struct memory_platform_data sdram0_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram0_dev = { - .id = -1, - .name = "mem", - .map_base = IMX_SDRAM_CS0, - .size = 32 * 1024 * 1024, - .platform_data = &sdram0_pdata, -}; - -static struct memory_platform_data sdram1_pdata = { - .name = "ram1", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram1_dev = { - .id = -1, - .name = "mem", - .map_base = IMX_SDRAM_CS1, - .size = 32 * 1024 * 1024, - .platform_data = &sdram1_pdata, -}; - -static struct memory_platform_data sram_pdata = { - .name = "sram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sram0_dev = { - .id = -1, - .name = "mem", - .map_base = 0x78000000, - .size = 128 * 1024, - .platform_data = &sram_pdata, -}; - struct imx_nand_platform_data nand_info = { .width = 1, .hw_ecc = 1, .flash_bbt = 1, }; -#ifdef CONFIG_MMU -static int tx25_mmu_init(void) +static int tx25_mem_init(void) { - mmu_init(); - - arm_create_section(0x80000000, 0x80000000, 32, PMD_SECT_DEF_CACHED); - arm_create_section(0x82000000, 0x80000000, 32, PMD_SECT_DEF_UNCACHED); - arm_create_section(0x90000000, 0x90000000, 32, PMD_SECT_DEF_CACHED); - arm_create_section(0x92000000, 0x90000000, 32, PMD_SECT_DEF_UNCACHED); - - setup_dma_coherent(0x02000000); - -#if TEXT_BASE & (0x100000 - 1) -#warning cannot create vector section. Adjust TEXT_BASE to a 1M boundary -#else - arm_create_section(0x0, TEXT_BASE, 1, PMD_SECT_DEF_UNCACHED); -#endif - mmu_enable(); + arm_add_mem_device("ram0", IMX_SDRAM_CS0, 32 * 1024 * 1024); + arm_add_mem_device("ram0", IMX_SDRAM_CS1, 32 * 1024 * 1024); + add_mem_device("ram0", 0x78000000, 128 * 1024, + IORESOURCE_MEM_WRITEABLE); return 0; } -postcore_initcall(tx25_mmu_init); -#endif +mem_initcall(tx25_mem_init); static struct pad_desc karo_tx25_padsd_fec[] = { MX25_PAD_D11__GPIO_4_9, /* FEC PHY power on pin */ @@ -158,6 +107,7 @@ static int tx25_devices_init(void) { gpio_fec_active(); + imx25_iim_register_fec_ethaddr(); imx25_add_fec(&fec_info); if (readl(IMX_CCM_BASE + CCM_RCSR) & (1 << 14)) @@ -171,12 +121,6 @@ static int tx25_devices_init(void) devfs_add_partition("nand0", 0x40000, 0x80000, PARTITION_FIXED, "env_raw"); dev_add_bb_dev("env_raw", "env0"); - register_device(&sdram0_dev); - register_device(&sdram1_dev); - register_device(&sram0_dev); - - armlinux_add_dram(&sdram0_dev); - armlinux_add_dram(&sdram1_dev); armlinux_set_bootparams((void *)0x80000100); armlinux_set_architecture(MACH_TYPE_TX25); armlinux_set_serial(imx_uid()); diff --git a/arch/arm/boards/karo-tx28/tx28-stk5.c b/arch/arm/boards/karo-tx28/tx28-stk5.c index 81cb80c7e0..8427dc2391 100644 --- a/arch/arm/boards/karo-tx28/tx28-stk5.c +++ b/arch/arm/boards/karo-tx28/tx28-stk5.c @@ -35,24 +35,12 @@ static struct mxs_mci_platform_data mci_pdata = { .f_max = 25000000, }; -static struct device_d mci_socket = { - .name = "mxs_mci", - .map_base = IMX_SSP0_BASE, - .platform_data = &mci_pdata, -}; - /* PhyAD[0..2]=0, RMIISEL=1 */ static struct fec_platform_data fec_info = { .xcv_type = RMII, .phy_addr = 0, }; -static struct device_d fec_dev = { - .name = "fec_imx", - .map_base = IMX_FEC0_BASE, - .platform_data = &fec_info, -}; - /* * The TX28 EVK comes with a VGA connector. We can support many video modes * @@ -215,13 +203,6 @@ static struct imx_fb_platformdata tx28_fb_pdata = { .enable = tx28_fb_enable, }; -static struct device_d ldcif_dev = { - .name = "stmfb", - .map_base = IMX_FB_BASE, - .size = 4096, - .platform_data = &tx28_fb_pdata, -}; - static const uint32_t tx28_starterkit_pad_setup[] = { /* * Part II of phy's initialization @@ -378,17 +359,20 @@ void base_board_init(void) /* run the SSP unit clock at 100 MHz */ imx_set_sspclk(0, 100000000, 1); - register_device(&mci_socket); + add_generic_device("mxs_mci", 0, NULL, IMX_SSP0_BASE, 0, + IORESOURCE_MEM, &mci_pdata); if (tx28_fb_pdata.fixed_screen < (void *)&_end) { printf("Warning: fixed_screen overlaps barebox\n"); tx28_fb_pdata.fixed_screen = NULL; } - register_device(&ldcif_dev); + add_generic_device("stmfb", 0, NULL, IMX_FB_BASE, 4096, + IORESOURCE_MEM, &tx28_fb_pdata); imx_enable_enetclk(); - register_device(&fec_dev); + add_generic_device("fec_imx", 0, NULL, IMX_FEC0_BASE, 0, + IORESOURCE_MEM, &fec_info); ret = register_persistent_environment(); if (ret != 0) @@ -396,15 +380,12 @@ void base_board_init(void) "storage (%d)\n", ret); } -static struct device_d tx28kit_serial_device = { - .name = "stm_serial", - .map_base = IMX_DBGUART_BASE, - .size = 8192, -}; - static int tx28kit_console_init(void) { - return register_device(&tx28kit_serial_device); + add_generic_device("stm_serial", 0, NULL, IMX_DBGUART_BASE, 8192, + IORESOURCE_MEM, NULL); + + return 0; } console_initcall(tx28kit_console_init); diff --git a/arch/arm/boards/karo-tx28/tx28.c b/arch/arm/boards/karo-tx28/tx28.c index 1f47a8d30f..def388a8d9 100644 --- a/arch/arm/boards/karo-tx28/tx28.c +++ b/arch/arm/boards/karo-tx28/tx28.c @@ -23,19 +23,6 @@ #include <mach/imx-regs.h> #include <asm/mmu.h> -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = IMX_MEMORY_BASE, - .size = 128 * 1024 * 1024, - .platform_data = &ram_pdata, -}; - /* setup the CPU card internal signals */ static const uint32_t tx28_pad_setup[] = { /* NAND interface */ @@ -83,22 +70,13 @@ static const uint32_t tx28_pad_setup[] = { extern void base_board_init(void); -#ifdef CONFIG_MMU -static int tx28_mmu_init(void) +static int tx28_mem_init(void) { - mmu_init(); - - arm_create_section(0x40000000, 0x40000000, 128, PMD_SECT_DEF_CACHED); - arm_create_section(0x50000000, 0x40000000, 128, PMD_SECT_DEF_UNCACHED); - - setup_dma_coherent(0x10000000); - - mmu_enable(); + arm_add_mem_device("ram0", IMX_MEMORY_BASE, 128 * 1024 * 1024); return 0; } -postcore_initcall(tx28_mmu_init); -#endif +mem_initcall(tx28_mem_init); static int tx28_devices_init(void) { @@ -108,10 +86,7 @@ static int tx28_devices_init(void) for (i = 0; i < ARRAY_SIZE(tx28_pad_setup); i++) imx_gpio_mode(tx28_pad_setup[i]); - register_device(&sdram_dev); - - armlinux_add_dram(&sdram_dev); - armlinux_set_bootparams((void *)(sdram_dev.map_base + 0x100)); + armlinux_set_bootparams((void *)IMX_MEMORY_BASE + 0x100); armlinux_set_architecture(MACH_TYPE_TX28); base_board_init(); diff --git a/arch/arm/boards/mini2440/mini2440.c b/arch/arm/boards/mini2440/mini2440.c index dcc7c3f8a4..fd1f2f27c3 100644 --- a/arch/arm/boards/mini2440/mini2440.c +++ b/arch/arm/boards/mini2440/mini2440.c @@ -44,29 +44,11 @@ #include <mach/mci.h> #include <mach/fb.h> -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = CS6_BASE, - .platform_data = &ram_pdata, -}; - static struct s3c24x0_nand_platform_data nand_info = { .nand_timing = CALC_NFCONF_TIMING(A9M2440_TACLS, A9M2440_TWRPH0, A9M2440_TWRPH1), .flash_bbt = 1, /* same as the kernel */ }; -static struct device_d nand_dev = { - .name = "s3c24x0_nand", - .map_base = S3C24X0_NAND_BASE, - .platform_data = &nand_info, -}; - /* * dm9000 network controller onboard * Connected to CS line 4 and interrupt line EINT7, @@ -75,19 +57,9 @@ static struct device_d nand_dev = { * Area 2: Offset 0x304...0x307 */ static struct dm9000_platform_data dm9000_data = { - .iobase = CS4_BASE + 0x300, - .iodata = CS4_BASE + 0x304, - .buswidth = DM9000_WIDTH_16, .srom = 1, }; -static struct device_d dm9000_dev = { - .name = "dm9000", - .map_base = CS4_BASE + 0x300, - .size = 8, - .platform_data = &dm9000_data, -}; - static struct s3c_mci_platform_data mci_data = { .caps = MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz, .voltages = MMC_VDD_32_33 | MMC_VDD_33_34, @@ -95,12 +67,6 @@ static struct s3c_mci_platform_data mci_data = { .detect_invert = 0, }; -static struct device_d mci_dev = { - .name = "s3c_mci", - .map_base = S3C2410_SDI_BASE, - .platform_data = &mci_data, -}; - static struct fb_videomode s3c24x0_fb_modes[] = { #ifdef CONFIG_MINI2440_VIDEO_N35 { @@ -166,12 +132,6 @@ static struct s3c_fb_platform_data s3c24x0_fb_data = { .passive_display = 0, }; -static struct device_d s3cfb_dev = { - .name = "s3c_fb", - .map_base = S3C2410_LCD_BASE, - .platform_data = &s3c24x0_fb_data, -}; - static const unsigned pin_usage[] = { /* address bus, used by NOR, SDRAM */ GPA1_ADDR16, @@ -303,13 +263,19 @@ static const unsigned pin_usage[] = { GPH7_RXD2, }; +static int mini2440_mem_init(void) +{ + arm_add_mem_device("ram0", CS6_BASE, s3c24x0_get_memory_size()); + + return 0; +} +mem_initcall(mini2440_mem_init); + static int mini2440_devices_init(void) { uint32_t reg; int i; - sdram_dev.size = s3c24x0_get_memory_size(); - /* ----------- configure the access to the outer space ---------- */ for (i = 0; i < ARRAY_SIZE(pin_usage); i++) s3c_gpio_mode(pin_usage[i]); @@ -328,9 +294,11 @@ static int mini2440_devices_init(void) reg |= 0x10000; writel(reg, MISCCR); - register_device(&nand_dev); - register_device(&sdram_dev); - register_device(&dm9000_dev); + add_generic_device("s3c24x0_nand", -1, NULL, S3C24X0_NAND_BASE, 0, + IORESOURCE_MEM, &nand_info); + + add_dm9000_device(0, CS4_BASE + 0x300, CS4_BASE + 0x304, + IORESOURCE_MEM_16BIT, &dm9000_data); #ifdef CONFIG_NAND /* ----------- add some vital partitions -------- */ devfs_del_partition("self_raw"); @@ -341,10 +309,11 @@ static int mini2440_devices_init(void) devfs_add_partition("nand0", 0x40000, 0x20000, PARTITION_FIXED, "env_raw"); dev_add_bb_dev("env_raw", "env0"); #endif - register_device(&mci_dev); - register_device(&s3cfb_dev); - armlinux_add_dram(&sdram_dev); - armlinux_set_bootparams((void *)sdram_dev.map_base + 0x100); + add_generic_device("s3c_mci", 0, NULL, S3C2410_SDI_BASE, 0, + IORESOURCE_MEM, &mci_data); + add_generic_device("s3c_fb", 0, NULL, S3C2410_LCD_BASE, 0, + IORESOURCE_MEM, &s3c24x0_fb_data); + armlinux_set_bootparams((void*)CS6_BASE + 0x100); armlinux_set_architecture(MACH_TYPE_MINI2440); return 0; @@ -359,12 +328,6 @@ void __bare_init nand_boot(void) } #endif -static struct device_d mini2440_serial_device = { - .name = "s3c24x0_serial", - .map_base = UART1_BASE, - .size = UART1_SIZE, -}; - static int mini2440_console_init(void) { /* @@ -376,7 +339,8 @@ static int mini2440_console_init(void) s3c_gpio_mode(GPH2_TXD0); s3c_gpio_mode(GPH3_RXD0); - register_device(&mini2440_serial_device); + add_generic_device("s3c24x0_serial", -1, NULL, UART1_BASE, UART1_SIZE, + IORESOURCE_MEM, NULL); return 0; } diff --git a/arch/arm/boards/mmccpu/init.c b/arch/arm/boards/mmccpu/init.c index 7cba01c4f0..36bc193bfc 100644 --- a/arch/arm/boards/mmccpu/init.c +++ b/arch/arm/boards/mmccpu/init.c @@ -37,18 +37,19 @@ #include <mach/gpio.h> #include <mach/io.h> -static struct device_d cfi_dev = { - .id = -1, - .name = "cfi_flash", - .map_base = AT91_CHIPSELECT_0, - .size = 0, /* zero means autodetect size */ -}; - static struct at91_ether_platform_data macb_pdata = { .flags = AT91SAM_ETHER_MII | AT91SAM_ETHER_FORCE_LINK, .phy_addr = 4, }; +static int mmccpu_mem_init(void) +{ + at91_add_device_sdram(128 * 1024 * 1024); + + return 0; +} +mem_initcall(mmccpu_mem_init); + static int mmccpu_devices_init(void) { /* @@ -59,9 +60,8 @@ static int mmccpu_devices_init(void) at91_set_gpio_output(AT91_PIN_PB27, 1); at91_set_gpio_value(AT91_PIN_PB27, 1); /* 1- enable, 0 - disable */ - at91_add_device_sdram(128 * 1024 * 1024); at91_add_device_eth(&macb_pdata); - register_device(&cfi_dev); + add_cfi_flash_device(0, AT91_CHIPSELECT_0, 0, 0); devfs_add_partition("nor0", 0x00000, 256 * 1024, PARTITION_FIXED, "self0"); devfs_add_partition("nor0", 0x40000, 128 * 1024, PARTITION_FIXED, "env0"); diff --git a/arch/arm/boards/netx/netx.c b/arch/arm/boards/netx/netx.c index c735d26bc4..92d2911e68 100644 --- a/arch/arm/boards/netx/netx.c +++ b/arch/arm/boards/netx/netx.c @@ -30,51 +30,27 @@ #include <generated/mach-types.h> #include <mach/netx-eth.h> -static struct device_d cfi_dev = { - .id = -1, - .name = "cfi_flash", - .map_base = 0xC0000000, - .size = 32 * 1024 * 1024, -}; - -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = 0x80000000, - .size = 64 * 1024 * 1024, - .platform_data = &ram_pdata, -}; - struct netx_eth_platform_data eth0_data = { .xcno = 0, }; -static struct device_d netx_eth_dev0 = { - .id = -1, - .name = "netx-eth", - .platform_data = ð0_data, -}; - struct netx_eth_platform_data eth1_data = { .xcno = 1, }; -static struct device_d netx_eth_dev1 = { - .id = -1, - .name = "netx-eth", - .platform_data = ð1_data, -}; +static int netx_mem_init(void) +{ + arm_add_mem_device("ram0", 0x80000000, 64 * 1024 * 1024); + + return 0; +} +mem_initcall(netx_mem_init); static int netx_devices_init(void) { - register_device(&cfi_dev); - register_device(&sdram_dev); - register_device(&netx_eth_dev0); - register_device(&netx_eth_dev1); + add_cfi_flash_device(-1, 0xC0000000, 32 * 1024 * 1024, 0); + + add_generic_device("netx-eth", -1, NULL, 0, 0, IORESOURCE_MEM, ð0_data); + add_generic_device("netx-eth", -1, NULL, 0, 0, IORESOURCE_MEM, ð1_data); devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self0"); @@ -83,7 +59,6 @@ static int netx_devices_init(void) { protect_file("/dev/env0", 1); - armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0x80000100); armlinux_set_architecture(MACH_TYPE_NXDB500); @@ -92,13 +67,6 @@ static int netx_devices_init(void) { device_initcall(netx_devices_init); -static struct device_d netx_serial_device = { - .id = -1, - .name = "netx_serial", - .map_base = NETX_PA_UART0, - .size = 0x40, -}; - static int netx_console_init(void) { /* configure gpio for serial */ @@ -107,7 +75,8 @@ static int netx_console_init(void) *(volatile unsigned long *)(0x00100808) = 2; *(volatile unsigned long *)(0x0010080c) = 2; - register_device(&netx_serial_device); + add_generic_device("netx_serial", -1, NULL, NETX_PA_UART0, 0x40, + IORESOURCE_MEM, NULL); return 0; } diff --git a/arch/arm/boards/nhk8815/setup.c b/arch/arm/boards/nhk8815/setup.c index 9cb0fd0494..dcf716620d 100644 --- a/arch/arm/boards/nhk8815/setup.c +++ b/arch/arm/boards/nhk8815/setup.c @@ -33,13 +33,6 @@ #include <mach/nand.h> #include <mach/fsmc.h> -static struct device_d nhk8815_network_dev = { - .id = -1, - .name = "smc91c111", - .map_base = 0x34000300, - .size = 16, -}; - static int nhk8815_nand_init(void) { /* FSMC setup for nand chip select (8-bit nand in 8815NHK) */ @@ -54,24 +47,45 @@ static int nhk8815_nand_init(void) } static struct nomadik_nand_platform_data nhk8815_nand_data = { - .addr_va = NAND_IO_ADDR, - .cmd_va = NAND_IO_CMD, - .data_va = NAND_IO_DATA, .options = NAND_COPYBACK | NAND_CACHEPRG | NAND_NO_PADDING \ | NAND_NO_READRDY | NAND_NO_AUTOINCR, .init = nhk8815_nand_init, }; +static struct resource nhk8815_nand_resources[] = { + { + .start = NAND_IO_ADDR, + .size = 0xfff, + .flags = IORESOURCE_MEM, + }, { + .start = NAND_IO_CMD, + .size = 0xfff, + .flags = IORESOURCE_MEM, + }, { + .start = NAND_IO_DATA, + .size = 0xfff, + .flags = IORESOURCE_MEM, + } +}; + static struct device_d nhk8815_nand_device = { .id = -1, .name = "nomadik_nand", + .num_resources = ARRAY_SIZE(nhk8815_nand_resources), + .resource = nhk8815_nand_resources, .platform_data = &nhk8815_nand_data, }; -static int nhk8815_devices_init(void) +static int nhk8815_mem_init(void) { st8815_add_device_sdram(64 * 1024 *1024); + return 0; +} +mem_initcall(nhk8815_mem_init); + +static int nhk8815_devices_init(void) +{ writel(0xC37800F0, NOMADIK_GPIO1_BASE + 0x20); writel(0x00000000, NOMADIK_GPIO1_BASE + 0x24); writel(0x00000000, NOMADIK_GPIO1_BASE + 0x28); @@ -81,7 +95,8 @@ static int nhk8815_devices_init(void) writel(0x0000305b, FSMC_BCR(1)); writel(0x00033f33, FSMC_BTR(1)); - register_device(&nhk8815_network_dev); + add_generic_device("smc91c111", -1, NULL, 0x34000300, 16, + IORESOURCE_MEM, NULL); register_device(&nhk8815_nand_device); diff --git a/arch/arm/boards/omap/board-beagle.c b/arch/arm/boards/omap/board-beagle.c index ced3df742d..49af40cf75 100644 --- a/arch/arm/boards/omap/board-beagle.c +++ b/arch/arm/boards/omap/board-beagle.c @@ -237,17 +237,6 @@ void board_init(void) static struct NS16550_plat serial_plat = { .clock = 48000000, /* 48MHz (APLL96/2) */ - .f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR, - .reg_read = omap_uart_read, - .reg_write = omap_uart_write, -}; - -static struct device_d beagle_serial_device = { - .id = -1, - .name = "serial_ns16550", - .map_base = OMAP_UART3_BASE, - .size = 1024, - .platform_data = (void *)&serial_plat, }; /** @@ -259,24 +248,14 @@ static struct device_d beagle_serial_device = { static int beagle_console_init(void) { /* Register the serial port */ - return register_device(&beagle_serial_device); + add_ns16550_device(-1, OMAP_UART3_BASE, 1024, IORESOURCE_MEM_8BIT, + &serial_plat); + + return 0; } console_initcall(beagle_console_init); #endif /* CONFIG_DRIVER_SERIAL_NS16550 */ -static struct memory_platform_data sram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = 0x80000000, - .size = 128 * 1024 * 1024, - .platform_data = &sram_pdata, -}; - #ifdef CONFIG_USB_EHCI_OMAP static struct omap_hcd omap_ehci_pdata = { .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, @@ -290,52 +269,33 @@ static struct omap_hcd omap_ehci_pdata = { static struct ehci_platform_data ehci_pdata = { .flags = 0, - .hccr_offset = 0x100, - .hcor_offset = 0x110, -}; - -static struct device_d usbh_dev = { - .id = -1, - .name = "ehci", - .map_base = 0x48064700, - .size = 4 * 1024, - .platform_data = &ehci_pdata, }; #endif /* CONFIG_USB_EHCI_OMAP */ -static struct device_d i2c_dev = { - .id = -1, - .name = "i2c-omap", - .map_base = OMAP_I2C1_BASE, -}; - static struct i2c_board_info i2c_devices[] = { { I2C_BOARD_INFO("twl4030", 0x48), }, }; -static struct device_d hsmmc_dev = { - .id = -1, - .name = "omap-hsmmc", - .map_base = 0x4809C000, - .size = SZ_4K, -}; - -static int beagle_devices_init(void) +static int beagle_mem_init(void) { - int ret; + arm_add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024); - ret = register_device(&sdram_dev); - if (ret) - goto failed; + return 0; +} +mem_initcall(beagle_mem_init); +static int beagle_devices_init(void) +{ i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices)); - register_device(&i2c_dev); + add_generic_device("i2c-omap", -1, NULL, 0x4809C000, SZ_4K, + IORESOURCE_MEM, NULL); #ifdef CONFIG_USB_EHCI_OMAP if (ehci_omap_init(&omap_ehci_pdata) >= 0) - register_device(&usbh_dev); + add_usb_ehci_device(-1, 0x48064700 + 0x100, + 0x48064700 + 0x110, &ehci_pdata); #endif /* CONFIG_USB_EHCI_OMAP */ #ifdef CONFIG_GPMC /* WP is made high and WAIT1 active Low */ @@ -343,13 +303,13 @@ static int beagle_devices_init(void) #endif gpmc_generic_nand_devices_init(0, 16, OMAP_ECC_HAMMING_CODE_HW_ROMCODE); - register_device(&hsmmc_dev); + add_generic_device("omap-hsmmc", -1, NULL, OMAP_I2C1_BASE, 0, + IORESOURCE_MEM, NULL); - armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0x80000100); armlinux_set_architecture(MACH_TYPE_OMAP3_BEAGLE); -failed: - return ret; + + return 0; } device_initcall(beagle_devices_init); diff --git a/arch/arm/boards/omap/board-omap3evm.c b/arch/arm/boards/omap/board-omap3evm.c index c37f1519ff..a2532d5c02 100644 --- a/arch/arm/boards/omap/board-omap3evm.c +++ b/arch/arm/boards/omap/board-omap3evm.c @@ -58,6 +58,7 @@ #include <mach/control.h> #include <mach/omap3-mux.h> #include <mach/gpmc.h> +#include <errno.h> #include "board.h" @@ -212,21 +213,6 @@ void board_init(void) static struct NS16550_plat serial_plat = { .clock = 48000000, /* 48MHz (APLL96/2) */ - .f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR, - .reg_read = omap_uart_read, - .reg_write = omap_uart_write, -}; - -static struct device_d omap3evm_serial_device = { - .id = -1, - .name = "serial_ns16550", -#if defined(CONFIG_OMAP3EVM_UART1) - .map_base = OMAP_UART1_BASE, -#elif defined(CONFIG_OMAP3EVM_UART3) - .map_base = OMAP_UART3_BASE, -#endif - .size = 1024, - .platform_data = (void *)&serial_plat, }; /** @@ -236,42 +222,35 @@ static struct device_d omap3evm_serial_device = { */ static int omap3evm_init_console(void) { - return register_device(&omap3evm_serial_device); + add_ns16550_device(-1, +#if defined(CONFIG_OMAP3EVM_UART1) + OMAP_UART1_BASE, +#elif defined(CONFIG_OMAP3EVM_UART3) + OMAP_UART3_BASE, +#endif + 1024, IORESOURCE_MEM_8BIT, &serial_plat); + + return 0; } console_initcall(omap3evm_init_console); #endif /* CONFIG_DRIVER_SERIAL_NS16550 */ -static struct memory_platform_data sram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; +static int omap3evm_mem_init(void) +{ + arm_add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024); -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = 0x80000000, - .size = 128 * 1024 * 1024, - .platform_data = &sram_pdata, -}; + return 0; +} +mem_initcall(omap3evm_mem_init); static int omap3evm_init_devices(void) { - int ret; - - ret = register_device(&sdram_dev); - if (ret) - goto failed; - #ifdef CONFIG_GPMC /* * WP is made high and WAIT1 active Low */ gpmc_generic_init(0x10); #endif - - armlinux_add_dram(&sdram_dev); - -failed: - return ret; + return 0; } device_initcall(omap3evm_init_devices); diff --git a/arch/arm/boards/omap/board-sdp343x.c b/arch/arm/boards/omap/board-sdp343x.c index f7615b4673..82fc16df63 100644 --- a/arch/arm/boards/omap/board-sdp343x.c +++ b/arch/arm/boards/omap/board-sdp343x.c @@ -61,6 +61,7 @@ #include <mach/control.h> #include <mach/omap3-mux.h> #include <mach/gpmc.h> +#include <errno.h> #include "board.h" /******************** Board Boot Time *******************/ @@ -604,17 +605,6 @@ static void mux_config(void) static struct NS16550_plat serial_plat = { .clock = 48000000, /* 48MHz (APLL96/2) */ - .f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR, - .reg_read = omap_uart_read, - .reg_write = omap_uart_write, -}; - -static struct device_d sdp3430_serial_device = { - .id = -1, - .name = "serial_ns16550", - .map_base = OMAP_UART3_BASE, - .size = 1024, - .platform_data = (void *)&serial_plat, }; /** @@ -625,50 +615,31 @@ static struct device_d sdp3430_serial_device = { static int sdp3430_console_init(void) { /* Register the serial port */ - return register_device(&sdp3430_serial_device); + add_ns16550_device(-1, OMAP_UART3_BASE, 1024, IORESOURCE_MEM_8BIT, + &serial_plat); + + return 0; } console_initcall(sdp3430_console_init); #endif /* CONFIG_DRIVER_SERIAL_NS16550 */ -/*------------------------- FLASH Devices -----------------------------------*/ -static int sdp3430_flash_init(void) +static int sdp3430_mem_init(void) { -#ifdef CONFIG_GPMC - /* WP is made high and WAIT1 active Low */ - gpmc_generic_init(0x10); -#endif + arm_add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024); + return 0; } - -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = 0x80000000, - .size = 128 * 1024 * 1024, - .platform_data = &ram_pdata, -}; - -/*-----------------------Generic Devices Initialization ---------------------*/ +mem_initcall(sdp3430_mem_init); static int sdp3430_devices_init(void) { - int ret; - ret = register_device(&sdram_dev); - if (ret) - goto failed; - ret = sdp3430_flash_init(); - if (ret) - goto failed; +#ifdef CONFIG_GPMC + /* WP is made high and WAIT1 active Low */ + gpmc_generic_init(0x10); +#endif - armlinux_add_dram(&sdram_dev); -failed: - return ret; + return 0; } device_initcall(sdp3430_devices_init); diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c index ff05f9e24b..1303c47233 100644 --- a/arch/arm/boards/panda/board.c +++ b/arch/arm/boards/panda/board.c @@ -32,66 +32,29 @@ static int board_revision; static struct NS16550_plat serial_plat = { .clock = 48000000, /* 48MHz (APLL96/2) */ - .f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR, - .reg_read = omap_uart_read, - .reg_write = omap_uart_write, -}; - -static struct device_d panda_serial_device = { - .id = -1, - .name = "serial_ns16550", - .map_base = OMAP44XX_UART3_BASE, - .size = 1024, - .platform_data = (void *)&serial_plat, }; static int panda_console_init(void) { /* Register the serial port */ - return register_device(&panda_serial_device); + add_ns16550_device(-1, OMAP44XX_UART3_BASE, 1024, IORESOURCE_MEM_8BIT, + &serial_plat); + + return 0; } console_initcall(panda_console_init); -static struct memory_platform_data sram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = 0x80000000, - .size = SZ_1G, - .platform_data = &sram_pdata, -}; - -#ifdef CONFIG_MMU -static int panda_mmu_init(void) +static int panda_mem_init(void) { - mmu_init(); - - arm_create_section(0x80000000, 0x80000000, 256, PMD_SECT_DEF_CACHED); - arm_create_section(0x90000000, 0x80000000, 256, PMD_SECT_DEF_UNCACHED); - - mmu_enable(); + arm_add_mem_device("ram0", 0x80000000, SZ_1G); return 0; } -device_initcall(panda_mmu_init); -#endif +mem_initcall(panda_mem_init); +#ifdef CONFIG_USB_EHCI static struct ehci_platform_data ehci_pdata = { .flags = 0, - .hccr_offset = 0x0, - .hcor_offset = 0x10, -}; - -static struct device_d usbh_dev = { - .id = -1, - .name = "ehci", - .map_base = 0x4a064c00, - .size = 4 * 1024, - .platform_data = &ehci_pdata, }; static void panda_ehci_init(void) @@ -124,8 +87,13 @@ static void panda_ehci_init(void) /* enable power to hub */ gpio_set_value(GPIO_HUB_POWER, 1); - register_device(&usbh_dev); + add_usb_ehci_device(-1, 0x4a064c00, + 0x4a064c00 + 0x10, &ehci_pdata); } +#else +static void panda_ehci_init(void) +{} +#endif static void __init panda_boardrev_init(void) { @@ -136,13 +104,6 @@ static void __init panda_boardrev_init(void) pr_info("PandaBoard Revision: %03d\n", board_revision); } -static struct device_d hsmmc_dev = { - .id = -1, - .name = "omap-hsmmc", - .map_base = 0x4809C100, - .size = SZ_4K, -}; - static int panda_devices_init(void) { panda_boardrev_init(); @@ -171,11 +132,10 @@ static int panda_devices_init(void) sr32(OMAP44XX_SCRM_ALTCLKSRC, 2, 2, 0x3); } - register_device(&sdram_dev); - register_device(&hsmmc_dev); + add_generic_device("omap-hsmmc", -1, NULL, 0x4809C100, SZ_4K, + IORESOURCE_MEM, NULL); panda_ehci_init(); - armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0x80000100); armlinux_set_architecture(MACH_TYPE_OMAP4_PANDA); diff --git a/arch/arm/boards/pcm037/pcm037.c b/arch/arm/boards/pcm037/pcm037.c index cb4ffe69f4..85f004fe48 100644 --- a/arch/arm/boards/pcm037/pcm037.c +++ b/arch/arm/boards/pcm037/pcm037.c @@ -39,87 +39,18 @@ #include <mach/imx-nand.h> #include <mach/devices-imx31.h> -/* - * Up to 32MiB NOR type flash, connected to - * CS line 0, data width is 16 bit - */ -static struct device_d cfi_dev = { - .id = -1, - .name = "cfi_flash", - .map_base = IMX_CS0_BASE, - .size = 32 * 1024 * 1024, /* area size */ -}; - -/* - * up to 2MiB static RAM type memory, connected - * to CS4, data width is 16 bit - */ -static struct memory_platform_data sram_dev_pdata0 = { - .name = "sram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sram_dev = { - .id = -1, - .name = "mem", - .map_base = IMX_CS4_BASE, - .size = IMX_CS4_RANGE, /* area size */ - .platform_data = &sram_dev_pdata0, -}; - -/* - * SMSC 9217 network controller - * connected to CS line 1 and interrupt line - * GPIO3, data width is 16 bit - */ -static struct device_d network_dev = { - .id = -1, - .name = "smc911x", - .map_base = IMX_CS1_BASE, - .size = IMX_CS1_RANGE, /* area size */ -}; - #if defined CONFIG_PCM037_SDRAM_BANK0_128MB #define SDRAM0 128 #elif defined CONFIG_PCM037_SDRAM_BANK0_256MB #define SDRAM0 256 #endif -static struct memory_platform_data ram_dev_pdata0 = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram0_dev = { - .id = -1, - .name = "mem", - .map_base = IMX_SDRAM_CS0, - .size = SDRAM0 * 1024 * 1024, /* fix size */ - .platform_data = &ram_dev_pdata0, -}; - -#ifndef CONFIG_PCM037_SDRAM_BANK1_NONE - #if defined CONFIG_PCM037_SDRAM_BANK1_128MB #define SDRAM1 128 #elif defined CONFIG_PCM037_SDRAM_BANK1_256MB #define SDRAM1 256 #endif -static struct memory_platform_data ram_dev_pdata1 = { - .name = "ram1", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram1_dev = { - .id = -1, - .name = "mem", - .map_base = IMX_SDRAM_CS1, - .size = SDRAM1 * 1024 * 1024, /* fix size */ - .platform_data = &ram_dev_pdata1, -}; -#endif - struct imx_nand_platform_data nand_info = { .width = 1, .hw_ecc = 1, @@ -127,20 +58,6 @@ struct imx_nand_platform_data nand_info = { }; #ifdef CONFIG_USB -static struct device_d usbotg_dev = { - .id = -1, - .name = "ehci", - .map_base = IMX_OTG_BASE, - .size = 0x200, -}; - -static struct device_d usbh2_dev = { - .id = -1, - .name = "ehci", - .map_base = IMX_OTG_BASE + 0x400, - .size = 0x200, -}; - static void pcm037_usb_init(void) { u32 tmp; @@ -229,32 +146,27 @@ static void pcm037_usb_init(void) } #endif -#ifdef CONFIG_MMU -static void pcm037_mmu_init(void) +static int pcm037_mem_init(void) { - mmu_init(); - - arm_create_section(0x80000000, 0x80000000, 128, PMD_SECT_DEF_CACHED); - arm_create_section(0x90000000, 0x80000000, 128, PMD_SECT_DEF_UNCACHED); - - setup_dma_coherent(0x10000000); - - mmu_enable(); - -#ifdef CONFIG_CACHE_L2X0 - l2x0_init((void __iomem *)0x30000000, 0x00030024, 0x00000000); + arm_add_mem_device("ram0", IMX_SDRAM_CS0, SDRAM0 * 1024 * 1024); +#ifndef CONFIG_PCM037_SDRAM_BANK1_NONE + arm_add_mem_device("ram1", IMX_SDRAM_CS1, SDRAM1 * 1024 * 1024); #endif + + return 0; } -#else -static void pcm037_mmu_init(void) +mem_initcall(pcm037_mem_init); + +static int pcm037_mmu_init(void) { + l2x0_init((void __iomem *)0x30000000, 0x00030024, 0x00000000); + + return 0; } -#endif +postmmu_initcall(pcm037_mmu_init); static int imx31_devices_init(void) { - pcm037_mmu_init(); - __REG(CSCR_U(0)) = 0x0000cf03; /* CS0: Nor Flash */ __REG(CSCR_L(0)) = 0x10000d03; __REG(CSCR_A(0)) = 0x00720900; @@ -271,7 +183,11 @@ static int imx31_devices_init(void) __REG(CSCR_L(5)) = 0x444A0301; __REG(CSCR_A(5)) = 0x44443302; - register_device(&cfi_dev); + /* + * Up to 32MiB NOR type flash, connected to + * CS line 0, data width is 16 bit + */ + add_cfi_flash_device(-1, IMX_CS0_BASE, 32 * 1024 * 1024, 0); /* * Create partitions that should be @@ -282,24 +198,28 @@ static int imx31_devices_init(void) protect_file("/dev/env0", 1); - register_device(&sram_dev); + /* + * up to 2MiB static RAM type memory, connected + * to CS4, data width is 16 bit + */ + add_mem_device("sram0", IMX_CS4_BASE, IMX_CS4_RANGE, /* area size */ + IORESOURCE_MEM_WRITEABLE); imx31_add_nand(&nand_info); - register_device(&network_dev); - register_device(&sdram0_dev); -#ifndef CONFIG_PCM037_SDRAM_BANK1_NONE - register_device(&sdram1_dev); -#endif + /* + * SMSC 9217 network controller + * connected to CS line 1 and interrupt line + * GPIO3, data width is 16 bit + */ + add_generic_device("smc911x", -1, NULL, IMX_CS1_BASE, IMX_CS1_RANGE, + IORESOURCE_MEM, NULL); + #ifdef CONFIG_USB pcm037_usb_init(); - register_device(&usbotg_dev); - register_device(&usbh2_dev); + add_generic_usb_ehci_device(-1, IMX_OTG_BASE, NULL); + add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL); #endif - armlinux_add_dram(&sdram0_dev); -#ifndef CONFIG_PCM037_SDRAM_BANK1_NONE - armlinux_add_dram(&sdram1_dev); -#endif armlinux_set_bootparams((void *)0x80000100); armlinux_set_architecture(MACH_TYPE_PCM037); diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c index 3ca6650443..4db50fe8c0 100644 --- a/arch/arm/boards/pcm038/pcm038.c +++ b/arch/arm/boards/pcm038/pcm038.c @@ -47,39 +47,6 @@ #include "pll.h" -static struct device_d cfi_dev = { - .id = -1, - .name = "cfi_flash", - .map_base = 0xC0000000, - .size = 32 * 1024 * 1024, -}; - -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = 0xa0000000, - .size = 128 * 1024 * 1024, - .platform_data = &ram_pdata, -}; - -static struct memory_platform_data sram_pdata = { - .name = "sram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sram_dev = { - .id = -1, - .name = "mem", - .map_base = 0xc8000000, - .size = 512 * 1024, /* Can be up to 2MiB */ - .platform_data = &sram_pdata, -}; - static struct fec_platform_data fec_info = { .xcv_type = MII100, .phy_addr = 1, @@ -142,13 +109,6 @@ static struct imx_fb_platform_data pcm038_fb_data = { }; #ifdef CONFIG_USB -static struct device_d usbh2_dev = { - .id = -1, - .name = "ehci", - .map_base = IMX_OTG_BASE + 0x400, - .size = 0x200, -}; - static void pcm038_usbh_init(void) { uint32_t temp; @@ -169,23 +129,15 @@ static void pcm038_usbh_init(void) } #endif -#ifdef CONFIG_MMU -static void pcm038_mmu_init(void) +static int pcm038_mem_init(void) { - mmu_init(); - - arm_create_section(0xa0000000, 0xa0000000, 128, PMD_SECT_DEF_CACHED); - arm_create_section(0xb0000000, 0xa0000000, 128, PMD_SECT_DEF_UNCACHED); + arm_add_mem_device("ram0", 0xa0000000, 128 * 1024 * 1024); - setup_dma_coherent(0x10000000); - - mmu_enable(); -} -#else -static void pcm038_mmu_init(void) -{ + add_mem_device("ram0", 0xc8000000, 512 * 1024, /* Can be up to 2MiB */ + IORESOURCE_MEM_WRITEABLE); + return 0; } -#endif +mem_initcall(pcm038_mem_init); static int pcm038_devices_init(void) { @@ -263,8 +215,6 @@ static int pcm038_devices_init(void) PD26_AF_USBH2_DATA5, }; - pcm038_mmu_init(); - /* configure 16 bit nor flash on cs0 */ CS0U = 0x0000CC03; CS0L = 0xa0330D01; @@ -289,18 +239,17 @@ static int pcm038_devices_init(void) gpio_direction_output(GPIO_PORTD | 28, 0); gpio_set_value(GPIO_PORTD | 28, 0); + spi_register_board_info(pcm038_spi_board_info, ARRAY_SIZE(pcm038_spi_board_info)); imx27_add_spi0(&pcm038_spi_0_data); - register_device(&cfi_dev); + add_cfi_flash_device(-1, 0xC0000000, 32 * 1024 * 1024, 0); imx27_add_nand(&nand_info); - register_device(&sdram_dev); - register_device(&sram_dev); imx27_add_fb(&pcm038_fb_data); #ifdef CONFIG_USB pcm038_usbh_init(); - register_device(&usbh2_dev); + add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL); #endif /* Register the fec device after the PLL re-initialisation @@ -330,7 +279,6 @@ static int pcm038_devices_init(void) printf("Using environment in %s Flash\n", envdev); - armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0xa0000100); armlinux_set_architecture(MACH_TYPE_PCM038); diff --git a/arch/arm/boards/pcm043/pcm043.c b/arch/arm/boards/pcm043/pcm043.c index 7db3c836c3..966899a5ba 100644 --- a/arch/arm/boards/pcm043/pcm043.c +++ b/arch/arm/boards/pcm043/pcm043.c @@ -46,34 +46,10 @@ #include <mach/iomux-mx35.h> #include <mach/devices-imx35.h> -/* - * Up to 32MiB NOR type flash, connected to - * CS line 0, data width is 16 bit - */ -static struct device_d cfi_dev = { - .id = -1, - .name = "cfi_flash", - .map_base = IMX_CS0_BASE, - .size = 32 * 1024 * 1024, /* area size */ -}; - static struct fec_platform_data fec_info = { .xcv_type = MII100, }; -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram0_dev = { - .id = -1, - .name = "mem", - .map_base = IMX_SDRAM_CS0, - .size = 128 * 1024 * 1024, - .platform_data = &ram_pdata, -}; - struct imx_nand_platform_data nand_info = { .width = 1, .hw_ecc = 1, @@ -123,25 +99,21 @@ static struct imx_ipu_fb_platform_data ipu_fb_data = { .bpp = 16, }; -#ifdef CONFIG_MMU -static int pcm043_mmu_init(void) +static int pcm043_mem_init(void) { - mmu_init(); - - arm_create_section(0x80000000, 0x80000000, 128, PMD_SECT_DEF_CACHED); - arm_create_section(0x90000000, 0x80000000, 128, PMD_SECT_DEF_UNCACHED); - - setup_dma_coherent(0x10000000); + arm_add_mem_device("ram0", IMX_SDRAM_CS0, 128 * 1024 * 1024); - mmu_enable(); + return 0; +} +mem_initcall(pcm043_mem_init); -#ifdef CONFIG_CACHE_L2X0 +static int pcm043_mmu_init(void) +{ l2x0_init((void __iomem *)0x30000000, 0x00030024, 0x00000000); -#endif + return 0; } -postcore_initcall(pcm043_mmu_init); -#endif +postmmu_initcall(pcm043_mmu_init); struct gpio_led led0 = { .gpio = 1 * 32 + 6, @@ -170,7 +142,11 @@ static int imx35_devices_init(void) * This platform supports NOR and NAND */ imx35_add_nand(&nand_info); - register_device(&cfi_dev); + /* + * Up to 32MiB NOR type flash, connected to + * CS line 0, data width is 16 bit + */ + add_cfi_flash_device(-1, IMX_CS0_BASE, 32 * 1024 * 1024, 0); if ((reg & 0xc00) == 0x800) { /* reset mode: external boot */ switch ( (reg >> 25) & 0x3) { @@ -189,10 +165,9 @@ static int imx35_devices_init(void) } } - register_device(&sdram0_dev); + imx35_add_fb(&ipu_fb_data); - armlinux_add_dram(&sdram0_dev); armlinux_set_bootparams((void *)0x80000100); armlinux_set_architecture(MACH_TYPE_PCM043); @@ -236,6 +211,7 @@ static int imx35_console_init(void) mxc_iomux_v3_setup_multiple_pads(pcm043_pads, ARRAY_SIZE(pcm043_pads)); imx35_add_uart0(); + return 0; } diff --git a/arch/arm/boards/pcm049/board.c b/arch/arm/boards/pcm049/board.c index 2303a9c21c..502e121b45 100644 --- a/arch/arm/boards/pcm049/board.c +++ b/arch/arm/boards/pcm049/board.c @@ -43,81 +43,26 @@ static struct NS16550_plat serial_plat = { .clock = 48000000, /* 48MHz (APLL96/2) */ - .f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR, - .reg_read = omap_uart_read, - .reg_write = omap_uart_write, -}; - -static struct device_d pcm049_serial_device = { - .id = -1, - .name = "serial_ns16550", - .map_base = OMAP44XX_UART3_BASE, - .size = 1024, - .platform_data = (void *)&serial_plat, }; static int pcm049_console_init(void) { /* Register the serial port */ - return register_device(&pcm049_serial_device); + add_ns16550_device(-1, OMAP44XX_UART3_BASE, 1024, IORESOURCE_MEM_8BIT, &serial_plat); + + return 0; } console_initcall(pcm049_console_init); -static struct memory_platform_data sram_pdata = { - .name = "sram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sram_dev = { - .id = -1, - .name = "mem", - .map_base = 0x40300000, - .size = 48 * 1024, - .platform_data = &sram_pdata, -}; - -static struct memory_platform_data sdram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = 0x80000000, - .size = SZ_512M, - .platform_data = &sdram_pdata, -}; - -#ifdef CONFIG_MMU -static int pcm049_mmu_init(void) +static int pcm049_mem_init(void) { - mmu_init(); - - arm_create_section(0x80000000, 0x80000000, 256, PMD_SECT_DEF_CACHED); - /* warning: This shadows the second half of our ram */ - arm_create_section(0x90000000, 0x80000000, 256, PMD_SECT_DEF_UNCACHED); - - mmu_enable(); + arm_add_mem_device("ram0", 0x80000000, SZ_512M); + add_mem_device("sram0", 0x40300000, 48 * 1024, + IORESOURCE_MEM_WRITEABLE); return 0; } -device_initcall(pcm049_mmu_init); -#endif - -static struct device_d hsmmc_dev = { - .id = -1, - .name = "omap-hsmmc", - .map_base = 0x4809C100, - .size = SZ_4K, -}; - -static struct device_d smc911x_dev = { - .id = -1, - .name = "smc911x", - .map_base = 0x2C000000, - .size = 0x4000, -}; +mem_initcall(pcm049_mem_init); static struct gpmc_config net_cfg = { .cfg = { @@ -136,14 +81,14 @@ static void pcm049_network_init(void) { gpmc_cs_config(5, &net_cfg); - register_device(&smc911x_dev); + add_generic_device("smc911x", -1, NULL, 0x2C000000, 0x4000, + IORESOURCE_MEM, NULL); } static int pcm049_devices_init(void) { - register_device(&sdram_dev); - register_device(&sram_dev); - register_device(&hsmmc_dev); + add_generic_device("omap-hsmmc", -1, NULL, 0x4809C100, SZ_4K, + IORESOURCE_MEM, NULL); gpmc_generic_init(0x10); @@ -160,7 +105,6 @@ static int pcm049_devices_init(void) dev_add_bb_dev("env_raw", "env0"); #endif - armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0x80000100); armlinux_set_architecture(MACH_TYPE_PCM049); diff --git a/arch/arm/boards/phycard-i.MX27/pca100.c b/arch/arm/boards/phycard-i.MX27/pca100.c index 89c0a14ac7..f285466641 100644 --- a/arch/arm/boards/phycard-i.MX27/pca100.c +++ b/arch/arm/boards/phycard-i.MX27/pca100.c @@ -41,19 +41,6 @@ #include <mach/iomux-mx27.h> #include <mach/devices-imx27.h> -static struct memory_platform_data ram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = 0xa0000000, - .size = 128 * 1024 * 1024, - .platform_data = &ram_pdata, -}; - static struct fec_platform_data fec_info = { .xcv_type = MII100, .phy_addr = 1, @@ -66,20 +53,6 @@ struct imx_nand_platform_data nand_info = { }; #ifdef CONFIG_USB -static struct device_d usbotg_dev = { - .id = -1, - .name = "ehci", - .map_base = IMX_OTG_BASE, - .size = 0x200, -}; - -static struct device_d usbh2_dev = { - .id = -1, - .name = "ehci", - .map_base = IMX_OTG_BASE + 0x400, - .size = 0x200, -}; - static void pca100_usb_register(void) { mdelay(10); @@ -90,29 +63,19 @@ static void pca100_usb_register(void) mdelay(10); isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x170), 1); - register_device(&usbotg_dev); + add_generic_usb_ehci_device(-1, IMX_OTG_BASE, NULL); isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x570), 1); - register_device(&usbh2_dev); + add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL); } #endif -#ifdef CONFIG_MMU -static void pca100_mmu_init(void) +static int pca100_mem_init(void) { - mmu_init(); + arm_add_mem_device("ram0", 0xa0000000, 128 * 1024 * 1024); - arm_create_section(0xa0000000, 0xa0000000, 128, PMD_SECT_DEF_CACHED); - arm_create_section(0xb0000000, 0xa0000000, 128, PMD_SECT_DEF_UNCACHED); - - setup_dma_coherent(0x10000000); - - mmu_enable(); -} -#else -static void pca100_mmu_init(void) -{ + return 0; } -#endif +mem_initcall(pca100_mem_init); static void pca100_usb_init(void) { @@ -224,7 +187,6 @@ static int pca100_devices_init(void) imx_gpio_mode(mode[i]); imx27_add_nand(&nand_info); - register_device(&sdram_dev); imx27_add_fec(&fec_info); imx27_add_mmc0(NULL); @@ -241,7 +203,6 @@ static int pca100_devices_init(void) devfs_add_partition("nand0", 0x40000, 0x20000, PARTITION_FIXED, "env_raw"); dev_add_bb_dev("env_raw", "env0"); - armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0xa0000100); armlinux_set_architecture(2149); @@ -250,17 +211,9 @@ static int pca100_devices_init(void) device_initcall(pca100_devices_init); -static struct device_d pca100_serial_device = { - .id = -1, - .name = "imx_serial", - .map_base = IMX_UART1_BASE, - .size = 4096, -}; - static int pca100_console_init(void) { - pca100_mmu_init(); - register_device(&pca100_serial_device); + imx27_add_uart0(); return 0; } diff --git a/arch/arm/boards/pm9261/init.c b/arch/arm/boards/pm9261/init.c index 6fb14f7bce..efc5dcc1fb 100644 --- a/arch/arm/boards/pm9261/init.c +++ b/arch/arm/boards/pm9261/init.c @@ -89,20 +89,9 @@ static void pm_add_device_nand(void) */ #if defined(CONFIG_DRIVER_NET_DM9000) static struct dm9000_platform_data dm9000_data = { - .iobase = AT91_CHIPSELECT_2, - .iodata = AT91_CHIPSELECT_2 + 4, - .buswidth = DM9000_WIDTH_16, .srom = 1, }; -static struct device_d dm9000_dev = { - .id = 0, - .name = "dm9000", - .map_base = AT91_CHIPSELECT_2, - .size = 8, - .platform_data = &dm9000_data, -}; - /* * SMC timings for the DM9000. * Note: These timings were calculated for MASTER_CLOCK = 100000000 according to the DM9000 timings. @@ -130,25 +119,26 @@ static void __init pm_add_device_dm9000(void) /* Configure chip-select 2 (DM9000) */ sam9_smc_configure(2, &dm9000_smc_config); - register_device(&dm9000_dev); + add_dm9000_device(0, AT91_CHIPSELECT_2, AT91_CHIPSELECT_2 + 4, + IORESOURCE_MEM_16BIT, &dm9000_data); } #else static void __init ek_add_device_dm9000(void) {} #endif /* CONFIG_DRIVER_NET_DM9000 */ -static struct device_d cfi_dev = { - .id = 0, - .name = "cfi_flash", - .map_base = AT91_CHIPSELECT_0, - .size = 4 * 1024 * 1024, -}; +static int pm9261_mem_init(void) +{ + at91_add_device_sdram(64 * 1024 * 1024); + + return 0; +} +mem_initcall(pm9261_mem_init); static int pm9261_devices_init(void) { - at91_add_device_sdram(64 * 1024 * 1024); pm_add_device_nand(); - register_device(&cfi_dev); pm_add_device_dm9000(); + add_cfi_flash_device(0, AT91_CHIPSELECT_0, 4 * 1024 * 1024, 0); devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self"); devfs_add_partition("nor0", 0x40000, 0x10000, PARTITION_FIXED, "env0"); diff --git a/arch/arm/boards/pm9263/init.c b/arch/arm/boards/pm9263/init.c index abe8def13c..aeca4e7d79 100644 --- a/arch/arm/boards/pm9263/init.c +++ b/arch/arm/boards/pm9263/init.c @@ -86,18 +86,19 @@ static void pm_add_device_nand(void) at91_add_device_nand(&nand_pdata); } -static struct device_d cfi_dev = { - .id = -1, - .name = "cfi_flash", - .map_base = AT91_CHIPSELECT_0, - .size = 4 * 1024 * 1024, -}; - static struct at91_ether_platform_data macb_pdata = { .flags = AT91SAM_ETHER_RMII, .phy_addr = 0, }; +static int pm9263_mem_init(void) +{ + at91_add_device_sdram(64 * 1024 * 1024); + + return 0; +} +mem_initcall(pm9263_mem_init); + static int pm9263_devices_init(void) { /* @@ -108,10 +109,9 @@ static int pm9263_devices_init(void) at91_set_gpio_output(AT91_PIN_PB27, 1); at91_set_gpio_value(AT91_PIN_PB27, 1); /* 1- enable, 0 - disable */ - at91_add_device_sdram(64 * 1024 * 1024); pm_add_device_nand(); at91_add_device_eth(&macb_pdata); - register_device(&cfi_dev); + add_cfi_flash_device(0, AT91_CHIPSELECT_0, 4 * 1024 * 1024, 0); devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self0"); devfs_add_partition("nor0", 0x40000, 0x10000, PARTITION_FIXED, "env0"); diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c index 8031ce5b64..35c9ce9f83 100644 --- a/arch/arm/boards/pm9g45/init.c +++ b/arch/arm/boards/pm9g45/init.c @@ -82,9 +82,16 @@ static struct at91_ether_platform_data macb_pdata = { .phy_addr = 0, }; -static int pm9g45_devices_init(void) +static int pm9g45_mem_init(void) { at91_add_device_sdram(128 * 1024 * 1024); + + return 0; +} +mem_initcall(pm9g45_mem_init); + +static int pm9g45_devices_init(void) +{ pm_add_device_nand(); at91_add_device_eth(&macb_pdata); diff --git a/arch/arm/boards/scb9328/env/config b/arch/arm/boards/scb9328/env/config new file mode 100644 index 0000000000..d0f3f25ee8 --- /dev/null +++ b/arch/arm/boards/scb9328/env/config @@ -0,0 +1,56 @@ +#!/bin/sh + +machine=scb9328 +eth0.serverip= +user= + +# use 'dhcp' to do dhcp in barebox and in kernel +# use 'none' if you want to skip kernel ip autoconfiguration +ip=dhcp + +# or set your networking parameters here +#eth0.ipaddr=a.b.c.d +#eth0.netmask=a.b.c.d +#eth0.gateway=a.b.c.d +#eth0.serverip=a.b.c.d + +# can be either 'net', 'nor' or 'nand' +kernel_loc=net +# can be either 'net', 'nor', 'nand' or 'initrd' +rootfs_loc=net + +# can be either 'jffs2' or 'ubifs' +rootfs_type=ubifs +rootfsimage=root-$machine.$rootfs_type + +# The image type of the kernel. Can be uimage, zimage, raw, or raw_lzo +kernelimage_type=zimage +kernelimage=zImage-$machine +#kernelimage_type=uimage +#kernelimage=uImage-$machine +#kernelimage_type=raw +#kernelimage=Image-$machine +#kernelimage_type=raw_lzo +#kernelimage=Image-$machine.lzo + +if [ -n $user ]; then + kernelimage="$user"-"$kernelimage" + nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine" + rootfsimage="$user"-"$rootfsimage" +else + nfsroot="$eth0.serverip:/path/to/nfs/root" +fi + +autoboot_timeout=3 + +bootargs="console=ttymxc0,115200" + +nor_parts="256k(barebox)ro,128k(bareboxenv),2M(kernel),-(root)" +rootfs_mtdblock_nor=3 + +nand_parts="256k(barebox)ro,128k(bareboxenv),2M(kernel),-(root)" +rootfs_mtdblock_nand=7 + +# set a fancy prompt (if support is compiled in) +PS1="\e[1;32mbarebox@\e[1;31m\h:\w\e[0m " + diff --git a/arch/arm/boards/scb9328/scb9328.c b/arch/arm/boards/scb9328/scb9328.c index a98d9fe26e..e90417f01e 100644 --- a/arch/arm/boards/scb9328/scb9328.c +++ b/arch/arm/boards/scb9328/scb9328.c @@ -32,43 +32,12 @@ #include <fcntl.h> #include <dm9000.h> #include <led.h> - -static struct device_d cfi_dev = { - .id = -1, - .name = "cfi_flash", - - .map_base = 0x10000000, - .size = 16 * 1024 * 1024, -}; - -static struct memory_platform_data sdram_pdata = { - .name = "ram0", - .flags = DEVFS_RDWR, -}; - -static struct device_d sdram_dev = { - .id = -1, - .name = "mem", - .map_base = 0x08000000, - .size = 16 * 1024 * 1024, - .platform_data = &sdram_pdata, -}; +#include <mach/devices-imx1.h> static struct dm9000_platform_data dm9000_data = { - .iobase = 0x16000000, - .iodata = 0x16000004, - .buswidth = DM9000_WIDTH_16, .srom = 1, }; -static struct device_d dm9000_dev = { - .id = -1, - .name = "dm9000", - .map_base = 0x16000000, - .size = 8, - .platform_data = &dm9000_data, -}; - struct gpio_led leds[] = { { .gpio = 32 + 21, @@ -81,6 +50,14 @@ struct gpio_led leds[] = { }, }; +static int scb9328_mem_init(void) +{ + arm_add_mem_device("ram0", 0x08000000, 16 * 1024 * 1024); + + return 0; +} +mem_initcall(scb9328_mem_init); + static int scb9328_devices_init(void) { int i; @@ -111,15 +88,14 @@ static int scb9328_devices_init(void) CS5U = 0x00008400; CS5L = 0x00000D03; - register_device(&cfi_dev); - register_device(&sdram_dev); - register_device(&dm9000_dev); + add_cfi_flash_device(-1, 0x10000000, 16 * 1024 * 1024, 0); + add_dm9000_device(-1, 0x16000000, 0x16000004, + IORESOURCE_MEM_16BIT, &dm9000_data); devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self0"); devfs_add_partition("nor0", 0x40000, 0x20000, PARTITION_FIXED, "env0"); protect_file("/dev/env0", 1); - armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0x08000100); armlinux_set_architecture(MACH_TYPE_SCB9328); @@ -128,20 +104,14 @@ static int scb9328_devices_init(void) device_initcall(scb9328_devices_init); -static struct device_d scb9328_serial_device = { - .id = -1, - .name = "imx_serial", - .map_base = IMX_UART1_BASE, - .size = 4096, -}; - static int scb9328_console_init(void) { /* init gpios for serial port */ imx_gpio_mode(PC11_PF_UART1_TXD); imx_gpio_mode(PC12_PF_UART1_RXD); - register_device(&scb9328_serial_device); + imx1_add_uart0(); + return 0; } diff --git a/arch/arm/boards/versatile/versatilepb.c b/arch/arm/boards/versatile/versatilepb.c index 5568f216e4..4e09de3c34 100644 --- a/arch/arm/boards/versatile/versatilepb.c +++ b/arch/arm/boards/versatile/versatilepb.c @@ -33,13 +33,6 @@ #include <partition.h> #include <sizes.h> -static struct device_d cfi_dev = { - .id = -1, - .name = "cfi_flash", - .map_base = VERSATILE_FLASH_BASE, - .size = VERSATILE_FLASH_SIZE, -}; - static int vpb_console_init(void) { versatile_register_uart(0); @@ -47,22 +40,22 @@ static int vpb_console_init(void) } console_initcall(vpb_console_init); -static struct device_d smc911x_dev = { - .id = -1, - .name = "smc91c111", - .map_base = VERSATILE_ETH_BASE, - .size = 64 * 1024, -}; - -static int vpb_devices_init(void) +static int vpb_mem_init(void) { versatile_add_sdram(64 * 1024 *1024); - register_device(&cfi_dev); + return 0; +} +mem_initcall(vpb_mem_init); + +static int vpb_devices_init(void) +{ + add_cfi_flash_device(-1, VERSATILE_FLASH_BASE, VERSATILE_FLASH_SIZE, 0); devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self"); devfs_add_partition("nor0", 0x40000, 0x20000, PARTITION_FIXED, "env0"); - register_device(&smc911x_dev); + add_generic_device("smc91c111", -1, NULL, VERSATILE_ETH_BASE, 64 * 1024, + IORESOURCE_MEM, NULL); armlinux_set_architecture(MACH_TYPE_VERSATILE_PB); armlinux_set_bootparams((void *)(0x00000100)); |