|
@@ -313,3 +313,173 @@ evm_led_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
|
|
*/
|
|
*/
|
|
evm_led_dev = platform_device_alloc("leds-gpio", 0);
|
|
evm_led_dev = platform_device_alloc("leds-gpio", 0);
|
|
platform_device_add_data(evm_led_dev,
|
|
platform_device_add_data(evm_led_dev,
|
|
|
|
+ &evm_led_data, sizeof evm_led_data);
|
|
|
|
+
|
|
|
|
+ evm_led_dev->dev.parent = &client->dev;
|
|
|
|
+ status = platform_device_add(evm_led_dev);
|
|
|
|
+ if (status < 0) {
|
|
|
|
+ platform_device_put(evm_led_dev);
|
|
|
|
+ evm_led_dev = NULL;
|
|
|
|
+ }
|
|
|
|
+ return status;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+evm_led_teardown(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
|
|
|
|
+{
|
|
|
|
+ if (evm_led_dev) {
|
|
|
|
+ platform_device_unregister(evm_led_dev);
|
|
|
|
+ evm_led_dev = NULL;
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static struct pcf857x_platform_data pcf_data_u2 = {
|
|
|
|
+ .gpio_base = PCF_Uxx_BASE(0),
|
|
|
|
+ .setup = evm_led_setup,
|
|
|
|
+ .teardown = evm_led_teardown,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/* U18 - A/V clock generator and user switch */
|
|
|
|
+
|
|
|
|
+static int sw_gpio;
|
|
|
|
+
|
|
|
|
+static ssize_t
|
|
|
|
+sw_show(struct device *d, struct device_attribute *a, char *buf)
|
|
|
|
+{
|
|
|
|
+ char *s = gpio_get_value_cansleep(sw_gpio) ? "on\n" : "off\n";
|
|
|
|
+
|
|
|
|
+ strcpy(buf, s);
|
|
|
|
+ return strlen(s);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static DEVICE_ATTR(user_sw, S_IRUGO, sw_show, NULL);
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+evm_u18_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
|
|
|
|
+{
|
|
|
|
+ int status;
|
|
|
|
+
|
|
|
|
+ /* export dip switch option */
|
|
|
|
+ sw_gpio = gpio + 7;
|
|
|
|
+ status = gpio_request(sw_gpio, "user_sw");
|
|
|
|
+ if (status == 0)
|
|
|
|
+ status = gpio_direction_input(sw_gpio);
|
|
|
|
+ if (status == 0)
|
|
|
|
+ status = device_create_file(&client->dev, &dev_attr_user_sw);
|
|
|
|
+ else
|
|
|
|
+ gpio_free(sw_gpio);
|
|
|
|
+ if (status != 0)
|
|
|
|
+ sw_gpio = -EINVAL;
|
|
|
|
+
|
|
|
|
+ /* audio PLL: 48 kHz (vs 44.1 or 32), single rate (vs double) */
|
|
|
|
+ gpio_request(gpio + 3, "pll_fs2");
|
|
|
|
+ gpio_direction_output(gpio + 3, 0);
|
|
|
|
+
|
|
|
|
+ gpio_request(gpio + 2, "pll_fs1");
|
|
|
|
+ gpio_direction_output(gpio + 2, 0);
|
|
|
|
+
|
|
|
|
+ gpio_request(gpio + 1, "pll_sr");
|
|
|
|
+ gpio_direction_output(gpio + 1, 0);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+evm_u18_teardown(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
|
|
|
|
+{
|
|
|
|
+ gpio_free(gpio + 1);
|
|
|
|
+ gpio_free(gpio + 2);
|
|
|
|
+ gpio_free(gpio + 3);
|
|
|
|
+
|
|
|
|
+ if (sw_gpio > 0) {
|
|
|
|
+ device_remove_file(&client->dev, &dev_attr_user_sw);
|
|
|
|
+ gpio_free(sw_gpio);
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static struct pcf857x_platform_data pcf_data_u18 = {
|
|
|
|
+ .gpio_base = PCF_Uxx_BASE(1),
|
|
|
|
+ .n_latch = (1 << 3) | (1 << 2) | (1 << 1),
|
|
|
|
+ .setup = evm_u18_setup,
|
|
|
|
+ .teardown = evm_u18_teardown,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/* U35 - various I/O signals used to manage USB, CF, ATA, etc */
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+evm_u35_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
|
|
|
|
+{
|
|
|
|
+ /* p0 = nDRV_VBUS (initial: don't supply it) */
|
|
|
|
+ gpio_request(gpio + 0, "nDRV_VBUS");
|
|
|
|
+ gpio_direction_output(gpio + 0, 1);
|
|
|
|
+
|
|
|
|
+ /* p1 = VDDIMX_EN */
|
|
|
|
+ gpio_request(gpio + 1, "VDDIMX_EN");
|
|
|
|
+ gpio_direction_output(gpio + 1, 1);
|
|
|
|
+
|
|
|
|
+ /* p2 = VLYNQ_EN */
|
|
|
|
+ gpio_request(gpio + 2, "VLYNQ_EN");
|
|
|
|
+ gpio_direction_output(gpio + 2, 1);
|
|
|
|
+
|
|
|
|
+ /* p3 = n3V3_CF_RESET (initial: stay in reset) */
|
|
|
|
+ gpio_request(gpio + 3, "nCF_RESET");
|
|
|
|
+ gpio_direction_output(gpio + 3, 0);
|
|
|
|
+
|
|
|
|
+ /* (p4 unused) */
|
|
|
|
+
|
|
|
|
+ /* p5 = 1V8_WLAN_RESET (initial: stay in reset) */
|
|
|
|
+ gpio_request(gpio + 5, "WLAN_RESET");
|
|
|
|
+ gpio_direction_output(gpio + 5, 1);
|
|
|
|
+
|
|
|
|
+ /* p6 = nATA_SEL (initial: select) */
|
|
|
|
+ gpio_request(gpio + 6, "nATA_SEL");
|
|
|
|
+ gpio_direction_output(gpio + 6, 0);
|
|
|
|
+
|
|
|
|
+ /* p7 = nCF_SEL (initial: deselect) */
|
|
|
|
+ gpio_request(gpio + 7, "nCF_SEL");
|
|
|
|
+ gpio_direction_output(gpio + 7, 1);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+evm_u35_teardown(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
|
|
|
|
+{
|
|
|
|
+ gpio_free(gpio + 7);
|
|
|
|
+ gpio_free(gpio + 6);
|
|
|
|
+ gpio_free(gpio + 5);
|
|
|
|
+ gpio_free(gpio + 3);
|
|
|
|
+ gpio_free(gpio + 2);
|
|
|
|
+ gpio_free(gpio + 1);
|
|
|
|
+ gpio_free(gpio + 0);
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static struct pcf857x_platform_data pcf_data_u35 = {
|
|
|
|
+ .gpio_base = PCF_Uxx_BASE(2),
|
|
|
|
+ .setup = evm_u35_setup,
|
|
|
|
+ .teardown = evm_u35_teardown,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/*----------------------------------------------------------------------*/
|
|
|
|
+
|
|
|
|
+/* Most of this EEPROM is unused, but U-Boot uses some data:
|
|
|
|
+ * - 0x7f00, 6 bytes Ethernet Address
|
|
|
|
+ * - 0x0039, 1 byte NTSC vs PAL (bit 0x80 == PAL)
|
|
|
|
+ * - ... 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,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * MSP430 supports RTC, card detection, input from IR remote, and
|