/* * Critical Link MityOMAP-L138 SoM * * Copyright (C) 2010 Critical Link LLC - http://www.criticallink.com * * This file is licensed under the terms of the GNU General Public License * version 2. This program is licensed "as is" without any warranty of * any kind, whether express or implied. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define MITYOMAPL138_PHY_ID "" #define FACTORY_CONFIG_MAGIC 0x012C0138 #define FACTORY_CONFIG_VERSION 0x00010001 /* Data Held in On-Board I2C device */ struct factory_config { u32 magic; u32 version; u8 mac[6]; u32 fpga_type; u32 spare; u32 serialnumber; char partnum[32]; }; static struct factory_config factory_config; struct part_no_info { const char *part_no; /* part number string of interest */ int max_freq; /* khz */ }; static struct part_no_info mityomapl138_pn_info[] = { { .part_no = "L138-C", .max_freq = 300000, }, { .part_no = "L138-D", .max_freq = 375000, }, { .part_no = "L138-F", .max_freq = 456000, }, { .part_no = "1808-C", .max_freq = 300000, }, { .part_no = "1808-D", .max_freq = 375000, }, { .part_no = "1808-F", .max_freq = 456000, }, { .part_no = "1810-D", .max_freq = 375000, }, }; #ifdef CONFIG_CPU_FREQ static void mityomapl138_cpufreq_init(const char *partnum) { int i, ret; for (i = 0; partnum && i < ARRAY_SIZE(mityomapl138_pn_info); i++) { /* * the part number has additional characters beyond what is * stored in the table. This information is not needed for * determining the speed grade, and would require several * more table entries. Only check the first N characters * for a match. */ if (!strncmp(partnum, mityomapl138_pn_info[i].part_no, strlen(mityomapl138_pn_info[i].part_no))) { da850_max_speed = mityomapl138_pn_info[i].max_freq; break; } } ret = da850_register_cpufreq("pll0_sysclk3"); if (ret) pr_warning("cpufreq registration failed: %d\n", ret); } #else static void mityomapl138_cpufreq_init(const char *partnum) { } #endif static void read_factory_config(struct memory_accessor *a, void *context) { int ret; const char *partnum = NULL; struct davinci_soc_info *soc_info = &davinci_soc_info; ret = a->read(a, (char *)&factory_config, 0, sizeof(factory_config)); if (ret != sizeof(struct factory_config)) { pr_warning("MityOMAPL138: Read Factory Config Failed: %d\n", ret); goto bad_config; } if (factory_config.magic != FACTORY_CONFIG_MAGIC) { pr_warning("MityOMAPL138: Factory Config Magic Wrong (%X)\n", factory_config.magic); goto bad_config; } if (factory_config.version != FACTORY_CONFIG_VERSION) { pr_warning("MityOMAPL138: Factory Config Version Wrong (%X)\n", factory_config.version); goto bad_config; }