diff options
-rw-r--r-- | arch/powerpc/include/asm/opal-api.h | 5 | ||||
-rw-r--r-- | arch/powerpc/include/asm/opal.h | 9 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/opal-flash.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/opal-wrappers.S | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/opal.c | 16 |
5 files changed, 31 insertions, 4 deletions
diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h index e8a6baf55e82..0321a909e663 100644 --- a/arch/powerpc/include/asm/opal-api.h +++ b/arch/powerpc/include/asm/opal-api.h | |||
@@ -150,7 +150,10 @@ | |||
150 | #define OPAL_IPMI_SEND 107 | 150 | #define OPAL_IPMI_SEND 107 |
151 | #define OPAL_IPMI_RECV 108 | 151 | #define OPAL_IPMI_RECV 108 |
152 | #define OPAL_I2C_REQUEST 109 | 152 | #define OPAL_I2C_REQUEST 109 |
153 | #define OPAL_LAST 109 | 153 | #define OPAL_FLASH_READ 110 |
154 | #define OPAL_FLASH_WRITE 111 | ||
155 | #define OPAL_FLASH_ERASE 112 | ||
156 | #define OPAL_LAST 112 | ||
154 | 157 | ||
155 | /* Device tree flags */ | 158 | /* Device tree flags */ |
156 | 159 | ||
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index fde90bacc65e..042af1abfc4d 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h | |||
@@ -194,6 +194,13 @@ int64_t opal_ipmi_recv(uint64_t interface, struct opal_ipmi_msg *msg, | |||
194 | int64_t opal_i2c_request(uint64_t async_token, uint32_t bus_id, | 194 | int64_t opal_i2c_request(uint64_t async_token, uint32_t bus_id, |
195 | struct opal_i2c_request *oreq); | 195 | struct opal_i2c_request *oreq); |
196 | 196 | ||
197 | int64_t opal_flash_read(uint64_t id, uint64_t offset, uint64_t buf, | ||
198 | uint64_t size, uint64_t token); | ||
199 | int64_t opal_flash_write(uint64_t id, uint64_t offset, uint64_t buf, | ||
200 | uint64_t size, uint64_t token); | ||
201 | int64_t opal_flash_erase(uint64_t id, uint64_t offset, uint64_t size, | ||
202 | uint64_t token); | ||
203 | |||
197 | /* Internal functions */ | 204 | /* Internal functions */ |
198 | extern int early_init_dt_scan_opal(unsigned long node, const char *uname, | 205 | extern int early_init_dt_scan_opal(unsigned long node, const char *uname, |
199 | int depth, void *data); | 206 | int depth, void *data); |
@@ -226,7 +233,7 @@ extern int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data); | |||
226 | struct rtc_time; | 233 | struct rtc_time; |
227 | extern unsigned long opal_get_boot_time(void); | 234 | extern unsigned long opal_get_boot_time(void); |
228 | extern void opal_nvram_init(void); | 235 | extern void opal_nvram_init(void); |
229 | extern void opal_flash_init(void); | 236 | extern void opal_flash_update_init(void); |
230 | extern void opal_flash_term_callback(void); | 237 | extern void opal_flash_term_callback(void); |
231 | extern int opal_elog_init(void); | 238 | extern int opal_elog_init(void); |
232 | extern void opal_platform_dump_init(void); | 239 | extern void opal_platform_dump_init(void); |
diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c index 0ff07ff891f0..4ec6219287fc 100644 --- a/arch/powerpc/platforms/powernv/opal-flash.c +++ b/arch/powerpc/platforms/powernv/opal-flash.c | |||
@@ -546,7 +546,7 @@ static struct attribute_group image_op_attr_group = { | |||
546 | .attrs = image_op_attrs, | 546 | .attrs = image_op_attrs, |
547 | }; | 547 | }; |
548 | 548 | ||
549 | void __init opal_flash_init(void) | 549 | void __init opal_flash_update_init(void) |
550 | { | 550 | { |
551 | int ret; | 551 | int ret; |
552 | 552 | ||
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S index b23fe7c4bf12..4e740375772c 100644 --- a/arch/powerpc/platforms/powernv/opal-wrappers.S +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S | |||
@@ -292,3 +292,6 @@ OPAL_CALL(opal_tpo_read, OPAL_READ_TPO); | |||
292 | OPAL_CALL(opal_ipmi_send, OPAL_IPMI_SEND); | 292 | OPAL_CALL(opal_ipmi_send, OPAL_IPMI_SEND); |
293 | OPAL_CALL(opal_ipmi_recv, OPAL_IPMI_RECV); | 293 | OPAL_CALL(opal_ipmi_recv, OPAL_IPMI_RECV); |
294 | OPAL_CALL(opal_i2c_request, OPAL_I2C_REQUEST); | 294 | OPAL_CALL(opal_i2c_request, OPAL_I2C_REQUEST); |
295 | OPAL_CALL(opal_flash_read, OPAL_FLASH_READ); | ||
296 | OPAL_CALL(opal_flash_write, OPAL_FLASH_WRITE); | ||
297 | OPAL_CALL(opal_flash_erase, OPAL_FLASH_ERASE); | ||
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 3fb981c0ca80..2241565b0739 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c | |||
@@ -693,6 +693,15 @@ static void __init opal_dump_region_init(void) | |||
693 | "rc = %d\n", rc); | 693 | "rc = %d\n", rc); |
694 | } | 694 | } |
695 | 695 | ||
696 | static void opal_flash_init(struct device_node *opal_node) | ||
697 | { | ||
698 | struct device_node *np; | ||
699 | |||
700 | for_each_child_of_node(opal_node, np) | ||
701 | if (of_device_is_compatible(np, "ibm,opal-flash")) | ||
702 | of_platform_device_create(np, NULL, NULL); | ||
703 | } | ||
704 | |||
696 | static void opal_ipmi_init(struct device_node *opal_node) | 705 | static void opal_ipmi_init(struct device_node *opal_node) |
697 | { | 706 | { |
698 | struct device_node *np; | 707 | struct device_node *np; |
@@ -817,7 +826,7 @@ static int __init opal_init(void) | |||
817 | /* Setup error log interface */ | 826 | /* Setup error log interface */ |
818 | rc = opal_elog_init(); | 827 | rc = opal_elog_init(); |
819 | /* Setup code update interface */ | 828 | /* Setup code update interface */ |
820 | opal_flash_init(); | 829 | opal_flash_update_init(); |
821 | /* Setup platform dump extract interface */ | 830 | /* Setup platform dump extract interface */ |
822 | opal_platform_dump_init(); | 831 | opal_platform_dump_init(); |
823 | /* Setup system parameters interface */ | 832 | /* Setup system parameters interface */ |
@@ -829,6 +838,8 @@ static int __init opal_init(void) | |||
829 | /* Initialize OPAL IPMI backend */ | 838 | /* Initialize OPAL IPMI backend */ |
830 | opal_ipmi_init(opal_node); | 839 | opal_ipmi_init(opal_node); |
831 | 840 | ||
841 | opal_flash_init(opal_node); | ||
842 | |||
832 | return 0; | 843 | return 0; |
833 | } | 844 | } |
834 | machine_subsys_initcall(powernv, opal_init); | 845 | machine_subsys_initcall(powernv, opal_init); |
@@ -867,6 +878,9 @@ void opal_shutdown(void) | |||
867 | EXPORT_SYMBOL_GPL(opal_invalid_call); | 878 | EXPORT_SYMBOL_GPL(opal_invalid_call); |
868 | EXPORT_SYMBOL_GPL(opal_ipmi_send); | 879 | EXPORT_SYMBOL_GPL(opal_ipmi_send); |
869 | EXPORT_SYMBOL_GPL(opal_ipmi_recv); | 880 | EXPORT_SYMBOL_GPL(opal_ipmi_recv); |
881 | EXPORT_SYMBOL_GPL(opal_flash_read); | ||
882 | EXPORT_SYMBOL_GPL(opal_flash_write); | ||
883 | EXPORT_SYMBOL_GPL(opal_flash_erase); | ||
870 | 884 | ||
871 | /* Convert a region of vmalloc memory to an opal sg list */ | 885 | /* Convert a region of vmalloc memory to an opal sg list */ |
872 | struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr, | 886 | struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr, |