|
@@ -215,3 +215,144 @@ static int evm_led_teardown(struct i2c_client *client, int gpio,
|
|
|
if (evm_led_dev) {
|
|
|
platform_device_unregister(evm_led_dev);
|
|
|
evm_led_dev = NULL;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int evm_sw_gpio[4] = { -EINVAL, -EINVAL, -EINVAL, -EINVAL };
|
|
|
+
|
|
|
+static int evm_sw_setup(struct i2c_client *client, int gpio,
|
|
|
+ unsigned ngpio, void *c)
|
|
|
+{
|
|
|
+ int status;
|
|
|
+ int i;
|
|
|
+ char label[10];
|
|
|
+
|
|
|
+ for (i = 0; i < 4; ++i) {
|
|
|
+ snprintf(label, 10, "user_sw%d", i);
|
|
|
+ status = gpio_request(gpio, label);
|
|
|
+ if (status)
|
|
|
+ goto out_free;
|
|
|
+ evm_sw_gpio[i] = gpio++;
|
|
|
+
|
|
|
+ status = gpio_direction_input(evm_sw_gpio[i]);
|
|
|
+ if (status) {
|
|
|
+ gpio_free(evm_sw_gpio[i]);
|
|
|
+ evm_sw_gpio[i] = -EINVAL;
|
|
|
+ goto out_free;
|
|
|
+ }
|
|
|
+
|
|
|
+ status = gpio_export(evm_sw_gpio[i], 0);
|
|
|
+ if (status) {
|
|
|
+ gpio_free(evm_sw_gpio[i]);
|
|
|
+ evm_sw_gpio[i] = -EINVAL;
|
|
|
+ goto out_free;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return status;
|
|
|
+out_free:
|
|
|
+ for (i = 0; i < 4; ++i) {
|
|
|
+ if (evm_sw_gpio[i] != -EINVAL) {
|
|
|
+ gpio_free(evm_sw_gpio[i]);
|
|
|
+ evm_sw_gpio[i] = -EINVAL;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return status;
|
|
|
+}
|
|
|
+
|
|
|
+static int evm_sw_teardown(struct i2c_client *client, int gpio,
|
|
|
+ unsigned ngpio, void *c)
|
|
|
+{
|
|
|
+ int i;
|
|
|
+
|
|
|
+ for (i = 0; i < 4; ++i) {
|
|
|
+ if (evm_sw_gpio[i] != -EINVAL) {
|
|
|
+ gpio_unexport(evm_sw_gpio[i]);
|
|
|
+ gpio_free(evm_sw_gpio[i]);
|
|
|
+ evm_sw_gpio[i] = -EINVAL;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int evm_pcf_setup(struct i2c_client *client, int gpio,
|
|
|
+ unsigned int ngpio, void *c)
|
|
|
+{
|
|
|
+ int status;
|
|
|
+
|
|
|
+ if (ngpio < 8)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ status = evm_sw_setup(client, gpio, 4, c);
|
|
|
+ if (status)
|
|
|
+ return status;
|
|
|
+
|
|
|
+ return evm_led_setup(client, gpio+4, 4, c);
|
|
|
+}
|
|
|
+
|
|
|
+static int evm_pcf_teardown(struct i2c_client *client, int gpio,
|
|
|
+ unsigned int ngpio, void *c)
|
|
|
+{
|
|
|
+ BUG_ON(ngpio < 8);
|
|
|
+
|
|
|
+ evm_sw_teardown(client, gpio, 4, c);
|
|
|
+ evm_led_teardown(client, gpio+4, 4, c);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static struct pcf857x_platform_data pcf_data = {
|
|
|
+ .gpio_base = DAVINCI_N_GPIO+1,
|
|
|
+ .setup = evm_pcf_setup,
|
|
|
+ .teardown = evm_pcf_teardown,
|
|
|
+};
|
|
|
+
|
|
|
+/* Most of this EEPROM is unused, but U-Boot uses some data:
|
|
|
+ * - 0x7f00, 6 bytes Ethernet Address
|
|
|
+ * - ... newer boards may have more
|
|
|
+ */
|
|
|
+
|
|
|
+static struct at24_platform_data eeprom_info = {
|
|
|
+ .byte_len = (256*1024) / 8,
|
|
|
+ .page_size = 64,
|
|
|
+ .flags = AT24_FLAG_ADDR16,
|
|
|
+ .setup = davinci_get_mac_addr,
|
|
|
+ .context = (void *)0x7f00,
|
|
|
+};
|
|
|
+
|
|
|
+static u8 dm646x_iis_serializer_direction[] = {
|
|
|
+ TX_MODE, RX_MODE, INACTIVE_MODE, INACTIVE_MODE,
|
|
|
+};
|
|
|
+
|
|
|
+static u8 dm646x_dit_serializer_direction[] = {
|
|
|
+ TX_MODE,
|
|
|
+};
|
|
|
+
|
|
|
+static struct snd_platform_data dm646x_evm_snd_data[] = {
|
|
|
+ {
|
|
|
+ .tx_dma_offset = 0x400,
|
|
|
+ .rx_dma_offset = 0x400,
|
|
|
+ .op_mode = DAVINCI_MCASP_IIS_MODE,
|
|
|
+ .num_serializer = ARRAY_SIZE(dm646x_iis_serializer_direction),
|
|
|
+ .tdm_slots = 2,
|
|
|
+ .serial_dir = dm646x_iis_serializer_direction,
|
|
|
+ .asp_chan_q = EVENTQ_0,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ .tx_dma_offset = 0x400,
|
|
|
+ .rx_dma_offset = 0,
|
|
|
+ .op_mode = DAVINCI_MCASP_DIT_MODE,
|
|
|
+ .num_serializer = ARRAY_SIZE(dm646x_dit_serializer_direction),
|
|
|
+ .tdm_slots = 32,
|
|
|
+ .serial_dir = dm646x_dit_serializer_direction,
|
|
|
+ .asp_chan_q = EVENTQ_0,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct i2c_client *cpld_client;
|
|
|
+
|
|
|
+static int cpld_video_probe(struct i2c_client *client,
|
|
|
+ const struct i2c_device_id *id)
|
|
|
+{
|
|
|
+ cpld_client = client;
|
|
|
+ return 0;
|