~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-davinci/common.c

Version: ~ [ linux-5.4-rc7 ] ~ [ linux-5.3.11 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.84 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.154 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.201 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.201 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.77 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Code commons to all DaVinci SoCs.
  3  *
  4  * Author: Mark A. Greer <mgreer@mvista.com>
  5  *
  6  * 2009 (c) MontaVista Software, Inc. This file is licensed under
  7  * the terms of the GNU General Public License version 2. This program
  8  * is licensed "as is" without any warranty of any kind, whether express
  9  * or implied.
 10  */
 11 #include <linux/module.h>
 12 #include <linux/io.h>
 13 #include <linux/etherdevice.h>
 14 
 15 #include <asm/tlb.h>
 16 #include <asm/mach/map.h>
 17 
 18 #include <mach/common.h>
 19 #include <mach/cputype.h>
 20 #include <mach/emac.h>
 21 
 22 #include "clock.h"
 23 
 24 struct davinci_soc_info davinci_soc_info;
 25 EXPORT_SYMBOL(davinci_soc_info);
 26 
 27 void __iomem *davinci_intc_base;
 28 int davinci_intc_type;
 29 
 30 void davinci_get_mac_addr(struct memory_accessor *mem_acc, void *context)
 31 {
 32         char *mac_addr = davinci_soc_info.emac_pdata->mac_addr;
 33         off_t offset = (off_t)context;
 34 
 35         /* Read MAC addr from EEPROM */
 36         if (mem_acc->read(mem_acc, mac_addr, offset, ETH_ALEN) == ETH_ALEN)
 37                 pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr);
 38 }
 39 
 40 static struct davinci_id * __init davinci_get_id(u32 jtag_id)
 41 {
 42         int i;
 43         struct davinci_id *dip;
 44         u8 variant = (jtag_id & 0xf0000000) >> 28;
 45         u16 part_no = (jtag_id & 0x0ffff000) >> 12;
 46 
 47         for (i = 0, dip = davinci_soc_info.ids; i < davinci_soc_info.ids_num;
 48                         i++, dip++)
 49                 /* Don't care about the manufacturer right now */
 50                 if ((dip->part_no == part_no) && (dip->variant == variant))
 51                         return dip;
 52 
 53         return NULL;
 54 }
 55 
 56 void __init davinci_common_init(struct davinci_soc_info *soc_info)
 57 {
 58         int ret;
 59         struct davinci_id *dip;
 60 
 61         if (!soc_info) {
 62                 ret = -EINVAL;
 63                 goto err;
 64         }
 65 
 66         memcpy(&davinci_soc_info, soc_info, sizeof(struct davinci_soc_info));
 67 
 68         if (davinci_soc_info.io_desc && (davinci_soc_info.io_desc_num > 0))
 69                 iotable_init(davinci_soc_info.io_desc,
 70                                 davinci_soc_info.io_desc_num);
 71 
 72         /*
 73          * Normally devicemaps_init() would flush caches and tlb after
 74          * mdesc->map_io(), but we must also do it here because of the CPU
 75          * revision check below.
 76          */
 77         local_flush_tlb_all();
 78         flush_cache_all();
 79 
 80         /*
 81          * We want to check CPU revision early for cpu_is_xxxx() macros.
 82          * IO space mapping must be initialized before we can do that.
 83          */
 84         davinci_soc_info.jtag_id = __raw_readl(davinci_soc_info.jtag_id_base);
 85 
 86         dip = davinci_get_id(davinci_soc_info.jtag_id);
 87         if (!dip) {
 88                 ret = -EINVAL;
 89                 goto err;
 90         }
 91 
 92         davinci_soc_info.cpu_id = dip->cpu_id;
 93         pr_info("DaVinci %s variant 0x%x\n", dip->name, dip->variant);
 94 
 95         if (davinci_soc_info.cpu_clks) {
 96                 ret = davinci_clk_init(davinci_soc_info.cpu_clks);
 97 
 98                 if (ret != 0)
 99                         goto err;
100         }
101 
102         davinci_intc_base = davinci_soc_info.intc_base;
103         davinci_intc_type = davinci_soc_info.intc_type;
104         return;
105 
106 err:
107         pr_err("davinci_common_init: SoC Initialization failed\n");
108 }
109 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp