Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'next/devel2' of git://git.linaro.org/people/arnd/arm-soc

* 'next/devel2' of git://git.linaro.org/people/arnd/arm-soc: (30 commits)
ARM: mmp: register internal sram bank
ARM: mmp: register audio sram bank
ARM: mmp: add sram allocator
gpio/samsung: Complain loudly if we don't know the SoC
ARM: S3C64XX: Fix SoC identification for S3C64xx devices
ARM: S3C2443: Remove redundant s3c_register_clocks call for init_clocks
ARM: S3C24XX: Add devname for hsmmc1 pclk
ARM: S3C24XX: use clk_get_rate to init fclk in common_setup_clocks
ARM: S3C2443: Accommodate cpufreq frequency scheme in armdiv
ARM: S3C2443: handle unset armdiv values gracefully
ARM: S3C2443: Add get_rate operation for clk_armdiv
ARM: S3C2416: Add comment describing the armdiv/armclk
ARM: S3C2443: Move clk_arm and clk_armdiv to common code
ARM: S3C24XX: Add infrastructure to transmit armdiv to common code
ARM: S3C2416: Add armdiv_mask constant
ARM: EXYNOS4: Add support for M-5MOLS camera on Nuri board
ARM: EXYNOS4: Enable MFC on ORIGEN
ARM: SAMSUNG: Add support s3c2416-adc for S3C2416/S3C2450
ARM: SAMSUNG: Add support s3c2443-adc for S3C2443
ARM: SAMSUNG: Allow overriding of adc device name for S3C24XX
...

