Commit c861cd3e authored by Linus Torvalds's avatar Linus Torvalds

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

* 'next/devel2' of git://git.linaro.org/people/arnd/arm-soc: (30 commits)
  ARM: mmp: register internal sram bank
  ARM: mmp: register audio sram bank
  ARM: mmp: add sram allocator
  gpio/samsung: Complain loudly if we don't know the SoC
  ARM: S3C64XX: Fix SoC identification for S3C64xx devices
  ARM: S3C2443: Remove redundant s3c_register_clocks call for init_clocks
  ARM: S3C24XX: Add devname for hsmmc1 pclk
  ARM: S3C24XX: use clk_get_rate to init fclk in common_setup_clocks
  ARM: S3C2443: Accommodate cpufreq frequency scheme in armdiv
  ARM: S3C2443: handle unset armdiv values gracefully
  ARM: S3C2443: Add get_rate operation for clk_armdiv
  ARM: S3C2416: Add comment describing the armdiv/armclk
  ARM: S3C2443: Move clk_arm and clk_armdiv to common code
  ARM: S3C24XX: Add infrastructure to transmit armdiv to common code
  ARM: S3C2416: Add armdiv_mask constant
  ARM: EXYNOS4: Add support for M-5MOLS camera on Nuri board
  ARM: EXYNOS4: Enable MFC on ORIGEN
  ARM: SAMSUNG: Add support s3c2416-adc for S3C2416/S3C2450
  ARM: SAMSUNG: Add support s3c2443-adc for S3C2443
  ARM: SAMSUNG: Allow overriding of adc device name for S3C24XX
  ...
