diff options
23 files changed, 651 insertions, 153 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index e17fe2503bba..2bda424c1b2b 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
| @@ -595,6 +595,7 @@ config ARCH_MMP | |||
| 595 | select TICK_ONESHOT | 595 | select TICK_ONESHOT |
| 596 | select PLAT_PXA | 596 | select PLAT_PXA |
| 597 | select SPARSE_IRQ | 597 | select SPARSE_IRQ |
| 598 | select GENERIC_ALLOCATOR | ||
| 598 | help | 599 | help |
| 599 | Support for Marvell's PXA168/PXA910(MMP) and MMP2 processor line. | 600 | Support for Marvell's PXA168/PXA910(MMP) and MMP2 processor line. |
| 600 | 601 | ||
| @@ -769,6 +770,7 @@ config ARCH_S3C64XX | |||
| 769 | select CPU_V6 | 770 | select CPU_V6 |
| 770 | select ARM_VIC | 771 | select ARM_VIC |
| 771 | select HAVE_CLK | 772 | select HAVE_CLK |
| 773 | select HAVE_TCM | ||
| 772 | select CLKDEV_LOOKUP | 774 | select CLKDEV_LOOKUP |
| 773 | select NO_IOPORT | 775 | select NO_IOPORT |
| 774 | select ARCH_USES_GETTIMEOFFSET | 776 | select ARCH_USES_GETTIMEOFFSET |
diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig index 59299ea5b2ff..51cff04795d5 100644 --- a/arch/arm/mach-exynos4/Kconfig +++ b/arch/arm/mach-exynos4/Kconfig | |||
| @@ -217,6 +217,7 @@ config MACH_UNIVERSAL_C210 | |||
| 217 | config MACH_NURI | 217 | config MACH_NURI |
| 218 | bool "Mobile NURI Board" | 218 | bool "Mobile NURI Board" |
| 219 | select CPU_EXYNOS4210 | 219 | select CPU_EXYNOS4210 |
| 220 | select S5P_GPIO_INT | ||
| 220 | select S3C_DEV_WDT | 221 | select S3C_DEV_WDT |
| 221 | select S3C_DEV_RTC | 222 | select S3C_DEV_RTC |
| 222 | select S5P_DEV_FIMD0 | 223 | select S5P_DEV_FIMD0 |
| @@ -226,15 +227,23 @@ config MACH_NURI | |||
| 226 | select S3C_DEV_I2C1 | 227 | select S3C_DEV_I2C1 |
| 227 | select S3C_DEV_I2C3 | 228 | select S3C_DEV_I2C3 |
| 228 | select S3C_DEV_I2C5 | 229 | select S3C_DEV_I2C5 |
| 230 | select S5P_DEV_CSIS0 | ||
| 231 | select S5P_DEV_FIMC0 | ||
| 232 | select S5P_DEV_FIMC1 | ||
| 233 | select S5P_DEV_FIMC2 | ||
| 234 | select S5P_DEV_FIMC3 | ||
| 229 | select S5P_DEV_MFC | 235 | select S5P_DEV_MFC |
| 230 | select S5P_DEV_USB_EHCI | 236 | select S5P_DEV_USB_EHCI |
| 237 | select S5P_SETUP_MIPIPHY | ||
| 231 | select EXYNOS4_DEV_PD | 238 | select EXYNOS4_DEV_PD |
| 239 | select EXYNOS4_SETUP_FIMC | ||
| 232 | select EXYNOS4_SETUP_FIMD0 | 240 | select EXYNOS4_SETUP_FIMD0 |
| 233 | select EXYNOS4_SETUP_I2C1 | 241 | select EXYNOS4_SETUP_I2C1 |
| 234 | select EXYNOS4_SETUP_I2C3 | 242 | select EXYNOS4_SETUP_I2C3 |
| 235 | select EXYNOS4_SETUP_I2C5 | 243 | select EXYNOS4_SETUP_I2C5 |
| 236 | select EXYNOS4_SETUP_SDHCI | 244 | select EXYNOS4_SETUP_SDHCI |
| 237 | select EXYNOS4_SETUP_USB_PHY | 245 | select EXYNOS4_SETUP_USB_PHY |
| 246 | select S5P_SETUP_MIPIPHY | ||
| 238 | select SAMSUNG_DEV_PWM | 247 | select SAMSUNG_DEV_PWM |
| 239 | select SAMSUNG_DEV_ADC | 248 | select SAMSUNG_DEV_ADC |
| 240 | help | 249 | help |
| @@ -253,11 +262,12 @@ config MACH_ORIGEN | |||
| 253 | select S5P_DEV_FIMC3 | 262 | select S5P_DEV_FIMC3 |
| 254 | select S5P_DEV_FIMD0 | 263 | select S5P_DEV_FIMD0 |
| 255 | select S5P_DEV_I2C_HDMIPHY | 264 | select S5P_DEV_I2C_HDMIPHY |
| 265 | select S5P_DEV_MFC | ||
| 256 | select S5P_DEV_TV | 266 | select S5P_DEV_TV |
| 257 | select S5P_DEV_USB_EHCI | 267 | select S5P_DEV_USB_EHCI |
| 258 | select EXYNOS4_DEV_PD | ||
| 259 | select SAMSUNG_DEV_BACKLIGHT | 268 | select SAMSUNG_DEV_BACKLIGHT |
| 260 | select SAMSUNG_DEV_PWM | 269 | select SAMSUNG_DEV_PWM |
| 270 | select EXYNOS4_DEV_PD | ||
| 261 | select EXYNOS4_SETUP_FIMD0 | 271 | select EXYNOS4_SETUP_FIMD0 |
| 262 | select EXYNOS4_SETUP_SDHCI | 272 | select EXYNOS4_SETUP_SDHCI |
| 263 | select EXYNOS4_SETUP_USB_PHY | 273 | select EXYNOS4_SETUP_USB_PHY |
diff --git a/arch/arm/mach-exynos4/mach-nuri.c b/arch/arm/mach-exynos4/mach-nuri.c index 2204911a24e9..236bbe187163 100644 --- a/arch/arm/mach-exynos4/mach-nuri.c +++ b/arch/arm/mach-exynos4/mach-nuri.c | |||
| @@ -27,6 +27,9 @@ | |||
| 27 | #include <linux/pwm_backlight.h> | 27 | #include <linux/pwm_backlight.h> |
| 28 | 28 | ||
| 29 | #include <video/platform_lcd.h> | 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 | #include <asm/mach/arch.h> | 34 | #include <asm/mach/arch.h> |
| 32 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
| @@ -45,6 +48,9 @@ | |||
| 45 | #include <plat/iic.h> | 48 | #include <plat/iic.h> |
| 46 | #include <plat/mfc.h> | 49 | #include <plat/mfc.h> |
| 47 | #include <plat/pd.h> | 50 | #include <plat/pd.h> |
| 51 | #include <plat/fimc-core.h> | ||
| 52 | #include <plat/camport.h> | ||
| 53 | #include <plat/mipi_csis.h> | ||
| 48 | 54 | ||
| 49 | #include <mach/map.h> | 55 | #include <mach/map.h> |
| 50 | 56 | ||
| @@ -65,6 +71,8 @@ | |||
| 65 | enum fixed_regulator_id { | 71 | enum fixed_regulator_id { |
| 66 | FIXED_REG_ID_MMC = 0, | 72 | FIXED_REG_ID_MMC = 0, |
| 67 | FIXED_REG_ID_MAX8903, | 73 | FIXED_REG_ID_MAX8903, |
| 74 | FIXED_REG_ID_CAM_A28V, | ||
| 75 | FIXED_REG_ID_CAM_12V, | ||
| 68 | }; | 76 | }; |
| 69 | 77 | ||
| 70 | static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = { | 78 | static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = { |
| @@ -1066,13 +1074,6 @@ static struct platform_device nuri_max8903_device = { | |||
| 1066 | }, | 1074 | }, |
| 1067 | }; | 1075 | }; |
| 1068 | 1076 | ||
| 1069 | static struct device *nuri_cm_devices[] = { | ||
| 1070 | &s3c_device_i2c5.dev, | ||
| 1071 | &s3c_device_adc.dev, | ||
| 1072 | NULL, /* Reserved for UART */ | ||
| 1073 | NULL, | ||
| 1074 | }; | ||
| 1075 | |||
| 1076 | static void __init nuri_power_init(void) | 1077 | static void __init nuri_power_init(void) |
| 1077 | { | 1078 | { |
| 1078 | int gpio; | 1079 | int gpio; |
| @@ -1117,10 +1118,140 @@ static void __init nuri_ehci_init(void) | |||
| 1117 | s5p_ehci_set_platdata(pdata); | 1118 | s5p_ehci_set_platdata(pdata); |
| 1118 | } | 1119 | } |
| 1119 | 1120 | ||
| 1121 | /* CAMERA */ | ||
| 1122 | static struct regulator_consumer_supply cam_vdda_supply[] = { | ||
| 1123 | REGULATOR_SUPPLY("a_sensor", "0-001f"), | ||
| 1124 | }; | ||
| 1125 | |||
| 1126 | static struct regulator_init_data cam_vdda_reg_init_data = { | ||
| 1127 | .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS }, | ||
| 1128 | .num_consumer_supplies = ARRAY_SIZE(cam_vdda_supply), | ||
| 1129 | .consumer_supplies = cam_vdda_supply, | ||
| 1130 | }; | ||
| 1131 | |||
| 1132 | static struct fixed_voltage_config cam_vdda_fixed_voltage_cfg = { | ||
| 1133 | .supply_name = "CAM_IO_EN", | ||
| 1134 | .microvolts = 2800000, | ||
| 1135 | .gpio = EXYNOS4_GPE2(1), /* CAM_IO_EN */ | ||
| 1136 | .enable_high = 1, | ||
| 1137 | .init_data = &cam_vdda_reg_init_data, | ||
| 1138 | }; | ||
| 1139 | |||
| 1140 | static struct platform_device cam_vdda_fixed_rdev = { | ||
| 1141 | .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_A28V, | ||
| 1142 | .dev = { .platform_data = &cam_vdda_fixed_voltage_cfg }, | ||
| 1143 | }; | ||
| 1144 | |||
| 1145 | static struct regulator_consumer_supply camera_8m_12v_supply = | ||
| 1146 | REGULATOR_SUPPLY("dig_12", "0-001f"); | ||
| 1147 | |||
| 1148 | static struct regulator_init_data cam_8m_12v_reg_init_data = { | ||
| 1149 | .num_consumer_supplies = 1, | ||
| 1150 | .consumer_supplies = &camera_8m_12v_supply, | ||
| 1151 | .constraints = { | ||
| 1152 | .valid_ops_mask = REGULATOR_CHANGE_STATUS | ||
| 1153 | }, | ||
| 1154 | }; | ||
| 1155 | |||
| 1156 | static struct fixed_voltage_config cam_8m_12v_fixed_voltage_cfg = { | ||
| 1157 | .supply_name = "8M_1.2V", | ||
| 1158 | .microvolts = 1200000, | ||
| 1159 | .gpio = EXYNOS4_GPE2(5), /* 8M_1.2V_EN */ | ||
| 1160 | .enable_high = 1, | ||
| 1161 | .init_data = &cam_8m_12v_reg_init_data, | ||
| 1162 | }; | ||
| 1163 | |||
| 1164 | static struct platform_device cam_8m_12v_fixed_rdev = { | ||
| 1165 | .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_12V, | ||
| 1166 | .dev = { .platform_data = &cam_8m_12v_fixed_voltage_cfg }, | ||
| 1167 | }; | ||
| 1168 | |||
| 1169 | static struct s5p_platform_mipi_csis mipi_csis_platdata = { | ||
| 1170 | .clk_rate = 166000000UL, | ||
| 1171 | .lanes = 2, | ||
| 1172 | .alignment = 32, | ||
| 1173 | .hs_settle = 12, | ||
| 1174 | .phy_enable = s5p_csis_phy_enable, | ||
| 1175 | }; | ||
| 1176 | |||
| 1177 | #define GPIO_CAM_MEGA_RST EXYNOS4_GPY3(7) /* ISP_RESET */ | ||
| 1178 | #define GPIO_CAM_8M_ISP_INT EXYNOS4_GPL2(5) | ||
| 1179 | |||
| 1180 | static struct m5mols_platform_data m5mols_platdata = { | ||
| 1181 | .gpio_reset = GPIO_CAM_MEGA_RST, | ||
| 1182 | }; | ||
| 1183 | |||
| 1184 | static struct i2c_board_info m5mols_board_info = { | ||
| 1185 | I2C_BOARD_INFO("M5MOLS", 0x1F), | ||
| 1186 | .platform_data = &m5mols_platdata, | ||
| 1187 | }; | ||
| 1188 | |||
| 1189 | static struct s5p_fimc_isp_info nuri_camera_sensors[] = { | ||
| 1190 | { | ||
| 1191 | .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | | ||
| 1192 | V4L2_MBUS_VSYNC_ACTIVE_LOW, | ||
| 1193 | .bus_type = FIMC_MIPI_CSI2, | ||
| 1194 | .board_info = &m5mols_board_info, | ||
| 1195 | .clk_frequency = 24000000UL, | ||
| 1196 | .csi_data_align = 32, | ||
| 1197 | }, | ||
| 1198 | }; | ||
| 1199 | |||
| 1200 | static struct s5p_platform_fimc fimc_md_platdata = { | ||
| 1201 | .isp_info = nuri_camera_sensors, | ||
| 1202 | .num_clients = ARRAY_SIZE(nuri_camera_sensors), | ||
| 1203 | }; | ||
| 1204 | |||
| 1205 | static struct gpio nuri_camera_gpios[] = { | ||
| 1206 | { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" }, | ||
| 1207 | { GPIO_CAM_MEGA_RST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" }, | ||
| 1208 | }; | ||
| 1209 | |||
| 1210 | static void nuri_camera_init(void) | ||
| 1211 | { | ||
| 1212 | s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata), | ||
| 1213 | &s5p_device_mipi_csis0); | ||
| 1214 | s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata), | ||
| 1215 | &s5p_device_fimc_md); | ||
| 1216 | |||
| 1217 | if (gpio_request_array(nuri_camera_gpios, | ||
| 1218 | ARRAY_SIZE(nuri_camera_gpios))) { | ||
| 1219 | pr_err("%s: GPIO request failed\n", __func__); | ||
| 1220 | return; | ||
| 1221 | } | ||
| 1222 | |||
| 1223 | m5mols_board_info.irq = s5p_register_gpio_interrupt(GPIO_CAM_8M_ISP_INT); | ||
| 1224 | if (!IS_ERR_VALUE(m5mols_board_info.irq)) | ||
| 1225 | s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xF)); | ||
| 1226 | else | ||
| 1227 | pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__); | ||
| 1228 | |||
| 1229 | /* Free GPIOs controlled directly by the sensor drivers. */ | ||
| 1230 | gpio_free(GPIO_CAM_MEGA_RST); | ||
| 1231 | |||
| 1232 | if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) { | ||
| 1233 | pr_err("%s: Camera port A setup failed\n", __func__); | ||
| 1234 | return; | ||
| 1235 | } | ||
| 1236 | /* Increase drive strength of the sensor clock output */ | ||
| 1237 | s5p_gpio_set_drvstr(EXYNOS4_GPJ1(3), S5P_GPIO_DRVSTR_LV4); | ||
| 1238 | } | ||
| 1239 | |||
| 1240 | static struct s3c2410_platform_i2c nuri_i2c0_platdata __initdata = { | ||
| 1241 | .frequency = 400000U, | ||
| 1242 | .sda_delay = 200, | ||
| 1243 | }; | ||
| 1244 | |||
| 1120 | static struct platform_device *nuri_devices[] __initdata = { | 1245 | static struct platform_device *nuri_devices[] __initdata = { |
| 1121 | /* Samsung Platform Devices */ | 1246 | /* Samsung Platform Devices */ |
| 1122 | &s3c_device_i2c5, /* PMIC should initialize first */ | 1247 | &s3c_device_i2c5, /* PMIC should initialize first */ |
| 1248 | &s3c_device_i2c0, | ||
| 1123 | &emmc_fixed_voltage, | 1249 | &emmc_fixed_voltage, |
| 1250 | &s5p_device_mipi_csis0, | ||
| 1251 | &s5p_device_fimc0, | ||
| 1252 | &s5p_device_fimc1, | ||
| 1253 | &s5p_device_fimc2, | ||
| 1254 | &s5p_device_fimc3, | ||
| 1124 | &s5p_device_fimd0, | 1255 | &s5p_device_fimd0, |
| 1125 | &s3c_device_hsmmc0, | 1256 | &s3c_device_hsmmc0, |
| 1126 | &s3c_device_hsmmc2, | 1257 | &s3c_device_hsmmc2, |
| @@ -1137,6 +1268,8 @@ static struct platform_device *nuri_devices[] __initdata = { | |||
| 1137 | &s5p_device_mfc_r, | 1268 | &s5p_device_mfc_r, |
| 1138 | &exynos4_device_pd[PD_MFC], | 1269 | &exynos4_device_pd[PD_MFC], |
| 1139 | &exynos4_device_pd[PD_LCD0], | 1270 | &exynos4_device_pd[PD_LCD0], |
| 1271 | &exynos4_device_pd[PD_CAM], | ||
| 1272 | &s5p_device_fimc_md, | ||
| 1140 | 1273 | ||
| 1141 | /* NURI Devices */ | 1274 | /* NURI Devices */ |
| 1142 | &nuri_gpio_keys, | 1275 | &nuri_gpio_keys, |
| @@ -1144,6 +1277,8 @@ static struct platform_device *nuri_devices[] __initdata = { | |||
| 1144 | &nuri_backlight_device, | 1277 | &nuri_backlight_device, |
| 1145 | &max8903_fixed_reg_dev, | 1278 | &max8903_fixed_reg_dev, |
| 1146 | &nuri_max8903_device, | 1279 | &nuri_max8903_device, |
| 1280 | &cam_vdda_fixed_rdev, | ||
| 1281 | &cam_8m_12v_fixed_rdev, | ||
| 1147 | }; | 1282 | }; |
| 1148 | 1283 | ||
| 1149 | static void __init nuri_map_io(void) | 1284 | static void __init nuri_map_io(void) |
| @@ -1164,6 +1299,7 @@ static void __init nuri_machine_init(void) | |||
| 1164 | nuri_tsp_init(); | 1299 | nuri_tsp_init(); |
| 1165 | nuri_power_init(); | 1300 | nuri_power_init(); |
| 1166 | 1301 | ||
| 1302 | s3c_i2c0_set_platdata(&nuri_i2c0_platdata); | ||
| 1167 | i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); | 1303 | i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); |
| 1168 | s3c_i2c3_set_platdata(&i2c3_data); | 1304 | s3c_i2c3_set_platdata(&i2c3_data); |
| 1169 | i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs)); | 1305 | i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs)); |
| @@ -1175,6 +1311,8 @@ static void __init nuri_machine_init(void) | |||
| 1175 | 1311 | ||
| 1176 | s5p_fimd0_set_platdata(&nuri_fb_pdata); | 1312 | s5p_fimd0_set_platdata(&nuri_fb_pdata); |
| 1177 | 1313 | ||
| 1314 | nuri_camera_init(); | ||
| 1315 | |||
| 1178 | nuri_ehci_init(); | 1316 | nuri_ehci_init(); |
| 1179 | clk_xusbxti.rate = 24000000; | 1317 | clk_xusbxti.rate = 24000000; |
| 1180 | 1318 | ||
| @@ -1182,6 +1320,12 @@ static void __init nuri_machine_init(void) | |||
| 1182 | platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices)); | 1320 | platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices)); |
| 1183 | s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev; | 1321 | s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev; |
| 1184 | s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev; | 1322 | s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev; |
| 1323 | |||
| 1324 | s5p_device_fimc0.dev.parent = &exynos4_device_pd[PD_CAM].dev; | ||
| 1325 | s5p_device_fimc1.dev.parent = &exynos4_device_pd[PD_CAM].dev; | ||
| 1326 | s5p_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev; | ||
| 1327 | s5p_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev; | ||
| 1328 | s5p_device_mipi_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev; | ||
| 1185 | } | 1329 | } |
| 1186 | 1330 | ||
| 1187 | MACHINE_START(NURI, "NURI") | 1331 | MACHINE_START(NURI, "NURI") |
diff --git a/arch/arm/mach-exynos4/mach-origen.c b/arch/arm/mach-exynos4/mach-origen.c index 71db8480bb5a..f80b563f2be7 100644 --- a/arch/arm/mach-exynos4/mach-origen.c +++ b/arch/arm/mach-exynos4/mach-origen.c | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include <plat/backlight.h> | 39 | #include <plat/backlight.h> |
| 40 | #include <plat/pd.h> | 40 | #include <plat/pd.h> |
| 41 | #include <plat/fb.h> | 41 | #include <plat/fb.h> |
| 42 | #include <plat/mfc.h> | ||
| 42 | 43 | ||
| 43 | #include <mach/map.h> | 44 | #include <mach/map.h> |
| 44 | 45 | ||
| @@ -89,6 +90,8 @@ static struct s3c2410_uartcfg origen_uartcfgs[] __initdata = { | |||
| 89 | 90 | ||
| 90 | static struct regulator_consumer_supply __initdata ldo3_consumer[] = { | 91 | static struct regulator_consumer_supply __initdata ldo3_consumer[] = { |
| 91 | REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */ | 92 | REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */ |
| 93 | REGULATOR_SUPPLY("vdd", "exynos4-hdmi"), /* HDMI */ | ||
| 94 | REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"), /* HDMI */ | ||
| 92 | }; | 95 | }; |
| 93 | static struct regulator_consumer_supply __initdata ldo6_consumer[] = { | 96 | static struct regulator_consumer_supply __initdata ldo6_consumer[] = { |
| 94 | REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */ | 97 | REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */ |
| @@ -98,6 +101,7 @@ static struct regulator_consumer_supply __initdata ldo7_consumer[] = { | |||
| 98 | }; | 101 | }; |
| 99 | static struct regulator_consumer_supply __initdata ldo8_consumer[] = { | 102 | static struct regulator_consumer_supply __initdata ldo8_consumer[] = { |
| 100 | REGULATOR_SUPPLY("vdd", "s5p-adc"), /* ADC */ | 103 | REGULATOR_SUPPLY("vdd", "s5p-adc"), /* ADC */ |
| 104 | REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"), /* HDMI */ | ||
| 101 | }; | 105 | }; |
| 102 | static struct regulator_consumer_supply __initdata ldo9_consumer[] = { | 106 | static struct regulator_consumer_supply __initdata ldo9_consumer[] = { |
| 103 | REGULATOR_SUPPLY("dvdd", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */ | 107 | REGULATOR_SUPPLY("dvdd", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */ |
| @@ -598,9 +602,17 @@ static struct platform_device *origen_devices[] __initdata = { | |||
| 598 | &s5p_device_fimd0, | 602 | &s5p_device_fimd0, |
| 599 | &s5p_device_hdmi, | 603 | &s5p_device_hdmi, |
| 600 | &s5p_device_i2c_hdmiphy, | 604 | &s5p_device_i2c_hdmiphy, |
| 605 | &s5p_device_mfc, | ||
| 606 | &s5p_device_mfc_l, | ||
| 607 | &s5p_device_mfc_r, | ||
| 601 | &s5p_device_mixer, | 608 | &s5p_device_mixer, |
| 602 | &exynos4_device_pd[PD_LCD0], | 609 | &exynos4_device_pd[PD_LCD0], |
| 603 | &exynos4_device_pd[PD_TV], | 610 | &exynos4_device_pd[PD_TV], |
| 611 | &exynos4_device_pd[PD_G3D], | ||
| 612 | &exynos4_device_pd[PD_LCD1], | ||
| 613 | &exynos4_device_pd[PD_CAM], | ||
| 614 | &exynos4_device_pd[PD_GPS], | ||
| 615 | &exynos4_device_pd[PD_MFC], | ||
| 604 | &origen_device_gpiokeys, | 616 | &origen_device_gpiokeys, |
| 605 | &origen_lcd_hv070wsa, | 617 | &origen_lcd_hv070wsa, |
| 606 | }; | 618 | }; |
| @@ -638,6 +650,11 @@ static void __init origen_power_init(void) | |||
| 638 | s3c_gpio_setpull(EXYNOS4_GPX0(4), S3C_GPIO_PULL_NONE); | 650 | s3c_gpio_setpull(EXYNOS4_GPX0(4), S3C_GPIO_PULL_NONE); |
| 639 | } | 651 | } |
| 640 | 652 | ||
| 653 | static void __init origen_reserve(void) | ||
| 654 | { | ||
| 655 | s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20); | ||
| 656 | } | ||
| 657 | |||
| 641 | static void __init origen_machine_init(void) | 658 | static void __init origen_machine_init(void) |
| 642 | { | 659 | { |
| 643 | origen_power_init(); | 660 | origen_power_init(); |
| @@ -661,11 +678,14 @@ static void __init origen_machine_init(void) | |||
| 661 | s5p_fimd0_set_platdata(&origen_lcd_pdata); | 678 | s5p_fimd0_set_platdata(&origen_lcd_pdata); |
| 662 | 679 | ||
| 663 | platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices)); | 680 | platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices)); |
| 681 | |||
| 664 | s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev; | 682 | s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev; |
| 665 | 683 | ||
| 666 | s5p_device_hdmi.dev.parent = &exynos4_device_pd[PD_TV].dev; | 684 | s5p_device_hdmi.dev.parent = &exynos4_device_pd[PD_TV].dev; |
| 667 | s5p_device_mixer.dev.parent = &exynos4_device_pd[PD_TV].dev; | 685 | s5p_device_mixer.dev.parent = &exynos4_device_pd[PD_TV].dev; |
| 668 | 686 | ||
| 687 | s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev; | ||
| 688 | |||
| 669 | samsung_bl_set(&origen_bl_gpio_info, &origen_bl_data); | 689 | samsung_bl_set(&origen_bl_gpio_info, &origen_bl_data); |
| 670 | } | 690 | } |
| 671 | 691 | ||
| @@ -676,4 +696,5 @@ MACHINE_START(ORIGEN, "ORIGEN") | |||
| 676 | .map_io = origen_map_io, | 696 | .map_io = origen_map_io, |
| 677 | .init_machine = origen_machine_init, | 697 | .init_machine = origen_machine_init, |
| 678 | .timer = &exynos4_timer, | 698 | .timer = &exynos4_timer, |
| 699 | .reserve = &origen_reserve, | ||
| 679 | MACHINE_END | 700 | MACHINE_END |
diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile index 8f948f981646..ba254a71691a 100644 --- a/arch/arm/mach-mmp/Makefile +++ b/arch/arm/mach-mmp/Makefile | |||
| @@ -7,7 +7,7 @@ obj-y += common.o clock.o devices.o time.o | |||
| 7 | # SoC support | 7 | # SoC support |
| 8 | obj-$(CONFIG_CPU_PXA168) += pxa168.o irq-pxa168.o | 8 | obj-$(CONFIG_CPU_PXA168) += pxa168.o irq-pxa168.o |
| 9 | obj-$(CONFIG_CPU_PXA910) += pxa910.o irq-pxa168.o | 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 | # board support | 12 | # board support |
| 13 | obj-$(CONFIG_MACH_ASPENITE) += aspenite.o | 13 | obj-$(CONFIG_MACH_ASPENITE) += aspenite.o |
diff --git a/arch/arm/mach-mmp/brownstone.c b/arch/arm/mach-mmp/brownstone.c index e411252e3d39..983cfb15fbde 100644 --- a/arch/arm/mach-mmp/brownstone.c +++ b/arch/arm/mach-mmp/brownstone.c | |||
| @@ -185,6 +185,15 @@ static struct sdhci_pxa_platdata mmp2_sdh_platdata_mmc2 = { | |||
| 185 | | PXA_FLAG_SD_8_BIT_CAPABLE_SLOT, | 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 | static void __init brownstone_init(void) | 198 | static void __init brownstone_init(void) |
| 190 | { | 199 | { |
| @@ -196,6 +205,8 @@ static void __init brownstone_init(void) | |||
| 196 | mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info)); | 205 | mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info)); |
| 197 | mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */ | 206 | mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */ |
| 198 | mmp2_add_sdhost(2, &mmp2_sdh_platdata_mmc2); /* eMMC */ | 207 | mmp2_add_sdhost(2, &mmp2_sdh_platdata_mmc2); /* eMMC */ |
| 208 | mmp2_add_asram(&mmp2_asram_platdata); | ||
| 209 | mmp2_add_isram(&mmp2_isram_platdata); | ||
| 199 | 210 | ||
| 200 | /* enable 5v regulator */ | 211 | /* enable 5v regulator */ |
| 201 | platform_device_register(&brownstone_v_5vp_device); | 212 | platform_device_register(&brownstone_v_5vp_device); |
diff --git a/arch/arm/mach-mmp/include/mach/mmp2.h b/arch/arm/mach-mmp/include/mach/mmp2.h index de7b88826ad7..2f7b2d3c2b18 100644 --- a/arch/arm/mach-mmp/include/mach/mmp2.h +++ b/arch/arm/mach-mmp/include/mach/mmp2.h | |||
| @@ -13,6 +13,7 @@ extern void mmp2_clear_pmic_int(void); | |||
| 13 | #include <linux/i2c.h> | 13 | #include <linux/i2c.h> |
| 14 | #include <linux/i2c/pxa-i2c.h> | 14 | #include <linux/i2c/pxa-i2c.h> |
| 15 | #include <mach/devices.h> | 15 | #include <mach/devices.h> |
| 16 | #include <mach/sram.h> | ||
| 16 | 17 | ||
| 17 | extern struct pxa_device_desc mmp2_device_uart1; | 18 | extern struct pxa_device_desc mmp2_device_uart1; |
| 18 | extern struct pxa_device_desc mmp2_device_uart2; | 19 | extern struct pxa_device_desc mmp2_device_uart2; |
| @@ -28,6 +29,8 @@ extern struct pxa_device_desc mmp2_device_sdh0; | |||
| 28 | extern struct pxa_device_desc mmp2_device_sdh1; | 29 | extern struct pxa_device_desc mmp2_device_sdh1; |
| 29 | extern struct pxa_device_desc mmp2_device_sdh2; | 30 | extern struct pxa_device_desc mmp2_device_sdh2; |
| 30 | extern struct pxa_device_desc mmp2_device_sdh3; | 31 | extern struct pxa_device_desc mmp2_device_sdh3; |
| 32 | extern struct pxa_device_desc mmp2_device_asram; | ||
| 33 | extern struct pxa_device_desc mmp2_device_isram; | ||
| 31 | 34 | ||
| 32 | static inline int mmp2_add_uart(int id) | 35 | static inline int mmp2_add_uart(int id) |
| 33 | { | 36 | { |
| @@ -85,5 +88,15 @@ static inline int mmp2_add_sdhost(int id, struct sdhci_pxa_platdata *data) | |||
| 85 | return pxa_register_device(d, data, sizeof(*data)); | 88 | return pxa_register_device(d, data, sizeof(*data)); |
| 86 | } | 89 | } |
| 87 | 90 | ||
| 91 | static inline int mmp2_add_asram(struct sram_platdata *data) | ||
| 92 | { | ||
| 93 | return pxa_register_device(&mmp2_device_asram, data, sizeof(*data)); | ||
| 94 | } | ||
| 95 | |||
| 96 | static inline int mmp2_add_isram(struct sram_platdata *data) | ||
| 97 | { | ||
| 98 | return pxa_register_device(&mmp2_device_isram, data, sizeof(*data)); | ||
| 99 | } | ||
| 100 | |||
| 88 | #endif /* __ASM_MACH_MMP2_H */ | 101 | #endif /* __ASM_MACH_MMP2_H */ |
| 89 | 102 | ||
diff --git a/arch/arm/mach-mmp/include/mach/sram.h b/arch/arm/mach-mmp/include/mach/sram.h new file mode 100644 index 000000000000..239e0fc1bb1f --- /dev/null +++ b/arch/arm/mach-mmp/include/mach/sram.h | |||
| @@ -0,0 +1,35 @@ | |||
| 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 */ | ||
diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c index 7a7e8e4dde41..5dd1d4a6aeb9 100644 --- a/arch/arm/mach-mmp/mmp2.c +++ b/arch/arm/mach-mmp/mmp2.c | |||
| @@ -226,4 +226,7 @@ MMP2_DEVICE(sdh0, "sdhci-pxav3", 0, MMC, 0xd4280000, 0x120); | |||
| 226 | MMP2_DEVICE(sdh1, "sdhci-pxav3", 1, MMC2, 0xd4280800, 0x120); | 226 | MMP2_DEVICE(sdh1, "sdhci-pxav3", 1, MMC2, 0xd4280800, 0x120); |
| 227 | MMP2_DEVICE(sdh2, "sdhci-pxav3", 2, MMC3, 0xd4281000, 0x120); | 227 | MMP2_DEVICE(sdh2, "sdhci-pxav3", 2, MMC3, 0xd4281000, 0x120); |
| 228 | MMP2_DEVICE(sdh3, "sdhci-pxav3", 3, MMC4, 0xd4281800, 0x120); | 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 | ||
diff --git a/arch/arm/mach-mmp/sram.c b/arch/arm/mach-mmp/sram.c new file mode 100644 index 000000000000..4304f9519372 --- /dev/null +++ b/arch/arm/mach-mmp/sram.c | |||
| @@ -0,0 +1,168 @@ | |||
| 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"); | ||
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio-nrs.h b/arch/arm/mach-s3c2410/include/mach/gpio-nrs.h index 4f7bf3272e87..019ea86057f6 100644 --- a/arch/arm/mach-s3c2410/include/mach/gpio-nrs.h +++ b/arch/arm/mach-s3c2410/include/mach/gpio-nrs.h | |||
| @@ -53,7 +53,7 @@ | |||
| 53 | #define S3C2410_GPIO_M_NR (32) /* technically 2. */ | 53 | #define S3C2410_GPIO_M_NR (32) /* technically 2. */ |
| 54 | 54 | ||
| 55 | #if CONFIG_S3C_GPIO_SPACE != 0 | 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 | #endif | 57 | #endif |
| 58 | 58 | ||
| 59 | #define S3C2410_GPIO_NEXT(__gpio) \ | 59 | #define S3C2410_GPIO_NEXT(__gpio) \ |
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h b/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h index df6434f326f0..c3feff3c0488 100644 --- a/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h +++ b/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h | |||
| @@ -65,6 +65,7 @@ | |||
| 65 | #define S3C2443_CLKDIV0_PREDIV_MASK (3<<4) | 65 | #define S3C2443_CLKDIV0_PREDIV_MASK (3<<4) |
| 66 | #define S3C2443_CLKDIV0_PREDIV_SHIFT (4) | 66 | #define S3C2443_CLKDIV0_PREDIV_SHIFT (4) |
| 67 | 67 | ||
| 68 | #define S3C2416_CLKDIV0_ARMDIV_MASK (7 << 9) | ||
| 68 | #define S3C2443_CLKDIV0_ARMDIV_MASK (15<<9) | 69 | #define S3C2443_CLKDIV0_ARMDIV_MASK (15<<9) |
| 69 | #define S3C2443_CLKDIV0_ARMDIV_SHIFT (9) | 70 | #define S3C2443_CLKDIV0_ARMDIV_SHIFT (9) |
| 70 | #define S3C2443_CLKDIV0_ARMDIV_1 (0<<9) | 71 | #define S3C2443_CLKDIV0_ARMDIV_1 (0<<9) |
diff --git a/arch/arm/mach-s3c2416/clock.c b/arch/arm/mach-s3c2416/clock.c index 72b7c6274c79..afbbe8bc21d1 100644 --- a/arch/arm/mach-s3c2416/clock.c +++ b/arch/arm/mach-s3c2416/clock.c | |||
| @@ -28,6 +28,14 @@ | |||
| 28 | #include <mach/regs-clock.h> | 28 | #include <mach/regs-clock.h> |
| 29 | #include <mach/regs-s3c2443-clock.h> | 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 | static unsigned int armdiv[8] = { | 39 | static unsigned int armdiv[8] = { |
| 32 | [0] = 1, | 40 | [0] = 1, |
| 33 | [1] = 2, | 41 | [1] = 2, |
| @@ -125,16 +133,9 @@ static struct clk hsmmc0_clk = { | |||
| 125 | .ctrlbit = S3C2416_HCLKCON_HSMMC0, | 133 | .ctrlbit = S3C2416_HCLKCON_HSMMC0, |
| 126 | }; | 134 | }; |
| 127 | 135 | ||
| 128 | static inline unsigned int s3c2416_fclk_div(unsigned long clkcon0) | ||
| 129 | { | ||
| 130 | clkcon0 &= 7 << S3C2443_CLKDIV0_ARMDIV_SHIFT; | ||
| 131 | |||
| 132 | return armdiv[clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT]; | ||
| 133 | } | ||
| 134 | |||
| 135 | void __init_or_cpufreq s3c2416_setup_clocks(void) | 136 | void __init_or_cpufreq s3c2416_setup_clocks(void) |
| 136 | { | 137 | { |
| 137 | s3c2443_common_setup_clocks(s3c2416_get_pll, s3c2416_fclk_div); | 138 | s3c2443_common_setup_clocks(s3c2416_get_pll); |
| 138 | } | 139 | } |
| 139 | 140 | ||
| 140 | 141 | ||
| @@ -158,7 +159,9 @@ void __init s3c2416_init_clocks(int xtal) | |||
| 158 | 159 | ||
| 159 | clk_epll.parent = &clk_epllref.clk; | 160 | clk_epll.parent = &clk_epllref.clk; |
| 160 | 161 | ||
| 161 | s3c2443_common_init_clocks(xtal, s3c2416_get_pll, s3c2416_fclk_div); | 162 | s3c2443_common_init_clocks(xtal, s3c2416_get_pll, |
| 163 | armdiv, ARRAY_SIZE(armdiv), | ||
| 164 | S3C2416_CLKDIV0_ARMDIV_MASK); | ||
| 162 | 165 | ||
| 163 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) | 166 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) |
| 164 | s3c_register_clksrc(clksrcs[ptr], 1); | 167 | s3c_register_clksrc(clksrcs[ptr], 1); |
diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c index 7dbee81c8908..ee214bc83c83 100644 --- a/arch/arm/mach-s3c2416/s3c2416.c +++ b/arch/arm/mach-s3c2416/s3c2416.c | |||
| @@ -60,6 +60,7 @@ | |||
| 60 | #include <plat/iic-core.h> | 60 | #include <plat/iic-core.h> |
| 61 | #include <plat/fb-core.h> | 61 | #include <plat/fb-core.h> |
| 62 | #include <plat/nand-core.h> | 62 | #include <plat/nand-core.h> |
| 63 | #include <plat/adc-core.h> | ||
| 63 | 64 | ||
| 64 | static struct map_desc s3c2416_iodesc[] __initdata = { | 65 | static struct map_desc s3c2416_iodesc[] __initdata = { |
| 65 | IODESC_ENT(WATCHDOG), | 66 | IODESC_ENT(WATCHDOG), |
| @@ -97,6 +98,8 @@ int __init s3c2416_init(void) | |||
| 97 | 98 | ||
| 98 | s3c_fb_setname("s3c2443-fb"); | 99 | s3c_fb_setname("s3c2443-fb"); |
| 99 | 100 | ||
| 101 | s3c_adc_setname("s3c2416-adc"); | ||
| 102 | |||
| 100 | #ifdef CONFIG_PM | 103 | #ifdef CONFIG_PM |
| 101 | register_syscore_ops(&s3c2416_pm_syscore_ops); | 104 | register_syscore_ops(&s3c2416_pm_syscore_ops); |
| 102 | #endif | 105 | #endif |
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c index cd51d04e1de7..1c2c088aa2e8 100644 --- a/arch/arm/mach-s3c2443/clock.c +++ b/arch/arm/mach-s3c2443/clock.c | |||
| @@ -61,10 +61,10 @@ | |||
| 61 | * | 61 | * |
| 62 | * this clock is sourced from msysclk and can have a number of | 62 | * this clock is sourced from msysclk and can have a number of |
| 63 | * divider values applied to it to then be fed into armclk. | 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 | 67 | ||
| 66 | /* armdiv divisor table */ | ||
| 67 | |||
| 68 | static unsigned int armdiv[16] = { | 68 | static unsigned int armdiv[16] = { |
| 69 | [S3C2443_CLKDIV0_ARMDIV_1 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 1, | 69 | [S3C2443_CLKDIV0_ARMDIV_1 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 1, |
| 70 | [S3C2443_CLKDIV0_ARMDIV_2 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 2, | 70 | [S3C2443_CLKDIV0_ARMDIV_2 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 2, |
| @@ -76,92 +76,6 @@ static unsigned int armdiv[16] = { | |||
| 76 | [S3C2443_CLKDIV0_ARMDIV_16 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 16, | 76 | [S3C2443_CLKDIV0_ARMDIV_16 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 16, |
| 77 | }; | 77 | }; |
| 78 | 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 | }; | ||
| 164 | |||
| 165 | /* hsspi | 79 | /* hsspi |
| 166 | * | 80 | * |
| 167 | * high-speed spi clock, sourced from esysclk | 81 | * high-speed spi clock, sourced from esysclk |
| @@ -254,25 +168,20 @@ static struct clk init_clocks_off[] = { | |||
| 254 | } | 168 | } |
| 255 | }; | 169 | }; |
| 256 | 170 | ||
| 257 | static struct clk init_clocks[] = { | ||
| 258 | }; | ||
| 259 | |||
| 260 | /* clocks to add straight away */ | 171 | /* clocks to add straight away */ |
| 261 | 172 | ||
| 262 | static struct clksrc_clk *clksrcs[] __initdata = { | 173 | static struct clksrc_clk *clksrcs[] __initdata = { |
| 263 | &clk_arm, | ||
| 264 | &clk_hsspi, | 174 | &clk_hsspi, |
| 265 | &clk_hsmmc_div, | 175 | &clk_hsmmc_div, |
| 266 | }; | 176 | }; |
| 267 | 177 | ||
| 268 | static struct clk *clks[] __initdata = { | 178 | static struct clk *clks[] __initdata = { |
| 269 | &clk_hsmmc, | 179 | &clk_hsmmc, |
| 270 | &clk_armdiv, | ||
| 271 | }; | 180 | }; |
| 272 | 181 | ||
| 273 | void __init_or_cpufreq s3c2443_setup_clocks(void) | 182 | void __init_or_cpufreq s3c2443_setup_clocks(void) |
| 274 | { | 183 | { |
| 275 | s3c2443_common_setup_clocks(s3c2443_get_mpll, s3c2443_fclk_div); | 184 | s3c2443_common_setup_clocks(s3c2443_get_mpll); |
| 276 | } | 185 | } |
| 277 | 186 | ||
| 278 | void __init s3c2443_init_clocks(int xtal) | 187 | void __init s3c2443_init_clocks(int xtal) |
| @@ -283,7 +192,9 @@ void __init s3c2443_init_clocks(int xtal) | |||
| 283 | clk_epll.rate = s3c2443_get_epll(epllcon, xtal); | 192 | clk_epll.rate = s3c2443_get_epll(epllcon, xtal); |
| 284 | clk_epll.parent = &clk_epllref.clk; | 193 | clk_epll.parent = &clk_epllref.clk; |
| 285 | 194 | ||
| 286 | s3c2443_common_init_clocks(xtal, s3c2443_get_mpll, s3c2443_fclk_div); | 195 | s3c2443_common_init_clocks(xtal, s3c2443_get_mpll, |
| 196 | armdiv, ARRAY_SIZE(armdiv), | ||
| 197 | S3C2443_CLKDIV0_ARMDIV_MASK); | ||
| 287 | 198 | ||
| 288 | s3c2443_setup_clocks(); | 199 | s3c2443_setup_clocks(); |
| 289 | 200 | ||
| @@ -292,10 +203,6 @@ void __init s3c2443_init_clocks(int xtal) | |||
| 292 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) | 203 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) |
| 293 | s3c_register_clksrc(clksrcs[ptr], 1); | 204 | s3c_register_clksrc(clksrcs[ptr], 1); |
| 294 | 205 | ||
| 295 | /* register clocks from clock array */ | ||
| 296 | |||
| 297 | s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); | ||
| 298 | |||
| 299 | /* We must be careful disabling the clocks we are not intending to | 206 | /* We must be careful disabling the clocks we are not intending to |
| 300 | * be using at boot time, as subsystems such as the LCD which do | 207 | * be using at boot time, as subsystems such as the LCD which do |
| 301 | * their own DMA requests to the bus can cause the system to lockup | 208 | * their own DMA requests to the bus can cause the system to lockup |
diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c2443/s3c2443.c index 5df6458ddd42..a22b771b0f36 100644 --- a/arch/arm/mach-s3c2443/s3c2443.c +++ b/arch/arm/mach-s3c2443/s3c2443.c | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | #include <plat/cpu.h> | 41 | #include <plat/cpu.h> |
| 42 | #include <plat/fb-core.h> | 42 | #include <plat/fb-core.h> |
| 43 | #include <plat/nand-core.h> | 43 | #include <plat/nand-core.h> |
| 44 | #include <plat/adc-core.h> | ||
| 44 | 45 | ||
| 45 | static struct map_desc s3c2443_iodesc[] __initdata = { | 46 | static struct map_desc s3c2443_iodesc[] __initdata = { |
| 46 | IODESC_ENT(WATCHDOG), | 47 | IODESC_ENT(WATCHDOG), |
| @@ -70,6 +71,8 @@ int __init s3c2443_init(void) | |||
| 70 | s3c_nand_setname("s3c2412-nand"); | 71 | s3c_nand_setname("s3c2412-nand"); |
| 71 | s3c_fb_setname("s3c2443-fb"); | 72 | s3c_fb_setname("s3c2443-fb"); |
| 72 | 73 | ||
| 74 | s3c_adc_setname("s3c2443-adc"); | ||
| 75 | |||
| 73 | /* change WDT IRQ number */ | 76 | /* change WDT IRQ number */ |
| 74 | s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT; | 77 | s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT; |
| 75 | s3c_device_wdt.resource[1].end = IRQ_S3C2443_WDT; | 78 | s3c_device_wdt.resource[1].end = IRQ_S3C2443_WDT; |
diff --git a/arch/arm/plat-s3c24xx/s3c2443-clock.c b/arch/arm/plat-s3c24xx/s3c2443-clock.c index 07a4c81587ac..5a21b15b2a97 100644 --- a/arch/arm/plat-s3c24xx/s3c2443-clock.c +++ b/arch/arm/plat-s3c24xx/s3c2443-clock.c | |||
| @@ -160,6 +160,124 @@ static struct clk clk_prediv = { | |||
| 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 | /* usbhost | 281 | /* usbhost |
| 164 | * | 282 | * |
| 165 | * usb host bus-clock, usually 48MHz to provide USB bus clock timing | 283 | * usb host bus-clock, usually 48MHz to provide USB bus clock timing |
| @@ -308,6 +426,7 @@ static struct clk init_clocks[] = { | |||
| 308 | .ctrlbit = S3C2443_HCLKCON_DMA5, | 426 | .ctrlbit = S3C2443_HCLKCON_DMA5, |
| 309 | }, { | 427 | }, { |
| 310 | .name = "hsmmc", | 428 | .name = "hsmmc", |
| 429 | .devname = "s3c-sdhci.1", | ||
| 311 | .parent = &clk_h, | 430 | .parent = &clk_h, |
| 312 | .enable = s3c2443_clkcon_enable_h, | 431 | .enable = s3c2443_clkcon_enable_h, |
| 313 | .ctrlbit = S3C2443_HCLKCON_HSMMC, | 432 | .ctrlbit = S3C2443_HCLKCON_HSMMC, |
| @@ -402,8 +521,7 @@ static inline unsigned long s3c2443_get_hdiv(unsigned long clkcon0) | |||
| 402 | 521 | ||
| 403 | /* EPLLCON compatible enough to get on/off information */ | 522 | /* EPLLCON compatible enough to get on/off information */ |
| 404 | 523 | ||
| 405 | void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll, | 524 | void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll) |
| 406 | fdiv_fn get_fdiv) | ||
| 407 | { | 525 | { |
| 408 | unsigned long epllcon = __raw_readl(S3C2443_EPLLCON); | 526 | unsigned long epllcon = __raw_readl(S3C2443_EPLLCON); |
| 409 | unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON); | 527 | unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON); |
| @@ -423,7 +541,7 @@ void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll, | |||
| 423 | pll = get_mpll(mpllcon, xtal); | 541 | pll = get_mpll(mpllcon, xtal); |
| 424 | clk_msysclk.clk.rate = pll; | 542 | clk_msysclk.clk.rate = pll; |
| 425 | 543 | ||
| 426 | fclk = pll / get_fdiv(clkdiv0); | 544 | fclk = clk_get_rate(&clk_armdiv); |
| 427 | hclk = s3c2443_prediv_getrate(&clk_prediv); | 545 | hclk = s3c2443_prediv_getrate(&clk_prediv); |
| 428 | hclk /= s3c2443_get_hdiv(clkdiv0); | 546 | hclk /= s3c2443_get_hdiv(clkdiv0); |
| 429 | pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1); | 547 | pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1); |
| @@ -458,6 +576,7 @@ static struct clk *clks[] __initdata = { | |||
| 458 | &clk_ext, | 576 | &clk_ext, |
| 459 | &clk_epll, | 577 | &clk_epll, |
| 460 | &clk_usb_bus, | 578 | &clk_usb_bus, |
| 579 | &clk_armdiv, | ||
| 461 | }; | 580 | }; |
| 462 | 581 | ||
| 463 | static struct clksrc_clk *clksrcs[] __initdata = { | 582 | static struct clksrc_clk *clksrcs[] __initdata = { |
| @@ -467,13 +586,19 @@ static struct clksrc_clk *clksrcs[] __initdata = { | |||
| 467 | &clk_epllref, | 586 | &clk_epllref, |
| 468 | &clk_esysclk, | 587 | &clk_esysclk, |
| 469 | &clk_msysclk, | 588 | &clk_msysclk, |
| 589 | &clk_arm, | ||
| 470 | }; | 590 | }; |
| 471 | 591 | ||
| 472 | void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, | 592 | void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, |
| 473 | fdiv_fn get_fdiv) | 593 | unsigned int *divs, int nr_divs, |
| 594 | int divmask) | ||
| 474 | { | 595 | { |
| 475 | int ptr; | 596 | int ptr; |
| 476 | 597 | ||
| 598 | armdiv = divs; | ||
| 599 | nr_armdiv = nr_divs; | ||
| 600 | armdivmask = divmask; | ||
| 601 | |||
| 477 | /* s3c2443 parents h and p clocks from prediv */ | 602 | /* s3c2443 parents h and p clocks from prediv */ |
| 478 | clk_h.parent = &clk_prediv; | 603 | clk_h.parent = &clk_prediv; |
| 479 | clk_p.parent = &clk_prediv; | 604 | clk_p.parent = &clk_prediv; |
| @@ -494,5 +619,5 @@ void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, | |||
| 494 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | 619 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
| 495 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | 620 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
| 496 | 621 | ||
| 497 | s3c2443_common_setup_clocks(get_mpll, get_fdiv); | 622 | s3c2443_common_setup_clocks(get_mpll); |
| 498 | } | 623 | } |
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c index ee8deef19481..33ecd0c9f0c3 100644 --- a/arch/arm/plat-samsung/adc.c +++ b/arch/arm/plat-samsung/adc.c | |||
| @@ -41,6 +41,8 @@ | |||
| 41 | 41 | ||
| 42 | enum s3c_cpu_type { | 42 | enum s3c_cpu_type { |
| 43 | TYPE_ADCV1, /* S3C24XX */ | 43 | TYPE_ADCV1, /* S3C24XX */ |
| 44 | TYPE_ADCV11, /* S3C2443 */ | ||
| 45 | TYPE_ADCV12, /* S3C2416, S3C2450 */ | ||
| 44 | TYPE_ADCV2, /* S3C64XX, S5P64X0, S5PC100 */ | 46 | TYPE_ADCV2, /* S3C64XX, S5P64X0, S5PC100 */ |
| 45 | TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */ | 47 | TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */ |
| 46 | }; | 48 | }; |
| @@ -98,13 +100,17 @@ static inline void s3c_adc_select(struct adc_device *adc, | |||
| 98 | 100 | ||
| 99 | client->select_cb(client, 1); | 101 | client->select_cb(client, 1); |
| 100 | 102 | ||
| 101 | con &= ~S3C2410_ADCCON_MUXMASK; | 103 | if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV2) |
| 104 | con &= ~S3C2410_ADCCON_MUXMASK; | ||
| 102 | con &= ~S3C2410_ADCCON_STDBM; | 105 | con &= ~S3C2410_ADCCON_STDBM; |
| 103 | con &= ~S3C2410_ADCCON_STARTMASK; | 106 | con &= ~S3C2410_ADCCON_STARTMASK; |
| 104 | 107 | ||
| 105 | if (!client->is_ts) { | 108 | if (!client->is_ts) { |
| 106 | if (cpu == TYPE_ADCV3) | 109 | if (cpu == TYPE_ADCV3) |
| 107 | writel(client->channel & 0xf, adc->regs + S5P_ADCMUX); | 110 | writel(client->channel & 0xf, adc->regs + S5P_ADCMUX); |
| 111 | else if (cpu == TYPE_ADCV11 || cpu == TYPE_ADCV12) | ||
| 112 | writel(client->channel & 0xf, | ||
| 113 | adc->regs + S3C2443_ADCMUX); | ||
| 108 | else | 114 | else |
| 109 | con |= S3C2410_ADCCON_SELMUX(client->channel); | 115 | con |= S3C2410_ADCCON_SELMUX(client->channel); |
| 110 | } | 116 | } |
| @@ -293,13 +299,13 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw) | |||
| 293 | 299 | ||
| 294 | client->nr_samples--; | 300 | client->nr_samples--; |
| 295 | 301 | ||
| 296 | if (cpu != TYPE_ADCV1) { | 302 | if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV11) { |
| 297 | /* S3C64XX/S5P ADC resolution is 12-bit */ | ||
| 298 | data0 &= 0xfff; | ||
| 299 | data1 &= 0xfff; | ||
| 300 | } else { | ||
| 301 | data0 &= 0x3ff; | 303 | data0 &= 0x3ff; |
| 302 | data1 &= 0x3ff; | 304 | data1 &= 0x3ff; |
| 305 | } else { | ||
| 306 | /* S3C2416/S3C64XX/S5P ADC resolution is 12-bit */ | ||
| 307 | data0 &= 0xfff; | ||
| 308 | data1 &= 0xfff; | ||
| 303 | } | 309 | } |
| 304 | 310 | ||
| 305 | if (client->convert_cb) | 311 | if (client->convert_cb) |
| @@ -320,7 +326,7 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw) | |||
| 320 | } | 326 | } |
| 321 | 327 | ||
| 322 | exit: | 328 | exit: |
| 323 | if (cpu != TYPE_ADCV1) { | 329 | if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) { |
| 324 | /* Clear ADC interrupt */ | 330 | /* Clear ADC interrupt */ |
| 325 | writel(0, adc->regs + S3C64XX_ADCCLRINT); | 331 | writel(0, adc->regs + S3C64XX_ADCCLRINT); |
| 326 | } | 332 | } |
| @@ -332,6 +338,7 @@ static int s3c_adc_probe(struct platform_device *pdev) | |||
| 332 | struct device *dev = &pdev->dev; | 338 | struct device *dev = &pdev->dev; |
| 333 | struct adc_device *adc; | 339 | struct adc_device *adc; |
| 334 | struct resource *regs; | 340 | struct resource *regs; |
| 341 | enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data; | ||
| 335 | int ret; | 342 | int ret; |
| 336 | unsigned tmp; | 343 | unsigned tmp; |
| 337 | 344 | ||
| @@ -394,10 +401,13 @@ static int s3c_adc_probe(struct platform_device *pdev) | |||
| 394 | clk_enable(adc->clk); | 401 | clk_enable(adc->clk); |
| 395 | 402 | ||
| 396 | tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; | 403 | tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; |
| 397 | if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1) { | 404 | |
| 398 | /* Enable 12-bit ADC resolution */ | 405 | /* Enable 12-bit ADC resolution */ |
| 406 | if (cpu == TYPE_ADCV12) | ||
| 407 | tmp |= S3C2416_ADCCON_RESSEL; | ||
| 408 | if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) | ||
| 399 | tmp |= S3C64XX_ADCCON_RESSEL; | 409 | tmp |= S3C64XX_ADCCON_RESSEL; |
| 400 | } | 410 | |
| 401 | writel(tmp, adc->regs + S3C2410_ADCCON); | 411 | writel(tmp, adc->regs + S3C2410_ADCCON); |
| 402 | 412 | ||
| 403 | dev_info(dev, "attached adc driver\n"); | 413 | dev_info(dev, "attached adc driver\n"); |
| @@ -464,6 +474,7 @@ static int s3c_adc_resume(struct device *dev) | |||
| 464 | struct platform_device *pdev = container_of(dev, | 474 | struct platform_device *pdev = container_of(dev, |
| 465 | struct platform_device, dev); | 475 | struct platform_device, dev); |
| 466 | struct adc_device *adc = platform_get_drvdata(pdev); | 476 | struct adc_device *adc = platform_get_drvdata(pdev); |
| 477 | enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data; | ||
| 467 | int ret; | 478 | int ret; |
| 468 | unsigned long tmp; | 479 | unsigned long tmp; |
| 469 | 480 | ||
| @@ -474,9 +485,13 @@ static int s3c_adc_resume(struct device *dev) | |||
| 474 | enable_irq(adc->irq); | 485 | enable_irq(adc->irq); |
| 475 | 486 | ||
| 476 | tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; | 487 | tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; |
| 488 | |||
| 477 | /* Enable 12-bit ADC resolution */ | 489 | /* Enable 12-bit ADC resolution */ |
| 478 | if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1) | 490 | if (cpu == TYPE_ADCV12) |
| 491 | tmp |= S3C2416_ADCCON_RESSEL; | ||
| 492 | if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) | ||
| 479 | tmp |= S3C64XX_ADCCON_RESSEL; | 493 | tmp |= S3C64XX_ADCCON_RESSEL; |
| 494 | |||
| 480 | writel(tmp, adc->regs + S3C2410_ADCCON); | 495 | writel(tmp, adc->regs + S3C2410_ADCCON); |
| 481 | 496 | ||
| 482 | return 0; | 497 | return 0; |
| @@ -492,6 +507,12 @@ static struct platform_device_id s3c_adc_driver_ids[] = { | |||
| 492 | .name = "s3c24xx-adc", | 507 | .name = "s3c24xx-adc", |
| 493 | .driver_data = TYPE_ADCV1, | 508 | .driver_data = TYPE_ADCV1, |
| 494 | }, { | 509 | }, { |
| 510 | .name = "s3c2443-adc", | ||
| 511 | .driver_data = TYPE_ADCV11, | ||
| 512 | }, { | ||
| 513 | .name = "s3c2416-adc", | ||
| 514 | .driver_data = TYPE_ADCV12, | ||
| 515 | }, { | ||
| 495 | .name = "s3c64xx-adc", | 516 | .name = "s3c64xx-adc", |
| 496 | .driver_data = TYPE_ADCV2, | 517 | .driver_data = TYPE_ADCV2, |
| 497 | }, { | 518 | }, { |
diff --git a/arch/arm/plat-samsung/include/plat/adc-core.h b/arch/arm/plat-samsung/include/plat/adc-core.h index a281568d5856..a927bee55359 100644 --- a/arch/arm/plat-samsung/include/plat/adc-core.h +++ b/arch/arm/plat-samsung/include/plat/adc-core.h | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | /* re-define device name depending on support. */ | 20 | /* re-define device name depending on support. */ |
| 21 | static inline void s3c_adc_setname(char *name) | 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 | s3c_device_adc.name = name; | 24 | s3c_device_adc.name = name; |
| 25 | #endif | 25 | #endif |
| 26 | } | 26 | } |
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h index 54f370f0fc07..40fd7b6b5e66 100644 --- a/arch/arm/plat-samsung/include/plat/cpu.h +++ b/arch/arm/plat-samsung/include/plat/cpu.h | |||
| @@ -25,7 +25,6 @@ extern unsigned long samsung_cpu_id; | |||
| 25 | 25 | ||
| 26 | #define S3C6400_CPU_ID 0x36400000 | 26 | #define S3C6400_CPU_ID 0x36400000 |
| 27 | #define S3C6410_CPU_ID 0x36410000 | 27 | #define S3C6410_CPU_ID 0x36410000 |
| 28 | #define S3C64XX_CPU_ID (S3C6400_CPU_ID & S3C6410_CPU_ID) | ||
| 29 | #define S3C64XX_CPU_MASK 0xFFFFF000 | 28 | #define S3C64XX_CPU_MASK 0xFFFFF000 |
| 30 | 29 | ||
| 31 | #define S5P6440_CPU_ID 0x56440000 | 30 | #define S5P6440_CPU_ID 0x56440000 |
| @@ -50,7 +49,8 @@ static inline int is_samsung_##name(void) \ | |||
| 50 | } | 49 | } |
| 51 | 50 | ||
| 52 | IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) | 51 | IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) |
| 53 | IS_SAMSUNG_CPU(s3c64xx, S3C64XX_CPU_ID, S3C64XX_CPU_MASK) | 52 | IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) |
| 53 | IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) | ||
| 54 | IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) | 54 | IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) |
| 55 | IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK) | 55 | IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK) |
| 56 | IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK) | 56 | IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK) |
| @@ -69,7 +69,7 @@ IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK) | |||
| 69 | #endif | 69 | #endif |
| 70 | 70 | ||
| 71 | #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) | 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 | #else | 73 | #else |
| 74 | # define soc_is_s3c64xx() 0 | 74 | # define soc_is_s3c64xx() 0 |
| 75 | #endif | 75 | #endif |
diff --git a/arch/arm/plat-samsung/include/plat/regs-adc.h b/arch/arm/plat-samsung/include/plat/regs-adc.h index 035e8c38d69c..70612100120f 100644 --- a/arch/arm/plat-samsung/include/plat/regs-adc.h +++ b/arch/arm/plat-samsung/include/plat/regs-adc.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #define S3C2410_ADCDAT0 S3C2410_ADCREG(0x0C) | 20 | #define S3C2410_ADCDAT0 S3C2410_ADCREG(0x0C) |
| 21 | #define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10) | 21 | #define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10) |
| 22 | #define S3C64XX_ADCUPDN S3C2410_ADCREG(0x14) | 22 | #define S3C64XX_ADCUPDN S3C2410_ADCREG(0x14) |
| 23 | #define S3C2443_ADCMUX S3C2410_ADCREG(0x18) | ||
| 23 | #define S3C64XX_ADCCLRINT S3C2410_ADCREG(0x18) | 24 | #define S3C64XX_ADCCLRINT S3C2410_ADCREG(0x18) |
| 24 | #define S5P_ADCMUX S3C2410_ADCREG(0x1C) | 25 | #define S5P_ADCMUX S3C2410_ADCREG(0x1C) |
| 25 | #define S3C64XX_ADCCLRINTPNDNUP S3C2410_ADCREG(0x20) | 26 | #define S3C64XX_ADCCLRINTPNDNUP S3C2410_ADCREG(0x20) |
| @@ -33,6 +34,7 @@ | |||
| 33 | #define S3C2410_ADCCON_PRSCVLMASK (0xFF<<6) | 34 | #define S3C2410_ADCCON_PRSCVLMASK (0xFF<<6) |
| 34 | #define S3C2410_ADCCON_SELMUX(x) (((x)&0x7)<<3) | 35 | #define S3C2410_ADCCON_SELMUX(x) (((x)&0x7)<<3) |
| 35 | #define S3C2410_ADCCON_MUXMASK (0x7<<3) | 36 | #define S3C2410_ADCCON_MUXMASK (0x7<<3) |
| 37 | #define S3C2416_ADCCON_RESSEL (1 << 3) | ||
| 36 | #define S3C2410_ADCCON_STDBM (1<<2) | 38 | #define S3C2410_ADCCON_STDBM (1<<2) |
| 37 | #define S3C2410_ADCCON_READ_START (1<<1) | 39 | #define S3C2410_ADCCON_READ_START (1<<1) |
| 38 | #define S3C2410_ADCCON_ENABLE_START (1<<0) | 40 | #define S3C2410_ADCCON_ENABLE_START (1<<0) |
| @@ -40,6 +42,7 @@ | |||
| 40 | 42 | ||
| 41 | 43 | ||
| 42 | /* ADCTSC Register Bits */ | 44 | /* ADCTSC Register Bits */ |
| 45 | #define S3C2443_ADCTSC_UD_SEN (1 << 8) | ||
| 43 | #define S3C2410_ADCTSC_YM_SEN (1<<7) | 46 | #define S3C2410_ADCTSC_YM_SEN (1<<7) |
| 44 | #define S3C2410_ADCTSC_YP_SEN (1<<6) | 47 | #define S3C2410_ADCTSC_YP_SEN (1<<6) |
| 45 | #define S3C2410_ADCTSC_XM_SEN (1<<5) | 48 | #define S3C2410_ADCTSC_XM_SEN (1<<5) |
diff --git a/arch/arm/plat-samsung/include/plat/s3c2443.h b/arch/arm/plat-samsung/include/plat/s3c2443.h index 4b2ac9a272b2..7fae1a050694 100644 --- a/arch/arm/plat-samsung/include/plat/s3c2443.h +++ b/arch/arm/plat-samsung/include/plat/s3c2443.h | |||
| @@ -37,10 +37,11 @@ extern int s3c2443_baseclk_add(void); | |||
| 37 | struct clk; /* some files don't need clk.h otherwise */ | 37 | struct clk; /* some files don't need clk.h otherwise */ |
| 38 | 38 | ||
| 39 | typedef unsigned int (*pll_fn)(unsigned int reg, unsigned int base); | 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); | 41 | extern void s3c2443_common_setup_clocks(pll_fn get_mpll); |
| 43 | extern void s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, fdiv_fn fdiv); | 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 | extern int s3c2443_clkcon_enable_h(struct clk *clk, int enable); | 46 | extern int s3c2443_clkcon_enable_h(struct clk *clk, int enable); |
| 46 | extern int s3c2443_clkcon_enable_p(struct clk *clk, int enable); | 47 | extern int s3c2443_clkcon_enable_p(struct clk *clk, int enable); |
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index b6be77ae4973..866251852719 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
| @@ -318,6 +318,7 @@ static unsigned samsung_gpio_getcfg_4bit(struct samsung_gpio_chip *chip, | |||
| 318 | return S3C_GPIO_SPECIAL(con); | 318 | return S3C_GPIO_SPECIAL(con); |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | #ifdef CONFIG_PLAT_S3C24XX | ||
| 321 | /* | 322 | /* |
| 322 | * s3c24xx_gpio_setcfg_abank - S3C24XX style GPIO configuration (Bank A) | 323 | * s3c24xx_gpio_setcfg_abank - S3C24XX style GPIO configuration (Bank A) |
| 323 | * @chip: The gpio chip that is being configured. | 324 | * @chip: The gpio chip that is being configured. |
| @@ -379,7 +380,9 @@ static unsigned s3c24xx_gpio_getcfg_abank(struct samsung_gpio_chip *chip, | |||
| 379 | 380 | ||
| 380 | return S3C_GPIO_SFN(con); | 381 | return S3C_GPIO_SFN(con); |
| 381 | } | 382 | } |
| 383 | #endif | ||
| 382 | 384 | ||
| 385 | #if defined(CONFIG_CPU_S5P6440) || defined(CONFIG_CPU_S5P6450) | ||
| 383 | static int s5p64x0_gpio_setcfg_rbank(struct samsung_gpio_chip *chip, | 386 | static int s5p64x0_gpio_setcfg_rbank(struct samsung_gpio_chip *chip, |
| 384 | unsigned int off, unsigned int cfg) | 387 | unsigned int off, unsigned int cfg) |
| 385 | { | 388 | { |
| @@ -417,6 +420,7 @@ static int s5p64x0_gpio_setcfg_rbank(struct samsung_gpio_chip *chip, | |||
| 417 | 420 | ||
| 418 | return 0; | 421 | return 0; |
| 419 | } | 422 | } |
| 423 | #endif | ||
| 420 | 424 | ||
| 421 | static void __init samsung_gpiolib_set_cfg(struct samsung_gpio_cfg *chipcfg, | 425 | static void __init samsung_gpiolib_set_cfg(struct samsung_gpio_cfg *chipcfg, |
| 422 | int nr_chips) | 426 | int nr_chips) |
| @@ -438,10 +442,12 @@ struct samsung_gpio_cfg s3c24xx_gpiocfg_default = { | |||
| 438 | .get_config = samsung_gpio_getcfg_2bit, | 442 | .get_config = samsung_gpio_getcfg_2bit, |
| 439 | }; | 443 | }; |
| 440 | 444 | ||
| 445 | #ifdef CONFIG_PLAT_S3C24XX | ||
| 441 | static struct samsung_gpio_cfg s3c24xx_gpiocfg_banka = { | 446 | static struct samsung_gpio_cfg s3c24xx_gpiocfg_banka = { |
| 442 | .set_config = s3c24xx_gpio_setcfg_abank, | 447 | .set_config = s3c24xx_gpio_setcfg_abank, |
| 443 | .get_config = s3c24xx_gpio_getcfg_abank, | 448 | .get_config = s3c24xx_gpio_getcfg_abank, |
| 444 | }; | 449 | }; |
| 450 | #endif | ||
| 445 | 451 | ||
| 446 | static struct samsung_gpio_cfg exynos4_gpio_cfg = { | 452 | static struct samsung_gpio_cfg exynos4_gpio_cfg = { |
| 447 | .set_pull = exynos4_gpio_setpull, | 453 | .set_pull = exynos4_gpio_setpull, |
| @@ -450,6 +456,7 @@ static struct samsung_gpio_cfg exynos4_gpio_cfg = { | |||
| 450 | .get_config = samsung_gpio_getcfg_4bit, | 456 | .get_config = samsung_gpio_getcfg_4bit, |
| 451 | }; | 457 | }; |
| 452 | 458 | ||
| 459 | #if defined(CONFIG_CPU_S5P6440) || defined(CONFIG_CPU_S5P6450) | ||
| 453 | static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = { | 460 | static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = { |
| 454 | .cfg_eint = 0x3, | 461 | .cfg_eint = 0x3, |
| 455 | .set_config = s5p64x0_gpio_setcfg_rbank, | 462 | .set_config = s5p64x0_gpio_setcfg_rbank, |
| @@ -457,6 +464,7 @@ static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = { | |||
| 457 | .set_pull = samsung_gpio_setpull_updown, | 464 | .set_pull = samsung_gpio_setpull_updown, |
| 458 | .get_pull = samsung_gpio_getpull_updown, | 465 | .get_pull = samsung_gpio_getpull_updown, |
| 459 | }; | 466 | }; |
| 467 | #endif | ||
| 460 | 468 | ||
| 461 | static struct samsung_gpio_cfg samsung_gpio_cfgs[] = { | 469 | static struct samsung_gpio_cfg samsung_gpio_cfgs[] = { |
| 462 | { | 470 | { |
| @@ -482,7 +490,14 @@ static struct samsung_gpio_cfg samsung_gpio_cfgs[] = { | |||
| 482 | }, { | 490 | }, { |
| 483 | .set_config = samsung_gpio_setcfg_2bit, | 491 | .set_config = samsung_gpio_setcfg_2bit, |
| 484 | .get_config = samsung_gpio_getcfg_2bit, | 492 | .get_config = samsung_gpio_getcfg_2bit, |
| 485 | }, | 493 | }, { |
| 494 | .set_pull = exynos4_gpio_setpull, | ||
| 495 | .get_pull = exynos4_gpio_getpull, | ||
| 496 | }, { | ||
| 497 | .cfg_eint = 0x3, | ||
| 498 | .set_pull = exynos4_gpio_setpull, | ||
| 499 | .get_pull = exynos4_gpio_getpull, | ||
| 500 | } | ||
| 486 | }; | 501 | }; |
| 487 | 502 | ||
| 488 | /* | 503 | /* |
| @@ -682,6 +697,7 @@ static int samsung_gpiolib_4bit2_output(struct gpio_chip *chip, | |||
| 682 | return 0; | 697 | return 0; |
| 683 | } | 698 | } |
| 684 | 699 | ||
| 700 | #ifdef CONFIG_PLAT_S3C24XX | ||
| 685 | /* The next set of routines are for the case of s3c24xx bank a */ | 701 | /* The next set of routines are for the case of s3c24xx bank a */ |
| 686 | 702 | ||
| 687 | static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset) | 703 | static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset) |
| @@ -717,6 +733,7 @@ static int s3c24xx_gpiolib_banka_output(struct gpio_chip *chip, | |||
| 717 | local_irq_restore(flags); | 733 | local_irq_restore(flags); |
| 718 | return 0; | 734 | return 0; |
| 719 | } | 735 | } |
| 736 | #endif | ||
| 720 | 737 | ||
| 721 | /* The next set of routines are for the case of s5p64x0 bank r */ | 738 | /* The next set of routines are for the case of s5p64x0 bank r */ |
| 722 | 739 | ||
| @@ -914,6 +931,10 @@ static void __init s3c24xx_gpiolib_add_chips(struct samsung_gpio_chip *chip, | |||
| 914 | struct gpio_chip *gc = &chip->chip; | 931 | struct gpio_chip *gc = &chip->chip; |
| 915 | 932 | ||
| 916 | for (i = 0 ; i < nr_chips; i++, chip++) { | 933 | for (i = 0 ; i < nr_chips; i++, chip++) { |
| 934 | /* skip banks not present on SoC */ | ||
| 935 | if (chip->chip.base >= S3C_GPIO_END) | ||
| 936 | continue; | ||
| 937 | |||
| 917 | if (!chip->config) | 938 | if (!chip->config) |
| 918 | chip->config = &s3c24xx_gpiocfg_default; | 939 | chip->config = &s3c24xx_gpiocfg_default; |
| 919 | if (!chip->pm) | 940 | if (!chip->pm) |
| @@ -2249,49 +2270,49 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = { | |||
| 2249 | .label = "GPL2", | 2270 | .label = "GPL2", |
| 2250 | }, | 2271 | }, |
| 2251 | }, { | 2272 | }, { |
| 2252 | .config = &samsung_gpio_cfgs[0], | 2273 | .config = &samsung_gpio_cfgs[8], |
| 2253 | .chip = { | 2274 | .chip = { |
| 2254 | .base = EXYNOS4_GPY0(0), | 2275 | .base = EXYNOS4_GPY0(0), |
| 2255 | .ngpio = EXYNOS4_GPIO_Y0_NR, | 2276 | .ngpio = EXYNOS4_GPIO_Y0_NR, |
| 2256 | .label = "GPY0", | 2277 | .label = "GPY0", |
| 2257 | }, | 2278 | }, |
| 2258 | }, { | 2279 | }, { |
| 2259 | .config = &samsung_gpio_cfgs[0], | 2280 | .config = &samsung_gpio_cfgs[8], |
| 2260 | .chip = { | 2281 | .chip = { |
| 2261 | .base = EXYNOS4_GPY1(0), | 2282 | .base = EXYNOS4_GPY1(0), |
| 2262 | .ngpio = EXYNOS4_GPIO_Y1_NR, | 2283 | .ngpio = EXYNOS4_GPIO_Y1_NR, |
| 2263 | .label = "GPY1", | 2284 | .label = "GPY1", |
| 2264 | }, | 2285 | }, |
| 2265 | }, { | 2286 | }, { |
| 2266 | .config = &samsung_gpio_cfgs[0], | 2287 | .config = &samsung_gpio_cfgs[8], |
| 2267 | .chip = { | 2288 | .chip = { |
| 2268 | .base = EXYNOS4_GPY2(0), | 2289 | .base = EXYNOS4_GPY2(0), |
| 2269 | .ngpio = EXYNOS4_GPIO_Y2_NR, | 2290 | .ngpio = EXYNOS4_GPIO_Y2_NR, |
| 2270 | .label = "GPY2", | 2291 | .label = "GPY2", |
| 2271 | }, | 2292 | }, |
| 2272 | }, { | 2293 | }, { |
| 2273 | .config = &samsung_gpio_cfgs[0], | 2294 | .config = &samsung_gpio_cfgs[8], |
| 2274 | .chip = { | 2295 | .chip = { |
| 2275 | .base = EXYNOS4_GPY3(0), | 2296 | .base = EXYNOS4_GPY3(0), |
| 2276 | .ngpio = EXYNOS4_GPIO_Y3_NR, | 2297 | .ngpio = EXYNOS4_GPIO_Y3_NR, |
| 2277 | .label = "GPY3", | 2298 | .label = "GPY3", |
| 2278 | }, | 2299 | }, |
| 2279 | }, { | 2300 | }, { |
| 2280 | .config = &samsung_gpio_cfgs[0], | 2301 | .config = &samsung_gpio_cfgs[8], |
| 2281 | .chip = { | 2302 | .chip = { |
| 2282 | .base = EXYNOS4_GPY4(0), | 2303 | .base = EXYNOS4_GPY4(0), |
| 2283 | .ngpio = EXYNOS4_GPIO_Y4_NR, | 2304 | .ngpio = EXYNOS4_GPIO_Y4_NR, |
| 2284 | .label = "GPY4", | 2305 | .label = "GPY4", |
| 2285 | }, | 2306 | }, |
| 2286 | }, { | 2307 | }, { |
| 2287 | .config = &samsung_gpio_cfgs[0], | 2308 | .config = &samsung_gpio_cfgs[8], |
| 2288 | .chip = { | 2309 | .chip = { |
| 2289 | .base = EXYNOS4_GPY5(0), | 2310 | .base = EXYNOS4_GPY5(0), |
| 2290 | .ngpio = EXYNOS4_GPIO_Y5_NR, | 2311 | .ngpio = EXYNOS4_GPIO_Y5_NR, |
| 2291 | .label = "GPY5", | 2312 | .label = "GPY5", |
| 2292 | }, | 2313 | }, |
| 2293 | }, { | 2314 | }, { |
| 2294 | .config = &samsung_gpio_cfgs[0], | 2315 | .config = &samsung_gpio_cfgs[8], |
| 2295 | .chip = { | 2316 | .chip = { |
| 2296 | .base = EXYNOS4_GPY6(0), | 2317 | .base = EXYNOS4_GPY6(0), |
| 2297 | .ngpio = EXYNOS4_GPIO_Y6_NR, | 2318 | .ngpio = EXYNOS4_GPIO_Y6_NR, |
| @@ -2299,7 +2320,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = { | |||
| 2299 | }, | 2320 | }, |
| 2300 | }, { | 2321 | }, { |
| 2301 | .base = (S5P_VA_GPIO2 + 0xC00), | 2322 | .base = (S5P_VA_GPIO2 + 0xC00), |
| 2302 | .config = &samsung_gpio_cfgs[3], | 2323 | .config = &samsung_gpio_cfgs[9], |
| 2303 | .irq_base = IRQ_EINT(0), | 2324 | .irq_base = IRQ_EINT(0), |
| 2304 | .chip = { | 2325 | .chip = { |
| 2305 | .base = EXYNOS4_GPX0(0), | 2326 | .base = EXYNOS4_GPX0(0), |
| @@ -2309,7 +2330,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = { | |||
| 2309 | }, | 2330 | }, |
| 2310 | }, { | 2331 | }, { |
| 2311 | .base = (S5P_VA_GPIO2 + 0xC20), | 2332 | .base = (S5P_VA_GPIO2 + 0xC20), |
| 2312 | .config = &samsung_gpio_cfgs[3], | 2333 | .config = &samsung_gpio_cfgs[9], |
| 2313 | .irq_base = IRQ_EINT(8), | 2334 | .irq_base = IRQ_EINT(8), |
| 2314 | .chip = { | 2335 | .chip = { |
| 2315 | .base = EXYNOS4_GPX1(0), | 2336 | .base = EXYNOS4_GPX1(0), |
| @@ -2319,7 +2340,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = { | |||
| 2319 | }, | 2340 | }, |
| 2320 | }, { | 2341 | }, { |
| 2321 | .base = (S5P_VA_GPIO2 + 0xC40), | 2342 | .base = (S5P_VA_GPIO2 + 0xC40), |
| 2322 | .config = &samsung_gpio_cfgs[3], | 2343 | .config = &samsung_gpio_cfgs[9], |
| 2323 | .irq_base = IRQ_EINT(16), | 2344 | .irq_base = IRQ_EINT(16), |
| 2324 | .chip = { | 2345 | .chip = { |
| 2325 | .base = EXYNOS4_GPX2(0), | 2346 | .base = EXYNOS4_GPX2(0), |
| @@ -2329,7 +2350,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = { | |||
| 2329 | }, | 2350 | }, |
| 2330 | }, { | 2351 | }, { |
| 2331 | .base = (S5P_VA_GPIO2 + 0xC60), | 2352 | .base = (S5P_VA_GPIO2 + 0xC60), |
| 2332 | .config = &samsung_gpio_cfgs[3], | 2353 | .config = &samsung_gpio_cfgs[9], |
| 2333 | .irq_base = IRQ_EINT(24), | 2354 | .irq_base = IRQ_EINT(24), |
| 2334 | .chip = { | 2355 | .chip = { |
| 2335 | .base = EXYNOS4_GPX3(0), | 2356 | .base = EXYNOS4_GPX3(0), |
| @@ -2465,6 +2486,9 @@ static __init int samsung_gpiolib_init(void) | |||
| 2465 | s5p_register_gpioint_bank(IRQ_GPIO_XA, 0, IRQ_GPIO1_NR_GROUPS); | 2486 | s5p_register_gpioint_bank(IRQ_GPIO_XA, 0, IRQ_GPIO1_NR_GROUPS); |
| 2466 | s5p_register_gpioint_bank(IRQ_GPIO_XB, IRQ_GPIO1_NR_GROUPS, IRQ_GPIO2_NR_GROUPS); | 2487 | s5p_register_gpioint_bank(IRQ_GPIO_XB, IRQ_GPIO1_NR_GROUPS, IRQ_GPIO2_NR_GROUPS); |
| 2467 | #endif | 2488 | #endif |
| 2489 | } else { | ||
| 2490 | WARN(1, "Unknown SoC in gpio-samsung, no GPIOs added\n"); | ||
| 2491 | return -ENODEV; | ||
| 2468 | } | 2492 | } |
| 2469 | 2493 | ||
| 2470 | return 0; | 2494 | return 0; |
