mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
![Linus Torvalds](/assets/img/avatar_default.png)
Here is a collection of cleanup patches. Among the pieces that stand out are: - The deletion of h720x platforms - Split of at91 non-dt platforms to their own Kconfig file to keep them separate - General cleanups and refactoring of i.MX and MXS platforms - Some restructuring of clock tables for OMAP - Convertion of PMC driver for Tegra to dt-only - Some renames of sunxi -> sun4i (Allwinner A10) - ... plus a bunch of other stuff that I haven't mentioned -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJRggUqAAoJEIwa5zzehBx3HjEQAJwp7heRs/HwTDzmzcyHkRMV usbaa9dHBuAZ0DzsWjLK99xEn8VWD9TvbeP6hN5gNhxko06UVza3o8PI2iV1ztMB 9K3u2+LS5on/5cOxnsU1va16h5hBZ0ZIgNx5NY+PZ5mBY6v1U3qTjljPP62iXp63 w+sdXeZDe/c5JvuoDRbY0OBR++3Jp8cQg7KbU78jWz3r5D2rC1zwhkf2audcRY6b jIWTj9M8CHynh/D6OzKqDcOYorBHNSRj0YbiWS2nnMfm+0V8nya00EPRpCPRiBUb sobSy1CI9Qxiih3bOf6QCfzCRzJ5hbtE0zlI8g3bqtEZ1yOsE949HrKapWHJJdIU JNTXrxXORAnaRhbzvSPNpp/iJBSDQRsfEETgv5BuHg/4lzTQfzElySbcgb4EeoHr 7Zt8ZR2/Du+u76qIPqs19ES3Wx+nOEOfSDAgZmlfPvlwmlGDYvqAXoeJ006VXnhG JacLuD/cFnJ1w00Bcl48ZXMIsVkoRqjvsCG5q688HGXMM1lU8DfgUpQY6OCWAbdu kFnBinJZk+HbE8FGS8O0BoQ+oiC0YIr2XhATL66PGHq7bLHb5ycwvZ7mrfC0AN9j M9hqTFednwfo9wF8vSj5nMsxXwP8/mky4ECGoFvLsMYDosunrNVnAHtTgDSE+ZgO 6kQJ1P8jBBXn2LyjF88W =xCAx -----END PGP SIGNATURE----- Merge tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM SoC cleanup from Olof Johansson: "Here is a collection of cleanup patches. Among the pieces that stand out are: - The deletion of h720x platforms - Split of at91 non-dt platforms to their own Kconfig file to keep them separate - General cleanups and refactoring of i.MX and MXS platforms - Some restructuring of clock tables for OMAP - Convertion of PMC driver for Tegra to dt-only - Some renames of sunxi -> sun4i (Allwinner A10) - ... plus a bunch of other stuff that I haven't mentioned" * tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (119 commits) ARM: i.MX: remove unused ARCH_* configs ARM i.MX53: remove platform ahci support ARM: sunxi: Rework the restart code irqchip: sunxi: Rename sunxi to sun4i irqchip: sunxi: Make use of the IRQCHIP_DECLARE macro clocksource: sunxi: Rename sunxi to sun4i clocksource: sunxi: make use of CLKSRC_OF clocksource: sunxi: Cleanup the timer code ARM: at91: remove trailing semicolon from macros ARM: at91/setup: fix trivial typos ARM: EXYNOS: remove "config EXYNOS_DEV_DRM" ARM: EXYNOS: change the name of USB ohci header ARM: SAMSUNG: Remove unnecessary code for dma ARM: S3C24XX: Remove unused GPIO drive strength register definitions ARM: OMAP4+: PM: Restore CPU power state to ON with clockdomain force wakeup method ARM: S3C24XX: Removed unneeded dependency on CPU_S3C2412 ARM: S3C24XX: Removed unneeded dependency on CPU_S3C2410 ARM: S3C24XX: Removed unneeded dependency on ARCH_S3C24XX for boards ARM: SAMSUNG: Fix typo "CONFIG_SAMSUNG_DEV_RTC" ARM: S5P64X0: Fix typo "CONFIG_S5P64X0_SETUP_SDHCI" ...
304 lines
7.9 KiB
C
304 lines
7.9 KiB
C
/* linux/arch/arm/plat-s3c24xx/cpu.c
|
|
*
|
|
* Copyright (c) 2004-2005 Simtec Electronics
|
|
* http://www.simtec.co.uk/products/SWLINUX/
|
|
* Ben Dooks <ben@simtec.co.uk>
|
|
*
|
|
* Common code for S3C24XX machines
|
|
*
|
|
* 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
|
|
*/
|
|
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/module.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/ioport.h>
|
|
#include <linux/serial_core.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/io.h>
|
|
|
|
#include <mach/hardware.h>
|
|
#include <mach/regs-clock.h>
|
|
#include <asm/irq.h>
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/system_info.h>
|
|
#include <asm/system_misc.h>
|
|
|
|
#include <asm/mach/arch.h>
|
|
#include <asm/mach/map.h>
|
|
|
|
#include <mach/regs-gpio.h>
|
|
#include <plat/regs-serial.h>
|
|
|
|
#include <plat/cpu.h>
|
|
#include <plat/devs.h>
|
|
#include <plat/clock.h>
|
|
#include <plat/cpu-freq.h>
|
|
#include <plat/pll.h>
|
|
|
|
#include "common.h"
|
|
|
|
/* table of supported CPUs */
|
|
|
|
static const char name_s3c2410[] = "S3C2410";
|
|
static const char name_s3c2412[] = "S3C2412";
|
|
static const char name_s3c2416[] = "S3C2416/S3C2450";
|
|
static const char name_s3c2440[] = "S3C2440";
|
|
static const char name_s3c2442[] = "S3C2442";
|
|
static const char name_s3c2442b[] = "S3C2442B";
|
|
static const char name_s3c2443[] = "S3C2443";
|
|
static const char name_s3c2410a[] = "S3C2410A";
|
|
static const char name_s3c2440a[] = "S3C2440A";
|
|
|
|
static struct cpu_table cpu_ids[] __initdata = {
|
|
{
|
|
.idcode = 0x32410000,
|
|
.idmask = 0xffffffff,
|
|
.map_io = s3c2410_map_io,
|
|
.init_clocks = s3c2410_init_clocks,
|
|
.init_uarts = s3c2410_init_uarts,
|
|
.init = s3c2410_init,
|
|
.name = name_s3c2410
|
|
},
|
|
{
|
|
.idcode = 0x32410002,
|
|
.idmask = 0xffffffff,
|
|
.map_io = s3c2410_map_io,
|
|
.init_clocks = s3c2410_init_clocks,
|
|
.init_uarts = s3c2410_init_uarts,
|
|
.init = s3c2410a_init,
|
|
.name = name_s3c2410a
|
|
},
|
|
{
|
|
.idcode = 0x32440000,
|
|
.idmask = 0xffffffff,
|
|
.map_io = s3c2440_map_io,
|
|
.init_clocks = s3c244x_init_clocks,
|
|
.init_uarts = s3c244x_init_uarts,
|
|
.init = s3c2440_init,
|
|
.name = name_s3c2440
|
|
},
|
|
{
|
|
.idcode = 0x32440001,
|
|
.idmask = 0xffffffff,
|
|
.map_io = s3c2440_map_io,
|
|
.init_clocks = s3c244x_init_clocks,
|
|
.init_uarts = s3c244x_init_uarts,
|
|
.init = s3c2440_init,
|
|
.name = name_s3c2440a
|
|
},
|
|
{
|
|
.idcode = 0x32440aaa,
|
|
.idmask = 0xffffffff,
|
|
.map_io = s3c2442_map_io,
|
|
.init_clocks = s3c244x_init_clocks,
|
|
.init_uarts = s3c244x_init_uarts,
|
|
.init = s3c2442_init,
|
|
.name = name_s3c2442
|
|
},
|
|
{
|
|
.idcode = 0x32440aab,
|
|
.idmask = 0xffffffff,
|
|
.map_io = s3c2442_map_io,
|
|
.init_clocks = s3c244x_init_clocks,
|
|
.init_uarts = s3c244x_init_uarts,
|
|
.init = s3c2442_init,
|
|
.name = name_s3c2442b
|
|
},
|
|
{
|
|
.idcode = 0x32412001,
|
|
.idmask = 0xffffffff,
|
|
.map_io = s3c2412_map_io,
|
|
.init_clocks = s3c2412_init_clocks,
|
|
.init_uarts = s3c2412_init_uarts,
|
|
.init = s3c2412_init,
|
|
.name = name_s3c2412,
|
|
},
|
|
{ /* a newer version of the s3c2412 */
|
|
.idcode = 0x32412003,
|
|
.idmask = 0xffffffff,
|
|
.map_io = s3c2412_map_io,
|
|
.init_clocks = s3c2412_init_clocks,
|
|
.init_uarts = s3c2412_init_uarts,
|
|
.init = s3c2412_init,
|
|
.name = name_s3c2412,
|
|
},
|
|
{ /* a strange version of the s3c2416 */
|
|
.idcode = 0x32450003,
|
|
.idmask = 0xffffffff,
|
|
.map_io = s3c2416_map_io,
|
|
.init_clocks = s3c2416_init_clocks,
|
|
.init_uarts = s3c2416_init_uarts,
|
|
.init = s3c2416_init,
|
|
.name = name_s3c2416,
|
|
},
|
|
{
|
|
.idcode = 0x32443001,
|
|
.idmask = 0xffffffff,
|
|
.map_io = s3c2443_map_io,
|
|
.init_clocks = s3c2443_init_clocks,
|
|
.init_uarts = s3c2443_init_uarts,
|
|
.init = s3c2443_init,
|
|
.name = name_s3c2443,
|
|
},
|
|
};
|
|
|
|
/* minimal IO mapping */
|
|
|
|
static struct map_desc s3c_iodesc[] __initdata = {
|
|
IODESC_ENT(GPIO),
|
|
IODESC_ENT(IRQ),
|
|
IODESC_ENT(MEMCTRL),
|
|
IODESC_ENT(UART)
|
|
};
|
|
|
|
/* read cpu identificaiton code */
|
|
|
|
static unsigned long s3c24xx_read_idcode_v5(void)
|
|
{
|
|
#if defined(CONFIG_CPU_S3C2416)
|
|
/* s3c2416 is v5, with S3C24XX_GSTATUS1 instead of S3C2412_GSTATUS1 */
|
|
|
|
u32 gs = __raw_readl(S3C24XX_GSTATUS1);
|
|
|
|
/* test for s3c2416 or similar device */
|
|
if ((gs >> 16) == 0x3245)
|
|
return gs;
|
|
#endif
|
|
|
|
#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
|
|
return __raw_readl(S3C2412_GSTATUS1);
|
|
#else
|
|
return 1UL; /* don't look like an 2400 */
|
|
#endif
|
|
}
|
|
|
|
static unsigned long s3c24xx_read_idcode_v4(void)
|
|
{
|
|
return __raw_readl(S3C2410_GSTATUS1);
|
|
}
|
|
|
|
static void s3c24xx_default_idle(void)
|
|
{
|
|
unsigned long tmp = 0;
|
|
int i;
|
|
|
|
/* idle the system by using the idle mode which will wait for an
|
|
* interrupt to happen before restarting the system.
|
|
*/
|
|
|
|
/* Warning: going into idle state upsets jtag scanning */
|
|
|
|
__raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE,
|
|
S3C2410_CLKCON);
|
|
|
|
/* the samsung port seems to do a loop and then unset idle.. */
|
|
for (i = 0; i < 50; i++)
|
|
tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */
|
|
|
|
/* this bit is not cleared on re-start... */
|
|
|
|
__raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE,
|
|
S3C2410_CLKCON);
|
|
}
|
|
|
|
void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
|
|
{
|
|
arm_pm_idle = s3c24xx_default_idle;
|
|
|
|
/* initialise the io descriptors we need for initialisation */
|
|
iotable_init(mach_desc, size);
|
|
iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
|
|
|
|
if (cpu_architecture() >= CPU_ARCH_ARMv5) {
|
|
samsung_cpu_id = s3c24xx_read_idcode_v5();
|
|
} else {
|
|
samsung_cpu_id = s3c24xx_read_idcode_v4();
|
|
}
|
|
s3c24xx_init_cpu();
|
|
|
|
s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
|
|
}
|
|
|
|
/* Serial port registrations */
|
|
|
|
#define S3C2410_PA_UART0 (S3C24XX_PA_UART)
|
|
#define S3C2410_PA_UART1 (S3C24XX_PA_UART + 0x4000 )
|
|
#define S3C2410_PA_UART2 (S3C24XX_PA_UART + 0x8000 )
|
|
#define S3C2443_PA_UART3 (S3C24XX_PA_UART + 0xC000 )
|
|
|
|
static struct resource s3c2410_uart0_resource[] = {
|
|
[0] = DEFINE_RES_MEM(S3C2410_PA_UART0, SZ_16K),
|
|
[1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX0, \
|
|
IRQ_S3CUART_ERR0 - IRQ_S3CUART_RX0 + 1, \
|
|
NULL, IORESOURCE_IRQ)
|
|
};
|
|
|
|
static struct resource s3c2410_uart1_resource[] = {
|
|
[0] = DEFINE_RES_MEM(S3C2410_PA_UART1, SZ_16K),
|
|
[1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX1, \
|
|
IRQ_S3CUART_ERR1 - IRQ_S3CUART_RX1 + 1, \
|
|
NULL, IORESOURCE_IRQ)
|
|
};
|
|
|
|
static struct resource s3c2410_uart2_resource[] = {
|
|
[0] = DEFINE_RES_MEM(S3C2410_PA_UART2, SZ_16K),
|
|
[1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX2, \
|
|
IRQ_S3CUART_ERR2 - IRQ_S3CUART_RX2 + 1, \
|
|
NULL, IORESOURCE_IRQ)
|
|
};
|
|
|
|
static struct resource s3c2410_uart3_resource[] = {
|
|
[0] = DEFINE_RES_MEM(S3C2443_PA_UART3, SZ_16K),
|
|
[1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX3, \
|
|
IRQ_S3CUART_ERR3 - IRQ_S3CUART_RX3 + 1, \
|
|
NULL, IORESOURCE_IRQ)
|
|
};
|
|
|
|
struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
|
|
[0] = {
|
|
.resources = s3c2410_uart0_resource,
|
|
.nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
|
|
},
|
|
[1] = {
|
|
.resources = s3c2410_uart1_resource,
|
|
.nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
|
|
},
|
|
[2] = {
|
|
.resources = s3c2410_uart2_resource,
|
|
.nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
|
|
},
|
|
[3] = {
|
|
.resources = s3c2410_uart3_resource,
|
|
.nr_resources = ARRAY_SIZE(s3c2410_uart3_resource),
|
|
},
|
|
};
|
|
|
|
/* initialise all the clocks */
|
|
|
|
void __init_or_cpufreq s3c24xx_setup_clocks(unsigned long fclk,
|
|
unsigned long hclk,
|
|
unsigned long pclk)
|
|
{
|
|
clk_upll.rate = s3c24xx_get_pll(__raw_readl(S3C2410_UPLLCON),
|
|
clk_xtal.rate);
|
|
|
|
clk_mpll.rate = fclk;
|
|
clk_h.rate = hclk;
|
|
clk_p.rate = pclk;
|
|
clk_f.rate = fclk;
|
|
}
|