diff options
Diffstat (limited to 'drivers/staging/westbridge/astoria/device/cyasdevice.c')
-rw-r--r-- | drivers/staging/westbridge/astoria/device/cyasdevice.c | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/drivers/staging/westbridge/astoria/device/cyasdevice.c b/drivers/staging/westbridge/astoria/device/cyasdevice.c index cd0f7cbc9b18..9b5bc53c990c 100644 --- a/drivers/staging/westbridge/astoria/device/cyasdevice.c +++ b/drivers/staging/westbridge/astoria/device/cyasdevice.c @@ -48,12 +48,12 @@ typedef struct cyasdevice { cy_as_device_handle dev_handle; /* Handle to the HAL */ cy_as_hal_device_tag hal_tag; -} cyasdevice ; +} cyasdevice; /* global ptr to astoria device */ -static cyasdevice *cy_as_device_controller ; +static cyasdevice *cy_as_device_controller; int cy_as_device_init_done; -const char *dev_handle_name = "cy_astoria_dev_handle" ; +const char *dev_handle_name = "cy_astoria_dev_handle"; #ifdef CONFIG_MACH_OMAP3_WESTBRIDGE_AST_PNAND_HAL extern void cy_as_hal_config_c_s_mux(void); @@ -61,17 +61,17 @@ extern void cy_as_hal_config_c_s_mux(void); static void cyasdevice_deinit(cyasdevice *cy_as_dev) { - cy_as_hal_print_message("<1>_cy_as_device deinitialize called\n") ; + cy_as_hal_print_message("<1>_cy_as_device deinitialize called\n"); if (!cy_as_dev) { cy_as_hal_print_message("<1>_cy_as_device_deinit: " - "device handle %x is invalid\n", (uint32_t)cy_as_dev) ; - return ; + "device handle %x is invalid\n", (uint32_t)cy_as_dev); + return; } /* stop west_brige */ if (cy_as_dev->dev_handle) { cy_as_hal_print_message("<1>_cy_as_device: " - "cy_as_misc_destroy_device called\n") ; + "cy_as_misc_destroy_device called\n"); if (cy_as_misc_destroy_device(cy_as_dev->dev_handle) != CY_AS_ERROR_SUCCESS) { cy_as_hal_print_message( @@ -89,40 +89,40 @@ static void cyasdevice_deinit(cyasdevice *cy_as_dev) #endif } - cy_as_hal_print_message("<1>_cy_as_device:HAL layer stopped\n") ; + cy_as_hal_print_message("<1>_cy_as_device:HAL layer stopped\n"); - kfree(cy_as_dev) ; - cy_as_device_controller = NULL ; - cy_as_hal_print_message("<1>_cy_as_device: deinitialized\n") ; + kfree(cy_as_dev); + cy_as_device_controller = NULL; + cy_as_hal_print_message("<1>_cy_as_device: deinitialized\n"); } /*called from src/cyasmisc.c:MyMiscCallback() as a func * pointer [dev_p->misc_event_cb] which was previously * registered by CyAsLLRegisterRequestCallback(..., - * MyMiscCallback) ; called from CyAsMiscConfigureDevice() + * MyMiscCallback); called from CyAsMiscConfigureDevice() * which is in turn called from cyasdevice_initialize() in * this src */ static void cy_misc_callback(cy_as_device_handle h, cy_as_misc_event_type evtype, void *evdata) { - (void)h ; - (void)evdata ; + (void)h; + (void)evdata; switch (evtype) { case cy_as_event_misc_initialized: cy_as_hal_print_message("<1>_cy_as_device: " - "initialization done callback triggered\n") ; - cy_as_device_init_done = 1 ; - break ; + "initialization done callback triggered\n"); + cy_as_device_init_done = 1; + break; case cy_as_event_misc_awake: cy_as_hal_print_message("<1>_cy_as_device: " - "cy_as_event_misc_awake event callback triggered\n") ; - cy_as_device_init_done = 1 ; - break ; + "cy_as_event_misc_awake event callback triggered\n"); + cy_as_device_init_done = 1; + break; default: - break ; + break; } } @@ -133,7 +133,7 @@ void hal_reset(cy_as_hal_device_tag tag) cy_as_hal_print_message("<1> send soft hard rst: " "MEM_RST_CTRL_REG_HARD...\n"); cy_as_hal_write_register(tag, CY_AS_MEM_RST_CTRL_REG, - CY_AS_MEM_RST_CTRL_REG_HARD) ; + CY_AS_MEM_RST_CTRL_REG_HARD); mdelay(60); cy_as_hal_print_message("<1> after RST: si_rev_REG:%x, " @@ -144,7 +144,7 @@ void hal_reset(cy_as_hal_device_tag tag) /* set it to LBD */ cy_as_hal_write_register(tag, CY_AS_MEM_PNAND_CFG, - PNAND_REG_CFG_INIT_VAL) ; + PNAND_REG_CFG_INIT_VAL); } EXPORT_SYMBOL(hal_reset); @@ -175,13 +175,13 @@ static struct platform_driver west_bridge_driver = { /* west bridge device driver main init */ static int cyasdevice_initialize(void) { - cyasdevice *cy_as_dev = 0 ; - int ret = 0 ; - int retval = 0 ; - cy_as_device_config config ; - cy_as_hal_sleep_channel channel ; + cyasdevice *cy_as_dev = 0; + int ret = 0; + int retval = 0; + cy_as_device_config config; + cy_as_hal_sleep_channel channel; cy_as_get_firmware_version_data ver_data = {0}; - const char *str = "" ; + const char *str = ""; int spin_lim; const struct firmware *fw_entry; @@ -189,19 +189,19 @@ static int cyasdevice_initialize(void) cy_as_misc_set_log_level(8); - cy_as_hal_print_message("<1>_cy_as_device initialize called\n") ; + cy_as_hal_print_message("<1>_cy_as_device initialize called\n"); if (cy_as_device_controller != 0) { cy_as_hal_print_message("<1>_cy_as_device: the device " - "has already been initilaized. ignoring\n") ; - return -EBUSY ; + "has already been initilaized. ignoring\n"); + return -EBUSY; } /* cy_as_dev = CyAsHalAlloc (sizeof(cyasdevice), SLAB_KERNEL); */ cy_as_dev = cy_as_hal_alloc(sizeof(cyasdevice)); if (cy_as_dev == NULL) { cy_as_hal_print_message("<1>_cy_as_device: " - "memmory allocation failed\n") ; + "memmory allocation failed\n"); return -ENOMEM; } memset(cy_as_dev, 0, sizeof(cyasdevice)); @@ -216,7 +216,7 @@ static int cyasdevice_initialize(void) &(cy_as_dev->hal_tag), cy_false)) { cy_as_hal_print_message( - "<1>_cy_as_device: start OMAP34xx HAL failed\n") ; + "<1>_cy_as_device: start OMAP34xx HAL failed\n"); goto done; } #endif @@ -226,28 +226,28 @@ static int cyasdevice_initialize(void) cy_as_dev->hal_tag) != CY_AS_ERROR_SUCCESS) { cy_as_hal_print_message( - "<1>_cy_as_device: create device failed\n") ; - goto done ; + "<1>_cy_as_device: create device failed\n"); + goto done; } memset(&config, 0, sizeof(config)); config.dmaintr = cy_true; - ret = cy_as_misc_configure_device(cy_as_dev->dev_handle, &config) ; + ret = cy_as_misc_configure_device(cy_as_dev->dev_handle, &config); if (ret != CY_AS_ERROR_SUCCESS) { cy_as_hal_print_message( "<1>_cy_as_device: configure device " - "failed. reason code: %d\n", ret) ; + "failed. reason code: %d\n", ret); goto done; } ret = cy_as_misc_register_callback(cy_as_dev->dev_handle, - cy_misc_callback) ; + cy_misc_callback); if (ret != CY_AS_ERROR_SUCCESS) { cy_as_hal_print_message("<1>_cy_as_device: " "cy_as_misc_register_callback failed. " - "reason code: %d\n", ret) ; + "reason code: %d\n", ret); goto done; } @@ -275,12 +275,12 @@ static int cyasdevice_initialize(void) cy_as_dev->dev_handle, fw_entry->data, fw_entry->size , - 0, 0) ; + 0, 0); } if (ret != CY_AS_ERROR_SUCCESS) { cy_as_hal_print_message("<1>_cy_as_device: cannot download " - "firmware. reason code: %d\n", ret) ; + "firmware. reason code: %d\n", ret); goto done; } @@ -289,10 +289,10 @@ static int cyasdevice_initialize(void) * to complete is 5sec*/ spin_lim = 50; - cy_as_hal_create_sleep_channel(&channel) ; + cy_as_hal_create_sleep_channel(&channel); while (!cy_as_device_init_done) { - cy_as_hal_sleep_on(&channel, 100) ; + cy_as_hal_sleep_on(&channel, 100); if (spin_lim-- <= 0) { cy_as_hal_print_message( @@ -301,46 +301,46 @@ static int cyasdevice_initialize(void) break; } } - cy_as_hal_destroy_sleep_channel(&channel) ; + cy_as_hal_destroy_sleep_channel(&channel); if (spin_lim > 0) cy_as_hal_print_message( - "cy_as_device: astoria firmware is loaded\n") ; + "cy_as_device: astoria firmware is loaded\n"); ret = cy_as_misc_get_firmware_version(cy_as_dev->dev_handle, - &ver_data, 0, 0) ; + &ver_data, 0, 0); if (ret != CY_AS_ERROR_SUCCESS) { cy_as_hal_print_message("<1>_cy_as_device: cannot get firmware " - "version. reason code: %d\n", ret) ; + "version. reason code: %d\n", ret); goto done; } if ((ver_data.media_type & 0x01) && (ver_data.media_type & 0x06)) - str = "nand and SD/MMC." ; + str = "nand and SD/MMC."; else if ((ver_data.media_type & 0x01) && (ver_data.media_type & 0x08)) - str = "nand and CEATA." ; + str = "nand and CEATA."; else if (ver_data.media_type & 0x01) - str = "nand." ; + str = "nand."; else if (ver_data.media_type & 0x08) - str = "CEATA." ; + str = "CEATA."; else - str = "SD/MMC." ; + str = "SD/MMC."; cy_as_hal_print_message("<1> cy_as_device:_firmware version: %s " "major=%d minor=%d build=%d,\n_media types supported:%s\n", ((ver_data.is_debug_mode) ? "debug" : "release"), - ver_data.major, ver_data.minor, ver_data.build, str) ; + ver_data.major, ver_data.minor, ver_data.build, str); /* done now */ - cy_as_device_controller = cy_as_dev ; + cy_as_device_controller = cy_as_dev; - return 0 ; + return 0; done: if (cy_as_dev) - cyasdevice_deinit(cy_as_dev) ; + cyasdevice_deinit(cy_as_dev); - return -EINVAL ; + return -EINVAL; } cy_as_device_handle cyasdevice_getdevhandle(void) @@ -350,21 +350,21 @@ cy_as_device_handle cyasdevice_getdevhandle(void) cy_as_hal_config_c_s_mux(); #endif - return cy_as_device_controller->dev_handle ; + return cy_as_device_controller->dev_handle; } return NULL; } -EXPORT_SYMBOL(cyasdevice_getdevhandle) ; +EXPORT_SYMBOL(cyasdevice_getdevhandle); cy_as_hal_device_tag cyasdevice_gethaltag(void) { if (cy_as_device_controller) return (cy_as_hal_device_tag) - cy_as_device_controller->hal_tag ; + cy_as_device_controller->hal_tag; return NULL; } -EXPORT_SYMBOL(cyasdevice_gethaltag) ; +EXPORT_SYMBOL(cyasdevice_gethaltag); /*init Westbridge device driver **/ @@ -373,14 +373,14 @@ static int __init cyasdevice_init(void) if (cyasdevice_initialize() != 0) return ENODEV; - return 0 ; + return 0; } static void __exit cyasdevice_cleanup(void) { - cyasdevice_deinit(cy_as_device_controller) ; + cyasdevice_deinit(cy_as_device_controller); } |