blob: 9bcbb89ebc21dac23df2d9d6b5256af4c5f29420 [file] [log] [blame]
Deepak Kodihalli017e45c2017-07-12 01:06:30 -05001/*
2 * Mailbox Daemon LPC Helpers
3 *
4 * Copyright 2017 IBM
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20#include "mbox.h"
21#include "mboxd_lpc.h"
22#include "mboxd_pnor_partition_table.h"
23
24/*
25 * reset_lpc() - Reset the lpc bus mapping
26 * @context: The mbox context pointer
27 *
28 * Return 0 on success otherwise negative error code
29 */
30int reset_lpc(struct mbox_context *context)
31{
Andrew Jefferydda8e382018-05-17 10:11:19 +093032 int rc;
33
Deepak Kodihalli88c74062017-07-25 15:29:56 -050034 destroy_vpnor(context);
Andrew Jefferydda8e382018-05-17 10:11:19 +093035
36 rc = init_vpnor(context);
37 if (rc < 0)
38 return rc;
39
40 rc = vpnor_copy_bootloader_partition(context);
41 if (rc < 0)
42 return rc;
43
Deepak Kodihalli017e45c2017-07-12 01:06:30 -050044 return point_to_memory(context);
45}