diff options
author | Andy Green <andy@openmoko.com> | 2009-03-09 21:02:16 +0000 |
---|---|---|
committer | Andy Green <agreen@octopus.localdomain> | 2009-03-09 21:02:16 +0000 |
commit | 84ca90e51953ac15f10b430dfe422896d69c4867 (patch) | |
tree | 565a010782c50f0e5d86eb340602e03b4044c7e6 /arch | |
parent | 5cdd4f17f1375a228c4b33e57912ccc057395f68 (diff) |
fix-s3c-cpu-detect-make-compatible-atag16.patch
The current version of CPU detection patch from Mark Brown and
Kyungmin Park takes a dump on system_rev. This patch changes it
to retain the low 16 of system_rev from the bootloader ATAG, and
adds access #defines and changes to use them.
No doubt they'll issue a better version of the CPU detection
patch and then this can be reverted.
Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-s3c2410/mach-gta01.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-s3c2442/mach-gta02.c | 13 | ||||
-rw-r--r-- | arch/arm/plat-s3c/include/mach/cpu.h | 3 | ||||
-rw-r--r-- | arch/arm/plat-s3c/init.c | 6 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/neo1973_pm_gps.c | 29 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/neo1973_pm_gsm.c | 5 |
6 files changed, 41 insertions, 32 deletions
diff --git a/arch/arm/mach-s3c2410/mach-gta01.c b/arch/arm/mach-s3c2410/mach-gta01.c index 27bf3591ae4..df76347a8f0 100644 --- a/arch/arm/mach-s3c2410/mach-gta01.c +++ b/arch/arm/mach-s3c2410/mach-gta01.c @@ -71,7 +71,7 @@ #include <mach/fb.h> #include <mach/spi.h> #include <mach/spi-gpio.h> -#include <mach/usb-control.h> +#include <mach/cpu.h> #include <mach/gta01.h> @@ -84,6 +84,7 @@ #include <plat/iic.h> #include <plat/mci.h> #include <asm/plat-s3c24xx/neo1973.h> +#include <plat/usb-control.h> #include <mach/neo1973-pm-gsm.h> #include <linux/jbt6k74.h> @@ -426,7 +427,7 @@ static void mangle_pmu_pdata_by_system_rev(void) reg_init_data = gta01_pcf_pdata.reg_init_data; - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01Bv4_SYSTEM_REV: /* FIXME : gta01_pcf_pdata.used_features |= PCF50606_FEAT_ACD; */ @@ -600,7 +601,7 @@ static void gta01_mmc_set_power(unsigned char power_mode, unsigned short vdd) regulator = s3c_sdi_regulator; return; - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: switch (power_mode) { case MMC_POWER_OFF: @@ -933,10 +934,10 @@ static void __init gta01_machine_init(void) { int rc; - if (system_rev == GTA01v4_SYSTEM_REV || - system_rev == GTA01Bv2_SYSTEM_REV || - system_rev == GTA01Bv3_SYSTEM_REV || - system_rev == GTA01Bv4_SYSTEM_REV) { + if (S3C_SYSTEM_REV_ATAG == GTA01v4_SYSTEM_REV || + S3C_SYSTEM_REV_ATAG == GTA01Bv2_SYSTEM_REV || + S3C_SYSTEM_REV_ATAG == GTA01Bv3_SYSTEM_REV || + S3C_SYSTEM_REV_ATAG == GTA01Bv4_SYSTEM_REV) { gta01_udc_cfg.udc_command = gta01_udc_command; gta01_mmc_cfg.ocr_avail = MMC_VDD_32_33; } @@ -965,7 +966,7 @@ static void __init gta01_machine_init(void) platform_device_register(>a01_button_dev); platform_device_register(>a01_pm_gsm_dev); - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: case GTA01v4_SYSTEM_REV: /* just use the default (GTA01_IRQ_PCF50606) */ diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c index 9ccd1d0594b..e5fb9dbcf9e 100644 --- a/arch/arm/mach-s3c2442/mach-gta02.c +++ b/arch/arm/mach-s3c2442/mach-gta02.c @@ -77,6 +77,7 @@ #include <mach/regs-mem.h> #include <mach/spi-gpio.h> #include <plat/pwm.h> +#include <mach/cpu.h> #include <mach/gta02.h> @@ -691,7 +692,7 @@ static void mangle_pmu_pdata_by_system_rev(void) reg_init_data = gta02_pcf_pdata.reg_init_data; - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA02v1_SYSTEM_REV: /* FIXME: this is only in v1 due to wrong PMU variant */ reg_init_data[PCF50633_REGULATOR_DOWN2] @@ -750,7 +751,7 @@ struct platform_device bq27000_battery_device = { static void gta02_hdq_attach_child_devices(struct device *parent_device) { - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA02v5_SYSTEM_REV: case GTA02v6_SYSTEM_REV: bq27000_battery_device.dev.parent = parent_device; @@ -1352,7 +1353,7 @@ static int glamo_irq_is_wired(void) static int gta02_glamo_can_set_mmc_power(void) { - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA02v3_SYSTEM_REV: case GTA02v4_SYSTEM_REV: case GTA02v5_SYSTEM_REV: @@ -1446,7 +1447,7 @@ static struct platform_device gta02_glamo_dev = { static void mangle_glamo_res_by_system_rev(void) { - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA02v1_SYSTEM_REV: break; default: @@ -1455,7 +1456,7 @@ static void mangle_glamo_res_by_system_rev(void) break; } - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA02v1_SYSTEM_REV: case GTA02v2_SYSTEM_REV: case GTA02v3_SYSTEM_REV: @@ -1591,7 +1592,7 @@ static void __init gta02_machine_init(void) /* set the panic callback to make AUX blink fast */ panic_blink = gta02_panic_blink; - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA02v6_SYSTEM_REV: /* we need push-pull interrupt from motion sensors */ lis302_pdata_top.open_drain = 0; diff --git a/arch/arm/plat-s3c/include/mach/cpu.h b/arch/arm/plat-s3c/include/mach/cpu.h index 81571a2da7a..cd260b137f2 100644 --- a/arch/arm/plat-s3c/include/mach/cpu.h +++ b/arch/arm/plat-s3c/include/mach/cpu.h @@ -28,6 +28,9 @@ extern unsigned int system_rev; +#define S3C_SYSTEM_REV_ATAG (system_rev & 0xffff) +#define S3C_SYSTEM_REV_CPU (system_rev & 0xffff0000) + /* * cpu_is_s3c24xx(): True for s3c2400, s3c2410, s3c2440 and so on * cpu_is_s3c241x(): True fro s3c2410, s3c2412 diff --git a/arch/arm/plat-s3c/init.c b/arch/arm/plat-s3c/init.c index f63ff9c86c3..94a3120f561 100644 --- a/arch/arm/plat-s3c/init.c +++ b/arch/arm/plat-s3c/init.c @@ -39,14 +39,16 @@ static void __init set_system_rev(unsigned int idcode) * system_rev & 0xfff00000 -> S3C Sub Class (241x/244x) * system_rev & 0xffff0000 -> S3C Type (2410/2440/6400/6410) * - * Remains[15:0] are reserved + * Remaining[15:0] are preserved from the value set by ATAG * * Exception: * Store Revision A to 1 such as * s3c2410A to s3c2411 * s3c2440A to s3c2441 */ - system_rev = (idcode & 0x0ffff000) << 4; + + system_rev &= 0xffff; + system_rev |= (idcode & 0x0ffff000) << 4; if (idcode == 0x32410002 || idcode == 0x32440001) system_rev |= (0x1 << 16); diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gps.c b/arch/arm/plat-s3c24xx/neo1973_pm_gps.c index f5052e230fc..f1f5de1689c 100644 --- a/arch/arm/plat-s3c24xx/neo1973_pm_gps.c +++ b/arch/arm/plat-s3c24xx/neo1973_pm_gps.c @@ -18,6 +18,7 @@ #include <linux/platform_device.h> #include <mach/hardware.h> +#include <mach/cpu.h> #include <asm/mach-types.h> @@ -77,7 +78,7 @@ static void gps_power_2v8_set(int on) { struct regulator *regulator = neo1973_gps.regulator[GTA01_GPS_REG_2V8]; - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: case GTA01v4_SYSTEM_REV: if (on) @@ -100,7 +101,7 @@ static int gps_power_2v8_get(void) int ret = 0; struct regulator *regulator = neo1973_gps.regulator[GTA01_GPS_REG_2V8]; - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: case GTA01v4_SYSTEM_REV: ret = regulator_is_enabled(regulator); @@ -122,7 +123,7 @@ static void gps_power_3v_set(int on) { struct regulator *regulator = neo1973_gps.regulator[GTA01_GPS_REG_3V]; - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: case GTA01v4_SYSTEM_REV: if (on) @@ -144,7 +145,7 @@ static int gps_power_3v_get(void) int ret = 0; struct regulator *regulator = neo1973_gps.regulator[GTA01_GPS_REG_3V]; - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: case GTA01v4_SYSTEM_REV: ret = regulator_is_enabled(regulator); @@ -165,7 +166,7 @@ static void gps_power_3v3_set(int on) { struct regulator *regulator = neo1973_gps.regulator[GTA01_GPS_REG_3V3]; - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: case GTA01v4_SYSTEM_REV: case GTA01Bv2_SYSTEM_REV: @@ -187,7 +188,7 @@ static int gps_power_3v3_get(void) int ret = 0; struct regulator *regulator = neo1973_gps.regulator[GTA01_GPS_REG_3V3]; - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: case GTA01v4_SYSTEM_REV: case GTA01Bv2_SYSTEM_REV: @@ -208,7 +209,7 @@ static void gps_power_2v5_set(int on) { struct regulator *regulator = neo1973_gps.regulator[GTA01_GPS_REG_2V5]; - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: /* This is CORE_1V8 and cannot be disabled */ break; @@ -230,7 +231,7 @@ static int gps_power_2v5_get(void) int ret = 0; struct regulator *regulator = neo1973_gps.regulator[GTA01_GPS_REG_2V5]; - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: /* This is CORE_1V8 and cannot be disabled */ ret = 1; @@ -251,7 +252,7 @@ static void gps_power_1v5_set(int on) { struct regulator *regulator = neo1973_gps.regulator[GTA01_GPS_REG_1V5]; - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: case GTA01v4_SYSTEM_REV: case GTA01Bv2_SYSTEM_REV: @@ -273,7 +274,7 @@ static int gps_power_1v5_get(void) int ret = 0; struct regulator *regulator = neo1973_gps.regulator[GTA01_GPS_REG_1V5]; - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: case GTA01v4_SYSTEM_REV: case GTA01Bv2_SYSTEM_REV: @@ -424,7 +425,7 @@ static ssize_t power_gps_write(struct device *dev, /* This is the nRESET pin */ static void gps_rst_set(int on) { - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: pcf50606_gpo_set_active(gta01_pcf, PCF50606_GPO1, on); break; @@ -439,7 +440,7 @@ static void gps_rst_set(int on) static int gps_rst_get(void) { - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: return pcf50606_gpo_get_active(gta01_pcf, PCF50606_GPO1); break; @@ -635,7 +636,7 @@ static int __init gta01_pm_gps_probe(struct platform_device *pdev) if (machine_is_neo1973_gta01()) { s3c2410_gpio_cfgpin(GTA01_GPIO_GPS_PWRON, S3C2410_GPIO_OUTPUT); - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: break; case GTA01v4_SYSTEM_REV: @@ -678,7 +679,7 @@ static int __init gta01_pm_gps_probe(struct platform_device *pdev) gps_power_sequence_down(); - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: case GTA01v4_SYSTEM_REV: case GTA01Bv2_SYSTEM_REV: diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c index 63591cdff6f..fbd9f0eece3 100644 --- a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c +++ b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c @@ -27,6 +27,7 @@ #include <mach/s3c24xx-serial.h> #include <mach/hardware.h> +#include <mach/cpu.h> /* For GTA02 */ #include <mach/gta02.h> @@ -281,7 +282,7 @@ static struct attribute_group gta01_gsm_attr_group = { static int __init gta01_gsm_probe(struct platform_device *pdev) { - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v3_SYSTEM_REV: gta01_gsm.gpio_ngsm_en = GTA01v3_GPIO_nGSM_EN; break; @@ -309,7 +310,7 @@ static int __init gta01_gsm_probe(struct platform_device *pdev) break; } - switch (system_rev) { + switch (S3C_SYSTEM_REV_ATAG) { case GTA01v4_SYSTEM_REV: case GTA01Bv2_SYSTEM_REV: gta01_gsm_sysfs_entries[ARRAY_SIZE(gta01_gsm_sysfs_entries)-2] = |