drivers/am335xgpio: Add AM335x driver for bitbang support on BeagleBones
[fw/openocd] / src / jtag / drivers / at91rm9200.c
index e2f64f53b0af723a868ff8bc2c2aaafa0a96c843..7bb5d8553854c9240a834342c81abad7fc17a3bc 100644 (file)
@@ -187,14 +187,20 @@ static const struct command_registration at91rm9200_command_handlers[] = {
        COMMAND_REGISTRATION_DONE
 };
 
-struct jtag_interface at91rm9200_interface = {
-       .name = "at91rm9200",
+static struct jtag_interface at91rm9200_interface = {
        .execute_queue = bitbang_execute_queue,
+};
+
+struct adapter_driver at91rm9200_adapter_driver = {
+       .name = "at91rm9200",
        .transports = jtag_only,
        .commands = at91rm9200_command_handlers,
+
        .init = at91rm9200_init,
        .quit = at91rm9200_quit,
        .reset = at91rm9200_reset,
+
+       .jtag_ops = &at91rm9200_interface,
 };
 
 static int at91rm9200_init(void)
@@ -203,7 +209,7 @@ static int at91rm9200_init(void)
 
        cur_device = devices;
 
-       if (at91rm9200_device == NULL || at91rm9200_device[0] == 0) {
+       if (!at91rm9200_device || at91rm9200_device[0] == 0) {
                at91rm9200_device = "rea_ecr";
                LOG_WARNING("No at91rm9200 device specified, using default 'rea_ecr'");
        }
@@ -225,14 +231,14 @@ static int at91rm9200_init(void)
 
        dev_mem_fd = open("/dev/mem", O_RDWR | O_SYNC);
        if (dev_mem_fd < 0) {
-               perror("open");
+               LOG_ERROR("open: %s", strerror(errno));
                return ERROR_JTAG_INIT_FAILED;
        }
 
        sys_controller = mmap(NULL, 4096, PROT_READ | PROT_WRITE,
                                MAP_SHARED, dev_mem_fd, AT91C_BASE_SYS);
        if (sys_controller == MAP_FAILED) {
-               perror("mmap");
+               LOG_ERROR("mmap: %s", strerror(errno));
                close(dev_mem_fd);
                return ERROR_JTAG_INIT_FAILED;
        }