13 #include <linux/kernel.h>
14 #include <linux/types.h>
16 #include <linux/list.h>
19 #include <linux/serial_core.h>
22 #include <linux/slab.h>
23 #include <linux/string.h>
42 #include <mach/hardware.h>
44 #include <mach/irqs.h>
73 #ifdef CONFIG_CPU_S3C2440
74 static struct resource s3c_ac97_resource[] = {
83 .
name =
"samsung-ac97",
85 .num_resources =
ARRAY_SIZE(s3c_ac97_resource),
86 .resource = s3c_ac97_resource,
88 .dma_mask = &samsung_device_dma_mask,
96 #ifdef CONFIG_PLAT_S3C24XX
97 static struct resource s3c_adc_resource[] = {
104 .name =
"s3c24xx-adc",
106 .num_resources =
ARRAY_SIZE(s3c_adc_resource),
107 .resource = s3c_adc_resource,
111 #if defined(CONFIG_SAMSUNG_DEV_ADC)
112 static struct resource s3c_adc_resource[] = {
119 .
name =
"samsung-adc",
121 .num_resources =
ARRAY_SIZE(s3c_adc_resource),
122 .resource = s3c_adc_resource,
128 #ifdef CONFIG_CPU_S3C2440
129 static struct resource s3c_camif_resource[] = {
136 .
name =
"s3c2440-camif",
138 .num_resources =
ARRAY_SIZE(s3c_camif_resource),
139 .resource = s3c_camif_resource,
141 .dma_mask = &samsung_device_dma_mask,
150 .name =
"samsung-audio",
153 .dma_mask = &samsung_device_dma_mask,
159 .name =
"samsung-idma",
162 .dma_mask = &samsung_device_dma_mask,
169 #ifdef CONFIG_S3C_DEV_FB
170 static struct resource s3c_fb_resource[] = {
181 .resource = s3c_fb_resource,
183 .dma_mask = &samsung_device_dma_mask,
197 #ifdef CONFIG_S5P_DEV_FIMC0
198 static struct resource s5p_fimc0_resource[] = {
206 .num_resources =
ARRAY_SIZE(s5p_fimc0_resource),
207 .resource = s5p_fimc0_resource,
209 .dma_mask = &samsung_device_dma_mask,
215 .name =
"s5p-fimc-md",
220 #ifdef CONFIG_S5P_DEV_FIMC1
221 static struct resource s5p_fimc1_resource[] = {
229 .num_resources =
ARRAY_SIZE(s5p_fimc1_resource),
230 .resource = s5p_fimc1_resource,
232 .dma_mask = &samsung_device_dma_mask,
238 #ifdef CONFIG_S5P_DEV_FIMC2
239 static struct resource s5p_fimc2_resource[] = {
247 .num_resources =
ARRAY_SIZE(s5p_fimc2_resource),
248 .resource = s5p_fimc2_resource,
250 .dma_mask = &samsung_device_dma_mask,
256 #ifdef CONFIG_S5P_DEV_FIMC3
257 static struct resource s5p_fimc3_resource[] = {
265 .num_resources =
ARRAY_SIZE(s5p_fimc3_resource),
266 .resource = s5p_fimc3_resource,
268 .dma_mask = &samsung_device_dma_mask,
276 #ifdef CONFIG_S5P_DEV_G2D
277 static struct resource s5p_g2d_resource[] = {
285 .num_resources =
ARRAY_SIZE(s5p_g2d_resource),
286 .resource = s5p_g2d_resource,
288 .dma_mask = &samsung_device_dma_mask,
294 #ifdef CONFIG_S5P_DEV_JPEG
295 static struct resource s5p_jpeg_resource[] = {
303 .num_resources =
ARRAY_SIZE(s5p_jpeg_resource),
304 .resource = s5p_jpeg_resource,
306 .dma_mask = &samsung_device_dma_mask,
314 #ifdef CONFIG_S5P_DEV_FIMD0
315 static struct resource s5p_fimd0_resource[] = {
325 .num_resources =
ARRAY_SIZE(s5p_fimd0_resource),
326 .resource = s5p_fimd0_resource,
328 .dma_mask = &samsung_device_dma_mask,
342 #ifdef CONFIG_S3C_DEV_HWMON
346 .dev.parent = &s3c_device_adc.
dev,
358 #ifdef CONFIG_S3C_DEV_HSMMC
359 static struct resource s3c_hsmmc_resource[] = {
373 .num_resources =
ARRAY_SIZE(s3c_hsmmc_resource),
374 .resource = s3c_hsmmc_resource,
376 .dma_mask = &samsung_device_dma_mask,
378 .platform_data = &s3c_hsmmc0_def_platdata,
388 #ifdef CONFIG_S3C_DEV_HSMMC1
389 static struct resource s3c_hsmmc1_resource[] = {
403 .num_resources =
ARRAY_SIZE(s3c_hsmmc1_resource),
404 .resource = s3c_hsmmc1_resource,
406 .dma_mask = &samsung_device_dma_mask,
408 .platform_data = &s3c_hsmmc1_def_platdata,
420 #ifdef CONFIG_S3C_DEV_HSMMC2
421 static struct resource s3c_hsmmc2_resource[] = {
435 .num_resources =
ARRAY_SIZE(s3c_hsmmc2_resource),
436 .resource = s3c_hsmmc2_resource,
438 .dma_mask = &samsung_device_dma_mask,
440 .platform_data = &s3c_hsmmc2_def_platdata,
450 #ifdef CONFIG_S3C_DEV_HSMMC3
451 static struct resource s3c_hsmmc3_resource[] = {
465 .num_resources =
ARRAY_SIZE(s3c_hsmmc3_resource),
466 .resource = s3c_hsmmc3_resource,
468 .dma_mask = &samsung_device_dma_mask,
470 .platform_data = &s3c_hsmmc3_def_platdata,
482 static struct resource s3c_i2c0_resource[] = {
488 .name =
"s3c2410-i2c",
489 #ifdef CONFIG_S3C_DEV_I2C1
494 .num_resources =
ARRAY_SIZE(s3c_i2c0_resource),
495 .resource = s3c_i2c0_resource,
501 .frequency = 100*1000,
521 #ifdef CONFIG_S3C_DEV_I2C1
522 static struct resource s3c_i2c1_resource[] = {
528 .name =
"s3c2410-i2c",
530 .num_resources =
ARRAY_SIZE(s3c_i2c1_resource),
531 .resource = s3c_i2c1_resource,
551 #ifdef CONFIG_S3C_DEV_I2C2
552 static struct resource s3c_i2c2_resource[] = {
558 .name =
"s3c2410-i2c",
560 .num_resources =
ARRAY_SIZE(s3c_i2c2_resource),
561 .resource = s3c_i2c2_resource,
581 #ifdef CONFIG_S3C_DEV_I2C3
582 static struct resource s3c_i2c3_resource[] = {
588 .name =
"s3c2440-i2c",
590 .num_resources =
ARRAY_SIZE(s3c_i2c3_resource),
591 .resource = s3c_i2c3_resource,
611 #ifdef CONFIG_S3C_DEV_I2C4
612 static struct resource s3c_i2c4_resource[] = {
618 .name =
"s3c2440-i2c",
620 .num_resources =
ARRAY_SIZE(s3c_i2c4_resource),
621 .resource = s3c_i2c4_resource,
641 #ifdef CONFIG_S3C_DEV_I2C5
642 static struct resource s3c_i2c5_resource[] = {
648 .name =
"s3c2440-i2c",
650 .num_resources =
ARRAY_SIZE(s3c_i2c5_resource),
651 .resource = s3c_i2c5_resource,
671 #ifdef CONFIG_S3C_DEV_I2C6
672 static struct resource s3c_i2c6_resource[] = {
678 .name =
"s3c2440-i2c",
680 .num_resources =
ARRAY_SIZE(s3c_i2c6_resource),
681 .resource = s3c_i2c6_resource,
701 #ifdef CONFIG_S3C_DEV_I2C7
702 static struct resource s3c_i2c7_resource[] = {
708 .name =
"s3c2440-i2c",
710 .num_resources =
ARRAY_SIZE(s3c_i2c7_resource),
711 .resource = s3c_i2c7_resource,
733 #ifdef CONFIG_S5P_DEV_I2C_HDMIPHY
734 static struct resource s5p_i2c_resource[] = {
740 .name =
"s3c2440-hdmiphy-i2c",
742 .num_resources =
ARRAY_SIZE(s5p_i2c_resource),
743 .resource = s5p_i2c_resource,
763 &s5p_device_i2c_hdmiphy);
793 #ifdef CONFIG_PLAT_S3C24XX
794 static struct resource s3c_iis_resource[] = {
799 .name =
"s3c24xx-iis",
801 .num_resources =
ARRAY_SIZE(s3c_iis_resource),
802 .resource = s3c_iis_resource,
804 .dma_mask = &samsung_device_dma_mask,
812 #ifdef CONFIG_SAMSUNG_DEV_IDE
813 static struct resource s3c_cfcon_resource[] = {
820 .num_resources =
ARRAY_SIZE(s3c_cfcon_resource),
821 .resource = s3c_cfcon_resource,
833 #ifdef CONFIG_SAMSUNG_DEV_KEYPAD
834 static struct resource samsung_keypad_resources[] = {
840 .name =
"samsung-keypad",
842 .num_resources =
ARRAY_SIZE(samsung_keypad_resources),
843 .resource = samsung_keypad_resources,
851 &samsung_device_keypad);
860 #ifdef CONFIG_PLAT_S3C24XX
861 static struct resource s3c_lcd_resource[] = {
867 .name =
"s3c2410-lcd",
869 .num_resources =
ARRAY_SIZE(s3c_lcd_resource),
870 .resource = s3c_lcd_resource,
872 .dma_mask = &samsung_device_dma_mask,
896 #ifdef CONFIG_S5P_DEV_MFC
897 static struct resource s5p_mfc_resource[] = {
905 .num_resources =
ARRAY_SIZE(s5p_mfc_resource),
906 .resource = s5p_mfc_resource,
921 .parent = &s5p_device_mfc.
dev,
922 .dma_mask = &samsung_device_dma_mask,
931 .parent = &s5p_device_mfc.
dev,
932 .dma_mask = &samsung_device_dma_mask,
940 #ifdef CONFIG_S5P_DEV_CSIS0
941 static struct resource s5p_mipi_csis0_resource[] = {
947 .name =
"s5p-mipi-csis",
949 .num_resources =
ARRAY_SIZE(s5p_mipi_csis0_resource),
950 .resource = s5p_mipi_csis0_resource,
954 #ifdef CONFIG_S5P_DEV_CSIS1
955 static struct resource s5p_mipi_csis1_resource[] = {
961 .name =
"s5p-mipi-csis",
963 .num_resources =
ARRAY_SIZE(s5p_mipi_csis1_resource),
964 .resource = s5p_mipi_csis1_resource,
970 #ifdef CONFIG_S3C_DEV_NAND
971 static struct resource s3c_nand_resource[] = {
976 .name =
"s3c2410-nand",
978 .num_resources =
ARRAY_SIZE(s3c_nand_resource),
979 .resource = s3c_nand_resource,
1001 set->partitions =
ptr;
1007 if (
set->nr_map &&
set->nr_chips) {
1008 size =
sizeof(
int) *
set->nr_chips;
1016 if (
set->ecc_layout) {
1019 set->ecc_layout =
ptr;
1060 for (i = 0; i < npd->
nr_sets; i++) {
1061 ret = s3c_nand_copy_set(to);
1075 #ifdef CONFIG_S3C_DEV_ONENAND
1076 static struct resource s3c_onenand_resources[] = {
1083 .name =
"samsung-onenand",
1085 .num_resources =
ARRAY_SIZE(s3c_onenand_resources),
1086 .resource = s3c_onenand_resources,
1090 #ifdef CONFIG_S3C64XX_DEV_ONENAND1
1091 static struct resource s3c64xx_onenand1_resources[] = {
1098 .name =
"samsung-onenand",
1100 .num_resources =
ARRAY_SIZE(s3c64xx_onenand1_resources),
1101 .resource = s3c64xx_onenand1_resources,
1107 &s3c64xx_device_onenand1);
1111 #ifdef CONFIG_S5P_DEV_ONENAND
1112 static struct resource s5p_onenand_resources[] = {
1119 .name =
"s5pc110-onenand",
1121 .num_resources =
ARRAY_SIZE(s5p_onenand_resources),
1122 .resource = s5p_onenand_resources,
1128 #ifdef CONFIG_PLAT_S5P
1129 static struct resource s5p_pmu_resource[] = {
1136 .num_resources =
ARRAY_SIZE(s5p_pmu_resource),
1137 .resource = s5p_pmu_resource,
1140 static int __init s5p_pmu_init(
void)
1150 #ifdef CONFIG_SAMSUNG_DEV_PWM
1152 #define TIMER_RESOURCE_SIZE (1)
1154 #define TIMER_RESOURCE(_tmr, _irq) \
1155 (struct resource [TIMER_RESOURCE_SIZE]) { \
1159 .flags = IORESOURCE_IRQ \
1163 #define DEFINE_S3C_TIMER(_tmr_no, _irq) \
1164 .name = "s3c24xx-pwm", \
1166 .num_resources = TIMER_RESOURCE_SIZE, \
1167 .resource = TIMER_RESOURCE(_tmr_no, _irq), \
1185 #ifdef CONFIG_PLAT_S3C24XX
1186 static struct resource s3c_rtc_resource[] = {
1193 .name =
"s3c2410-rtc",
1195 .num_resources =
ARRAY_SIZE(s3c_rtc_resource),
1196 .resource = s3c_rtc_resource,
1200 #ifdef CONFIG_S3C_DEV_RTC
1201 static struct resource s3c_rtc_resource[] = {
1208 .
name =
"s3c64xx-rtc",
1210 .num_resources =
ARRAY_SIZE(s3c_rtc_resource),
1211 .resource = s3c_rtc_resource,
1217 #ifdef CONFIG_PLAT_S3C24XX
1218 static struct resource s3c_sdi_resource[] = {
1224 .name =
"s3c2410-sdi",
1226 .num_resources =
ARRAY_SIZE(s3c_sdi_resource),
1227 .resource = s3c_sdi_resource,
1239 #ifdef CONFIG_PLAT_S3C24XX
1240 static struct resource s3c_spi0_resource[] = {
1246 .name =
"s3c2410-spi",
1248 .num_resources =
ARRAY_SIZE(s3c_spi0_resource),
1249 .resource = s3c_spi0_resource,
1251 .dma_mask = &samsung_device_dma_mask,
1256 static struct resource s3c_spi1_resource[] = {
1262 .name =
"s3c2410-spi",
1264 .num_resources =
ARRAY_SIZE(s3c_spi1_resource),
1265 .resource = s3c_spi1_resource,
1267 .dma_mask = &samsung_device_dma_mask,
1275 #ifdef CONFIG_PLAT_S3C24XX
1276 static struct resource s3c_ts_resource[] = {
1282 .name =
"s3c2410-ts",
1284 .dev.parent = &s3c_device_adc.
dev,
1285 .num_resources =
ARRAY_SIZE(s3c_ts_resource),
1286 .resource = s3c_ts_resource,
1296 #ifdef CONFIG_SAMSUNG_DEV_TS
1297 static struct resource s3c_ts_resource[] = {
1305 .oversampling_shift = 2,
1309 .
name =
"s3c64xx-ts",
1311 .num_resources =
ARRAY_SIZE(s3c_ts_resource),
1312 .resource = s3c_ts_resource,
1318 pd = &default_ts_data;
1327 #ifdef CONFIG_S5P_DEV_TV
1329 static struct resource s5p_hdmi_resources[] = {
1337 .num_resources =
ARRAY_SIZE(s5p_hdmi_resources),
1338 .resource = s5p_hdmi_resources,
1341 static struct resource s5p_sdo_resources[] = {
1349 .num_resources =
ARRAY_SIZE(s5p_sdo_resources),
1350 .resource = s5p_sdo_resources,
1353 static struct resource s5p_mixer_resources[] = {
1360 .name =
"s5p-mixer",
1362 .num_resources =
ARRAY_SIZE(s5p_mixer_resources),
1363 .resource = s5p_mixer_resources,
1365 .dma_mask = &samsung_device_dma_mask,
1373 #ifdef CONFIG_S3C_DEV_USB_HOST
1374 static struct resource s3c_usb_resource[] = {
1380 .name =
"s3c2410-ohci",
1382 .num_resources =
ARRAY_SIZE(s3c_usb_resource),
1383 .resource = s3c_usb_resource,
1385 .dma_mask = &samsung_device_dma_mask,
1408 #ifdef CONFIG_PLAT_S3C24XX
1409 static struct resource s3c_usbgadget_resource[] = {
1415 .name =
"s3c2410-usbgadget",
1417 .num_resources =
ARRAY_SIZE(s3c_usbgadget_resource),
1418 .resource = s3c_usbgadget_resource,
1429 #ifdef CONFIG_S5P_DEV_USB_EHCI
1430 static struct resource s5p_ehci_resource[] = {
1438 .num_resources =
ARRAY_SIZE(s5p_ehci_resource),
1439 .resource = s5p_ehci_resource,
1441 .dma_mask = &samsung_device_dma_mask,
1462 #ifdef CONFIG_S3C_DEV_USB_HSOTG
1463 static struct resource s3c_usb_hsotg_resources[] = {
1469 .name =
"s3c-hsotg",
1471 .num_resources =
ARRAY_SIZE(s3c_usb_hsotg_resources),
1472 .resource = s3c_usb_hsotg_resources,
1474 .dma_mask = &samsung_device_dma_mask,
1484 &s3c_device_usb_hsotg);
1495 #ifdef CONFIG_PLAT_S3C24XX
1496 static struct resource s3c_hsudc_resource[] = {
1502 .name =
"s3c-hsudc",
1504 .num_resources =
ARRAY_SIZE(s3c_hsudc_resource),
1505 .resource = s3c_hsudc_resource,
1507 .dma_mask = &samsung_device_dma_mask,
1520 #ifdef CONFIG_S3C_DEV_WDT
1521 static struct resource s3c_wdt_resource[] = {
1527 .name =
"s3c2410-wdt",
1529 .num_resources =
ARRAY_SIZE(s3c_wdt_resource),
1530 .resource = s3c_wdt_resource,
1534 #ifdef CONFIG_S3C64XX_DEV_SPI0
1535 static struct resource s3c64xx_spi0_resource[] = {
1543 .name =
"s3c6410-spi",
1545 .num_resources =
ARRAY_SIZE(s3c64xx_spi0_resource),
1546 .resource = s3c64xx_spi0_resource,
1548 .dma_mask = &samsung_device_dma_mask,
1559 if (!num_cs || src_clk_nr < 0) {
1560 pr_err(
"%s: Invalid SPI configuration\n", __func__);
1572 #ifdef CONFIG_S3C64XX_DEV_SPI1
1573 static struct resource s3c64xx_spi1_resource[] = {
1581 .name =
"s3c6410-spi",
1583 .num_resources =
ARRAY_SIZE(s3c64xx_spi1_resource),
1584 .resource = s3c64xx_spi1_resource,
1586 .dma_mask = &samsung_device_dma_mask,
1597 if (!num_cs || src_clk_nr < 0) {
1598 pr_err(
"%s: Invalid SPI configuration\n", __func__);
1610 #ifdef CONFIG_S3C64XX_DEV_SPI2
1611 static struct resource s3c64xx_spi2_resource[] = {
1619 .name =
"s3c6410-spi",
1621 .num_resources =
ARRAY_SIZE(s3c64xx_spi2_resource),
1622 .resource = s3c64xx_spi2_resource,
1624 .dma_mask = &samsung_device_dma_mask,
1635 if (!num_cs || src_clk_nr < 0) {
1636 pr_err(
"%s: Invalid SPI configuration\n", __func__);