--- zzzz-none-000/linux-2.6.19.2/arch/arm/kernel/setup.c 2007-01-10 19:10:37.000000000 +0000 +++ davinci-8020-5504/linux-2.6.19.2/arch/arm/kernel/setup.c 2007-06-18 12:09:18.000000000 +0000 @@ -21,8 +21,10 @@ #include #include #include +#include #include #include +#include #include #include @@ -36,6 +38,14 @@ #include #include +/*------------------------------------------------------------------------------------------*\ +\*------------------------------------------------------------------------------------------*/ +#include +#include +#include +/*------------------------------------------------------------------------------------------*\ +\*------------------------------------------------------------------------------------------*/ + #include "compat.h" #ifndef MEM_SIZE @@ -108,12 +118,17 @@ static const char *machine_name; static char command_line[COMMAND_LINE_SIZE]; +char *getcmdline(void) { + return command_line; +} + static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; #define ENDIANNESS ((char)endian_test.l) DEFINE_PER_CPU(struct cpuinfo_arm, cpu_data); +int *pEnvironment; /* * Standard memory resources */ @@ -357,9 +372,6 @@ #ifndef CONFIG_VFP elf_hwcap &= ~HWCAP_VFP; #endif -#ifndef CONFIG_IWMMXT - elf_hwcap &= ~HWCAP_IWMMXT; -#endif cpu_proc_init(); } @@ -701,12 +713,21 @@ static int __init parse_tag_cmdline(const struct tag *tag) { - strlcpy(default_command_line, tag->u.cmdline.cmdline, COMMAND_LINE_SIZE); + strlcat(default_command_line, " ", COMMAND_LINE_SIZE - strlen(default_command_line) - 1); + strlcat(default_command_line, tag->u.cmdline.cmdline, COMMAND_LINE_SIZE - strlen(default_command_line) - 1); return 0; } __tagtable(ATAG_CMDLINE, parse_tag_cmdline); +static int __init parse_tag_envp(const struct tag *tag) +{ + pEnvironment = (int *)tag->u.envp.envp; + return 0; +} + +__tagtable(ATAG_ENVP, parse_tag_envp); + /* * Scan the tag table for this tag, and call its parse function. * The tag table is built by the linker from all the __tagtable @@ -767,11 +788,40 @@ } arch_initcall(customize_machine); +/*------------------------------------------------------------------------------------------*\ +\*------------------------------------------------------------------------------------------*/ +unsigned int davinci_revision[5] = { 123, 0, 0, 0, 0 }; +EXPORT_SYMBOL(davinci_revision); + +/*------------------------------------------------------------------------------------------*\ +\*------------------------------------------------------------------------------------------*/ +static int hw_revision_setup(char *ptr) { + unsigned int i = 0; + unsigned int my_atoi(char *p); + printk("[hw_revision_setup] str=\"%s\"\n", ptr); + while(ptr && *ptr) { + printk("[hw_revision_setup] HWRevision: %s\n", ptr); + davinci_revision[i++] = my_atoi(ptr); + ptr = strchr(ptr, '.'); + if(ptr) { + ptr++; + if(*ptr == ' ') + break; + } + if(i >= sizeof(davinci_revision) / sizeof(davinci_revision[0])) + break; + } + return 0; +} + +/*------------------------------------------------------------------------------------------*\ +\*------------------------------------------------------------------------------------------*/ void __init setup_arch(char **cmdline_p) { struct tag *tags = (struct tag *)&init_tags; struct machine_desc *mdesc; char *from = default_command_line; + void set_flash_architecture(unsigned paged); setup_processor(); mdesc = setup_machine(machine_arch_type); @@ -832,6 +882,73 @@ conswitchp = &dummy_con; #endif #endif + /*--- das Environment kann erst initialisiert werden, wenn das Memorymapping eingerichtet ist ---*/ +#if defined(CONFIG_ARCH_DAVINCI) + if(strstr(saved_command_line, "HWRevision=")) { + hw_revision_setup(strstr(saved_command_line, "HWRevision=") + sizeof("HWRevision=") - 1); + } + + +#ifdef CONFIG_MTD_COMPLEX_MAPPINGS + if(davinci_revision[1] == 1) { + struct gpio_controller *GPIO = (struct gpio_controller *)IO_ADDRESS(DAVINCI_GPIO_BASE); + int i, *pi; + static struct resource my_gpio_resource[4] = { + { + .name = "flash A20", + .start = CONFIG_MTD_PAGED_BIT_A20, + .end = CONFIG_MTD_PAGED_BIT_A20, + .flags = IORESOURCE_IO + }, + { + .name = "flash A21", + .start = CONFIG_MTD_PAGED_BIT_A21, + .end = CONFIG_MTD_PAGED_BIT_A21, + .flags = IORESOURCE_IO + }, + { + .name = "flash A22", + .start = CONFIG_MTD_PAGED_BIT_A22, + .end = CONFIG_MTD_PAGED_BIT_A22, + .flags = IORESOURCE_IO + }, + { + .name = "flash A23", + .start = CONFIG_MTD_PAGED_BIT_A23, + .end = CONFIG_MTD_PAGED_BIT_A23, + .flags = IORESOURCE_IO + } + }; + for(i = 0 ; i < 4 ; i++) { + if(request_resource(&gpio_resource, &my_gpio_resource[i])) + printk(KERN_ERR "ERROR: mapped flash: gpio %u not available\n", my_gpio_resource[i].start); + } + + set_flash_architecture(1); + /*--- board_setup_gpio("neue hardware", 4); ---*/ + davinci_gpio_ctrl(CONFIG_MTD_PAGED_BIT_A20, GPIO_PIN, GPIO_OUTPUT_PIN); + davinci_gpio_ctrl(CONFIG_MTD_PAGED_BIT_A21, GPIO_PIN, GPIO_OUTPUT_PIN); + davinci_gpio_ctrl(CONFIG_MTD_PAGED_BIT_A22, GPIO_PIN, GPIO_OUTPUT_PIN); + davinci_gpio_ctrl(CONFIG_MTD_PAGED_BIT_A23, GPIO_PIN, GPIO_OUTPUT_PIN); + + GPIO->clr_data = + (1 << CONFIG_MTD_PAGED_BIT_A20) | + (1 << CONFIG_MTD_PAGED_BIT_A21) | + (1 << CONFIG_MTD_PAGED_BIT_A22) | + (1 << CONFIG_MTD_PAGED_BIT_A23); + + pi = (int *)EMIF_ADDRESS(0x02000000); + for(i = 0 ; i < 32 ; i++, pi++) { + printk("0x%x: 0x%x\n", pi, *pi); + } + env_init(phys_to_virt((unsigned long)pEnvironment), ENV_LOCATION_PHY_RAM); + return; + } +#endif /*--- #ifdef CONFIG_MTD_COMPLEX_MAPPINGS ---*/ + + set_flash_architecture(0); +#endif /*--- #if defined(CONFIG_ARCH_DAVINCI) ---*/ + env_init(phys_to_virt((unsigned long)pEnvironment), ENV_LOCATION_FLASH); } @@ -857,7 +974,6 @@ "vfp", "edsp", "java", - "iwmmxt", NULL };