+651 -153
+2
arch/arm/Kconfig
··· 595 595 select TICK_ONESHOT 596 596 select PLAT_PXA 597 597 select SPARSE_IRQ 598 + select GENERIC_ALLOCATOR 598 599 help 599 600 Support for Marvell's PXA168/PXA910(MMP) and MMP2 processor line. 600 601 ··· 770 769 select CPU_V6 771 770 select ARM_VIC 772 771 select HAVE_CLK 772 + select HAVE_TCM 773 773 select CLKDEV_LOOKUP 774 774 select NO_IOPORT 775 775 select ARCH_USES_GETTIMEOFFSET
+11 -1
arch/arm/mach-exynos4/Kconfig
··· 217 217 config MACH_NURI 218 218 bool "Mobile NURI Board" 219 219 select CPU_EXYNOS4210 220 + select S5P_GPIO_INT 220 221 select S3C_DEV_WDT 221 222 select S3C_DEV_RTC 222 223 select S5P_DEV_FIMD0 ··· 227 226 select S3C_DEV_I2C1 228 227 select S3C_DEV_I2C3 229 228 select S3C_DEV_I2C5 229 + select S5P_DEV_CSIS0 230 + select S5P_DEV_FIMC0 231 + select S5P_DEV_FIMC1 232 + select S5P_DEV_FIMC2 233 + select S5P_DEV_FIMC3 230 234 select S5P_DEV_MFC 231 235 select S5P_DEV_USB_EHCI 236 + select S5P_SETUP_MIPIPHY 232 237 select EXYNOS4_DEV_PD 238 + select EXYNOS4_SETUP_FIMC 233 239 select EXYNOS4_SETUP_FIMD0 234 240 select EXYNOS4_SETUP_I2C1 235 241 select EXYNOS4_SETUP_I2C3 236 242 select EXYNOS4_SETUP_I2C5 237 243 select EXYNOS4_SETUP_SDHCI 238 244 select EXYNOS4_SETUP_USB_PHY 245 + select S5P_SETUP_MIPIPHY 239 246 select SAMSUNG_DEV_PWM 240 247 select SAMSUNG_DEV_ADC 241 248 help ··· 262 253 select S5P_DEV_FIMC3 263 254 select S5P_DEV_FIMD0 264 255 select S5P_DEV_I2C_HDMIPHY 256 + select S5P_DEV_MFC 265 257 select S5P_DEV_TV 266 258 select S5P_DEV_USB_EHCI 267 - select EXYNOS4_DEV_PD 268 259 select SAMSUNG_DEV_BACKLIGHT 269 260 select SAMSUNG_DEV_PWM 261 + select EXYNOS4_DEV_PD 270 262 select EXYNOS4_SETUP_FIMD0 271 263 select EXYNOS4_SETUP_SDHCI 272 264 select EXYNOS4_SETUP_USB_PHY
+151 -7
arch/arm/mach-exynos4/mach-nuri.c
··· 27 27 #include <linux/pwm_backlight.h> 28 28 29 29 #include <video/platform_lcd.h> 30 + #include <media/m5mols.h> 31 + #include <media/s5p_fimc.h> 32 + #include <media/v4l2-mediabus.h> 30 33 31 34 #include <asm/mach/arch.h> 32 35 #include <asm/mach-types.h> ··· 48 45 #include <plat/iic.h> 49 46 #include <plat/mfc.h> 50 47 #include <plat/pd.h> 48 + #include <plat/fimc-core.h> 49 + #include <plat/camport.h> 50 + #include <plat/mipi_csis.h> 51 51 52 52 #include <mach/map.h> 53 53 ··· 71 65 enum fixed_regulator_id { 72 66 FIXED_REG_ID_MMC = 0, 73 67 FIXED_REG_ID_MAX8903, 68 + FIXED_REG_ID_CAM_A28V, 69 + FIXED_REG_ID_CAM_12V, 74 70 }; 75 71 76 72 static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = { ··· 1074 1066 }, 1075 1067 }; 1076 1068 1077 - static struct device *nuri_cm_devices[] = { 1078 - &s3c_device_i2c5.dev, 1079 - &s3c_device_adc.dev, 1080 - NULL, /* Reserved for UART */ 1081 - NULL, 1082 - }; 1083 - 1084 1069 static void __init nuri_power_init(void) 1085 1070 { 1086 1071 int gpio; ··· 1118 1117 s5p_ehci_set_platdata(pdata); 1119 1118 } 1120 1119 1120 + /* CAMERA */ 1121 + static struct regulator_consumer_supply cam_vdda_supply[] = { 1122 + REGULATOR_SUPPLY("a_sensor", "0-001f"), 1123 + }; 1124 + 1125 + static struct regulator_init_data cam_vdda_reg_init_data = { 1126 + .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS }, 1127 + .num_consumer_supplies = ARRAY_SIZE(cam_vdda_supply), 1128 + .consumer_supplies = cam_vdda_supply, 1129 + }; 1130 + 1131 + static struct fixed_voltage_config cam_vdda_fixed_voltage_cfg = { 1132 + .supply_name = "CAM_IO_EN", 1133 + .microvolts = 2800000, 1134 + .gpio = EXYNOS4_GPE2(1), /* CAM_IO_EN */ 1135 + .enable_high = 1, 1136 + .init_data = &cam_vdda_reg_init_data, 1137 + }; 1138 + 1139 + static struct platform_device cam_vdda_fixed_rdev = { 1140 + .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_A28V, 1141 + .dev = { .platform_data = &cam_vdda_fixed_voltage_cfg }, 1142 + }; 1143 + 1144 + static struct regulator_consumer_supply camera_8m_12v_supply = 1145 + REGULATOR_SUPPLY("dig_12", "0-001f"); 1146 + 1147 + static struct regulator_init_data cam_8m_12v_reg_init_data = { 1148 + .num_consumer_supplies = 1, 1149 + .consumer_supplies = &camera_8m_12v_supply, 1150 + .constraints = { 1151 + .valid_ops_mask = REGULATOR_CHANGE_STATUS 1152 + }, 1153 + }; 1154 + 1155 + static struct fixed_voltage_config cam_8m_12v_fixed_voltage_cfg = { 1156 + .supply_name = "8M_1.2V", 1157 + .microvolts = 1200000, 1158 + .gpio = EXYNOS4_GPE2(5), /* 8M_1.2V_EN */ 1159 + .enable_high = 1, 1160 + .init_data = &cam_8m_12v_reg_init_data, 1161 + }; 1162 + 1163 + static struct platform_device cam_8m_12v_fixed_rdev = { 1164 + .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_12V, 1165 + .dev = { .platform_data = &cam_8m_12v_fixed_voltage_cfg }, 1166 + }; 1167 + 1168 + static struct s5p_platform_mipi_csis mipi_csis_platdata = { 1169 + .clk_rate = 166000000UL, 1170 + .lanes = 2, 1171 + .alignment = 32, 1172 + .hs_settle = 12, 1173 + .phy_enable = s5p_csis_phy_enable, 1174 + }; 1175 + 1176 + #define GPIO_CAM_MEGA_RST EXYNOS4_GPY3(7) /* ISP_RESET */ 1177 + #define GPIO_CAM_8M_ISP_INT EXYNOS4_GPL2(5) 1178 + 1179 + static struct m5mols_platform_data m5mols_platdata = { 1180 + .gpio_reset = GPIO_CAM_MEGA_RST, 1181 + }; 1182 + 1183 + static struct i2c_board_info m5mols_board_info = { 1184 + I2C_BOARD_INFO("M5MOLS", 0x1F), 1185 + .platform_data = &m5mols_platdata, 1186 + }; 1187 + 1188 + static struct s5p_fimc_isp_info nuri_camera_sensors[] = { 1189 + { 1190 + .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | 1191 + V4L2_MBUS_VSYNC_ACTIVE_LOW, 1192 + .bus_type = FIMC_MIPI_CSI2, 1193 + .board_info = &m5mols_board_info, 1194 + .clk_frequency = 24000000UL, 1195 + .csi_data_align = 32, 1196 + }, 1197 + }; 1198 + 1199 + static struct s5p_platform_fimc fimc_md_platdata = { 1200 + .isp_info = nuri_camera_sensors, 1201 + .num_clients = ARRAY_SIZE(nuri_camera_sensors), 1202 + }; 1203 + 1204 + static struct gpio nuri_camera_gpios[] = { 1205 + { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" }, 1206 + { GPIO_CAM_MEGA_RST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" }, 1207 + }; 1208 + 1209 + static void nuri_camera_init(void) 1210 + { 1211 + s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata), 1212 + &s5p_device_mipi_csis0); 1213 + s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata), 1214 + &s5p_device_fimc_md); 1215 + 1216 + if (gpio_request_array(nuri_camera_gpios, 1217 + ARRAY_SIZE(nuri_camera_gpios))) { 1218 + pr_err("%s: GPIO request failed\n", __func__); 1219 + return; 1220 + } 1221 + 1222 + m5mols_board_info.irq = s5p_register_gpio_interrupt(GPIO_CAM_8M_ISP_INT); 1223 + if (!IS_ERR_VALUE(m5mols_board_info.irq)) 1224 + s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xF)); 1225 + else 1226 + pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__); 1227 + 1228 + /* Free GPIOs controlled directly by the sensor drivers. */ 1229 + gpio_free(GPIO_CAM_MEGA_RST); 1230 + 1231 + if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) { 1232 + pr_err("%s: Camera port A setup failed\n", __func__); 1233 + return; 1234 + } 1235 + /* Increase drive strength of the sensor clock output */ 1236 + s5p_gpio_set_drvstr(EXYNOS4_GPJ1(3), S5P_GPIO_DRVSTR_LV4); 1237 + } 1238 + 1239 + static struct s3c2410_platform_i2c nuri_i2c0_platdata __initdata = { 1240 + .frequency = 400000U, 1241 + .sda_delay = 200, 1242 + }; 1243 + 1121 1244 static struct platform_device *nuri_devices[] __initdata = { 1122 1245 /* Samsung Platform Devices */ 1123 1246 &s3c_device_i2c5, /* PMIC should initialize first */ 1247 + &s3c_device_i2c0, 1124 1248 &emmc_fixed_voltage, 1249 + &s5p_device_mipi_csis0, 1250 + &s5p_device_fimc0, 1251 + &s5p_device_fimc1, 1252 + &s5p_device_fimc2, 1253 + &s5p_device_fimc3, 1125 1254 &s5p_device_fimd0, 1126 1255 &s3c_device_hsmmc0, 1127 1256 &s3c_device_hsmmc2, ··· 1268 1137 &s5p_device_mfc_r, 1269 1138 &exynos4_device_pd[PD_MFC], 1270 1139 &exynos4_device_pd[PD_LCD0], 1140 + &exynos4_device_pd[PD_CAM], 1141 + &s5p_device_fimc_md, 1271 1142 1272 1143 /* NURI Devices */ 1273 1144 &nuri_gpio_keys, ··· 1277 1144 &nuri_backlight_device, 1278 1145 &max8903_fixed_reg_dev, 1279 1146 &nuri_max8903_device, 1147 + &cam_vdda_fixed_rdev, 1148 + &cam_8m_12v_fixed_rdev, 1280 1149 }; 1281 1150 1282 1151 static void __init nuri_map_io(void) ··· 1299 1164 nuri_tsp_init(); 1300 1165 nuri_power_init(); 1301 1166 1167 + s3c_i2c0_set_platdata(&nuri_i2c0_platdata); 1302 1168 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); 1303 1169 s3c_i2c3_set_platdata(&i2c3_data); 1304 1170 i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs)); ··· 1311 1175 1312 1176 s5p_fimd0_set_platdata(&nuri_fb_pdata); 1313 1177 1178 + nuri_camera_init(); 1179 + 1314 1180 nuri_ehci_init(); 1315 1181 clk_xusbxti.rate = 24000000; 1316 1182 ··· 1320 1182 platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices)); 1321 1183 s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev; 1322 1184 s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev; 1185 + 1186 + s5p_device_fimc0.dev.parent = &exynos4_device_pd[PD_CAM].dev; 1187 + s5p_device_fimc1.dev.parent = &exynos4_device_pd[PD_CAM].dev; 1188 + s5p_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev; 1189 + s5p_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev; 1190 + s5p_device_mipi_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev; 1323 1191 } 1324 1192 1325 1193 MACHINE_START(NURI, "NURI")
+21
arch/arm/mach-exynos4/mach-origen.c
··· 39 39 #include <plat/backlight.h> 40 40 #include <plat/pd.h> 41 41 #include <plat/fb.h> 42 + #include <plat/mfc.h> 42 43 43 44 #include <mach/map.h> 44 45 ··· 90 89 91 90 static struct regulator_consumer_supply __initdata ldo3_consumer[] = { 92 91 REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */ 92 + REGULATOR_SUPPLY("vdd", "exynos4-hdmi"), /* HDMI */ 93 + REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"), /* HDMI */ 93 94 }; 94 95 static struct regulator_consumer_supply __initdata ldo6_consumer[] = { 95 96 REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */ ··· 101 98 }; 102 99 static struct regulator_consumer_supply __initdata ldo8_consumer[] = { 103 100 REGULATOR_SUPPLY("vdd", "s5p-adc"), /* ADC */ 101 + REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"), /* HDMI */ 104 102 }; 105 103 static struct regulator_consumer_supply __initdata ldo9_consumer[] = { 106 104 REGULATOR_SUPPLY("dvdd", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */ ··· 602 598 &s5p_device_fimd0, 603 599 &s5p_device_hdmi, 604 600 &s5p_device_i2c_hdmiphy, 601 + &s5p_device_mfc, 602 + &s5p_device_mfc_l, 603 + &s5p_device_mfc_r, 605 604 &s5p_device_mixer, 606 605 &exynos4_device_pd[PD_LCD0], 607 606 &exynos4_device_pd[PD_TV], 607 + &exynos4_device_pd[PD_G3D], 608 + &exynos4_device_pd[PD_LCD1], 609 + &exynos4_device_pd[PD_CAM], 610 + &exynos4_device_pd[PD_GPS], 611 + &exynos4_device_pd[PD_MFC], 608 612 &origen_device_gpiokeys, 609 613 &origen_lcd_hv070wsa, 610 614 }; ··· 650 638 s3c_gpio_setpull(EXYNOS4_GPX0(4), S3C_GPIO_PULL_NONE); 651 639 } 652 640 641 + static void __init origen_reserve(void) 642 + { 643 + s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20); 644 + } 645 + 653 646 static void __init origen_machine_init(void) 654 647 { 655 648 origen_power_init(); ··· 678 661 s5p_fimd0_set_platdata(&origen_lcd_pdata); 679 662 680 663 platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices)); 664 + 681 665 s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev; 682 666 683 667 s5p_device_hdmi.dev.parent = &exynos4_device_pd[PD_TV].dev; 684 668 s5p_device_mixer.dev.parent = &exynos4_device_pd[PD_TV].dev; 669 + 670 + s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev; 685 671 686 672 samsung_bl_set(&origen_bl_gpio_info, &origen_bl_data); 687 673 } ··· 696 676 .map_io = origen_map_io, 697 677 .init_machine = origen_machine_init, 698 678 .timer = &exynos4_timer, 679 + .reserve = &origen_reserve, 699 680 MACHINE_END
+1 -1
arch/arm/mach-mmp/Makefile
··· 7 7 # SoC support 8 8 obj-$(CONFIG_CPU_PXA168) += pxa168.o irq-pxa168.o 9 9 obj-$(CONFIG_CPU_PXA910) += pxa910.o irq-pxa168.o 10 - obj-$(CONFIG_CPU_MMP2) += mmp2.o irq-mmp2.o 10 + obj-$(CONFIG_CPU_MMP2) += mmp2.o irq-mmp2.o sram.o 11 11 12 12 # board support 13 13 obj-$(CONFIG_MACH_ASPENITE) += aspenite.o
+11
arch/arm/mach-mmp/brownstone.c
··· 185 185 | PXA_FLAG_SD_8_BIT_CAPABLE_SLOT, 186 186 }; 187 187 188 + static struct sram_platdata mmp2_asram_platdata = { 189 + .pool_name = "asram", 190 + .granularity = SRAM_GRANULARITY, 191 + }; 192 + 193 + static struct sram_platdata mmp2_isram_platdata = { 194 + .pool_name = "isram", 195 + .granularity = SRAM_GRANULARITY, 196 + }; 188 197 189 198 static void __init brownstone_init(void) 190 199 { ··· 205 196 mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info)); 206 197 mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */ 207 198 mmp2_add_sdhost(2, &mmp2_sdh_platdata_mmc2); /* eMMC */ 199 + mmp2_add_asram(&mmp2_asram_platdata); 200 + mmp2_add_isram(&mmp2_isram_platdata); 208 201 209 202 /* enable 5v regulator */ 210 203 platform_device_register(&brownstone_v_5vp_device);
+13
arch/arm/mach-mmp/include/mach/mmp2.h
··· 13 13 #include <linux/i2c.h> 14 14 #include <linux/i2c/pxa-i2c.h> 15 15 #include <mach/devices.h> 16 + #include <mach/sram.h> 16 17 17 18 extern struct pxa_device_desc mmp2_device_uart1; 18 19 extern struct pxa_device_desc mmp2_device_uart2; ··· 29 28 extern struct pxa_device_desc mmp2_device_sdh1; 30 29 extern struct pxa_device_desc mmp2_device_sdh2; 31 30 extern struct pxa_device_desc mmp2_device_sdh3; 31 + extern struct pxa_device_desc mmp2_device_asram; 32 + extern struct pxa_device_desc mmp2_device_isram; 32 33 33 34 static inline int mmp2_add_uart(int id) 34 35 { ··· 86 83 } 87 84 88 85 return pxa_register_device(d, data, sizeof(*data)); 86 + } 87 + 88 + static inline int mmp2_add_asram(struct sram_platdata *data) 89 + { 90 + return pxa_register_device(&mmp2_device_asram, data, sizeof(*data)); 91 + } 92 + 93 + static inline int mmp2_add_isram(struct sram_platdata *data) 94 + { 95 + return pxa_register_device(&mmp2_device_isram, data, sizeof(*data)); 89 96 } 90 97 91 98 #endif /* __ASM_MACH_MMP2_H */
+35
arch/arm/mach-mmp/include/mach/sram.h
··· 1 + /* 2 + * linux/arch/arm/mach-mmp/include/mach/sram.h 3 + * 4 + * SRAM Memory Management 5 + * 6 + * Copyright (c) 2011 Marvell Semiconductors Inc. 7 + * 8 + * This program is free software; you can redistribute it and/or modify 9 + * it under the terms of the GNU General Public License version 2 as 10 + * published by the Free Software Foundation. 11 + * 12 + */ 13 + 14 + #ifndef __ASM_ARCH_SRAM_H 15 + #define __ASM_ARCH_SRAM_H 16 + 17 + #include <linux/genalloc.h> 18 + 19 + /* ARBITRARY: SRAM allocations are multiples of this 2^N size */ 20 + #define SRAM_GRANULARITY 512 21 + 22 + enum sram_type { 23 + MMP_SRAM_UNDEFINED = 0, 24 + MMP_ASRAM, 25 + MMP_ISRAM, 26 + }; 27 + 28 + struct sram_platdata { 29 + char *pool_name; 30 + int granularity; 31 + }; 32 + 33 + extern struct gen_pool *sram_get_gpool(char *pool_name); 34 + 35 + #endif /* __ASM_ARCH_SRAM_H */
+3
arch/arm/mach-mmp/mmp2.c
··· 226 226 MMP2_DEVICE(sdh1, "sdhci-pxav3", 1, MMC2, 0xd4280800, 0x120); 227 227 MMP2_DEVICE(sdh2, "sdhci-pxav3", 2, MMC3, 0xd4281000, 0x120); 228 228 MMP2_DEVICE(sdh3, "sdhci-pxav3", 3, MMC4, 0xd4281800, 0x120); 229 + MMP2_DEVICE(asram, "asram", -1, NONE, 0xe0000000, 0x4000); 230 + /* 0xd1000000 ~ 0xd101ffff is reserved for secure processor */ 231 + MMP2_DEVICE(isram, "isram", -1, NONE, 0xd1020000, 0x18000); 229 232
+168
arch/arm/mach-mmp/sram.c
··· 1 + /* 2 + * linux/arch/arm/mach-mmp/sram.c 3 + * 4 + * based on mach-davinci/sram.c - DaVinci simple SRAM allocator 5 + * 6 + * Copyright (c) 2011 Marvell Semiconductors Inc. 7 + * All Rights Reserved 8 + * 9 + * Add for mmp sram support - Leo Yan <leoy@marvell.com> 10 + * 11 + * This program is free software; you can redistribute it and/or modify 12 + * it under the terms of the GNU General Public License version 2 as 13 + * published by the Free Software Foundation. 14 + * 15 + */ 16 + 17 + #include <linux/module.h> 18 + #include <linux/init.h> 19 + #include <linux/platform_device.h> 20 + #include <linux/io.h> 21 + #include <linux/err.h> 22 + #include <linux/slab.h> 23 + #include <linux/genalloc.h> 24 + 25 + #include <mach/sram.h> 26 + 27 + struct sram_bank_info { 28 + char *pool_name; 29 + struct gen_pool *gpool; 30 + int granularity; 31 + 32 + phys_addr_t sram_phys; 33 + void __iomem *sram_virt; 34 + u32 sram_size; 35 + 36 + struct list_head node; 37 + }; 38 + 39 + static DEFINE_MUTEX(sram_lock); 40 + static LIST_HEAD(sram_bank_list); 41 + 42 + struct gen_pool *sram_get_gpool(char *pool_name) 43 + { 44 + struct sram_bank_info *info = NULL; 45 + 46 + if (!pool_name) 47 + return NULL; 48 + 49 + mutex_lock(&sram_lock); 50 + 51 + list_for_each_entry(info, &sram_bank_list, node) 52 + if (!strcmp(pool_name, info->pool_name)) 53 + break; 54 + 55 + mutex_unlock(&sram_lock); 56 + 57 + if (&info->node == &sram_bank_list) 58 + return NULL; 59 + 60 + return info->gpool; 61 + } 62 + EXPORT_SYMBOL(sram_get_gpool); 63 + 64 + static int __devinit sram_probe(struct platform_device *pdev) 65 + { 66 + struct sram_platdata *pdata = pdev->dev.platform_data; 67 + struct sram_bank_info *info; 68 + struct resource *res; 69 + int ret = 0; 70 + 71 + if (!pdata && !pdata->pool_name) 72 + return -ENODEV; 73 + 74 + info = kzalloc(sizeof(*info), GFP_KERNEL); 75 + if (!info) 76 + return -ENOMEM; 77 + 78 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 79 + if (res == NULL) { 80 + dev_err(&pdev->dev, "no memory resource defined\n"); 81 + ret = -ENODEV; 82 + goto out; 83 + } 84 + 85 + if (!resource_size(res)) 86 + return 0; 87 + 88 + info->sram_phys = (phys_addr_t)res->start; 89 + info->sram_size = resource_size(res); 90 + info->sram_virt = ioremap(info->sram_phys, info->sram_size); 91 + info->pool_name = kstrdup(pdata->pool_name, GFP_KERNEL); 92 + info->granularity = pdata->granularity; 93 + 94 + info->gpool = gen_pool_create(ilog2(info->granularity), -1); 95 + if (!info->gpool) { 96 + dev_err(&pdev->dev, "create pool failed\n"); 97 + ret = -ENOMEM; 98 + goto create_pool_err; 99 + } 100 + 101 + ret = gen_pool_add_virt(info->gpool, (unsigned long)info->sram_virt, 102 + info->sram_phys, info->sram_size, -1); 103 + if (ret < 0) { 104 + dev_err(&pdev->dev, "add new chunk failed\n"); 105 + ret = -ENOMEM; 106 + goto add_chunk_err; 107 + } 108 + 109 + mutex_lock(&sram_lock); 110 + list_add(&info->node, &sram_bank_list); 111 + mutex_unlock(&sram_lock); 112 + 113 + platform_set_drvdata(pdev, info); 114 + 115 + dev_info(&pdev->dev, "initialized\n"); 116 + return 0; 117 + 118 + add_chunk_err: 119 + gen_pool_destroy(info->gpool); 120 + create_pool_err: 121 + iounmap(info->sram_virt); 122 + kfree(info->pool_name); 123 + out: 124 + kfree(info); 125 + return ret; 126 + } 127 + 128 + static int __devexit sram_remove(struct platform_device *pdev) 129 + { 130 + struct sram_bank_info *info; 131 + 132 + info = platform_get_drvdata(pdev); 133 + if (info == NULL) 134 + return -ENODEV; 135 + 136 + mutex_lock(&sram_lock); 137 + list_del(&info->node); 138 + mutex_unlock(&sram_lock); 139 + 140 + gen_pool_destroy(info->gpool); 141 + iounmap(info->sram_virt); 142 + kfree(info->pool_name); 143 + kfree(info); 144 + return 0; 145 + } 146 + 147 + static const struct platform_device_id sram_id_table[] = { 148 + { "asram", MMP_ASRAM }, 149 + { "isram", MMP_ISRAM }, 150 + { } 151 + }; 152 + 153 + static struct platform_driver sram_driver = { 154 + .probe = sram_probe, 155 + .remove = sram_remove, 156 + .driver = { 157 + .name = "mmp-sram", 158 + }, 159 + .id_table = sram_id_table, 160 + }; 161 + 162 + static int __init sram_init(void) 163 + { 164 + return platform_driver_register(&sram_driver); 165 + } 166 + core_initcall(sram_init); 167 + 168 + MODULE_LICENSE("GPL");
+1 -1
arch/arm/mach-s3c2410/include/mach/gpio-nrs.h
··· 53 53 #define S3C2410_GPIO_M_NR (32) /* technically 2. */ 54 54 55 55 #if CONFIG_S3C_GPIO_SPACE != 0 56 - #error CONFIG_S3C_GPIO_SPACE cannot be zero at the moment 56 + #error CONFIG_S3C_GPIO_SPACE cannot be nonzero at the moment 57 57 #endif 58 58 59 59 #define S3C2410_GPIO_NEXT(__gpio) \
+1
arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h
··· 65 65 #define S3C2443_CLKDIV0_PREDIV_MASK (3<<4) 66 66 #define S3C2443_CLKDIV0_PREDIV_SHIFT (4) 67 67 68 + #define S3C2416_CLKDIV0_ARMDIV_MASK (7 << 9) 68 69 #define S3C2443_CLKDIV0_ARMDIV_MASK (15<<9) 69 70 #define S3C2443_CLKDIV0_ARMDIV_SHIFT (9) 70 71 #define S3C2443_CLKDIV0_ARMDIV_1 (0<<9)
+12 -9
arch/arm/mach-s3c2416/clock.c
··· 28 28 #include <mach/regs-clock.h> 29 29 #include <mach/regs-s3c2443-clock.h> 30 30 31 + /* armdiv 32 + * 33 + * this clock is sourced from msysclk and can have a number of 34 + * divider values applied to it to then be fed into armclk. 35 + * The real clock definition is done in s3c2443-clock.c, 36 + * only the armdiv divisor table must be defined here. 37 + */ 38 + 31 39 static unsigned int armdiv[8] = { 32 40 [0] = 1, 33 41 [1] = 2, ··· 133 125 .ctrlbit = S3C2416_HCLKCON_HSMMC0, 134 126 }; 135 127 136 - static inline unsigned int s3c2416_fclk_div(unsigned long clkcon0) 137 - { 138 - clkcon0 &= 7 << S3C2443_CLKDIV0_ARMDIV_SHIFT; 139 - 140 - return armdiv[clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT]; 141 - } 142 - 143 128 void __init_or_cpufreq s3c2416_setup_clocks(void) 144 129 { 145 - s3c2443_common_setup_clocks(s3c2416_get_pll, s3c2416_fclk_div); 130 + s3c2443_common_setup_clocks(s3c2416_get_pll); 146 131 } 147 132 148 133 ··· 159 158 160 159 clk_epll.parent = &clk_epllref.clk; 161 160 162 - s3c2443_common_init_clocks(xtal, s3c2416_get_pll, s3c2416_fclk_div); 161 + s3c2443_common_init_clocks(xtal, s3c2416_get_pll, 162 + armdiv, ARRAY_SIZE(armdiv), 163 + S3C2416_CLKDIV0_ARMDIV_MASK); 163 164 164 165 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) 165 166 s3c_register_clksrc(clksrcs[ptr], 1);
+3
arch/arm/mach-s3c2416/s3c2416.c
··· 60 60 #include <plat/iic-core.h> 61 61 #include <plat/fb-core.h> 62 62 #include <plat/nand-core.h> 63 + #include <plat/adc-core.h> 63 64 64 65 static struct map_desc s3c2416_iodesc[] __initdata = { 65 66 IODESC_ENT(WATCHDOG), ··· 97 96 s3c_i2c1_setname("s3c2440-i2c"); 98 97 99 98 s3c_fb_setname("s3c2443-fb"); 99 + 100 + s3c_adc_setname("s3c2416-adc"); 100 101 101 102 #ifdef CONFIG_PM 102 103 register_syscore_ops(&s3c2416_pm_syscore_ops);
+6 -99
arch/arm/mach-s3c2443/clock.c
··· 61 61 * 62 62 * this clock is sourced from msysclk and can have a number of 63 63 * divider values applied to it to then be fed into armclk. 64 + * The real clock definition is done in s3c2443-clock.c, 65 + * only the armdiv divisor table must be defined here. 64 66 */ 65 - 66 - /* armdiv divisor table */ 67 67 68 68 static unsigned int armdiv[16] = { 69 69 [S3C2443_CLKDIV0_ARMDIV_1 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 1, ··· 74 74 [S3C2443_CLKDIV0_ARMDIV_8 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 8, 75 75 [S3C2443_CLKDIV0_ARMDIV_12 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 12, 76 76 [S3C2443_CLKDIV0_ARMDIV_16 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 16, 77 - }; 78 - 79 - static inline unsigned int s3c2443_fclk_div(unsigned long clkcon0) 80 - { 81 - clkcon0 &= S3C2443_CLKDIV0_ARMDIV_MASK; 82 - 83 - return armdiv[clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT]; 84 - } 85 - 86 - static unsigned long s3c2443_armclk_roundrate(struct clk *clk, 87 - unsigned long rate) 88 - { 89 - unsigned long parent = clk_get_rate(clk->parent); 90 - unsigned long calc; 91 - unsigned best = 256; /* bigger than any value */ 92 - unsigned div; 93 - int ptr; 94 - 95 - for (ptr = 0; ptr < ARRAY_SIZE(armdiv); ptr++) { 96 - div = armdiv[ptr]; 97 - calc = parent / div; 98 - if (calc <= rate && div < best) 99 - best = div; 100 - } 101 - 102 - return parent / best; 103 - } 104 - 105 - static int s3c2443_armclk_setrate(struct clk *clk, unsigned long rate) 106 - { 107 - unsigned long parent = clk_get_rate(clk->parent); 108 - unsigned long calc; 109 - unsigned div; 110 - unsigned best = 256; /* bigger than any value */ 111 - int ptr; 112 - int val = -1; 113 - 114 - for (ptr = 0; ptr < ARRAY_SIZE(armdiv); ptr++) { 115 - div = armdiv[ptr]; 116 - calc = parent / div; 117 - if (calc <= rate && div < best) { 118 - best = div; 119 - val = ptr; 120 - } 121 - } 122 - 123 - if (val >= 0) { 124 - unsigned long clkcon0; 125 - 126 - clkcon0 = __raw_readl(S3C2443_CLKDIV0); 127 - clkcon0 &= ~S3C2443_CLKDIV0_ARMDIV_MASK; 128 - clkcon0 |= val << S3C2443_CLKDIV0_ARMDIV_SHIFT; 129 - __raw_writel(clkcon0, S3C2443_CLKDIV0); 130 - } 131 - 132 - return (val == -1) ? -EINVAL : 0; 133 - } 134 - 135 - static struct clk clk_armdiv = { 136 - .name = "armdiv", 137 - .parent = &clk_msysclk.clk, 138 - .ops = &(struct clk_ops) { 139 - .round_rate = s3c2443_armclk_roundrate, 140 - .set_rate = s3c2443_armclk_setrate, 141 - }, 142 - }; 143 - 144 - /* armclk 145 - * 146 - * this is the clock fed into the ARM core itself, from armdiv or from hclk. 147 - */ 148 - 149 - static struct clk *clk_arm_sources[] = { 150 - [0] = &clk_armdiv, 151 - [1] = &clk_h, 152 - }; 153 - 154 - static struct clksrc_clk clk_arm = { 155 - .clk = { 156 - .name = "armclk", 157 - }, 158 - .sources = &(struct clksrc_sources) { 159 - .sources = clk_arm_sources, 160 - .nr_sources = ARRAY_SIZE(clk_arm_sources), 161 - }, 162 - .reg_src = { .reg = S3C2443_CLKDIV0, .size = 1, .shift = 13 }, 163 77 }; 164 78 165 79 /* hsspi ··· 168 254 } 169 255 }; 170 256 171 - static struct clk init_clocks[] = { 172 - }; 173 - 174 257 /* clocks to add straight away */ 175 258 176 259 static struct clksrc_clk *clksrcs[] __initdata = { 177 - &clk_arm, 178 260 &clk_hsspi, 179 261 &clk_hsmmc_div, 180 262 }; 181 263 182 264 static struct clk *clks[] __initdata = { 183 265 &clk_hsmmc, 184 - &clk_armdiv, 185 266 }; 186 267 187 268 void __init_or_cpufreq s3c2443_setup_clocks(void) 188 269 { 189 - s3c2443_common_setup_clocks(s3c2443_get_mpll, s3c2443_fclk_div); 270 + s3c2443_common_setup_clocks(s3c2443_get_mpll); 190 271 } 191 272 192 273 void __init s3c2443_init_clocks(int xtal) ··· 192 283 clk_epll.rate = s3c2443_get_epll(epllcon, xtal); 193 284 clk_epll.parent = &clk_epllref.clk; 194 285 195 - s3c2443_common_init_clocks(xtal, s3c2443_get_mpll, s3c2443_fclk_div); 286 + s3c2443_common_init_clocks(xtal, s3c2443_get_mpll, 287 + armdiv, ARRAY_SIZE(armdiv), 288 + S3C2443_CLKDIV0_ARMDIV_MASK); 196 289 197 290 s3c2443_setup_clocks(); 198 291 ··· 202 291 203 292 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) 204 293 s3c_register_clksrc(clksrcs[ptr], 1); 205 - 206 - /* register clocks from clock array */ 207 - 208 - s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); 209 294 210 295 /* We must be careful disabling the clocks we are not intending to 211 296 * be using at boot time, as subsystems such as the LCD which do
+3
arch/arm/mach-s3c2443/s3c2443.c
··· 41 41 #include <plat/cpu.h> 42 42 #include <plat/fb-core.h> 43 43 #include <plat/nand-core.h> 44 + #include <plat/adc-core.h> 44 45 45 46 static struct map_desc s3c2443_iodesc[] __initdata = { 46 47 IODESC_ENT(WATCHDOG), ··· 70 69 71 70 s3c_nand_setname("s3c2412-nand"); 72 71 s3c_fb_setname("s3c2443-fb"); 72 + 73 + s3c_adc_setname("s3c2443-adc"); 73 74 74 75 /* change WDT IRQ number */ 75 76 s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
+130 -5
arch/arm/plat-s3c24xx/s3c2443-clock.c
··· 160 160 }, 161 161 }; 162 162 163 + /* armdiv 164 + * 165 + * this clock is sourced from msysclk and can have a number of 166 + * divider values applied to it to then be fed into armclk. 167 + */ 168 + 169 + static unsigned int *armdiv; 170 + static int nr_armdiv; 171 + static int armdivmask; 172 + 173 + static unsigned long s3c2443_armclk_roundrate(struct clk *clk, 174 + unsigned long rate) 175 + { 176 + unsigned long parent = clk_get_rate(clk->parent); 177 + unsigned long calc; 178 + unsigned best = 256; /* bigger than any value */ 179 + unsigned div; 180 + int ptr; 181 + 182 + if (!nr_armdiv) 183 + return -EINVAL; 184 + 185 + for (ptr = 0; ptr < nr_armdiv; ptr++) { 186 + div = armdiv[ptr]; 187 + if (div) { 188 + /* cpufreq provides 266mhz as 266666000 not 266666666 */ 189 + calc = (parent / div / 1000) * 1000; 190 + if (calc <= rate && div < best) 191 + best = div; 192 + } 193 + } 194 + 195 + return parent / best; 196 + } 197 + 198 + static unsigned long s3c2443_armclk_getrate(struct clk *clk) 199 + { 200 + unsigned long rate = clk_get_rate(clk->parent); 201 + unsigned long clkcon0; 202 + int val; 203 + 204 + if (!nr_armdiv || !armdivmask) 205 + return -EINVAL; 206 + 207 + clkcon0 = __raw_readl(S3C2443_CLKDIV0); 208 + clkcon0 &= armdivmask; 209 + val = clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT; 210 + 211 + return rate / armdiv[val]; 212 + } 213 + 214 + static int s3c2443_armclk_setrate(struct clk *clk, unsigned long rate) 215 + { 216 + unsigned long parent = clk_get_rate(clk->parent); 217 + unsigned long calc; 218 + unsigned div; 219 + unsigned best = 256; /* bigger than any value */ 220 + int ptr; 221 + int val = -1; 222 + 223 + if (!nr_armdiv || !armdivmask) 224 + return -EINVAL; 225 + 226 + for (ptr = 0; ptr < nr_armdiv; ptr++) { 227 + div = armdiv[ptr]; 228 + if (div) { 229 + /* cpufreq provides 266mhz as 266666000 not 266666666 */ 230 + calc = (parent / div / 1000) * 1000; 231 + if (calc <= rate && div < best) { 232 + best = div; 233 + val = ptr; 234 + } 235 + } 236 + } 237 + 238 + if (val >= 0) { 239 + unsigned long clkcon0; 240 + 241 + clkcon0 = __raw_readl(S3C2443_CLKDIV0); 242 + clkcon0 &= ~armdivmask; 243 + clkcon0 |= val << S3C2443_CLKDIV0_ARMDIV_SHIFT; 244 + __raw_writel(clkcon0, S3C2443_CLKDIV0); 245 + } 246 + 247 + return (val == -1) ? -EINVAL : 0; 248 + } 249 + 250 + static struct clk clk_armdiv = { 251 + .name = "armdiv", 252 + .parent = &clk_msysclk.clk, 253 + .ops = &(struct clk_ops) { 254 + .round_rate = s3c2443_armclk_roundrate, 255 + .get_rate = s3c2443_armclk_getrate, 256 + .set_rate = s3c2443_armclk_setrate, 257 + }, 258 + }; 259 + 260 + /* armclk 261 + * 262 + * this is the clock fed into the ARM core itself, from armdiv or from hclk. 263 + */ 264 + 265 + static struct clk *clk_arm_sources[] = { 266 + [0] = &clk_armdiv, 267 + [1] = &clk_h, 268 + }; 269 + 270 + static struct clksrc_clk clk_arm = { 271 + .clk = { 272 + .name = "armclk", 273 + }, 274 + .sources = &(struct clksrc_sources) { 275 + .sources = clk_arm_sources, 276 + .nr_sources = ARRAY_SIZE(clk_arm_sources), 277 + }, 278 + .reg_src = { .reg = S3C2443_CLKDIV0, .size = 1, .shift = 13 }, 279 + }; 280 + 163 281 /* usbhost 164 282 * 165 283 * usb host bus-clock, usually 48MHz to provide USB bus clock timing ··· 426 308 .ctrlbit = S3C2443_HCLKCON_DMA5, 427 309 }, { 428 310 .name = "hsmmc", 311 + .devname = "s3c-sdhci.1", 429 312 .parent = &clk_h, 430 313 .enable = s3c2443_clkcon_enable_h, 431 314 .ctrlbit = S3C2443_HCLKCON_HSMMC, ··· 521 402 522 403 /* EPLLCON compatible enough to get on/off information */ 523 404 524 - void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll, 525 - fdiv_fn get_fdiv) 405 + void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll) 526 406 { 527 407 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON); 528 408 unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON); ··· 541 423 pll = get_mpll(mpllcon, xtal); 542 424 clk_msysclk.clk.rate = pll; 543 425 544 - fclk = pll / get_fdiv(clkdiv0); 426 + fclk = clk_get_rate(&clk_armdiv); 545 427 hclk = s3c2443_prediv_getrate(&clk_prediv); 546 428 hclk /= s3c2443_get_hdiv(clkdiv0); 547 429 pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1); ··· 576 458 &clk_ext, 577 459 &clk_epll, 578 460 &clk_usb_bus, 461 + &clk_armdiv, 579 462 }; 580 463 581 464 static struct clksrc_clk *clksrcs[] __initdata = { ··· 586 467 &clk_epllref, 587 468 &clk_esysclk, 588 469 &clk_msysclk, 470 + &clk_arm, 589 471 }; 590 472 591 473 void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, 592 - fdiv_fn get_fdiv) 474 + unsigned int *divs, int nr_divs, 475 + int divmask) 593 476 { 594 477 int ptr; 478 + 479 + armdiv = divs; 480 + nr_armdiv = nr_divs; 481 + armdivmask = divmask; 595 482 596 483 /* s3c2443 parents h and p clocks from prediv */ 597 484 clk_h.parent = &clk_prediv; ··· 619 494 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); 620 495 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); 621 496 622 - s3c2443_common_setup_clocks(get_mpll, get_fdiv); 497 + s3c2443_common_setup_clocks(get_mpll); 623 498 }
+32 -11
arch/arm/plat-samsung/adc.c
··· 41 41 42 42 enum s3c_cpu_type { 43 43 TYPE_ADCV1, /* S3C24XX */ 44 + TYPE_ADCV11, /* S3C2443 */ 45 + TYPE_ADCV12, /* S3C2416, S3C2450 */ 44 46 TYPE_ADCV2, /* S3C64XX, S5P64X0, S5PC100 */ 45 47 TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */ 46 48 }; ··· 100 98 101 99 client->select_cb(client, 1); 102 100 103 - con &= ~S3C2410_ADCCON_MUXMASK; 101 + if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV2) 102 + con &= ~S3C2410_ADCCON_MUXMASK; 104 103 con &= ~S3C2410_ADCCON_STDBM; 105 104 con &= ~S3C2410_ADCCON_STARTMASK; 106 105 107 106 if (!client->is_ts) { 108 107 if (cpu == TYPE_ADCV3) 109 108 writel(client->channel & 0xf, adc->regs + S5P_ADCMUX); 109 + else if (cpu == TYPE_ADCV11 || cpu == TYPE_ADCV12) 110 + writel(client->channel & 0xf, 111 + adc->regs + S3C2443_ADCMUX); 110 112 else 111 113 con |= S3C2410_ADCCON_SELMUX(client->channel); 112 114 } ··· 299 293 300 294 client->nr_samples--; 301 295 302 - if (cpu != TYPE_ADCV1) { 303 - /* S3C64XX/S5P ADC resolution is 12-bit */ 304 - data0 &= 0xfff; 305 - data1 &= 0xfff; 306 - } else { 296 + if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV11) { 307 297 data0 &= 0x3ff; 308 298 data1 &= 0x3ff; 299 + } else { 300 + /* S3C2416/S3C64XX/S5P ADC resolution is 12-bit */ 301 + data0 &= 0xfff; 302 + data1 &= 0xfff; 309 303 } 310 304 311 305 if (client->convert_cb) ··· 326 320 } 327 321 328 322 exit: 329 - if (cpu != TYPE_ADCV1) { 323 + if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) { 330 324 /* Clear ADC interrupt */ 331 325 writel(0, adc->regs + S3C64XX_ADCCLRINT); 332 326 } ··· 338 332 struct device *dev = &pdev->dev; 339 333 struct adc_device *adc; 340 334 struct resource *regs; 335 + enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data; 341 336 int ret; 342 337 unsigned tmp; 343 338 ··· 401 394 clk_enable(adc->clk); 402 395 403 396 tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; 404 - if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1) { 405 - /* Enable 12-bit ADC resolution */ 397 + 398 + /* Enable 12-bit ADC resolution */ 399 + if (cpu == TYPE_ADCV12) 400 + tmp |= S3C2416_ADCCON_RESSEL; 401 + if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) 406 402 tmp |= S3C64XX_ADCCON_RESSEL; 407 - } 403 + 408 404 writel(tmp, adc->regs + S3C2410_ADCCON); 409 405 410 406 dev_info(dev, "attached adc driver\n"); ··· 474 464 struct platform_device *pdev = container_of(dev, 475 465 struct platform_device, dev); 476 466 struct adc_device *adc = platform_get_drvdata(pdev); 467 + enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data; 477 468 int ret; 478 469 unsigned long tmp; 479 470 ··· 485 474 enable_irq(adc->irq); 486 475 487 476 tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; 477 + 488 478 /* Enable 12-bit ADC resolution */ 489 - if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1) 479 + if (cpu == TYPE_ADCV12) 480 + tmp |= S3C2416_ADCCON_RESSEL; 481 + if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) 490 482 tmp |= S3C64XX_ADCCON_RESSEL; 483 + 491 484 writel(tmp, adc->regs + S3C2410_ADCCON); 492 485 493 486 return 0; ··· 506 491 { 507 492 .name = "s3c24xx-adc", 508 493 .driver_data = TYPE_ADCV1, 494 + }, { 495 + .name = "s3c2443-adc", 496 + .driver_data = TYPE_ADCV11, 497 + }, { 498 + .name = "s3c2416-adc", 499 + .driver_data = TYPE_ADCV12, 509 500 }, { 510 501 .name = "s3c64xx-adc", 511 502 .driver_data = TYPE_ADCV2,
+1 -1
arch/arm/plat-samsung/include/plat/adc-core.h
··· 20 20 /* re-define device name depending on support. */ 21 21 static inline void s3c_adc_setname(char *name) 22 22 { 23 - #ifdef CONFIG_SAMSUNG_DEV_ADC 23 + #if defined(CONFIG_SAMSUNG_DEV_ADC) || defined(CONFIG_PLAT_S3C24XX) 24 24 s3c_device_adc.name = name; 25 25 #endif 26 26 }
+3 -3
arch/arm/plat-samsung/include/plat/cpu.h
··· 25 25 26 26 #define S3C6400_CPU_ID 0x36400000 27 27 #define S3C6410_CPU_ID 0x36410000 28 - #define S3C64XX_CPU_ID (S3C6400_CPU_ID & S3C6410_CPU_ID) 29 28 #define S3C64XX_CPU_MASK 0xFFFFF000 30 29 31 30 #define S5P6440_CPU_ID 0x56440000 ··· 49 50 } 50 51 51 52 IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) 52 - IS_SAMSUNG_CPU(s3c64xx, S3C64XX_CPU_ID, S3C64XX_CPU_MASK) 53 + IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) 54 + IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) 53 55 IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) 54 56 IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK) 55 57 IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK) ··· 69 69 #endif 70 70 71 71 #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) 72 - # define soc_is_s3c64xx() is_samsung_s3c64xx() 72 + # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410()) 73 73 #else 74 74 # define soc_is_s3c64xx() 0 75 75 #endif
+3
arch/arm/plat-samsung/include/plat/regs-adc.h
··· 20 20 #define S3C2410_ADCDAT0 S3C2410_ADCREG(0x0C) 21 21 #define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10) 22 22 #define S3C64XX_ADCUPDN S3C2410_ADCREG(0x14) 23 + #define S3C2443_ADCMUX S3C2410_ADCREG(0x18) 23 24 #define S3C64XX_ADCCLRINT S3C2410_ADCREG(0x18) 24 25 #define S5P_ADCMUX S3C2410_ADCREG(0x1C) 25 26 #define S3C64XX_ADCCLRINTPNDNUP S3C2410_ADCREG(0x20) ··· 34 33 #define S3C2410_ADCCON_PRSCVLMASK (0xFF<<6) 35 34 #define S3C2410_ADCCON_SELMUX(x) (((x)&0x7)<<3) 36 35 #define S3C2410_ADCCON_MUXMASK (0x7<<3) 36 + #define S3C2416_ADCCON_RESSEL (1 << 3) 37 37 #define S3C2410_ADCCON_STDBM (1<<2) 38 38 #define S3C2410_ADCCON_READ_START (1<<1) 39 39 #define S3C2410_ADCCON_ENABLE_START (1<<0) ··· 42 40 43 41 44 42 /* ADCTSC Register Bits */ 43 + #define S3C2443_ADCTSC_UD_SEN (1 << 8) 45 44 #define S3C2410_ADCTSC_YM_SEN (1<<7) 46 45 #define S3C2410_ADCTSC_YP_SEN (1<<6) 47 46 #define S3C2410_ADCTSC_XM_SEN (1<<5)
+4 -3
arch/arm/plat-samsung/include/plat/s3c2443.h
··· 37 37 struct clk; /* some files don't need clk.h otherwise */ 38 38 39 39 typedef unsigned int (*pll_fn)(unsigned int reg, unsigned int base); 40 - typedef unsigned int (*fdiv_fn)(unsigned long clkcon0); 41 40 42 - extern void s3c2443_common_setup_clocks(pll_fn get_mpll, fdiv_fn fdiv); 43 - extern void s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, fdiv_fn fdiv); 41 + extern void s3c2443_common_setup_clocks(pll_fn get_mpll); 42 + extern void s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, 43 + unsigned int *divs, int nr_divs, 44 + int divmask); 44 45 45 46 extern int s3c2443_clkcon_enable_h(struct clk *clk, int enable); 46 47 extern int s3c2443_clkcon_enable_p(struct clk *clk, int enable);
+36 -12
drivers/gpio/gpio-samsung.c
··· 318 318 return S3C_GPIO_SPECIAL(con); 319 319 } 320 320 321 + #ifdef CONFIG_PLAT_S3C24XX 321 322 /* 322 323 * s3c24xx_gpio_setcfg_abank - S3C24XX style GPIO configuration (Bank A) 323 324 * @chip: The gpio chip that is being configured. ··· 380 379 381 380 return S3C_GPIO_SFN(con); 382 381 } 382 + #endif 383 383 384 + #if defined(CONFIG_CPU_S5P6440) || defined(CONFIG_CPU_S5P6450) 384 385 static int s5p64x0_gpio_setcfg_rbank(struct samsung_gpio_chip *chip, 385 386 unsigned int off, unsigned int cfg) 386 387 { ··· 420 417 421 418 return 0; 422 419 } 420 + #endif 423 421 424 422 static void __init samsung_gpiolib_set_cfg(struct samsung_gpio_cfg *chipcfg, 425 423 int nr_chips) ··· 442 438 .get_config = samsung_gpio_getcfg_2bit, 443 439 }; 444 440 441 + #ifdef CONFIG_PLAT_S3C24XX 445 442 static struct samsung_gpio_cfg s3c24xx_gpiocfg_banka = { 446 443 .set_config = s3c24xx_gpio_setcfg_abank, 447 444 .get_config = s3c24xx_gpio_getcfg_abank, 448 445 }; 446 + #endif 449 447 450 448 static struct samsung_gpio_cfg exynos4_gpio_cfg = { 451 449 .set_pull = exynos4_gpio_setpull, ··· 456 450 .get_config = samsung_gpio_getcfg_4bit, 457 451 }; 458 452 453 + #if defined(CONFIG_CPU_S5P6440) || defined(CONFIG_CPU_S5P6450) 459 454 static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = { 460 455 .cfg_eint = 0x3, 461 456 .set_config = s5p64x0_gpio_setcfg_rbank, ··· 464 457 .set_pull = samsung_gpio_setpull_updown, 465 458 .get_pull = samsung_gpio_getpull_updown, 466 459 }; 460 + #endif 467 461 468 462 static struct samsung_gpio_cfg samsung_gpio_cfgs[] = { 469 463 { ··· 490 482 }, { 491 483 .set_config = samsung_gpio_setcfg_2bit, 492 484 .get_config = samsung_gpio_getcfg_2bit, 493 - }, 485 + }, { 486 + .set_pull = exynos4_gpio_setpull, 487 + .get_pull = exynos4_gpio_getpull, 488 + }, { 489 + .cfg_eint = 0x3, 490 + .set_pull = exynos4_gpio_setpull, 491 + .get_pull = exynos4_gpio_getpull, 492 + } 494 493 }; 495 494 496 495 /* ··· 697 682 return 0; 698 683 } 699 684 685 + #ifdef CONFIG_PLAT_S3C24XX 700 686 /* The next set of routines are for the case of s3c24xx bank a */ 701 687 702 688 static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset) ··· 733 717 local_irq_restore(flags); 734 718 return 0; 735 719 } 720 + #endif 736 721 737 722 /* The next set of routines are for the case of s5p64x0 bank r */ 738 723 ··· 931 914 struct gpio_chip *gc = &chip->chip; 932 915 933 916 for (i = 0 ; i < nr_chips; i++, chip++) { 917 + /* skip banks not present on SoC */ 918 + if (chip->chip.base >= S3C_GPIO_END) 919 + continue; 920 + 934 921 if (!chip->config) 935 922 chip->config = &s3c24xx_gpiocfg_default; 936 923 if (!chip->pm) ··· 2270 2249 .label = "GPL2", 2271 2250 }, 2272 2251 }, { 2273 - .config = &samsung_gpio_cfgs[0], 2252 + .config = &samsung_gpio_cfgs[8], 2274 2253 .chip = { 2275 2254 .base = EXYNOS4_GPY0(0), 2276 2255 .ngpio = EXYNOS4_GPIO_Y0_NR, 2277 2256 .label = "GPY0", 2278 2257 }, 2279 2258 }, { 2280 - .config = &samsung_gpio_cfgs[0], 2259 + .config = &samsung_gpio_cfgs[8], 2281 2260 .chip = { 2282 2261 .base = EXYNOS4_GPY1(0), 2283 2262 .ngpio = EXYNOS4_GPIO_Y1_NR, 2284 2263 .label = "GPY1", 2285 2264 }, 2286 2265 }, { 2287 - .config = &samsung_gpio_cfgs[0], 2266 + .config = &samsung_gpio_cfgs[8], 2288 2267 .chip = { 2289 2268 .base = EXYNOS4_GPY2(0), 2290 2269 .ngpio = EXYNOS4_GPIO_Y2_NR, 2291 2270 .label = "GPY2", 2292 2271 }, 2293 2272 }, { 2294 - .config = &samsung_gpio_cfgs[0], 2273 + .config = &samsung_gpio_cfgs[8], 2295 2274 .chip = { 2296 2275 .base = EXYNOS4_GPY3(0), 2297 2276 .ngpio = EXYNOS4_GPIO_Y3_NR, 2298 2277 .label = "GPY3", 2299 2278 }, 2300 2279 }, { 2301 - .config = &samsung_gpio_cfgs[0], 2280 + .config = &samsung_gpio_cfgs[8], 2302 2281 .chip = { 2303 2282 .base = EXYNOS4_GPY4(0), 2304 2283 .ngpio = EXYNOS4_GPIO_Y4_NR, 2305 2284 .label = "GPY4", 2306 2285 }, 2307 2286 }, { 2308 - .config = &samsung_gpio_cfgs[0], 2287 + .config = &samsung_gpio_cfgs[8], 2309 2288 .chip = { 2310 2289 .base = EXYNOS4_GPY5(0), 2311 2290 .ngpio = EXYNOS4_GPIO_Y5_NR, 2312 2291 .label = "GPY5", 2313 2292 }, 2314 2293 }, { 2315 - .config = &samsung_gpio_cfgs[0], 2294 + .config = &samsung_gpio_cfgs[8], 2316 2295 .chip = { 2317 2296 .base = EXYNOS4_GPY6(0), 2318 2297 .ngpio = EXYNOS4_GPIO_Y6_NR, ··· 2320 2299 }, 2321 2300 }, { 2322 2301 .base = (S5P_VA_GPIO2 + 0xC00), 2323 - .config = &samsung_gpio_cfgs[3], 2302 + .config = &samsung_gpio_cfgs[9], 2324 2303 .irq_base = IRQ_EINT(0), 2325 2304 .chip = { 2326 2305 .base = EXYNOS4_GPX0(0), ··· 2330 2309 }, 2331 2310 }, { 2332 2311 .base = (S5P_VA_GPIO2 + 0xC20), 2333 - .config = &samsung_gpio_cfgs[3], 2312 + .config = &samsung_gpio_cfgs[9], 2334 2313 .irq_base = IRQ_EINT(8), 2335 2314 .chip = { 2336 2315 .base = EXYNOS4_GPX1(0), ··· 2340 2319 }, 2341 2320 }, { 2342 2321 .base = (S5P_VA_GPIO2 + 0xC40), 2343 - .config = &samsung_gpio_cfgs[3], 2322 + .config = &samsung_gpio_cfgs[9], 2344 2323 .irq_base = IRQ_EINT(16), 2345 2324 .chip = { 2346 2325 .base = EXYNOS4_GPX2(0), ··· 2350 2329 }, 2351 2330 }, { 2352 2331 .base = (S5P_VA_GPIO2 + 0xC60), 2353 - .config = &samsung_gpio_cfgs[3], 2332 + .config = &samsung_gpio_cfgs[9], 2354 2333 .irq_base = IRQ_EINT(24), 2355 2334 .chip = { 2356 2335 .base = EXYNOS4_GPX3(0), ··· 2486 2465 s5p_register_gpioint_bank(IRQ_GPIO_XA, 0, IRQ_GPIO1_NR_GROUPS); 2487 2466 s5p_register_gpioint_bank(IRQ_GPIO_XB, IRQ_GPIO1_NR_GROUPS, IRQ_GPIO2_NR_GROUPS); 2488 2467 #endif 2468 + } else { 2469 + WARN(1, "Unknown SoC in gpio-samsung, no GPIOs added\n"); 2470 + return -ENODEV; 2489 2471 } 2490 2472 2491 2473 return 0;