parents 7abec10c b8bc8397
...@@ -595,6 +595,7 @@ config ARCH_MMP ...@@ -595,6 +595,7 @@ config ARCH_MMP
select TICK_ONESHOT select TICK_ONESHOT
select PLAT_PXA select PLAT_PXA
select SPARSE_IRQ select SPARSE_IRQ
select GENERIC_ALLOCATOR
help help
Support for Marvell's PXA168/PXA910(MMP) and MMP2 processor line. Support for Marvell's PXA168/PXA910(MMP) and MMP2 processor line.
...@@ -769,6 +770,7 @@ config ARCH_S3C64XX ...@@ -769,6 +770,7 @@ config ARCH_S3C64XX
select CPU_V6 select CPU_V6
select ARM_VIC select ARM_VIC
select HAVE_CLK select HAVE_CLK
select HAVE_TCM
select CLKDEV_LOOKUP select CLKDEV_LOOKUP
select NO_IOPORT select NO_IOPORT
select ARCH_USES_GETTIMEOFFSET select ARCH_USES_GETTIMEOFFSET
......
...@@ -217,6 +217,7 @@ config MACH_UNIVERSAL_C210 ...@@ -217,6 +217,7 @@ config MACH_UNIVERSAL_C210
config MACH_NURI config MACH_NURI
bool "Mobile NURI Board" bool "Mobile NURI Board"
select CPU_EXYNOS4210 select CPU_EXYNOS4210
select S5P_GPIO_INT
select S3C_DEV_WDT select S3C_DEV_WDT
select S3C_DEV_RTC select S3C_DEV_RTC
select S5P_DEV_FIMD0 select S5P_DEV_FIMD0
...@@ -226,15 +227,23 @@ config MACH_NURI ...@@ -226,15 +227,23 @@ config MACH_NURI
select S3C_DEV_I2C1 select S3C_DEV_I2C1
select S3C_DEV_I2C3 select S3C_DEV_I2C3
select S3C_DEV_I2C5 select S3C_DEV_I2C5
select S5P_DEV_CSIS0
select S5P_DEV_FIMC0
select S5P_DEV_FIMC1
select S5P_DEV_FIMC2
select S5P_DEV_FIMC3
select S5P_DEV_MFC select S5P_DEV_MFC
select S5P_DEV_USB_EHCI select S5P_DEV_USB_EHCI
select S5P_SETUP_MIPIPHY
select EXYNOS4_DEV_PD select EXYNOS4_DEV_PD
select EXYNOS4_SETUP_FIMC
select EXYNOS4_SETUP_FIMD0 select EXYNOS4_SETUP_FIMD0
select EXYNOS4_SETUP_I2C1 select EXYNOS4_SETUP_I2C1
select EXYNOS4_SETUP_I2C3 select EXYNOS4_SETUP_I2C3
select EXYNOS4_SETUP_I2C5 select EXYNOS4_SETUP_I2C5
select EXYNOS4_SETUP_SDHCI select EXYNOS4_SETUP_SDHCI
select EXYNOS4_SETUP_USB_PHY select EXYNOS4_SETUP_USB_PHY
select S5P_SETUP_MIPIPHY
select SAMSUNG_DEV_PWM select SAMSUNG_DEV_PWM
select SAMSUNG_DEV_ADC select SAMSUNG_DEV_ADC
help help
...@@ -253,11 +262,12 @@ config MACH_ORIGEN ...@@ -253,11 +262,12 @@ config MACH_ORIGEN
select S5P_DEV_FIMC3 select S5P_DEV_FIMC3
select S5P_DEV_FIMD0 select S5P_DEV_FIMD0
select S5P_DEV_I2C_HDMIPHY select S5P_DEV_I2C_HDMIPHY
select S5P_DEV_MFC
select S5P_DEV_TV select S5P_DEV_TV
select S5P_DEV_USB_EHCI select S5P_DEV_USB_EHCI
select EXYNOS4_DEV_PD
select SAMSUNG_DEV_BACKLIGHT select SAMSUNG_DEV_BACKLIGHT
select SAMSUNG_DEV_PWM select SAMSUNG_DEV_PWM
select EXYNOS4_DEV_PD
select EXYNOS4_SETUP_FIMD0 select EXYNOS4_SETUP_FIMD0
select EXYNOS4_SETUP_SDHCI select EXYNOS4_SETUP_SDHCI
select EXYNOS4_SETUP_USB_PHY select EXYNOS4_SETUP_USB_PHY
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <video/platform_lcd.h> #include <video/platform_lcd.h>
#include <media/m5mols.h>
#include <media/s5p_fimc.h>
#include <media/v4l2-mediabus.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
...@@ -45,6 +48,9 @@ ...@@ -45,6 +48,9 @@
#include <plat/iic.h> #include <plat/iic.h>
#include <plat/mfc.h> #include <plat/mfc.h>
#include <plat/pd.h> #include <plat/pd.h>
#include <plat/fimc-core.h>
#include <plat/camport.h>
#include <plat/mipi_csis.h>
#include <mach/map.h> #include <mach/map.h>
...@@ -65,6 +71,8 @@ ...@@ -65,6 +71,8 @@
enum fixed_regulator_id { enum fixed_regulator_id {
FIXED_REG_ID_MMC = 0, FIXED_REG_ID_MMC = 0,
FIXED_REG_ID_MAX8903, FIXED_REG_ID_MAX8903,
FIXED_REG_ID_CAM_A28V,
FIXED_REG_ID_CAM_12V,
}; };
static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = { static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = {
...@@ -1066,13 +1074,6 @@ static struct platform_device nuri_max8903_device = { ...@@ -1066,13 +1074,6 @@ static struct platform_device nuri_max8903_device = {
}, },
}; };
static struct device *nuri_cm_devices[] = {
&s3c_device_i2c5.dev,
&s3c_device_adc.dev,
NULL, /* Reserved for UART */
NULL,
};
static void __init nuri_power_init(void) static void __init nuri_power_init(void)
{ {
int gpio; int gpio;
...@@ -1117,10 +1118,140 @@ static void __init nuri_ehci_init(void) ...@@ -1117,10 +1118,140 @@ static void __init nuri_ehci_init(void)
s5p_ehci_set_platdata(pdata); s5p_ehci_set_platdata(pdata);
} }
/* CAMERA */
static struct regulator_consumer_supply cam_vdda_supply[] = {
REGULATOR_SUPPLY("a_sensor", "0-001f"),
};
static struct regulator_init_data cam_vdda_reg_init_data = {
.constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
.num_consumer_supplies = ARRAY_SIZE(cam_vdda_supply),
.consumer_supplies = cam_vdda_supply,
};
static struct fixed_voltage_config cam_vdda_fixed_voltage_cfg = {
.supply_name = "CAM_IO_EN",
.microvolts = 2800000,
.gpio = EXYNOS4_GPE2(1), /* CAM_IO_EN */
.enable_high = 1,
.init_data = &cam_vdda_reg_init_data,
};
static struct platform_device cam_vdda_fixed_rdev = {
.name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_A28V,
.dev = { .platform_data = &cam_vdda_fixed_voltage_cfg },
};
static struct regulator_consumer_supply camera_8m_12v_supply =
REGULATOR_SUPPLY("dig_12", "0-001f");
static struct regulator_init_data cam_8m_12v_reg_init_data = {
.num_consumer_supplies = 1,
.consumer_supplies = &camera_8m_12v_supply,
.constraints = {
.valid_ops_mask = REGULATOR_CHANGE_STATUS
},
};
static struct fixed_voltage_config cam_8m_12v_fixed_voltage_cfg = {
.supply_name = "8M_1.2V",
.microvolts = 1200000,
.gpio = EXYNOS4_GPE2(5), /* 8M_1.2V_EN */
.enable_high = 1,
.init_data = &cam_8m_12v_reg_init_data,
};
static struct platform_device cam_8m_12v_fixed_rdev = {
.name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_12V,
.dev = { .platform_data = &cam_8m_12v_fixed_voltage_cfg },
};
static struct s5p_platform_mipi_csis mipi_csis_platdata = {
.clk_rate = 166000000UL,
.lanes = 2,
.alignment = 32,
.hs_settle = 12,
.phy_enable = s5p_csis_phy_enable,
};
#define GPIO_CAM_MEGA_RST EXYNOS4_GPY3(7) /* ISP_RESET */
#define GPIO_CAM_8M_ISP_INT EXYNOS4_GPL2(5)
static struct m5mols_platform_data m5mols_platdata = {
.gpio_reset = GPIO_CAM_MEGA_RST,
};
static struct i2c_board_info m5mols_board_info = {
I2C_BOARD_INFO("M5MOLS", 0x1F),
.platform_data = &m5mols_platdata,
};
static struct s5p_fimc_isp_info nuri_camera_sensors[] = {
{
.flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
V4L2_MBUS_VSYNC_ACTIVE_LOW,
.bus_type = FIMC_MIPI_CSI2,
.board_info = &m5mols_board_info,
.clk_frequency = 24000000UL,
.csi_data_align = 32,
},
};
static struct s5p_platform_fimc fimc_md_platdata = {
.isp_info = nuri_camera_sensors,
.num_clients = ARRAY_SIZE(nuri_camera_sensors),
};
static struct gpio nuri_camera_gpios[] = {
{ GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" },
{ GPIO_CAM_MEGA_RST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" },
};
static void nuri_camera_init(void)
{
s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
&s5p_device_mipi_csis0);
s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata),
&s5p_device_fimc_md);
if (gpio_request_array(nuri_camera_gpios,
ARRAY_SIZE(nuri_camera_gpios))) {
pr_err("%s: GPIO request failed\n", __func__);
return;
}
m5mols_board_info.irq = s5p_register_gpio_interrupt(GPIO_CAM_8M_ISP_INT);
if (!IS_ERR_VALUE(m5mols_board_info.irq))
s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xF));
else
pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__);
/* Free GPIOs controlled directly by the sensor drivers. */
gpio_free(GPIO_CAM_MEGA_RST);
if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) {
pr_err("%s: Camera port A setup failed\n", __func__);
return;
}
/* Increase drive strength of the sensor clock output */
s5p_gpio_set_drvstr(EXYNOS4_GPJ1(3), S5P_GPIO_DRVSTR_LV4);
}
static struct s3c2410_platform_i2c nuri_i2c0_platdata __initdata = {
.frequency = 400000U,
.sda_delay = 200,
};
static struct platform_device *nuri_devices[] __initdata = { static struct platform_device *nuri_devices[] __initdata = {
/* Samsung Platform Devices */ /* Samsung Platform Devices */
&s3c_device_i2c5, /* PMIC should initialize first */ &s3c_device_i2c5, /* PMIC should initialize first */
&s3c_device_i2c0,
&emmc_fixed_voltage, &emmc_fixed_voltage,
&s5p_device_mipi_csis0,
&s5p_device_fimc0,
&s5p_device_fimc1,
&s5p_device_fimc2,
&s5p_device_fimc3,
&s5p_device_fimd0, &s5p_device_fimd0,
&s3c_device_hsmmc0, &s3c_device_hsmmc0,
&s3c_device_hsmmc2, &s3c_device_hsmmc2,
...@@ -1137,6 +1268,8 @@ static struct platform_device *nuri_devices[] __initdata = { ...@@ -1137,6 +1268,8 @@ static struct platform_device *nuri_devices[] __initdata = {
&s5p_device_mfc_r, &s5p_device_mfc_r,
&exynos4_device_pd[PD_MFC], &exynos4_device_pd[PD_MFC],
&exynos4_device_pd[PD_LCD0], &exynos4_device_pd[PD_LCD0],
&exynos4_device_pd[PD_CAM],
&s5p_device_fimc_md,
/* NURI Devices */ /* NURI Devices */
&nuri_gpio_keys, &nuri_gpio_keys,
...@@ -1144,6 +1277,8 @@ static struct platform_device *nuri_devices[] __initdata = { ...@@ -1144,6 +1277,8 @@ static struct platform_device *nuri_devices[] __initdata = {
&nuri_backlight_device, &nuri_backlight_device,
&max8903_fixed_reg_dev, &max8903_fixed_reg_dev,
&nuri_max8903_device, &nuri_max8903_device,
&cam_vdda_fixed_rdev,
&cam_8m_12v_fixed_rdev,
}; };
static void __init nuri_map_io(void) static void __init nuri_map_io(void)
...@@ -1164,6 +1299,7 @@ static void __init nuri_machine_init(void) ...@@ -1164,6 +1299,7 @@ static void __init nuri_machine_init(void)
nuri_tsp_init(); nuri_tsp_init();
nuri_power_init(); nuri_power_init();
s3c_i2c0_set_platdata(&nuri_i2c0_platdata);
i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
s3c_i2c3_set_platdata(&i2c3_data); s3c_i2c3_set_platdata(&i2c3_data);
i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs)); i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
...@@ -1175,6 +1311,8 @@ static void __init nuri_machine_init(void) ...@@ -1175,6 +1311,8 @@ static void __init nuri_machine_init(void)
s5p_fimd0_set_platdata(&nuri_fb_pdata); s5p_fimd0_set_platdata(&nuri_fb_pdata);
nuri_camera_init();
nuri_ehci_init(); nuri_ehci_init();
clk_xusbxti.rate = 24000000; clk_xusbxti.rate = 24000000;
...@@ -1182,6 +1320,12 @@ static void __init nuri_machine_init(void) ...@@ -1182,6 +1320,12 @@ static void __init nuri_machine_init(void)
platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices)); platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev; s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev;
s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev; s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
s5p_device_fimc0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s5p_device_fimc1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s5p_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s5p_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s5p_device_mipi_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
} }
MACHINE_START(NURI, "NURI") MACHINE_START(NURI, "NURI")
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <plat/backlight.h> #include <plat/backlight.h>
#include <plat/pd.h> #include <plat/pd.h>
#include <plat/fb.h> #include <plat/fb.h>
#include <plat/mfc.h>
#include <mach/map.h> #include <mach/map.h>
...@@ -89,6 +90,8 @@ static struct s3c2410_uartcfg origen_uartcfgs[] __initdata = { ...@@ -89,6 +90,8 @@ static struct s3c2410_uartcfg origen_uartcfgs[] __initdata = {
static struct regulator_consumer_supply __initdata ldo3_consumer[] = { static struct regulator_consumer_supply __initdata ldo3_consumer[] = {
REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */ REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */
REGULATOR_SUPPLY("vdd", "exynos4-hdmi"), /* HDMI */
REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"), /* HDMI */
}; };
static struct regulator_consumer_supply __initdata ldo6_consumer[] = { static struct regulator_consumer_supply __initdata ldo6_consumer[] = {
REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */ REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */
...@@ -98,6 +101,7 @@ static struct regulator_consumer_supply __initdata ldo7_consumer[] = { ...@@ -98,6 +101,7 @@ static struct regulator_consumer_supply __initdata ldo7_consumer[] = {
}; };
static struct regulator_consumer_supply __initdata ldo8_consumer[] = { static struct regulator_consumer_supply __initdata ldo8_consumer[] = {
REGULATOR_SUPPLY("vdd", "s5p-adc"), /* ADC */ REGULATOR_SUPPLY("vdd", "s5p-adc"), /* ADC */
REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"), /* HDMI */
}; };
static struct regulator_consumer_supply __initdata ldo9_consumer[] = { static struct regulator_consumer_supply __initdata ldo9_consumer[] = {
REGULATOR_SUPPLY("dvdd", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */ REGULATOR_SUPPLY("dvdd", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
...@@ -598,9 +602,17 @@ static struct platform_device *origen_devices[] __initdata = { ...@@ -598,9 +602,17 @@ static struct platform_device *origen_devices[] __initdata = {
&s5p_device_fimd0, &s5p_device_fimd0,
&s5p_device_hdmi, &s5p_device_hdmi,
&s5p_device_i2c_hdmiphy, &s5p_device_i2c_hdmiphy,
&s5p_device_mfc,
&s5p_device_mfc_l,
&s5p_device_mfc_r,
&s5p_device_mixer, &s5p_device_mixer,
&exynos4_device_pd[PD_LCD0], &exynos4_device_pd[PD_LCD0],
&exynos4_device_pd[PD_TV], &exynos4_device_pd[PD_TV],
&exynos4_device_pd[PD_G3D],
&exynos4_device_pd[PD_LCD1],
&exynos4_device_pd[PD_CAM],
&exynos4_device_pd[PD_GPS],
&exynos4_device_pd[PD_MFC],
&origen_device_gpiokeys, &origen_device_gpiokeys,
&origen_lcd_hv070wsa, &origen_lcd_hv070wsa,
}; };
...@@ -638,6 +650,11 @@ static void __init origen_power_init(void) ...@@ -638,6 +650,11 @@ static void __init origen_power_init(void)
s3c_gpio_setpull(EXYNOS4_GPX0(4), S3C_GPIO_PULL_NONE); s3c_gpio_setpull(EXYNOS4_GPX0(4), S3C_GPIO_PULL_NONE);
} }
static void __init origen_reserve(void)
{
s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
}
static void __init origen_machine_init(void) static void __init origen_machine_init(void)
{ {
origen_power_init(); origen_power_init();
...@@ -661,11 +678,14 @@ static void __init origen_machine_init(void) ...@@ -661,11 +678,14 @@ static void __init origen_machine_init(void)
s5p_fimd0_set_platdata(&origen_lcd_pdata); s5p_fimd0_set_platdata(&origen_lcd_pdata);
platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices)); platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices));
s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev; s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
s5p_device_hdmi.dev.parent = &exynos4_device_pd[PD_TV].dev; s5p_device_hdmi.dev.parent = &exynos4_device_pd[PD_TV].dev;
s5p_device_mixer.dev.parent = &exynos4_device_pd[PD_TV].dev; s5p_device_mixer.dev.parent = &exynos4_device_pd[PD_TV].dev;
s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev;
samsung_bl_set(&origen_bl_gpio_info, &origen_bl_data); samsung_bl_set(&origen_bl_gpio_info, &origen_bl_data);
} }
...@@ -676,4 +696,5 @@ MACHINE_START(ORIGEN, "ORIGEN") ...@@ -676,4 +696,5 @@ MACHINE_START(ORIGEN, "ORIGEN")
.map_io = origen_map_io, .map_io = origen_map_io,
.init_machine = origen_machine_init, .init_machine = origen_machine_init,
.timer = &exynos4_timer, .timer = &exynos4_timer,
.reserve = &origen_reserve,
MACHINE_END MACHINE_END
...@@ -7,7 +7,7 @@ obj-y += common.o clock.o devices.o time.o ...@@ -7,7 +7,7 @@ obj-y += common.o clock.o devices.o time.o
# SoC support # SoC support
obj-$(CONFIG_CPU_PXA168) += pxa168.o irq-pxa168.o obj-$(CONFIG_CPU_PXA168) += pxa168.o irq-pxa168.o
obj-$(CONFIG_CPU_PXA910) += pxa910.o irq-pxa168.o obj-$(CONFIG_CPU_PXA910) += pxa910.o irq-pxa168.o
obj-$(CONFIG_CPU_MMP2) += mmp2.o irq-mmp2.o obj-$(CONFIG_CPU_MMP2) += mmp2.o irq-mmp2.o sram.o
# board support # board support
obj-$(CONFIG_MACH_ASPENITE) += aspenite.o obj-$(CONFIG_MACH_ASPENITE) += aspenite.o
......
...@@ -185,6 +185,15 @@ static struct sdhci_pxa_platdata mmp2_sdh_platdata_mmc2 = { ...@@ -185,6 +185,15 @@ static struct sdhci_pxa_platdata mmp2_sdh_platdata_mmc2 = {
| PXA_FLAG_SD_8_BIT_CAPABLE_SLOT, | PXA_FLAG_SD_8_BIT_CAPABLE_SLOT,
}; };
static struct sram_platdata mmp2_asram_platdata = {
.pool_name = "asram",
.granularity = SRAM_GRANULARITY,
};
static struct sram_platdata mmp2_isram_platdata = {
.pool_name = "isram",
.granularity = SRAM_GRANULARITY,
};
static void __init brownstone_init(void) static void __init brownstone_init(void)
{ {
...@@ -196,6 +205,8 @@ static void __init brownstone_init(void) ...@@ -196,6 +205,8 @@ static void __init brownstone_init(void)
mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info)); mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info));
mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */ mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
mmp2_add_sdhost(2, &mmp2_sdh_platdata_mmc2); /* eMMC */ mmp2_add_sdhost(2, &mmp2_sdh_platdata_mmc2); /* eMMC */
mmp2_add_asram(&mmp2_asram_platdata);
mmp2_add_isram(&mmp2_isram_platdata);
/* enable 5v regulator */ /* enable 5v regulator */
platform_device_register(&brownstone_v_5vp_device); platform_device_register(&brownstone_v_5vp_device);
......
...@@ -13,6 +13,7 @@ extern void mmp2_clear_pmic_int(void); ...@@ -13,6 +13,7 @@ extern void mmp2_clear_pmic_int(void);
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/pxa-i2c.h> #include <linux/i2c/pxa-i2c.h>
#include <mach/devices.h> #include <mach/devices.h>
#include <mach/sram.h>
extern struct pxa_device_desc mmp2_device_uart1; extern struct pxa_device_desc mmp2_device_uart1;
extern struct pxa_device_desc mmp2_device_uart2; extern struct pxa_device_desc mmp2_device_uart2;
...@@ -28,6 +29,8 @@ extern struct pxa_device_desc mmp2_device_sdh0; ...@@ -28,6 +29,8 @@ extern struct pxa_device_desc mmp2_device_sdh0;
extern struct pxa_device_desc mmp2_device_sdh1; extern struct pxa_device_desc mmp2_device_sdh1;
extern struct pxa_device_desc mmp2_device_sdh2; extern struct pxa_device_desc mmp2_device_sdh2;
extern struct pxa_device_desc mmp2_device_sdh3; extern struct pxa_device_desc mmp2_device_sdh3;
extern struct pxa_device_desc mmp2_device_asram;
extern struct pxa_device_desc mmp2_device_isram;
static inline int mmp2_add_uart(int id) static inline int mmp2_add_uart(int id)
{ {
...@@ -85,5 +88,15 @@ static inline int mmp2_add_sdhost(int id, struct sdhci_pxa_platdata *data) ...@@ -85,5 +88,15 @@ static inline int mmp2_add_sdhost(int id, struct sdhci_pxa_platdata *data)
return pxa_register_device(d, data, sizeof(*data)); return pxa_register_device(d, data, sizeof(*data));
} }
static inline int mmp2_add_asram(struct sram_platdata *data)
{
return pxa_register_device(&mmp2_device_asram, data, sizeof(*data));
}
static inline int mmp2_add_isram(struct sram_platdata *data)
{
return pxa_register_device(&mmp2_device_isram, data, sizeof(*data));
}
#endif /* __ASM_MACH_MMP2_H */ #endif /* __ASM_MACH_MMP2_H */
/*
* linux/arch/arm/mach-mmp/include/mach/sram.h
*
* SRAM Memory Management
*
* Copyright (c) 2011 Marvell Semiconductors Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#ifndef __ASM_ARCH_SRAM_H
#define __ASM_ARCH_SRAM_H
#include <linux/genalloc.h>
/* ARBITRARY: SRAM allocations are multiples of this 2^N size */
#define SRAM_GRANULARITY 512
enum sram_type {
MMP_SRAM_UNDEFINED = 0,
MMP_ASRAM,
MMP_ISRAM,
};
struct sram_platdata {
char *pool_name;
int granularity;
};
extern struct gen_pool *sram_get_gpool(char *pool_name);
#endif /* __ASM_ARCH_SRAM_H */
...@@ -226,4 +226,7 @@ MMP2_DEVICE(sdh0, "sdhci-pxav3", 0, MMC, 0xd4280000, 0x120); ...@@ -226,4 +226,7 @@ MMP2_DEVICE(sdh0, "sdhci-pxav3", 0, MMC, 0xd4280000, 0x120);
MMP2_DEVICE(sdh1, "sdhci-pxav3", 1, MMC2, 0xd4280800, 0x120); MMP2_DEVICE(sdh1, "sdhci-pxav3", 1, MMC2, 0xd4280800, 0x120);
MMP2_DEVICE(sdh2, "sdhci-pxav3", 2, MMC3, 0xd4281000, 0x120); MMP2_DEVICE(sdh2, "sdhci-pxav3", 2, MMC3, 0xd4281000, 0x120);
MMP2_DEVICE(sdh3, "sdhci-pxav3", 3, MMC4, 0xd4281800, 0x120); MMP2_DEVICE(sdh3, "sdhci-pxav3", 3, MMC4, 0xd4281800, 0x120);
MMP2_DEVICE(asram, "asram", -1, NONE, 0xe0000000, 0x4000);
/* 0xd1000000 ~ 0xd101ffff is reserved for secure processor */
MMP2_DEVICE(isram, "isram", -1, NONE, 0xd1020000, 0x18000);
/*
* linux/arch/arm/mach-mmp/sram.c
*
* based on mach-davinci/sram.c - DaVinci simple SRAM allocator
*
* Copyright (c) 2011 Marvell Semiconductors Inc.
* All Rights Reserved
*
* Add for mmp sram support - Leo Yan <leoy@marvell.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/genalloc.h>
#include <mach/sram.h>
struct sram_bank_info {
char *pool_name;
struct gen_pool *gpool;
int granularity;
phys_addr_t sram_phys;
void __iomem *sram_virt;
u32 sram_size;
struct list_head node;
};
static DEFINE_MUTEX(sram_lock);
static LIST_HEAD(sram_bank_list);
struct gen_pool *sram_get_gpool(char *pool_name)
{
struct sram_bank_info *info = NULL;
if (!pool_name)
return NULL;
mutex_lock(&sram_lock);
list_for_each_entry(info, &sram_bank_list, node)
if (!strcmp(pool_name, info->pool_name))
break;
mutex_unlock(&sram_lock);
if (&info->node == &sram_bank_list)
return NULL;
return info->gpool;
}
EXPORT_SYMBOL(sram_get_gpool);
static int __devinit sram_probe(struct platform_device *pdev)
{
struct sram_platdata *pdata = pdev->dev.platform_data;
struct sram_bank_info *info;
struct resource *res;
int ret = 0;
if (!pdata && !pdata->pool_name)
return -ENODEV;
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) {
dev_err(&pdev->dev, "no memory resource defined\n");
ret = -ENODEV;
goto out;
}
if (!resource_size(res))
return 0;
info->sram_phys = (phys_addr_t)res->start;
info->sram_size = resource_size(res);
info->sram_virt = ioremap(info->sram_phys, info->sram_size);
info->pool_name = kstrdup(pdata->pool_name, GFP_KERNEL);
info->granularity = pdata->granularity;
info->gpool = gen_pool_create(ilog2(info->granularity), -1);
if (!info->gpool) {
dev_err(&pdev->dev, "create pool failed\n");
ret = -ENOMEM;
goto create_pool_err;
}
ret = gen_pool_add_virt(info->gpool, (unsigned long)info->sram_virt,
info->sram_phys, info->sram_size, -1);
if (ret < 0) {
dev_err(&pdev->dev, "add new chunk failed\n");
ret = -ENOMEM;
goto add_chunk_err;
}
mutex_lock(&sram_lock);
list_add(&info->node, &sram_bank_list);
mutex_unlock(&sram_lock);
platform_set_drvdata(pdev, info);
dev_info(&pdev->dev, "initialized\n");
return 0;
add_chunk_err:
gen_pool_destroy(info->gpool);
create_pool_err:
iounmap(info->sram_virt);
kfree(info->pool_name);
out:
kfree(info);
return ret;
}
static int __devexit sram_remove(struct platform_device *pdev)
{
struct sram_bank_info *info;
info = platform_get_drvdata(pdev);
if (info == NULL)
return -ENODEV;
mutex_lock(&sram_lock);
list_del(&info->node);
mutex_unlock(&sram_lock);
gen_pool_destroy(info->gpool);
iounmap(info->sram_virt);
kfree(info->pool_name);
kfree(info);
return 0;
}
static const struct platform_device_id sram_id_table[] = {
{ "asram", MMP_ASRAM },
{ "isram", MMP_ISRAM },
{ }
};
static struct platform_driver sram_driver = {
.probe = sram_probe,
.remove = sram_remove,
.driver = {
.name = "mmp-sram",
},
.id_table = sram_id_table,
};
static int __init sram_init(void)
{
return platform_driver_register(&sram_driver);
}
core_initcall(sram_init);
MODULE_LICENSE("GPL");
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
#define S3C2410_GPIO_M_NR (32) /* technically 2. */ #define S3C2410_GPIO_M_NR (32) /* technically 2. */
#if CONFIG_S3C_GPIO_SPACE != 0 #if CONFIG_S3C_GPIO_SPACE != 0
#error CONFIG_S3C_GPIO_SPACE cannot be zero at the moment #error CONFIG_S3C_GPIO_SPACE cannot be nonzero at the moment
#endif #endif
#define S3C2410_GPIO_NEXT(__gpio) \ #define S3C2410_GPIO_NEXT(__gpio) \
......
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
#define S3C2443_CLKDIV0_PREDIV_MASK (3<<4) #define S3C2443_CLKDIV0_PREDIV_MASK (3<<4)
#define S3C2443_CLKDIV0_PREDIV_SHIFT (4) #define S3C2443_CLKDIV0_PREDIV_SHIFT (4)
#define S3C2416_CLKDIV0_ARMDIV_MASK (7 << 9)
#define S3C2443_CLKDIV0_ARMDIV_MASK (15<<9) #define S3C2443_CLKDIV0_ARMDIV_MASK (15<<9)
#define S3C2443_CLKDIV0_ARMDIV_SHIFT (9) #define S3C2443_CLKDIV0_ARMDIV_SHIFT (9)
#define S3C2443_CLKDIV0_ARMDIV_1 (0<<9) #define S3C2443_CLKDIV0_ARMDIV_1 (0<<9)
......
...@@ -28,6 +28,14 @@ ...@@ -28,6 +28,14 @@
#include <mach/regs-clock.h> #include <mach/regs-clock.h>
#include <mach/regs-s3c2443-clock.h> #include <mach/regs-s3c2443-clock.h>
/* armdiv
*
* this clock is sourced from msysclk and can have a number of
* divider values applied to it to then be fed into armclk.
* The real clock definition is done in s3c2443-clock.c,
* only the armdiv divisor table must be defined here.
*/
static unsigned int armdiv[8] = { static unsigned int armdiv[8] = {
[0] = 1, [0] = 1,
[1] = 2, [1] = 2,
...@@ -125,16 +133,9 @@ static struct clk hsmmc0_clk = { ...@@ -125,16 +133,9 @@ static struct clk hsmmc0_clk = {
.ctrlbit = S3C2416_HCLKCON_HSMMC0, .ctrlbit = S3C2416_HCLKCON_HSMMC0,
}; };
static inline unsigned int s3c2416_fclk_div(unsigned long clkcon0)
{
clkcon0 &= 7 << S3C2443_CLKDIV0_ARMDIV_SHIFT;
return armdiv[clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT];
}
void __init_or_cpufreq s3c2416_setup_clocks(void) void __init_or_cpufreq s3c2416_setup_clocks(void)
{ {
s3c2443_common_setup_clocks(s3c2416_get_pll, s3c2416_fclk_div); s3c2443_common_setup_clocks(s3c2416_get_pll);
} }
...@@ -158,7 +159,9 @@ void __init s3c2416_init_clocks(int xtal) ...@@ -158,7 +159,9 @@ void __init s3c2416_init_clocks(int xtal)
clk_epll.parent = &clk_epllref.clk; clk_epll.parent = &clk_epllref.clk;
s3c2443_common_init_clocks(xtal, s3c2416_get_pll, s3c2416_fclk_div); s3c2443_common_init_clocks(xtal, s3c2416_get_pll,
armdiv, ARRAY_SIZE(armdiv),
S3C2416_CLKDIV0_ARMDIV_MASK);
for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
s3c_register_clksrc(clksrcs[ptr], 1); s3c_register_clksrc(clksrcs[ptr], 1);
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include <plat/iic-core.h> #include <plat/iic-core.h>
#include <plat/fb-core.h> #include <plat/fb-core.h>
#include <plat/nand-core.h> #include <plat/nand-core.h>
#include <plat/adc-core.h>
static struct map_desc s3c2416_iodesc[] __initdata = { static struct map_desc s3c2416_iodesc[] __initdata = {
IODESC_ENT(WATCHDOG), IODESC_ENT(WATCHDOG),
...@@ -97,6 +98,8 @@ int __init s3c2416_init(void) ...@@ -97,6 +98,8 @@ int __init s3c2416_init(void)
s3c_fb_setname("s3c2443-fb"); s3c_fb_setname("s3c2443-fb");
s3c_adc_setname("s3c2416-adc");
#ifdef CONFIG_PM #ifdef CONFIG_PM
register_syscore_ops(&s3c2416_pm_syscore_ops); register_syscore_ops(&s3c2416_pm_syscore_ops);
#endif #endif
......
...@@ -61,10 +61,10 @@ ...@@ -61,10 +61,10 @@
* *
* this clock is sourced from msysclk and can have a number of * this clock is sourced from msysclk and can have a number of
* divider values applied to it to then be fed into armclk. * divider values applied to it to then be fed into armclk.
* The real clock definition is done in s3c2443-clock.c,
* only the armdiv divisor table must be defined here.
*/ */
/* armdiv divisor table */
static unsigned int armdiv[16] = { static unsigned int armdiv[16] = {
[S3C2443_CLKDIV0_ARMDIV_1 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 1, [S3C2443_CLKDIV0_ARMDIV_1 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 1,
[S3C2443_CLKDIV0_ARMDIV_2 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 2, [S3C2443_CLKDIV0_ARMDIV_2 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 2,
...@@ -76,92 +76,6 @@ static unsigned int armdiv[16] = { ...@@ -76,92 +76,6 @@ static unsigned int armdiv[16] = {
[S3C2443_CLKDIV0_ARMDIV_16 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 16, [S3C2443_CLKDIV0_ARMDIV_16 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 16,
}; };
static inline unsigned int s3c2443_fclk_div(unsigned long clkcon0)
{
clkcon0 &= S3C2443_CLKDIV0_ARMDIV_MASK;
return armdiv[clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT];
}
static unsigned long s3c2443_armclk_roundrate(struct clk *clk,
unsigned long rate)
{
unsigned long parent = clk_get_rate(clk->parent);
unsigned long calc;
unsigned best = 256; /* bigger than any value */
unsigned div;
int ptr;
for (ptr = 0; ptr < ARRAY_SIZE(armdiv); ptr++) {
div = armdiv[ptr];
calc = parent / div;
if (calc <= rate && div < best)
best = div;
}
return parent / best;
}
static int s3c2443_armclk_setrate(struct clk *clk, unsigned long rate)
{
unsigned long parent = clk_get_rate(clk->parent);
unsigned long calc;
unsigned div;
unsigned best = 256; /* bigger than any value */
int ptr;
int val = -1;
for (ptr = 0; ptr < ARRAY_SIZE(armdiv); ptr++) {
div = armdiv[ptr];
calc = parent / div;
if (calc <= rate && div < best) {
best = div;
val = ptr;
}
}
if (val >= 0) {
unsigned long clkcon0;
clkcon0 = __raw_readl(S3C2443_CLKDIV0);
clkcon0 &= ~S3C2443_CLKDIV0_ARMDIV_MASK;
clkcon0 |= val << S3C2443_CLKDIV0_ARMDIV_SHIFT;
__raw_writel(clkcon0, S3C2443_CLKDIV0);
}
return (val == -1) ? -EINVAL : 0;
}
static struct clk clk_armdiv = {
.name = "armdiv",
.parent = &clk_msysclk.clk,
.ops = &(struct clk_ops) {
.round_rate = s3c2443_armclk_roundrate,
.set_rate = s3c2443_armclk_setrate,
},
};
/* armclk
*
* this is the clock fed into the ARM core itself, from armdiv or from hclk.
*/
static struct clk *clk_arm_sources[] = {
[0] = &clk_armdiv,
[1] = &clk_h,
};
static struct clksrc_clk clk_arm = {
.clk = {
.name = "armclk",
},
.sources = &(struct clksrc_sources) {
.sources = clk_arm_sources,
.nr_sources = ARRAY_SIZE(clk_arm_sources),
},
.reg_src = { .reg = S3C2443_CLKDIV0, .size = 1, .shift = 13 },
};
/* hsspi /* hsspi
* *
* high-speed spi clock, sourced from esysclk * high-speed spi clock, sourced from esysclk
...@@ -254,25 +168,20 @@ static struct clk init_clocks_off[] = { ...@@ -254,25 +168,20 @@ static struct clk init_clocks_off[] = {
} }
}; };
static struct clk init_clocks[] = {
};
/* clocks to add straight away */ /* clocks to add straight away */
static struct clksrc_clk *clksrcs[] __initdata = { static struct clksrc_clk *clksrcs[] __initdata = {
&clk_arm,
&clk_hsspi, &clk_hsspi,
&clk_hsmmc_div, &clk_hsmmc_div,
}; };
static struct clk *clks[] __initdata = { static struct clk *clks[] __initdata = {
&clk_hsmmc, &clk_hsmmc,
&clk_armdiv,
}; };
void __init_or_cpufreq s3c2443_setup_clocks(void) void __init_or_cpufreq s3c2443_setup_clocks(void)
{ {
s3c2443_common_setup_clocks(s3c2443_get_mpll, s3c2443_fclk_div); s3c2443_common_setup_clocks(s3c2443_get_mpll);
} }
void __init s3c2443_init_clocks(int xtal) void __init s3c2443_init_clocks(int xtal)
...@@ -283,7 +192,9 @@ void __init s3c2443_init_clocks(int xtal) ...@@ -283,7 +192,9 @@ void __init s3c2443_init_clocks(int xtal)
clk_epll.rate = s3c2443_get_epll(epllcon, xtal); clk_epll.rate = s3c2443_get_epll(epllcon, xtal);
clk_epll.parent = &clk_epllref.clk; clk_epll.parent = &clk_epllref.clk;
s3c2443_common_init_clocks(xtal, s3c2443_get_mpll, s3c2443_fclk_div); s3c2443_common_init_clocks(xtal, s3c2443_get_mpll,
armdiv, ARRAY_SIZE(armdiv),
S3C2443_CLKDIV0_ARMDIV_MASK);
s3c2443_setup_clocks(); s3c2443_setup_clocks();
...@@ -292,10 +203,6 @@ void __init s3c2443_init_clocks(int xtal) ...@@ -292,10 +203,6 @@ void __init s3c2443_init_clocks(int xtal)
for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
s3c_register_clksrc(clksrcs[ptr], 1); s3c_register_clksrc(clksrcs[ptr], 1);
/* register clocks from clock array */
s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
/* We must be careful disabling the clocks we are not intending to /* We must be careful disabling the clocks we are not intending to
* be using at boot time, as subsystems such as the LCD which do * be using at boot time, as subsystems such as the LCD which do
* their own DMA requests to the bus can cause the system to lockup * their own DMA requests to the bus can cause the system to lockup
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <plat/cpu.h> #include <plat/cpu.h>
#include <plat/fb-core.h> #include <plat/fb-core.h>
#include <plat/nand-core.h> #include <plat/nand-core.h>
#include <plat/adc-core.h>
static struct map_desc s3c2443_iodesc[] __initdata = { static struct map_desc s3c2443_iodesc[] __initdata = {
IODESC_ENT(WATCHDOG), IODESC_ENT(WATCHDOG),
...@@ -70,6 +71,8 @@ int __init s3c2443_init(void) ...@@ -70,6 +71,8 @@ int __init s3c2443_init(void)
s3c_nand_setname("s3c2412-nand"); s3c_nand_setname("s3c2412-nand");
s3c_fb_setname("s3c2443-fb"); s3c_fb_setname("s3c2443-fb");
s3c_adc_setname("s3c2443-adc");
/* change WDT IRQ number */ /* change WDT IRQ number */
s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT; s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
s3c_device_wdt.resource[1].end = IRQ_S3C2443_WDT; s3c_device_wdt.resource[1].end = IRQ_S3C2443_WDT;
......
...@@ -160,6 +160,124 @@ static struct clk clk_prediv = { ...@@ -160,6 +160,124 @@ static struct clk clk_prediv = {
}, },
}; };
/* armdiv
*
* this clock is sourced from msysclk and can have a number of
* divider values applied to it to then be fed into armclk.
*/
static unsigned int *armdiv;
static int nr_armdiv;
static int armdivmask;
static unsigned long s3c2443_armclk_roundrate(struct clk *clk,
unsigned long rate)
{
unsigned long parent = clk_get_rate(clk->parent);
unsigned long calc;
unsigned best = 256; /* bigger than any value */
unsigned div;
int ptr;
if (!nr_armdiv)
return -EINVAL;
for (ptr = 0; ptr < nr_armdiv; ptr++) {
div = armdiv[ptr];
if (div) {
/* cpufreq provides 266mhz as 266666000 not 266666666 */
calc = (parent / div / 1000) * 1000;
if (calc <= rate && div < best)
best = div;
}
}
return parent / best;
}
static unsigned long s3c2443_armclk_getrate(struct clk *clk)
{
unsigned long rate = clk_get_rate(clk->parent);
unsigned long clkcon0;
int val;
if (!nr_armdiv || !armdivmask)
return -EINVAL;
clkcon0 = __raw_readl(S3C2443_CLKDIV0);
clkcon0 &= armdivmask;
val = clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT;
return rate / armdiv[val];
}
static int s3c2443_armclk_setrate(struct clk *clk, unsigned long rate)
{
unsigned long parent = clk_get_rate(clk->parent);
unsigned long calc;
unsigned div;
unsigned best = 256; /* bigger than any value */
int ptr;
int val = -1;
if (!nr_armdiv || !armdivmask)
return -EINVAL;
for (ptr = 0; ptr < nr_armdiv; ptr++) {
div = armdiv[ptr];
if (div) {
/* cpufreq provides 266mhz as 266666000 not 266666666 */
calc = (parent / div / 1000) * 1000;
if (calc <= rate && div < best) {
best = div;
val = ptr;
}
}
}
if (val >= 0) {
unsigned long clkcon0;
clkcon0 = __raw_readl(S3C2443_CLKDIV0);
clkcon0 &= ~armdivmask;
clkcon0 |= val << S3C2443_CLKDIV0_ARMDIV_SHIFT;
__raw_writel(clkcon0, S3C2443_CLKDIV0);
}
return (val == -1) ? -EINVAL : 0;
}
static struct clk clk_armdiv = {
.name = "armdiv",
.parent = &clk_msysclk.clk,
.ops = &(struct clk_ops) {
.round_rate = s3c2443_armclk_roundrate,
.get_rate = s3c2443_armclk_getrate,
.set_rate = s3c2443_armclk_setrate,
},
};
/* armclk
*
* this is the clock fed into the ARM core itself, from armdiv or from hclk.
*/
static struct clk *clk_arm_sources[] = {
[0] = &clk_armdiv,
[1] = &clk_h,
};
static struct clksrc_clk clk_arm = {
.clk = {
.name = "armclk",
},
.sources = &(struct clksrc_sources) {
.sources = clk_arm_sources,
.nr_sources = ARRAY_SIZE(clk_arm_sources),
},
.reg_src = { .reg = S3C2443_CLKDIV0, .size = 1, .shift = 13 },
};
/* usbhost /* usbhost
* *
* usb host bus-clock, usually 48MHz to provide USB bus clock timing * usb host bus-clock, usually 48MHz to provide USB bus clock timing
...@@ -308,6 +426,7 @@ static struct clk init_clocks[] = { ...@@ -308,6 +426,7 @@ static struct clk init_clocks[] = {
.ctrlbit = S3C2443_HCLKCON_DMA5, .ctrlbit = S3C2443_HCLKCON_DMA5,
}, { }, {
.name = "hsmmc", .name = "hsmmc",
.devname = "s3c-sdhci.1",
.parent = &clk_h, .parent = &clk_h,
.enable = s3c2443_clkcon_enable_h, .enable = s3c2443_clkcon_enable_h,
.ctrlbit = S3C2443_HCLKCON_HSMMC, .ctrlbit = S3C2443_HCLKCON_HSMMC,
...@@ -402,8 +521,7 @@ static inline unsigned long s3c2443_get_hdiv(unsigned long clkcon0) ...@@ -402,8 +521,7 @@ static inline unsigned long s3c2443_get_hdiv(unsigned long clkcon0)
/* EPLLCON compatible enough to get on/off information */ /* EPLLCON compatible enough to get on/off information */
void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll, void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll)
fdiv_fn get_fdiv)
{ {
unsigned long epllcon = __raw_readl(S3C2443_EPLLCON); unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON); unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON);
...@@ -423,7 +541,7 @@ void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll, ...@@ -423,7 +541,7 @@ void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll,
pll = get_mpll(mpllcon, xtal); pll = get_mpll(mpllcon, xtal);
clk_msysclk.clk.rate = pll; clk_msysclk.clk.rate = pll;
fclk = pll / get_fdiv(clkdiv0); fclk = clk_get_rate(&clk_armdiv);
hclk = s3c2443_prediv_getrate(&clk_prediv); hclk = s3c2443_prediv_getrate(&clk_prediv);
hclk /= s3c2443_get_hdiv(clkdiv0); hclk /= s3c2443_get_hdiv(clkdiv0);
pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1); pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1);
...@@ -458,6 +576,7 @@ static struct clk *clks[] __initdata = { ...@@ -458,6 +576,7 @@ static struct clk *clks[] __initdata = {
&clk_ext, &clk_ext,
&clk_epll, &clk_epll,
&clk_usb_bus, &clk_usb_bus,
&clk_armdiv,
}; };
static struct clksrc_clk *clksrcs[] __initdata = { static struct clksrc_clk *clksrcs[] __initdata = {
...@@ -467,13 +586,19 @@ static struct clksrc_clk *clksrcs[] __initdata = { ...@@ -467,13 +586,19 @@ static struct clksrc_clk *clksrcs[] __initdata = {
&clk_epllref, &clk_epllref,
&clk_esysclk, &clk_esysclk,
&clk_msysclk, &clk_msysclk,
&clk_arm,
}; };
void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,
fdiv_fn get_fdiv) unsigned int *divs, int nr_divs,
int divmask)
{ {
int ptr; int ptr;
armdiv = divs;
nr_armdiv = nr_divs;
armdivmask = divmask;
/* s3c2443 parents h and p clocks from prediv */ /* s3c2443 parents h and p clocks from prediv */
clk_h.parent = &clk_prediv; clk_h.parent = &clk_prediv;
clk_p.parent = &clk_prediv; clk_p.parent = &clk_prediv;
...@@ -494,5 +619,5 @@ void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, ...@@ -494,5 +619,5 @@ void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,
s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
s3c2443_common_setup_clocks(get_mpll, get_fdiv); s3c2443_common_setup_clocks(get_mpll);
} }
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
enum s3c_cpu_type { enum s3c_cpu_type {
TYPE_ADCV1, /* S3C24XX */ TYPE_ADCV1, /* S3C24XX */
TYPE_ADCV11, /* S3C2443 */
TYPE_ADCV12, /* S3C2416, S3C2450 */
TYPE_ADCV2, /* S3C64XX, S5P64X0, S5PC100 */ TYPE_ADCV2, /* S3C64XX, S5P64X0, S5PC100 */
TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */ TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */
}; };
...@@ -98,13 +100,17 @@ static inline void s3c_adc_select(struct adc_device *adc, ...@@ -98,13 +100,17 @@ static inline void s3c_adc_select(struct adc_device *adc,
client->select_cb(client, 1); client->select_cb(client, 1);
con &= ~S3C2410_ADCCON_MUXMASK; if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV2)
con &= ~S3C2410_ADCCON_MUXMASK;
con &= ~S3C2410_ADCCON_STDBM; con &= ~S3C2410_ADCCON_STDBM;
con &= ~S3C2410_ADCCON_STARTMASK; con &= ~S3C2410_ADCCON_STARTMASK;
if (!client->is_ts) { if (!client->is_ts) {
if (cpu == TYPE_ADCV3) if (cpu == TYPE_ADCV3)
writel(client->channel & 0xf, adc->regs + S5P_ADCMUX); writel(client->channel & 0xf, adc->regs + S5P_ADCMUX);
else if (cpu == TYPE_ADCV11 || cpu == TYPE_ADCV12)
writel(client->channel & 0xf,
adc->regs + S3C2443_ADCMUX);
else else
con |= S3C2410_ADCCON_SELMUX(client->channel); con |= S3C2410_ADCCON_SELMUX(client->channel);
} }
...@@ -293,13 +299,13 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw) ...@@ -293,13 +299,13 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
client->nr_samples--; client->nr_samples--;
if (cpu != TYPE_ADCV1) { if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV11) {
/* S3C64XX/S5P ADC resolution is 12-bit */
data0 &= 0xfff;
data1 &= 0xfff;
} else {
data0 &= 0x3ff; data0 &= 0x3ff;
data1 &= 0x3ff; data1 &= 0x3ff;
} else {
/* S3C2416/S3C64XX/S5P ADC resolution is 12-bit */
data0 &= 0xfff;
data1 &= 0xfff;
} }
if (client->convert_cb) if (client->convert_cb)
...@@ -320,7 +326,7 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw) ...@@ -320,7 +326,7 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
} }
exit: exit:
if (cpu != TYPE_ADCV1) { if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) {
/* Clear ADC interrupt */ /* Clear ADC interrupt */
writel(0, adc->regs + S3C64XX_ADCCLRINT); writel(0, adc->regs + S3C64XX_ADCCLRINT);
} }
...@@ -332,6 +338,7 @@ static int s3c_adc_probe(struct platform_device *pdev) ...@@ -332,6 +338,7 @@ static int s3c_adc_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct adc_device *adc; struct adc_device *adc;
struct resource *regs; struct resource *regs;
enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data;
int ret; int ret;
unsigned tmp; unsigned tmp;
...@@ -394,10 +401,13 @@ static int s3c_adc_probe(struct platform_device *pdev) ...@@ -394,10 +401,13 @@ static int s3c_adc_probe(struct platform_device *pdev)
clk_enable(adc->clk); clk_enable(adc->clk);
tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1) {
/* Enable 12-bit ADC resolution */ /* Enable 12-bit ADC resolution */
if (cpu == TYPE_ADCV12)
tmp |= S3C2416_ADCCON_RESSEL;
if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3)
tmp |= S3C64XX_ADCCON_RESSEL; tmp |= S3C64XX_ADCCON_RESSEL;
}
writel(tmp, adc->regs + S3C2410_ADCCON); writel(tmp, adc->regs + S3C2410_ADCCON);
dev_info(dev, "attached adc driver\n"); dev_info(dev, "attached adc driver\n");
...@@ -464,6 +474,7 @@ static int s3c_adc_resume(struct device *dev) ...@@ -464,6 +474,7 @@ static int s3c_adc_resume(struct device *dev)
struct platform_device *pdev = container_of(dev, struct platform_device *pdev = container_of(dev,
struct platform_device, dev); struct platform_device, dev);
struct adc_device *adc = platform_get_drvdata(pdev); struct adc_device *adc = platform_get_drvdata(pdev);
enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data;
int ret; int ret;
unsigned long tmp; unsigned long tmp;
...@@ -474,9 +485,13 @@ static int s3c_adc_resume(struct device *dev) ...@@ -474,9 +485,13 @@ static int s3c_adc_resume(struct device *dev)
enable_irq(adc->irq); enable_irq(adc->irq);
tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
/* Enable 12-bit ADC resolution */ /* Enable 12-bit ADC resolution */
if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1) if (cpu == TYPE_ADCV12)
tmp |= S3C2416_ADCCON_RESSEL;
if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3)
tmp |= S3C64XX_ADCCON_RESSEL; tmp |= S3C64XX_ADCCON_RESSEL;
writel(tmp, adc->regs + S3C2410_ADCCON); writel(tmp, adc->regs + S3C2410_ADCCON);
return 0; return 0;
...@@ -491,6 +506,12 @@ static struct platform_device_id s3c_adc_driver_ids[] = { ...@@ -491,6 +506,12 @@ static struct platform_device_id s3c_adc_driver_ids[] = {
{ {
.name = "s3c24xx-adc", .name = "s3c24xx-adc",
.driver_data = TYPE_ADCV1, .driver_data = TYPE_ADCV1,
}, {
.name = "s3c2443-adc",
.driver_data = TYPE_ADCV11,
}, {
.name = "s3c2416-adc",
.driver_data = TYPE_ADCV12,
}, { }, {
.name = "s3c64xx-adc", .name = "s3c64xx-adc",
.driver_data = TYPE_ADCV2, .driver_data = TYPE_ADCV2,
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/* re-define device name depending on support. */ /* re-define device name depending on support. */
static inline void s3c_adc_setname(char *name) static inline void s3c_adc_setname(char *name)
{ {
#ifdef CONFIG_SAMSUNG_DEV_ADC #if defined(CONFIG_SAMSUNG_DEV_ADC) || defined(CONFIG_PLAT_S3C24XX)
s3c_device_adc.name = name; s3c_device_adc.name = name;
#endif #endif
} }
......
...@@ -25,7 +25,6 @@ extern unsigned long samsung_cpu_id; ...@@ -25,7 +25,6 @@ extern unsigned long samsung_cpu_id;
#define S3C6400_CPU_ID 0x36400000 #define S3C6400_CPU_ID 0x36400000
#define S3C6410_CPU_ID 0x36410000 #define S3C6410_CPU_ID 0x36410000
#define S3C64XX_CPU_ID (S3C6400_CPU_ID & S3C6410_CPU_ID)
#define S3C64XX_CPU_MASK 0xFFFFF000 #define S3C64XX_CPU_MASK 0xFFFFF000
#define S5P6440_CPU_ID 0x56440000 #define S5P6440_CPU_ID 0x56440000
...@@ -50,7 +49,8 @@ static inline int is_samsung_##name(void) \ ...@@ -50,7 +49,8 @@ static inline int is_samsung_##name(void) \
} }
IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
IS_SAMSUNG_CPU(s3c64xx, S3C64XX_CPU_ID, S3C64XX_CPU_MASK) IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK) IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK) 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,7 +69,7 @@ IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
#endif #endif
#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
# define soc_is_s3c64xx() is_samsung_s3c64xx() # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410())
#else #else
# define soc_is_s3c64xx() 0 # define soc_is_s3c64xx() 0
#endif #endif
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define S3C2410_ADCDAT0 S3C2410_ADCREG(0x0C) #define S3C2410_ADCDAT0 S3C2410_ADCREG(0x0C)
#define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10) #define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10)
#define S3C64XX_ADCUPDN S3C2410_ADCREG(0x14) #define S3C64XX_ADCUPDN S3C2410_ADCREG(0x14)
#define S3C2443_ADCMUX S3C2410_ADCREG(0x18)
#define S3C64XX_ADCCLRINT S3C2410_ADCREG(0x18) #define S3C64XX_ADCCLRINT S3C2410_ADCREG(0x18)
#define S5P_ADCMUX S3C2410_ADCREG(0x1C) #define S5P_ADCMUX S3C2410_ADCREG(0x1C)
#define S3C64XX_ADCCLRINTPNDNUP S3C2410_ADCREG(0x20) #define S3C64XX_ADCCLRINTPNDNUP S3C2410_ADCREG(0x20)
...@@ -33,6 +34,7 @@ ...@@ -33,6 +34,7 @@
#define S3C2410_ADCCON_PRSCVLMASK (0xFF<<6) #define S3C2410_ADCCON_PRSCVLMASK (0xFF<<6)
#define S3C2410_ADCCON_SELMUX(x) (((x)&0x7)<<3) #define S3C2410_ADCCON_SELMUX(x) (((x)&0x7)<<3)
#define S3C2410_ADCCON_MUXMASK (0x7<<3) #define S3C2410_ADCCON_MUXMASK (0x7<<3)
#define S3C2416_ADCCON_RESSEL (1 << 3)
#define S3C2410_ADCCON_STDBM (1<<2) #define S3C2410_ADCCON_STDBM (1<<2)
#define S3C2410_ADCCON_READ_START (1<<1) #define S3C2410_ADCCON_READ_START (1<<1)
#define S3C2410_ADCCON_ENABLE_START (1<<0) #define S3C2410_ADCCON_ENABLE_START (1<<0)
...@@ -40,6 +42,7 @@ ...@@ -40,6 +42,7 @@
/* ADCTSC Register Bits */ /* ADCTSC Register Bits */
#define S3C2443_ADCTSC_UD_SEN (1 << 8)
#define S3C2410_ADCTSC_YM_SEN (1<<7) #define S3C2410_ADCTSC_YM_SEN (1<<7)
#define S3C2410_ADCTSC_YP_SEN (1<<6) #define S3C2410_ADCTSC_YP_SEN (1<<6)
#define S3C2410_ADCTSC_XM_SEN (1<<5) #define S3C2410_ADCTSC_XM_SEN (1<<5)
......
...@@ -37,10 +37,11 @@ extern int s3c2443_baseclk_add(void); ...@@ -37,10 +37,11 @@ extern int s3c2443_baseclk_add(void);
struct clk; /* some files don't need clk.h otherwise */ struct clk; /* some files don't need clk.h otherwise */
typedef unsigned int (*pll_fn)(unsigned int reg, unsigned int base); typedef unsigned int (*pll_fn)(unsigned int reg, unsigned int base);
typedef unsigned int (*fdiv_fn)(unsigned long clkcon0);
extern void s3c2443_common_setup_clocks(pll_fn get_mpll, fdiv_fn fdiv); extern void s3c2443_common_setup_clocks(pll_fn get_mpll);
extern void s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, fdiv_fn fdiv); extern void s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,
unsigned int *divs, int nr_divs,
int divmask);
extern int s3c2443_clkcon_enable_h(struct clk *clk, int enable); extern int s3c2443_clkcon_enable_h(struct clk *clk, int enable);
extern int s3c2443_clkcon_enable_p(struct clk *clk, int enable); extern int s3c2443_clkcon_enable_p(struct clk *clk, int enable);
......
...@@ -318,6 +318,7 @@ static unsigned samsung_gpio_getcfg_4bit(struct samsung_gpio_chip *chip, ...@@ -318,6 +318,7 @@ static unsigned samsung_gpio_getcfg_4bit(struct samsung_gpio_chip *chip,
return S3C_GPIO_SPECIAL(con); return S3C_GPIO_SPECIAL(con);
} }
#ifdef CONFIG_PLAT_S3C24XX
/* /*
* s3c24xx_gpio_setcfg_abank - S3C24XX style GPIO configuration (Bank A) * s3c24xx_gpio_setcfg_abank - S3C24XX style GPIO configuration (Bank A)
* @chip: The gpio chip that is being configured. * @chip: The gpio chip that is being configured.
...@@ -379,7 +380,9 @@ static unsigned s3c24xx_gpio_getcfg_abank(struct samsung_gpio_chip *chip, ...@@ -379,7 +380,9 @@ static unsigned s3c24xx_gpio_getcfg_abank(struct samsung_gpio_chip *chip,
return S3C_GPIO_SFN(con); return S3C_GPIO_SFN(con);
} }
#endif
#if defined(CONFIG_CPU_S5P6440) || defined(CONFIG_CPU_S5P6450)
static int s5p64x0_gpio_setcfg_rbank(struct samsung_gpio_chip *chip, static int s5p64x0_gpio_setcfg_rbank(struct samsung_gpio_chip *chip,
unsigned int off, unsigned int cfg) unsigned int off, unsigned int cfg)
{ {
...@@ -417,6 +420,7 @@ static int s5p64x0_gpio_setcfg_rbank(struct samsung_gpio_chip *chip, ...@@ -417,6 +420,7 @@ static int s5p64x0_gpio_setcfg_rbank(struct samsung_gpio_chip *chip,
return 0; return 0;
} }
#endif
static void __init samsung_gpiolib_set_cfg(struct samsung_gpio_cfg *chipcfg, static void __init samsung_gpiolib_set_cfg(struct samsung_gpio_cfg *chipcfg,
int nr_chips) int nr_chips)
...@@ -438,10 +442,12 @@ struct samsung_gpio_cfg s3c24xx_gpiocfg_default = { ...@@ -438,10 +442,12 @@ struct samsung_gpio_cfg s3c24xx_gpiocfg_default = {
.get_config = samsung_gpio_getcfg_2bit, .get_config = samsung_gpio_getcfg_2bit,
}; };
#ifdef CONFIG_PLAT_S3C24XX
static struct samsung_gpio_cfg s3c24xx_gpiocfg_banka = { static struct samsung_gpio_cfg s3c24xx_gpiocfg_banka = {
.set_config = s3c24xx_gpio_setcfg_abank, .set_config = s3c24xx_gpio_setcfg_abank,
.get_config = s3c24xx_gpio_getcfg_abank, .get_config = s3c24xx_gpio_getcfg_abank,
}; };
#endif
static struct samsung_gpio_cfg exynos4_gpio_cfg = { static struct samsung_gpio_cfg exynos4_gpio_cfg = {
.set_pull = exynos4_gpio_setpull, .set_pull = exynos4_gpio_setpull,
...@@ -450,6 +456,7 @@ static struct samsung_gpio_cfg exynos4_gpio_cfg = { ...@@ -450,6 +456,7 @@ static struct samsung_gpio_cfg exynos4_gpio_cfg = {
.get_config = samsung_gpio_getcfg_4bit, .get_config = samsung_gpio_getcfg_4bit,
}; };
#if defined(CONFIG_CPU_S5P6440) || defined(CONFIG_CPU_S5P6450)
static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = { static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = {
.cfg_eint = 0x3, .cfg_eint = 0x3,
.set_config = s5p64x0_gpio_setcfg_rbank, .set_config = s5p64x0_gpio_setcfg_rbank,
...@@ -457,6 +464,7 @@ static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = { ...@@ -457,6 +464,7 @@ static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = {
.set_pull = samsung_gpio_setpull_updown, .set_pull = samsung_gpio_setpull_updown,
.get_pull = samsung_gpio_getpull_updown, .get_pull = samsung_gpio_getpull_updown,
}; };
#endif
static struct samsung_gpio_cfg samsung_gpio_cfgs[] = { static struct samsung_gpio_cfg samsung_gpio_cfgs[] = {
{ {
...@@ -482,7 +490,14 @@ static struct samsung_gpio_cfg samsung_gpio_cfgs[] = { ...@@ -482,7 +490,14 @@ static struct samsung_gpio_cfg samsung_gpio_cfgs[] = {
}, { }, {
.set_config = samsung_gpio_setcfg_2bit, .set_config = samsung_gpio_setcfg_2bit,
.get_config = samsung_gpio_getcfg_2bit, .get_config = samsung_gpio_getcfg_2bit,
}, }, {
.set_pull = exynos4_gpio_setpull,
.get_pull = exynos4_gpio_getpull,
}, {
.cfg_eint = 0x3,
.set_pull = exynos4_gpio_setpull,
.get_pull = exynos4_gpio_getpull,
}
}; };
/* /*
...@@ -682,6 +697,7 @@ static int samsung_gpiolib_4bit2_output(struct gpio_chip *chip, ...@@ -682,6 +697,7 @@ static int samsung_gpiolib_4bit2_output(struct gpio_chip *chip,
return 0; return 0;
} }
#ifdef CONFIG_PLAT_S3C24XX
/* The next set of routines are for the case of s3c24xx bank a */ /* The next set of routines are for the case of s3c24xx bank a */
static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset) 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,6 +733,7 @@ static int s3c24xx_gpiolib_banka_output(struct gpio_chip *chip,
local_irq_restore(flags); local_irq_restore(flags);
return 0; return 0;
} }
#endif
/* The next set of routines are for the case of s5p64x0 bank r */ /* The next set of routines are for the case of s5p64x0 bank r */
...@@ -914,6 +931,10 @@ static void __init s3c24xx_gpiolib_add_chips(struct samsung_gpio_chip *chip, ...@@ -914,6 +931,10 @@ static void __init s3c24xx_gpiolib_add_chips(struct samsung_gpio_chip *chip,
struct gpio_chip *gc = &chip->chip; struct gpio_chip *gc = &chip->chip;
for (i = 0 ; i < nr_chips; i++, chip++) { for (i = 0 ; i < nr_chips; i++, chip++) {
/* skip banks not present on SoC */
if (chip->chip.base >= S3C_GPIO_END)
continue;
if (!chip->config) if (!chip->config)
chip->config = &s3c24xx_gpiocfg_default; chip->config = &s3c24xx_gpiocfg_default;
if (!chip->pm) if (!chip->pm)
...@@ -2249,49 +2270,49 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = { ...@@ -2249,49 +2270,49 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
.label = "GPL2", .label = "GPL2",
}, },
}, { }, {
.config = &samsung_gpio_cfgs[0], .config = &samsung_gpio_cfgs[8],
.chip = { .chip = {
.base = EXYNOS4_GPY0(0), .base = EXYNOS4_GPY0(0),
.ngpio = EXYNOS4_GPIO_Y0_NR, .ngpio = EXYNOS4_GPIO_Y0_NR,
.label = "GPY0", .label = "GPY0",
}, },
}, { }, {
.config = &samsung_gpio_cfgs[0], .config = &samsung_gpio_cfgs[8],
.chip = { .chip = {
.base = EXYNOS4_GPY1(0), .base = EXYNOS4_GPY1(0),
.ngpio = EXYNOS4_GPIO_Y1_NR, .ngpio = EXYNOS4_GPIO_Y1_NR,
.label = "GPY1", .label = "GPY1",
}, },
}, { }, {
.config = &samsung_gpio_cfgs[0], .config = &samsung_gpio_cfgs[8],
.chip = { .chip = {
.base = EXYNOS4_GPY2(0), .base = EXYNOS4_GPY2(0),
.ngpio = EXYNOS4_GPIO_Y2_NR, .ngpio = EXYNOS4_GPIO_Y2_NR,
.label = "GPY2", .label = "GPY2",
}, },
}, { }, {
.config = &samsung_gpio_cfgs[0], .config = &samsung_gpio_cfgs[8],
.chip = { .chip = {
.base = EXYNOS4_GPY3(0), .base = EXYNOS4_GPY3(0),
.ngpio = EXYNOS4_GPIO_Y3_NR, .ngpio = EXYNOS4_GPIO_Y3_NR,
.label = "GPY3", .label = "GPY3",
}, },
}, { }, {
.config = &samsung_gpio_cfgs[0], .config = &samsung_gpio_cfgs[8],
.chip = { .chip = {
.base = EXYNOS4_GPY4(0), .base = EXYNOS4_GPY4(0),
.ngpio = EXYNOS4_GPIO_Y4_NR, .ngpio = EXYNOS4_GPIO_Y4_NR,
.label = "GPY4", .label = "GPY4",
}, },
}, { }, {
.config = &samsung_gpio_cfgs[0], .config = &samsung_gpio_cfgs[8],
.chip = { .chip = {
.base = EXYNOS4_GPY5(0), .base = EXYNOS4_GPY5(0),
.ngpio = EXYNOS4_GPIO_Y5_NR, .ngpio = EXYNOS4_GPIO_Y5_NR,
.label = "GPY5", .label = "GPY5",
}, },
}, { }, {
.config = &samsung_gpio_cfgs[0], .config = &samsung_gpio_cfgs[8],
.chip = { .chip = {
.base = EXYNOS4_GPY6(0), .base = EXYNOS4_GPY6(0),
.ngpio = EXYNOS4_GPIO_Y6_NR, .ngpio = EXYNOS4_GPIO_Y6_NR,
...@@ -2299,7 +2320,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = { ...@@ -2299,7 +2320,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
}, },
}, { }, {
.base = (S5P_VA_GPIO2 + 0xC00), .base = (S5P_VA_GPIO2 + 0xC00),
.config = &samsung_gpio_cfgs[3], .config = &samsung_gpio_cfgs[9],
.irq_base = IRQ_EINT(0), .irq_base = IRQ_EINT(0),
.chip = { .chip = {
.base = EXYNOS4_GPX0(0), .base = EXYNOS4_GPX0(0),
...@@ -2309,7 +2330,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = { ...@@ -2309,7 +2330,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
}, },
}, { }, {
.base = (S5P_VA_GPIO2 + 0xC20), .base = (S5P_VA_GPIO2 + 0xC20),
.config = &samsung_gpio_cfgs[3], .config = &samsung_gpio_cfgs[9],
.irq_base = IRQ_EINT(8), .irq_base = IRQ_EINT(8),
.chip = { .chip = {
.base = EXYNOS4_GPX1(0), .base = EXYNOS4_GPX1(0),
...@@ -2319,7 +2340,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = { ...@@ -2319,7 +2340,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
}, },
}, { }, {
.base = (S5P_VA_GPIO2 + 0xC40), .base = (S5P_VA_GPIO2 + 0xC40),
.config = &samsung_gpio_cfgs[3], .config = &samsung_gpio_cfgs[9],
.irq_base = IRQ_EINT(16), .irq_base = IRQ_EINT(16),
.chip = { .chip = {
.base = EXYNOS4_GPX2(0), .base = EXYNOS4_GPX2(0),
...@@ -2329,7 +2350,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = { ...@@ -2329,7 +2350,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
}, },
}, { }, {
.base = (S5P_VA_GPIO2 + 0xC60), .base = (S5P_VA_GPIO2 + 0xC60),
.config = &samsung_gpio_cfgs[3], .config = &samsung_gpio_cfgs[9],
.irq_base = IRQ_EINT(24), .irq_base = IRQ_EINT(24),
.chip = { .chip = {
.base = EXYNOS4_GPX3(0), .base = EXYNOS4_GPX3(0),
...@@ -2465,6 +2486,9 @@ static __init int samsung_gpiolib_init(void) ...@@ -2465,6 +2486,9 @@ static __init int samsung_gpiolib_init(void)
s5p_register_gpioint_bank(IRQ_GPIO_XA, 0, IRQ_GPIO1_NR_GROUPS); s5p_register_gpioint_bank(IRQ_GPIO_XA, 0, IRQ_GPIO1_NR_GROUPS);
s5p_register_gpioint_bank(IRQ_GPIO_XB, IRQ_GPIO1_NR_GROUPS, IRQ_GPIO2_NR_GROUPS); s5p_register_gpioint_bank(IRQ_GPIO_XB, IRQ_GPIO1_NR_GROUPS, IRQ_GPIO2_NR_GROUPS);
#endif #endif
} else {
WARN(1, "Unknown SoC in gpio-samsung, no GPIOs added\n");
return -ENODEV;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment