From: Minkyu Kang Date: Wed, 11 Aug 2010 03:05:19 +0000 (+0900) Subject: s5p: use accessor function instead of SoC specific define X-Git-Tag: JH02_20100820~90 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=758a9971dc47d19468cde4124fe0b3d7006c04d6;p=kernel%2Fu-boot.git s5p: use accessor function instead of SoC specific define for prepare new s5p series SoC Signed-off-by: Minkyu Kang --- diff --git a/arch/arm/cpu/arm1176/s5p64xx/gpio.c b/arch/arm/cpu/arm1176/s5p64xx/gpio.c index b2b034e..4960475 100644 --- a/arch/arm/cpu/arm1176/s5p64xx/gpio.c +++ b/arch/arm/cpu/arm1176/s5p64xx/gpio.c @@ -158,7 +158,7 @@ static char *gpio_name1[] = { static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { struct s5pc110_gpio *gpio = - (struct s5pc110_gpio *)S5PC110_GPIO_BASE; + (struct s5pc110_gpio *)samsung_get_base_gpio(); int i = 0; int j; diff --git a/arch/arm/cpu/armv7/s5pc1xx/clock.c b/arch/arm/cpu/armv7/s5pc1xx/clock.c index 19619f9..67af84a 100644 --- a/arch/arm/cpu/armv7/s5pc1xx/clock.c +++ b/arch/arm/cpu/armv7/s5pc1xx/clock.c @@ -45,7 +45,8 @@ unsigned long (*get_pll_clk)(int); /* s5pc110: return pll clock frequency */ static unsigned long s5pc100_get_pll_clk(int pllreg) { - struct s5pc100_clock *clk = (struct s5pc100_clock *)S5PC1XX_CLOCK_BASE; + struct s5pc100_clock *clk = + (struct s5pc100_clock *)samsung_get_base_clock(); unsigned long r, m, p, s, mask, fout; unsigned int freq; @@ -95,7 +96,8 @@ static unsigned long s5pc100_get_pll_clk(int pllreg) /* s5pc100: return pll clock frequency */ static unsigned long s5pc110_get_pll_clk(int pllreg) { - struct s5pc110_clock *clk = (struct s5pc110_clock *)S5PC1XX_CLOCK_BASE; + struct s5pc110_clock *clk = + (struct s5pc110_clock *)samsung_get_base_clock(); unsigned long r, m, p, s, mask, fout; unsigned int freq; @@ -151,7 +153,8 @@ static unsigned long s5pc110_get_pll_clk(int pllreg) /* s5pc110: return ARM clock frequency */ static unsigned long s5pc110_get_arm_clk(void) { - struct s5pc110_clock *clk = (struct s5pc110_clock *)S5PC1XX_CLOCK_BASE; + struct s5pc110_clock *clk = + (struct s5pc110_clock *)samsung_get_base_clock(); unsigned long div; unsigned long dout_apll, armclk; unsigned int apll_ratio; @@ -170,7 +173,8 @@ static unsigned long s5pc110_get_arm_clk(void) /* s5pc100: return ARM clock frequency */ static unsigned long s5pc100_get_arm_clk(void) { - struct s5pc100_clock *clk = (struct s5pc100_clock *)S5PC1XX_CLOCK_BASE; + struct s5pc100_clock *clk = + (struct s5pc100_clock *)samsung_get_base_clock(); unsigned long div; unsigned long dout_apll, armclk; unsigned int apll_ratio, arm_ratio; @@ -191,7 +195,8 @@ static unsigned long s5pc100_get_arm_clk(void) /* s5pc100: return HCLKD0 frequency */ static unsigned long get_hclk(void) { - struct s5pc100_clock *clk = (struct s5pc100_clock *)S5PC1XX_CLOCK_BASE; + struct s5pc100_clock *clk = + (struct s5pc100_clock *)samsung_get_base_clock(); unsigned long hclkd0; uint div, d0_bus_ratio; @@ -207,7 +212,8 @@ static unsigned long get_hclk(void) /* s5pc100: return PCLKD1 frequency */ static unsigned long get_pclkd1(void) { - struct s5pc100_clock *clk = (struct s5pc100_clock *)S5PC1XX_CLOCK_BASE; + struct s5pc100_clock *clk = + (struct s5pc100_clock *)samsung_get_base_clock(); unsigned long d1_bus, pclkd1; uint div, d1_bus_ratio, pclkd1_ratio; @@ -227,7 +233,8 @@ static unsigned long get_pclkd1(void) /* s5pc110: return HCLKs frequency */ static unsigned long get_hclk_sys(int dom) { - struct s5pc110_clock *clk = (struct s5pc110_clock *)S5PC1XX_CLOCK_BASE; + struct s5pc110_clock *clk = + (struct s5pc110_clock *)samsung_get_base_clock(); unsigned long hclk; unsigned int div; unsigned int offset; @@ -255,7 +262,8 @@ static unsigned long get_hclk_sys(int dom) /* s5pc110: return PCLKs frequency */ static unsigned long get_pclk_sys(int dom) { - struct s5pc110_clock *clk = (struct s5pc110_clock *)S5PC1XX_CLOCK_BASE; + struct s5pc110_clock *clk = + (struct s5pc110_clock *)samsung_get_base_clock(); unsigned long pclk; unsigned int div; unsigned int offset; diff --git a/arch/arm/cpu/armv7/s5pc1xx/cpu_info.c b/arch/arm/cpu/armv7/s5pc1xx/cpu_info.c index c5d1c83..c3c46fa 100644 --- a/arch/arm/cpu/armv7/s5pc1xx/cpu_info.c +++ b/arch/arm/cpu/armv7/s5pc1xx/cpu_info.c @@ -32,7 +32,7 @@ unsigned int s5pc1xx_cpu_rev = 1; #ifdef CONFIG_ARCH_CPU_INIT int arch_cpu_init(void) { - s5pc1xx_cpu_id = readl(S5PC1XX_PRO_ID); + s5pc1xx_cpu_id = readl(samsung_get_base_pro_id()); s5pc1xx_cpu_id = 0xC000 | ((s5pc1xx_cpu_id & 0x00FFF000) >> 12); #ifndef CONFIG_RECOVERY_BLOCK s5pc1xx_clock_init(); diff --git a/arch/arm/cpu/armv7/s5pc1xx/reset.S b/arch/arm/cpu/armv7/s5pc1xx/reset.S index 7f6ff9c..70fa146 100644 --- a/arch/arm/cpu/armv7/s5pc1xx/reset.S +++ b/arch/arm/cpu/armv7/s5pc1xx/reset.S @@ -28,7 +28,7 @@ .globl reset_cpu reset_cpu: - ldr r1, =S5PC1XX_PRO_ID + ldr r1, =S5PC100_PRO_ID ldr r2, [r1] ldr r4, =0x00010000 and r4, r2, r4 diff --git a/arch/arm/cpu/armv7/s5pc1xx/sromc.c b/arch/arm/cpu/armv7/s5pc1xx/sromc.c index 380be81..044d122 100644 --- a/arch/arm/cpu/armv7/s5pc1xx/sromc.c +++ b/arch/arm/cpu/armv7/s5pc1xx/sromc.c @@ -35,12 +35,8 @@ void s5pc1xx_config_sromc(u32 srom_bank, u32 smc_bw_conf, u32 smc_bc_conf) { u32 tmp; - struct s5pc1xx_smc *srom; - - if (cpu_is_s5pc100()) - srom = (struct s5pc1xx_smc *)S5PC100_SROMC_BASE; - else - srom = (struct s5pc1xx_smc *)S5PC110_SROMC_BASE; + struct s5pc1xx_smc *srom = + (struct s5pc1xx_smc *)samsung_get_base_sromc(); /* Configure SMC_BW register to handle proper SROMC bank */ tmp = srom->bw; diff --git a/arch/arm/cpu/armv7/s5pc1xx/timer.c b/arch/arm/cpu/armv7/s5pc1xx/timer.c index d9ca7c1..a51b642 100644 --- a/arch/arm/cpu/armv7/s5pc1xx/timer.c +++ b/arch/arm/cpu/armv7/s5pc1xx/timer.c @@ -46,10 +46,7 @@ static unsigned long lastdec; /* Last decremneter snapshot */ /* macro to read the 16 bit timer */ static inline struct s5pc1xx_timer *s5pc1xx_get_base_timer(void) { - if (cpu_is_s5pc110()) - return (struct s5pc1xx_timer *)S5PC110_TIMER_BASE; - else - return (struct s5pc1xx_timer *)S5PC100_TIMER_BASE; + return (struct s5pc1xx_timer *)samsung_get_base_timer(); } int timer_init(void) diff --git a/arch/arm/include/asm/arch-s5pc1xx/cpu.h b/arch/arm/include/asm/arch-s5pc1xx/cpu.h index c1488ce..6f462a3 100644 --- a/arch/arm/include/asm/arch-s5pc1xx/cpu.h +++ b/arch/arm/include/asm/arch-s5pc1xx/cpu.h @@ -25,9 +25,9 @@ #define S5PC1XX_ADDR_BASE 0xE0000000 -#define S5PC1XX_CLOCK_BASE 0xE0100000 - /* S5PC100 */ +#define S5PC100_PRO_ID 0xE0000000 +#define S5PC100_CLOCK_BASE 0xE0100000 #define S5PC100_GPIO_BASE 0xE0300000 #define S5PC100_VIC0_BASE 0xE4000000 #define S5PC100_VIC1_BASE 0xE4100000 @@ -41,6 +41,8 @@ #define S5PC100_MMC_BASE 0xED800000 /* S5PC110 */ +#define S5PC110_PRO_ID 0xE0000000 +#define S5PC110_CLOCK_BASE 0xE0100000 #define S5PC110_GPIO_BASE 0xE0200000 #define S5PC110_ADC_BASE 0xE1700000 #define S5PC110_PWMTIMER_BASE 0xE2500000 @@ -57,7 +59,6 @@ #define S5PC110_VIC3_BASE 0xF2300000 /* Chip ID */ -#define S5PC1XX_PRO_ID 0xE0000000 #ifndef __ASSEMBLY__ /* CPU detection macros */ @@ -72,6 +73,25 @@ static inline int cpu_is_##type(void) \ IS_SAMSUNG_TYPE(s5pc100, 0xc100) IS_SAMSUNG_TYPE(s5pc110, 0xc110) +#define SAMSUNG_BASE(device, base) \ +static inline unsigned int samsung_get_base_##device(void) \ +{ \ + if (cpu_is_s5pc100()) \ + return S5PC100_##base; \ + else if (cpu_is_s5pc110()) \ + return S5PC110_##base; \ + else \ + return 0; \ +} \ + +SAMSUNG_BASE(clock, CLOCK_BASE) +SAMSUNG_BASE(gpio, GPIO_BASE) +SAMSUNG_BASE(pro_id, PRO_ID) +SAMSUNG_BASE(mmc, MMC_BASE) +SAMSUNG_BASE(sromc, SROMC_BASE) +SAMSUNG_BASE(timer, PWMTIMER_BASE) +SAMSUNG_BASE(uart, UART_BASE) + extern unsigned int s5pc1xx_cpu_rev; static inline int s5pc1xx_get_cpu_rev(void) diff --git a/arch/arm/include/asm/arch-s5pc1xx/pwm.h b/arch/arm/include/asm/arch-s5pc1xx/pwm.h index e02a8d8..518f6ae 100644 --- a/arch/arm/include/asm/arch-s5pc1xx/pwm.h +++ b/arch/arm/include/asm/arch-s5pc1xx/pwm.h @@ -22,10 +22,6 @@ #ifndef __ASM_ARM_ARCH_PWM_H_ #define __ASM_ARM_ARCH_PWM_H_ -/* PWM timer addressing */ -#define S5PC100_TIMER_BASE S5PC100_PWMTIMER_BASE -#define S5PC110_TIMER_BASE S5PC110_PWMTIMER_BASE - /* Interval mode(Auto Reload) of PWM Timer 4 */ #define S5PC1XX_TCON4_AUTO_RELOAD (1 << 22) /* Update TCNTB4 */ diff --git a/board/samsung/goni/lowlevel_init.S b/board/samsung/goni/lowlevel_init.S index 4b72992..62737ab 100644 --- a/board/samsung/goni/lowlevel_init.S +++ b/board/samsung/goni/lowlevel_init.S @@ -51,7 +51,7 @@ lowlevel_init: ldr r7, =S5PC100_GPIO_BASE ldr r8, =S5PC100_GPIO_BASE /* Read CPU ID */ - ldr r2, =S5PC1XX_PRO_ID + ldr r2, =S5PC110_PRO_ID ldr r0, [r2] mov r1, #0x00010000 and r0, r0, r1 @@ -377,7 +377,7 @@ lockloop: * void system_clock_init(void) */ system_clock_init: - ldr r0, =S5PC1XX_CLOCK_BASE @ 0xE0100000 + ldr r0, =S5PC110_CLOCK_BASE @ 0xE0100000 /* Check S5PC100 */ cmp r7, r8 @@ -437,7 +437,7 @@ system_clock_init: ldr r1, =0x3ff03ff str r1, [r0, #0x114] @ S5PC110_CLAMP_STABLE - ldr r0, =S5PC1XX_CLOCK_BASE @ 0xE0100000 + ldr r0, =S5PC110_CLOCK_BASE @ 0xE0100000 /* Set Clock divider */ ldr r1, =0x14131330 @ 1:1:4:4, 1:4:5 diff --git a/board/samsung/p1p2/lowlevel_init.S b/board/samsung/p1p2/lowlevel_init.S index d8aa7f9..57256ce 100644 --- a/board/samsung/p1p2/lowlevel_init.S +++ b/board/samsung/p1p2/lowlevel_init.S @@ -54,7 +54,7 @@ lowlevel_init: ldr r7, =S5PC100_GPIO_BASE ldr r8, =S5PC100_GPIO_BASE /* Read CPU ID */ - ldr r2, =S5PC1XX_PRO_ID + ldr r2, =S5PC100_PRO_ID ldr r0, [r2] mov r1, #0x00010000 and r0, r0, r1 @@ -331,7 +331,7 @@ lockloop: * void system_clock_init(void) */ system_clock_init: - ldr r0, =S5PC1XX_CLOCK_BASE @ 0xE0100000 + ldr r0, =S5PC110_CLOCK_BASE @ 0xE0100000 /* Check S5PC100 */ cmp r7, r8 diff --git a/board/samsung/p1p2/modem_boot.c b/board/samsung/p1p2/modem_boot.c index 3ee35c1..15185ff 100644 --- a/board/samsung/p1p2/modem_boot.c +++ b/board/samsung/p1p2/modem_boot.c @@ -43,7 +43,7 @@ #define CRC_ERR 0xff extern struct serial_device s5pc1xx_serial3_device; -static struct s5pc110_gpio *gpio = (struct s5pc110_gpio *)S5PC110_GPIO_BASE; +static struct s5pc110_gpio *gpio = (struct s5pc110_gpio *)samsung_get_base_gpio(); int uart_serial_pollc(struct serial_device *uart, int retry) { diff --git a/board/samsung/p1p2/onenand.c b/board/samsung/p1p2/onenand.c index 057bc6a..68b64d6 100644 --- a/board/samsung/p1p2/onenand.c +++ b/board/samsung/p1p2/onenand.c @@ -42,7 +42,7 @@ void onenand_board_init(struct mtd_info *mtd) this->options |= ONENAND_RUNTIME_BADBLOCK_CHECK; } else { struct s5pc100_clock *clk = - (struct s5pc100_clock *)S5PC1XX_CLOCK_BASE; + (struct s5pc100_clock *)samsung_get_base_clock(); struct samsung_onenand *onenand; this->base = (void *) S5PC100_ONENAND_BASE; diff --git a/board/samsung/p1p2/p1p2.c b/board/samsung/p1p2/p1p2.c index 576f849..8bbeb6a 100644 --- a/board/samsung/p1p2/p1p2.c +++ b/board/samsung/p1p2/p1p2.c @@ -253,7 +253,7 @@ static void enable_battery(void); void i2c_init_board(void) { - struct s5pc110_gpio *gpio = (struct s5pc110_gpio *)S5PC110_GPIO_BASE; + struct s5pc110_gpio *gpio = (struct s5pc110_gpio *)samsung_get_base_gpio(); int num_bus; if (cpu_is_s5pc100()) @@ -442,7 +442,7 @@ static void check_hw_revision(void) if (cpu_is_s5pc100()) { struct s5pc100_gpio *gpio = - (struct s5pc100_gpio *)S5PC100_GPIO_BASE; + (struct s5pc100_gpio *)samsung_get_base_gpio(); board_rev = get_hw_revision(&gpio->gpio_j0); @@ -451,7 +451,7 @@ static void check_hw_revision(void) board = MACH_TICKERTAPE; } else { struct s5pc110_gpio *gpio = - (struct s5pc110_gpio *)S5PC110_GPIO_BASE; + (struct s5pc110_gpio *)samsung_get_base_gpio(); board_rev = get_hw_revision(&gpio->gpio_j0); @@ -831,7 +831,7 @@ static void check_keypad(void) if (cpu_is_s5pc100()) { struct s5pc100_gpio *gpio = - (struct s5pc100_gpio *)S5PC100_GPIO_BASE; + (struct s5pc100_gpio *)samsung_get_base_gpio(); row_num = 3; col_num = 3; /* Set GPH2[2:0] to KP_COL[2:0] */ @@ -1479,7 +1479,7 @@ static struct gpio_external external_powerdown_modes[] = { static void setup_power_down_mode_registers(void) { - struct s5pc110_gpio *gpio = (struct s5pc110_gpio *)S5PC110_GPIO_BASE; + struct s5pc110_gpio *gpio = (struct s5pc110_gpio *)samsung_get_base_gpio(); struct s5p_gpio_bank *bank; struct gpio_powermode *p; struct gpio_external *ge; @@ -1527,7 +1527,7 @@ extern void s6e63m0_set_spi_interface(struct s6e63m0_platform_data *cs, struct s6e63m0_platform_data *so); struct s6e63m0_platform_data pd_cs, pd_clk, pd_si, pd_so; -struct s5pc110_gpio *gpio_base = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; +struct s5pc110_gpio *gpio_base = (struct s5pc110_gpio *)samsung_get_base_gpio(); int s5p_no_lcd_support(void) { @@ -1642,7 +1642,7 @@ void lcd_cfg_gpio(void) void backlight_on(unsigned int onoff) { - struct s5pc110_gpio *gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; + struct s5pc110_gpio *gpio = (struct s5pc110_gpio *)samsung_get_base_gpio(); if (onoff) { if (machine_is_geminus()) @@ -1655,7 +1655,7 @@ void backlight_on(unsigned int onoff) void reset_lcd(void) { - struct s5pc110_gpio *gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; + struct s5pc110_gpio *gpio = (struct s5pc110_gpio *)samsung_get_base_gpio(); if (machine_is_aquila() || machine_is_geminus()) gpio_set_value(&gpio->gpio_mp0_5, 5, 1); @@ -1673,7 +1673,7 @@ void reset_lcd(void) } void lcd_set_RST(void) { - struct s5pc110_gpio *gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; + struct s5pc110_gpio *gpio = (struct s5pc110_gpio *)samsung_get_base_gpio(); gpio_set_value(&gpio->gpio_mp0_5, 5, 1); udelay(1400000); @@ -1685,7 +1685,7 @@ void lcd_set_RST(void) void lcd_power_on(unsigned int onoff) { - struct s5pc110_gpio *gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; + struct s5pc110_gpio *gpio = (struct s5pc110_gpio *)samsung_get_base_gpio(); if (onoff) { if (machine_is_aquila() || machine_is_geminus() || machine_is_p1p2()) @@ -1923,7 +1923,7 @@ int misc_init_r(void) int board_init(void) { /* Set Initial global variables */ - s5pc110_gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; + s5pc110_gpio = (struct s5pc110_gpio *)samsung_get_base_gpio(); gd->bd->bi_arch_number = MACH_TYPE; gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; @@ -2142,7 +2142,8 @@ int board_mmc_init(bd_t *bis) { unsigned int reg; unsigned int clock; - struct s5pc110_clock *clk = (struct s5pc110_clock *)S5PC1XX_CLOCK_BASE; + struct s5pc110_clock *clk = + (struct s5pc110_clock *)samsung_get_base_clock(); int i; /* MMC0 Clock source = SCLKMPLL */ diff --git a/board/samsung/smdkc100/lowlevel_init.S b/board/samsung/smdkc100/lowlevel_init.S index 86e2f09..aafd089 100644 --- a/board/samsung/smdkc100/lowlevel_init.S +++ b/board/samsung/smdkc100/lowlevel_init.S @@ -131,7 +131,7 @@ wakeup_reset: * void system_clock_init(void) */ system_clock_init: - ldr r8, =S5PC1XX_CLOCK_BASE @ 0xE0100000 + ldr r8, =S5PC100_CLOCK_BASE @ 0xE0100000 /* Set Clock divider */ ldr r1, =0x00011110 diff --git a/board/samsung/smdkc100/onenand.c b/board/samsung/smdkc100/onenand.c index c25869e..501855e 100644 --- a/board/samsung/smdkc100/onenand.c +++ b/board/samsung/smdkc100/onenand.c @@ -35,7 +35,8 @@ void onenand_board_init(struct mtd_info *mtd) { struct onenand_chip *this = mtd->priv; - struct s5pc100_clock *clk = (struct s5pc100_clock *)S5PC1XX_CLOCK_BASE; + struct s5pc100_clock *clk = + (struct s5pc100_clock *)samsung_get_base_clock(); struct samsung_onenand *onenand; int value; diff --git a/board/samsung/universal/lowlevel_init.S b/board/samsung/universal/lowlevel_init.S index c188a50..8caa9bd 100644 --- a/board/samsung/universal/lowlevel_init.S +++ b/board/samsung/universal/lowlevel_init.S @@ -54,7 +54,7 @@ lowlevel_init: ldr r7, =S5PC100_GPIO_BASE ldr r8, =S5PC100_GPIO_BASE /* Read CPU ID */ - ldr r2, =S5PC1XX_PRO_ID + ldr r2, =S5PC100_PRO_ID ldr r0, [r2] mov r1, #0x00010000 and r0, r0, r1 @@ -442,7 +442,7 @@ lockloop: * void system_clock_init(void) */ system_clock_init: - ldr r0, =S5PC1XX_CLOCK_BASE @ 0xE0100000 + ldr r0, =S5PC100_CLOCK_BASE @ 0xE0100000 /* Check S5PC100 */ cmp r7, r8 @@ -526,7 +526,7 @@ system_clock_init: ldr r1, =0x3ff03ff str r1, [r0, #0x114] @ S5PC110_CLAMP_STABLE - ldr r0, =S5PC1XX_CLOCK_BASE @ 0xE0100000 + ldr r0, =S5PC100_CLOCK_BASE @ 0xE0100000 /* Set Clock divider */ ldr r1, =0x14131330 @ 1:1:4:4, 1:4:5 diff --git a/board/samsung/universal/modem_boot.c b/board/samsung/universal/modem_boot.c index 3ee35c1..ee68685 100644 --- a/board/samsung/universal/modem_boot.c +++ b/board/samsung/universal/modem_boot.c @@ -43,7 +43,8 @@ #define CRC_ERR 0xff extern struct serial_device s5pc1xx_serial3_device; -static struct s5pc110_gpio *gpio = (struct s5pc110_gpio *)S5PC110_GPIO_BASE; +static struct s5pc110_gpio *gpio = + (struct s5pc110_gpio *)samsung_get_base_gpio(); int uart_serial_pollc(struct serial_device *uart, int retry) { diff --git a/board/samsung/universal/onenand.c b/board/samsung/universal/onenand.c index 27c2311..001d428 100644 --- a/board/samsung/universal/onenand.c +++ b/board/samsung/universal/onenand.c @@ -43,7 +43,7 @@ void onenand_board_init(struct mtd_info *mtd) this->chip_probe = s5pc110_chip_probe; } else { struct s5pc100_clock *clk = - (struct s5pc100_clock *)S5PC1XX_CLOCK_BASE; + (struct s5pc100_clock *)samsung_get_base_clock(); struct samsung_onenand *onenand; this->base = (void *) S5PC100_ONENAND_BASE; diff --git a/board/samsung/universal/universal.c b/board/samsung/universal/universal.c index 54564fb..9cb0cb4 100644 --- a/board/samsung/universal/universal.c +++ b/board/samsung/universal/universal.c @@ -298,7 +298,6 @@ static void check_micro_usb(int intr); void i2c_init_board(void) { - struct s5pc110_gpio *gpio = (struct s5pc110_gpio *)S5PC110_GPIO_BASE; int num_bus; if (cpu_is_s5pc100()) @@ -311,11 +310,11 @@ void i2c_init_board(void) i2c_gpio[I2C_GPIO7].bus->gpio_base = 0; } else if (mach_is_goni()) { i2c_gpio[I2C_GPIO7].bus->gpio_base = - (unsigned int)&gpio->gpio_mp0_5; + (unsigned int)&s5pc110_gpio->gpio_mp0_5; } else if (mach_is_cypress()) { i2c_gpio[I2C_GPIO7].bus = &i2c_cypress_gpio7; i2c_gpio[I2C_GPIO7].bus->gpio_base = - (unsigned int)&gpio->gpio_mp0_5; + (unsigned int)&s5pc110_gpio->gpio_mp0_5; } else { i2c_gpio[I2C_GPIO7].bus->gpio_base = 0; } @@ -323,7 +322,7 @@ void i2c_init_board(void) if (board_has_AVS()) { /* no I2C2. it's used by AVS-IEM */ static int printed = 0; struct s5p_gpio_bank *bank = - (struct s5p_gpio_bank *)(&gpio->gpio_d1); + (struct s5p_gpio_bank *)(&s5pc110_gpio->gpio_d1); /* set GPD1CON[4], [5] as IEM_SPWI/SCLK */ gpio_cfg_pin(bank, 4, 0x2); /* IEM_SCLK */ gpio_cfg_pin(bank, 5, 0x2); /* IEM_SPWI */ @@ -333,13 +332,19 @@ void i2c_init_board(void) puts("(I2C2 Diabled. AVS Mode) "); printed = 1; } - } else - i2c_gpio[I2C_2].bus->gpio_base = (unsigned int)&gpio->gpio_d1; + } else { + i2c_gpio[I2C_2].bus->gpio_base = + (unsigned int)&s5pc110_gpio->gpio_d1; + } - i2c_gpio[I2C_GPIO3].bus->gpio_base = (unsigned int)&gpio->gpio_j3; - i2c_gpio[I2C_PMIC].bus->gpio_base = (unsigned int)&gpio->gpio_j4; - i2c_gpio[I2C_GPIO5].bus->gpio_base = (unsigned int)&gpio->gpio_mp0_5; - i2c_gpio[I2C_GPIO6].bus->gpio_base = (unsigned int)&gpio->gpio_j3; + i2c_gpio[I2C_GPIO3].bus->gpio_base = + (unsigned int)&s5pc110_gpio->gpio_j3; + i2c_gpio[I2C_PMIC].bus->gpio_base = + (unsigned int)&s5pc110_gpio->gpio_j4; + i2c_gpio[I2C_GPIO5].bus->gpio_base = + (unsigned int)&s5pc110_gpio->gpio_mp0_5; + i2c_gpio[I2C_GPIO6].bus->gpio_base = + (unsigned int)&s5pc110_gpio->gpio_j3; i2c_gpio_init(i2c_gpio, num_bus, I2C_PMIC); @@ -543,8 +548,6 @@ static void check_hw_revision(void) if (board_rev == 3) board = MACH_TICKERTAPE; } else { - struct s5pc110_gpio *gpio = - (struct s5pc110_gpio *)S5PC110_GPIO_BASE; int hwrev3 = 1; board_rev = 0; @@ -574,26 +577,26 @@ static void check_hw_revision(void) */ /* C110 Aquila */ - if (gpio_get_value(&gpio->gpio_j1, 4) == 0) { + if (gpio_get_value(&s5pc110_gpio->gpio_j1, 4) == 0) { board = MACH_TYPE_AQUILA; board_rev |= J1_B2_BOARD; - gpio_set_pull(&gpio->gpio_j2, 6, GPIO_PULL_NONE); - gpio_direction_input(&gpio->gpio_j2, 6); + gpio_set_pull(&s5pc110_gpio->gpio_j2, 6, GPIO_PULL_NONE); + gpio_direction_input(&s5pc110_gpio->gpio_j2, 6); /* Check board */ - if (gpio_get_value(&gpio->gpio_h1, 2) == 0) + if (gpio_get_value(&s5pc110_gpio->gpio_h1, 2) == 0) board_rev |= LIMO_UNIVERSAL_BOARD; - if (gpio_get_value(&gpio->gpio_h3, 2) == 0) + if (gpio_get_value(&s5pc110_gpio->gpio_h3, 2) == 0) board_rev |= LIMO_REAL_BOARD; - if (gpio_get_value(&gpio->gpio_j2, 6) == 1) + if (gpio_get_value(&s5pc110_gpio->gpio_j2, 6) == 1) board_rev |= MEDIA_BOARD; /* set gpio to default value. */ - gpio_set_pull(&gpio->gpio_j2, 6, GPIO_PULL_DOWN); - gpio_direction_output(&gpio->gpio_j2, 6, 0); + gpio_set_pull(&s5pc110_gpio->gpio_j2, 6, GPIO_PULL_DOWN); + gpio_direction_output(&s5pc110_gpio->gpio_j2, 6, 0); } /* Workaround: C110 Aquila Rev0.6 */ @@ -603,14 +606,14 @@ static void check_hw_revision(void) } /* C110 Aquila Bamboo */ - if (gpio_get_value(&gpio->gpio_j2, 0) == 1) { + if (gpio_get_value(&s5pc110_gpio->gpio_j2, 0) == 1) { board = MACH_TYPE_AQUILA; board_rev |= BAMBOO_BOARD; } /* C110 TickerTape */ - if (gpio_get_value(&gpio->gpio_d1, 0) == 0 && - gpio_get_value(&gpio->gpio_d1, 1) == 0) + if (gpio_get_value(&s5pc110_gpio->gpio_d1, 0) == 0 && + gpio_get_value(&s5pc110_gpio->gpio_d1, 1) == 0) board = MACH_TICKERTAPE; /* WMG160 - GPH3[0:4] = 0x00 */ @@ -618,7 +621,7 @@ static void check_hw_revision(void) int i, wmg160 = 1; for (i = 0; i < 4; i++) { - if (gpio_get_value(&gpio->gpio_h3, i) != 0) { + if (gpio_get_value(&s5pc110_gpio->gpio_h3, i) != 0) { wmg160 = 0; break; } @@ -630,34 +633,34 @@ static void check_hw_revision(void) } /* C110 Geminus for rev0.0 */ - gpio_set_pull(&gpio->gpio_j1, 2, GPIO_PULL_NONE); - gpio_direction_input(&gpio->gpio_j1, 2); - if (gpio_get_value(&gpio->gpio_j1, 2) == 1) { + gpio_set_pull(&s5pc110_gpio->gpio_j1, 2, GPIO_PULL_NONE); + gpio_direction_input(&s5pc110_gpio->gpio_j1, 2); + if (gpio_get_value(&s5pc110_gpio->gpio_j1, 2) == 1) { board = MACH_GEMINUS; if ((board_rev & ~BOARD_MASK) == 3) board_rev &= ~0xff; } - gpio_set_pull(&gpio->gpio_j1, 2, GPIO_PULL_DOWN); - gpio_direction_output(&gpio->gpio_j1, 2, 0); + gpio_set_pull(&s5pc110_gpio->gpio_j1, 2, GPIO_PULL_DOWN); + gpio_direction_output(&s5pc110_gpio->gpio_j1, 2, 0); /* C110 Geminus for rev0.1 ~ */ - gpio_set_pull(&gpio->gpio_j0, 6, GPIO_PULL_NONE); - gpio_direction_input(&gpio->gpio_j0, 6); - if (gpio_get_value(&gpio->gpio_j0, 6) == 1) { + gpio_set_pull(&s5pc110_gpio->gpio_j0, 6, GPIO_PULL_NONE); + gpio_direction_input(&s5pc110_gpio->gpio_j0, 6); + if (gpio_get_value(&s5pc110_gpio->gpio_j0, 6) == 1) { board = MACH_GEMINUS; hwrev3 = 7; } - gpio_set_pull(&gpio->gpio_j0, 6, GPIO_PULL_DOWN); + gpio_set_pull(&s5pc110_gpio->gpio_j0, 6, GPIO_PULL_DOWN); /* Kessler MP0_5[6] == 1 */ - gpio_direction_input(&gpio->gpio_mp0_5, 6); - if (gpio_get_value(&gpio->gpio_mp0_5, 6) == 1) { + gpio_direction_input(&s5pc110_gpio->gpio_mp0_5, 6); + if (gpio_get_value(&s5pc110_gpio->gpio_mp0_5, 6) == 1) { /* Cypress: Do this for cypress */ - gpio_set_pull(&gpio->gpio_j2, 2, GPIO_PULL_NONE); - gpio_direction_input(&gpio->gpio_j2, 2); - if (gpio_get_value(&gpio->gpio_j2, 2) == 1) { + gpio_set_pull(&s5pc110_gpio->gpio_j2, 2, GPIO_PULL_NONE); + gpio_direction_input(&s5pc110_gpio->gpio_j2, 2); + if (gpio_get_value(&s5pc110_gpio->gpio_j2, 2) == 1) { board = MACH_CYPRESS; - gpio_direction_output(&gpio->gpio_mp0_5, 6, 0); + gpio_direction_output(&s5pc110_gpio->gpio_mp0_5, 6, 0); } else { board = MACH_TYPE_GONI; board_rev |= KESSLER_BOARD; @@ -667,23 +670,23 @@ static void check_hw_revision(void) #endif /* Limo SDK MP0_5[4] == 1 */ - gpio_direction_input(&gpio->gpio_mp0_5, 4); - if (gpio_get_value(&gpio->gpio_mp0_5, 4) == 1) { + gpio_direction_input(&s5pc110_gpio->gpio_mp0_5, 4); + if (gpio_get_value(&s5pc110_gpio->gpio_mp0_5, 4) == 1) { board_rev &= ~KESSLER_BOARD; /* Haydn MP0_4[0] == 1 */ - gpio_direction_input(&gpio->gpio_mp0_4, 0); - if (gpio_get_value(&gpio->gpio_mp0_4, 0) == 1) + gpio_direction_input(&s5pc110_gpio->gpio_mp0_4, 0); + if (gpio_get_value(&s5pc110_gpio->gpio_mp0_4, 0) == 1) board_rev |= HAYDN_BOARD; else board_rev |= SDK_BOARD; } } - gpio_set_pull(&gpio->gpio_j2, 2, GPIO_PULL_DOWN); + gpio_set_pull(&s5pc110_gpio->gpio_j2, 2, GPIO_PULL_DOWN); hwrev3 = 7; } else { - gpio_direction_output(&gpio->gpio_mp0_5, 6, 0); + gpio_direction_output(&s5pc110_gpio->gpio_mp0_5, 6, 0); /* Goni S1 board detection */ if (board == MACH_TICKERTAPE) { board = MACH_TYPE_GONI; @@ -692,7 +695,7 @@ static void check_hw_revision(void) } } - board_rev |= get_hw_revision(&gpio->gpio_j0, hwrev3); + board_rev |= get_hw_revision(&s5pc110_gpio->gpio_j0, hwrev3); } /* Set machine id */ @@ -1749,7 +1752,6 @@ static void init_pmic(void) static void setup_power_down_mode_registers(void) { - struct s5pc110_gpio *gpio = (struct s5pc110_gpio *)S5PC110_GPIO_BASE; struct s5p_gpio_bank *bank; struct gpio_powermode *p; int n_p; @@ -1823,7 +1825,7 @@ static void setup_power_down_mode_registers(void) } } - bank = &gpio->gpio_a0; + bank = &s5pc110_gpio->gpio_a0; for (i = 0; i < n_p; i++, p++, bank++) { writel(p->conpdn, &bank->pdn_con); @@ -1833,7 +1835,7 @@ static void setup_power_down_mode_registers(void) writel(0xff0022b0, (unsigned int *)0xF0000000); writel(0xff0022b0, (unsigned int *)0xF1400000); - bank = &gpio->gpio_h0; + bank = &s5pc110_gpio->gpio_h0; for (i = 0; i < n_ge; i++) { writel(ge->con, &bank->con); @@ -1863,29 +1865,27 @@ extern void ld9040_set_platform_data(struct spi_platform_data *pd); struct spi_platform_data spi_pd; -struct s5pc110_gpio *gpio_base = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; - void lcd_cfg_gpio(void) { unsigned int i, f3_end = 4; for (i = 0; i < 8; i++) { /* set GPF0,1,2[0:7] for RGB Interface and Data lines (32bit) */ - gpio_cfg_pin(&gpio_base->gpio_f0, i, GPIO_FUNC(2)); - gpio_cfg_pin(&gpio_base->gpio_f1, i, GPIO_FUNC(2)); - gpio_cfg_pin(&gpio_base->gpio_f2, i, GPIO_FUNC(2)); + gpio_cfg_pin(&s5pc110_gpio->gpio_f0, i, GPIO_FUNC(2)); + gpio_cfg_pin(&s5pc110_gpio->gpio_f1, i, GPIO_FUNC(2)); + gpio_cfg_pin(&s5pc110_gpio->gpio_f2, i, GPIO_FUNC(2)); /* pull-up/down disable */ - gpio_set_pull(&gpio_base->gpio_f0, i, GPIO_PULL_NONE); - gpio_set_pull(&gpio_base->gpio_f1, i, GPIO_PULL_NONE); - gpio_set_pull(&gpio_base->gpio_f2, i, GPIO_PULL_NONE); + gpio_set_pull(&s5pc110_gpio->gpio_f0, i, GPIO_PULL_NONE); + gpio_set_pull(&s5pc110_gpio->gpio_f1, i, GPIO_PULL_NONE); + gpio_set_pull(&s5pc110_gpio->gpio_f2, i, GPIO_PULL_NONE); /* drive strength to max (24bit) */ - gpio_set_drv(&gpio_base->gpio_f0, i, GPIO_DRV_4X); - gpio_set_rate(&gpio_base->gpio_f0, i, GPIO_DRV_SLOW); - gpio_set_drv(&gpio_base->gpio_f1, i, GPIO_DRV_4X); - gpio_set_rate(&gpio_base->gpio_f1, i, GPIO_DRV_SLOW); - gpio_set_drv(&gpio_base->gpio_f2, i, GPIO_DRV_4X); - gpio_set_rate(&gpio_base->gpio_f2, i, GPIO_DRV_SLOW); + gpio_set_drv(&s5pc110_gpio->gpio_f0, i, GPIO_DRV_4X); + gpio_set_rate(&s5pc110_gpio->gpio_f0, i, GPIO_DRV_SLOW); + gpio_set_drv(&s5pc110_gpio->gpio_f1, i, GPIO_DRV_4X); + gpio_set_rate(&s5pc110_gpio->gpio_f1, i, GPIO_DRV_SLOW); + gpio_set_drv(&s5pc110_gpio->gpio_f2, i, GPIO_DRV_4X); + gpio_set_rate(&s5pc110_gpio->gpio_f2, i, GPIO_DRV_SLOW); } /* set DISPLAY_DE_B pin for dual rgb mode. */ @@ -1894,47 +1894,47 @@ void lcd_cfg_gpio(void) for (i = 0; i < f3_end; i++) { /* set GPF3[0:3] for RGB Interface and Data lines (32bit) */ - gpio_cfg_pin(&gpio_base->gpio_f3, i, GPIO_PULL_UP); + gpio_cfg_pin(&s5pc110_gpio->gpio_f3, i, GPIO_PULL_UP); /* pull-up/down disable */ - gpio_set_pull(&gpio_base->gpio_f3, i, GPIO_PULL_NONE); + gpio_set_pull(&s5pc110_gpio->gpio_f3, i, GPIO_PULL_NONE); /* drive strength to max (24bit) */ - gpio_set_drv(&gpio_base->gpio_f3, i, GPIO_DRV_4X); - gpio_set_rate(&gpio_base->gpio_f3, i, GPIO_DRV_SLOW); + gpio_set_drv(&s5pc110_gpio->gpio_f3, i, GPIO_DRV_4X); + gpio_set_rate(&s5pc110_gpio->gpio_f3, i, GPIO_DRV_SLOW); } /* display output path selection (only [1:0] valid) */ writel(0x2, 0xE0107008); /* gpio pad configuration for LCD reset. */ - gpio_cfg_pin(&gpio_base->gpio_mp0_5, 5, GPIO_OUTPUT); + gpio_cfg_pin(&s5pc110_gpio->gpio_mp0_5, 5, GPIO_OUTPUT); /* gpio pad configuration for LCD ON. */ - gpio_cfg_pin(&gpio_base->gpio_j1, 3, GPIO_OUTPUT); + gpio_cfg_pin(&s5pc110_gpio->gpio_j1, 3, GPIO_OUTPUT); /* LCD_BACKLIGHT_EN */ if (mach_is_geminus()) - gpio_cfg_pin(&gpio_base->gpio_mp0_5, 0, GPIO_OUTPUT); + gpio_cfg_pin(&s5pc110_gpio->gpio_mp0_5, 0, GPIO_OUTPUT); if (board_is_sdk() && hwrevision(0)) { - gpio_cfg_pin(&gpio_base->gpio_mp0_4, 4, GPIO_OUTPUT); - gpio_direction_output(&gpio_base->gpio_mp0_4, 4, 0); + gpio_cfg_pin(&s5pc110_gpio->gpio_mp0_4, 4, GPIO_OUTPUT); + gpio_direction_output(&s5pc110_gpio->gpio_mp0_4, 4, 0); } /* * gpio pad configuration for * DISPLAY_CS, DISPLAY_CLK, DISPLAY_SO, DISPLAY_SI. */ - gpio_cfg_pin(&gpio_base->gpio_mp0_1, 1, GPIO_OUTPUT); - gpio_cfg_pin(&gpio_base->gpio_mp0_4, 1, GPIO_OUTPUT); - gpio_cfg_pin(&gpio_base->gpio_mp0_4, 2, GPIO_INPUT); - gpio_cfg_pin(&gpio_base->gpio_mp0_4, 3, GPIO_OUTPUT); + gpio_cfg_pin(&s5pc110_gpio->gpio_mp0_1, 1, GPIO_OUTPUT); + gpio_cfg_pin(&s5pc110_gpio->gpio_mp0_4, 1, GPIO_OUTPUT); + gpio_cfg_pin(&s5pc110_gpio->gpio_mp0_4, 2, GPIO_INPUT); + gpio_cfg_pin(&s5pc110_gpio->gpio_mp0_4, 3, GPIO_OUTPUT); if (mach_is_aquila() || mach_is_goni()) { - spi_pd.cs_bank = &gpio_base->gpio_mp0_1; + spi_pd.cs_bank = &s5pc110_gpio->gpio_mp0_1; spi_pd.cs_num = 1; - spi_pd.clk_bank = &gpio_base->gpio_mp0_4; + spi_pd.clk_bank = &s5pc110_gpio->gpio_mp0_4; spi_pd.clk_num = 1; - spi_pd.si_bank = &gpio_base->gpio_mp0_4; + spi_pd.si_bank = &s5pc110_gpio->gpio_mp0_4; spi_pd.si_num = 3; - spi_pd.so_bank = &gpio_base->gpio_mp0_4; + spi_pd.so_bank = &s5pc110_gpio->gpio_mp0_4; spi_pd.so_num = 2; if (board_is_sdk() && hwrevision(0)) @@ -1954,24 +1954,24 @@ void lcd_cfg_gpio(void) gpio_cfg_pin(&gpio_base->gpio_mp0_1, 0, GPIO_OUTPUT); #endif /* FLCD_CS_S */ - gpio_cfg_pin(&gpio_base->gpio_mp0_5, 1, GPIO_OUTPUT); + gpio_cfg_pin(&s5pc110_gpio->gpio_mp0_5, 1, GPIO_OUTPUT); /* FLCD_CLK */ - gpio_cfg_pin(&gpio_base->gpio_mp0_4, 0, GPIO_OUTPUT); + gpio_cfg_pin(&s5pc110_gpio->gpio_mp0_4, 0, GPIO_OUTPUT); /* FLCD_SDI */ - gpio_cfg_pin(&gpio_base->gpio_mp0_4, 2, GPIO_OUTPUT); + gpio_cfg_pin(&s5pc110_gpio->gpio_mp0_4, 2, GPIO_OUTPUT); /* FLCD_RST_S */ - gpio_cfg_pin(&gpio_base->gpio_mp0_4, 5, GPIO_OUTPUT); + gpio_cfg_pin(&s5pc110_gpio->gpio_mp0_4, 5, GPIO_OUTPUT); /* FLCD_ON_S */ - gpio_cfg_pin(&gpio_base->gpio_g2, 2, GPIO_OUTPUT); + gpio_cfg_pin(&s5pc110_gpio->gpio_g2, 2, GPIO_OUTPUT); #if 0 /* universal cypress */ pd_cs.bank = &gpio_base->gpio_mp0_1; pd_cs.num = 0; #endif - spi_pd.cs_bank = &gpio_base->gpio_mp0_5; + spi_pd.cs_bank = &s5pc110_gpio->gpio_mp0_5; spi_pd.cs_num = 1; - spi_pd.clk_bank = &gpio_base->gpio_mp0_4; + spi_pd.clk_bank = &s5pc110_gpio->gpio_mp0_4; spi_pd.clk_num = 0; - spi_pd.si_bank = &gpio_base->gpio_mp0_4; + spi_pd.si_bank = &s5pc110_gpio->gpio_mp0_4; spi_pd.si_num = 2; spi_pd.set_rev = 1; @@ -1997,18 +1997,17 @@ void backlight_on(unsigned int onoff) unsigned char addr; unsigned char val[2]; - struct s5pc110_gpio *gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; if (onoff) { if (mach_is_geminus()) - gpio_set_value(&gpio->gpio_mp0_5, 0, 1); + gpio_set_value(&s5pc110_gpio->gpio_mp0_5, 0, 1); } else { if (mach_is_geminus()) - gpio_set_value(&gpio->gpio_mp0_5, 0, 0); + gpio_set_value(&s5pc110_gpio->gpio_mp0_5, 0, 0); } if (mach_is_goni() && board_is_sdk() && hwrevision(0)) { - gpio_set_value(&gpio->gpio_mp0_4, 4, 1); + gpio_set_value(&s5pc110_gpio->gpio_mp0_4, 4, 1); udelay(6); i2c_set_bus_num(I2C_GPIO5); @@ -2035,39 +2034,36 @@ void backlight_on(unsigned int onoff) void reset_lcd(void) { - struct s5pc110_gpio *gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; - if (mach_is_aquila() || mach_is_goni() || mach_is_geminus()) { - gpio_set_value(&gpio->gpio_mp0_5, 5, 1); + gpio_set_value(&s5pc110_gpio->gpio_mp0_5, 5, 1); if (board_is_sdk() && (hwrevision(3) || hwrevision(6))) { udelay(10000); - gpio_set_value(&gpio->gpio_mp0_5, 5, 0); + gpio_set_value(&s5pc110_gpio->gpio_mp0_5, 5, 0); udelay(10000); - gpio_set_value(&gpio->gpio_mp0_5, 5, 1); + gpio_set_value(&s5pc110_gpio->gpio_mp0_5, 5, 1); udelay(100); } } if (mach_is_cypress()) - gpio_set_value(&gpio->gpio_mp0_4, 5, 1); + gpio_set_value(&s5pc110_gpio->gpio_mp0_4, 5, 1); } void lcd_power_on(unsigned int onoff) { - struct s5pc110_gpio *gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; if (onoff) { /* TSP_LDO_ON */ if (mach_is_aquila() || mach_is_geminus()) - gpio_set_value(&gpio->gpio_j1, 3, 1); + gpio_set_value(&s5pc110_gpio->gpio_j1, 3, 1); if (mach_is_cypress()) - gpio_set_value(&gpio->gpio_g2, 2, 1); + gpio_set_value(&s5pc110_gpio->gpio_g2, 2, 1); if (mach_is_goni()) { unsigned char addr; unsigned char val[2]; unsigned char val2[2]; - gpio_set_value(&gpio->gpio_j1, 3, 1); + gpio_set_value(&s5pc110_gpio->gpio_j1, 3, 1); addr = 0xCC >> 1; /* max8998 */ if (max8998_probe()) @@ -2092,16 +2088,16 @@ void lcd_power_on(unsigned int onoff) } } else { if (mach_is_aquila() || mach_is_geminus()) - gpio_set_value(&gpio->gpio_j1, 3, 0); + gpio_set_value(&s5pc110_gpio->gpio_j1, 3, 0); if (mach_is_cypress()) - gpio_set_value(&gpio->gpio_g2, 2, 0); + gpio_set_value(&s5pc110_gpio->gpio_g2, 2, 0); if (mach_is_goni()) { unsigned char addr; unsigned char val[2]; - gpio_set_value(&gpio->gpio_j1, 3, 0); + gpio_set_value(&s5pc110_gpio->gpio_j1, 3, 0); addr = 0xCC >> 1; /* max8998 */ if (max8998_probe()) @@ -2427,7 +2423,7 @@ int misc_init_r(void) int board_init(void) { /* Set Initial global variables */ - s5pc110_gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; + s5pc110_gpio = (struct s5pc110_gpio *)samsung_get_base_gpio(); gd->bd->bi_arch_number = MACH_TYPE_AQUILA; gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c index d739ba1..5566c47 100644 --- a/drivers/gpio/s5p_gpio.c +++ b/drivers/gpio/s5p_gpio.c @@ -171,7 +171,7 @@ static char *gpio_name1[] = { static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { struct s5pc110_gpio *gpio = - (struct s5pc110_gpio *)S5PC110_GPIO_BASE; + (struct s5pc110_gpio *)samsung_get_base_gpio(); int i = 0; int j; diff --git a/drivers/mmc/s5p_mmc.c b/drivers/mmc/s5p_mmc.c index 0295fb0..5874043 100644 --- a/drivers/mmc/s5p_mmc.c +++ b/drivers/mmc/s5p_mmc.c @@ -30,11 +30,7 @@ struct mmc_host mmc_host[4]; static inline struct s5p_mmc *s5p_get_base_mmc(int dev_index) { unsigned long offset = dev_index * sizeof(struct s5p_mmc); - - if (cpu_is_s5pc100()) - return (struct s5p_mmc *)(S5PC100_MMC_BASE + offset); - else - return (struct s5p_mmc *)(S5PC110_MMC_BASE + offset); + return (struct s5p_mmc *)(samsung_get_base_mmc() + offset); } static void mmc_prepare_data(struct mmc_host *host, struct mmc_data *data) diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c index d3d4280..6a61b4f 100644 --- a/drivers/serial/serial_s5p.c +++ b/drivers/serial/serial_s5p.c @@ -30,18 +30,7 @@ static inline struct s5p_uart *s5p_get_base_uart(int dev_index) { u32 offset = dev_index * sizeof(struct s5p_uart); - -#ifdef CONFIG_S5PC1XX - if (cpu_is_s5pc100()) - return (struct s5p_uart *)(S5PC100_UART_BASE + offset); - else - return (struct s5p_uart *)(S5PC110_UART_BASE + offset); -#elif CONFIG_S5P64XX - if (cpu_is_s5p6442()) - return (struct s5pc1xx_uart *)(S5P6442_UART_BASE + offset); - else - return NULL; -#endif + return (struct s5p_uart *)(samsung_get_base_uart() + offset); } /* diff --git a/drivers/video/ams701ka.c b/drivers/video/ams701ka.c index 9d20ec6..69a3c92 100644 --- a/drivers/video/ams701ka.c +++ b/drivers/video/ams701ka.c @@ -25,7 +25,7 @@ #include #include -struct s5pc110_gpio *gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; +struct s5pc110_gpio *gpio = (struct s5pc110_gpio *)samsung_get_base_gpio(); #define SLEEPMSEC 0x1000 #define ENDDEF 0x2000 diff --git a/drivers/video/s5p-fimd.c b/drivers/video/s5p-fimd.c index cb52faf..8f1710c 100644 --- a/drivers/video/s5p-fimd.c +++ b/drivers/video/s5p-fimd.c @@ -135,7 +135,8 @@ static void s5pc_fimd_set_clock(void) unsigned int cfg = 0, div = 0, fimd_ratio = 0, temp = 0, remainder, remainder_div; unsigned long pixel_clock, src_clock, max_clock; - struct s5pc110_clock *clk = (struct s5pc110_clock *)S5PC1XX_CLOCK_BASE; + struct s5pc110_clock *clk = + (struct s5pc110_clock *)samsung_get_base_clock(); u64 div64; s5pc1xx_clock_init();