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

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-s3c/init.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 //
  3 // Copyright (c) 2008 Simtec Electronics
  4 //      Ben Dooks <ben@simtec.co.uk>
  5 //      http://armlinux.simtec.co.uk/
  6 //
  7 // S3C series CPU initialisation
  8 
  9 /*
 10  * NOTE: Code in this file is not used on S3C64xx when booting with
 11  * Device Tree support.
 12  */
 13 
 14 #include <linux/init.h>
 15 #include <linux/module.h>
 16 #include <linux/interrupt.h>
 17 #include <linux/ioport.h>
 18 #include <linux/serial_core.h>
 19 #include <linux/serial_s3c.h>
 20 #include <linux/platform_device.h>
 21 #include <linux/of.h>
 22 
 23 #include <asm/mach/arch.h>
 24 #include <asm/mach/map.h>
 25 
 26 #include "cpu.h"
 27 #include "devs.h"
 28 
 29 static struct cpu_table *cpu;
 30 
 31 static struct cpu_table * __init s3c_lookup_cpu(unsigned long idcode,
 32                                                 struct cpu_table *tab,
 33                                                 unsigned int count)
 34 {
 35         for (; count != 0; count--, tab++) {
 36                 if ((idcode & tab->idmask) == (tab->idcode & tab->idmask))
 37                         return tab;
 38         }
 39 
 40         return NULL;
 41 }
 42 
 43 void __init s3c_init_cpu(unsigned long idcode,
 44                          struct cpu_table *cputab, unsigned int cputab_size)
 45 {
 46         cpu = s3c_lookup_cpu(idcode, cputab, cputab_size);
 47 
 48         if (cpu == NULL) {
 49                 printk(KERN_ERR "Unknown CPU type 0x%08lx\n", idcode);
 50                 panic("Unknown S3C24XX CPU");
 51         }
 52 
 53         printk("CPU %s (id 0x%08lx)\n", cpu->name, idcode);
 54 
 55         if (cpu->init == NULL) {
 56                 printk(KERN_ERR "CPU %s support not enabled\n", cpu->name);
 57                 panic("Unsupported Samsung CPU");
 58         }
 59 
 60         if (cpu->map_io)
 61                 cpu->map_io();
 62 
 63         pr_err("The platform is deprecated and scheduled for removal. Please reach to the maintainers of the platform and linux-samsung-soc@vger.kernel.org if you still use it.  Without such feedback, the platform will be removed after 2022.\n");
 64 }
 65 
 66 /* uart management */
 67 #if IS_ENABLED(CONFIG_SAMSUNG_ATAGS)
 68 static int nr_uarts __initdata = 0;
 69 
 70 #ifdef CONFIG_SERIAL_SAMSUNG_UARTS
 71 static struct s3c2410_uartcfg uart_cfgs[CONFIG_SERIAL_SAMSUNG_UARTS];
 72 #endif
 73 
 74 /* s3c24xx_init_uartdevs
 75  *
 76  * copy the specified platform data and configuration into our central
 77  * set of devices, before the data is thrown away after the init process.
 78  *
 79  * This also fills in the array passed to the serial driver for the
 80  * early initialisation of the console.
 81 */
 82 
 83 void __init s3c24xx_init_uartdevs(char *name,
 84                                   struct s3c24xx_uart_resources *res,
 85                                   struct s3c2410_uartcfg *cfg, int no)
 86 {
 87 #ifdef CONFIG_SERIAL_SAMSUNG_UARTS
 88         struct platform_device *platdev;
 89         struct s3c2410_uartcfg *cfgptr = uart_cfgs;
 90         struct s3c24xx_uart_resources *resp;
 91         int uart;
 92 
 93         memcpy(cfgptr, cfg, sizeof(struct s3c2410_uartcfg) * no);
 94 
 95         for (uart = 0; uart < no; uart++, cfg++, cfgptr++) {
 96                 platdev = s3c24xx_uart_src[cfgptr->hwport];
 97 
 98                 resp = res + cfgptr->hwport;
 99 
100                 s3c24xx_uart_devs[uart] = platdev;
101 
102                 platdev->name = name;
103                 platdev->resource = resp->resources;
104                 platdev->num_resources = resp->nr_resources;
105 
106                 platdev->dev.platform_data = cfgptr;
107         }
108 
109         nr_uarts = no;
110 #endif
111 }
112 
113 void __init s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no)
114 {
115         if (cpu == NULL)
116                 return;
117 
118         if (cpu->init_uarts == NULL && IS_ENABLED(CONFIG_SAMSUNG_ATAGS)) {
119                 printk(KERN_ERR "s3c24xx_init_uarts: cpu has no uart init\n");
120         } else
121                 (cpu->init_uarts)(cfg, no);
122 }
123 #endif
124 
125 static int __init s3c_arch_init(void)
126 {
127         int ret;
128 
129         /* init is only needed for ATAGS based platforms */
130         if (!IS_ENABLED(CONFIG_ATAGS))
131                 return 0;
132 
133         // do the correct init for cpu
134 
135         if (cpu == NULL) {
136                 /* Not needed when booting with device tree. */
137                 if (of_have_populated_dt())
138                         return 0;
139                 panic("s3c_arch_init: NULL cpu\n");
140         }
141 
142         ret = (cpu->init)();
143         if (ret != 0)
144                 return ret;
145 #if IS_ENABLED(CONFIG_SAMSUNG_ATAGS)
146         ret = platform_add_devices(s3c24xx_uart_devs, nr_uarts);
147 #endif
148         return ret;
149 }
150 
151 arch_initcall(s3c_arch_init);
152 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php